Skip to content

Added sub-case for basic test where the provided pitches are zero#2440

Open
shajder wants to merge 7 commits intoKhronosGroup:mainfrom
shajder:basic_copy_buffer_zero_pitches
Open

Added sub-case for basic test where the provided pitches are zero#2440
shajder wants to merge 7 commits intoKhronosGroup:mainfrom
shajder:basic_copy_buffer_zero_pitches

Conversation

@shajder
Copy link
Contributor

@shajder shajder commented Jul 8, 2025

Related to #2279

@ewagalamon ewagalamon linked an issue Jul 29, 2025 that may be closed by this pull request
Copy link
Contributor

@bashbaug bashbaug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds additional coverage for clEnqueueCopyBufferRect.

Should we add additional coverage for clEnqueueReadBufferRect and clEnqueueWriteBufferRect also? If this is something we want, it's fine to add it in a separate PR.

@shajder
Copy link
Contributor Author

shajder commented Sep 2, 2025

This adds additional coverage for clEnqueueCopyBufferRect.

Should we add additional coverage for clEnqueueReadBufferRect and clEnqueueWriteBufferRect also? If this is something we want, it's fine to add it in a separate PR.

Should I create separate issue or just comment to #2279

@shajder
Copy link
Contributor Author

shajder commented Sep 12, 2025

This adds additional coverage for clEnqueueCopyBufferRect.
Should we add additional coverage for clEnqueueReadBufferRect and clEnqueueWriteBufferRect also? If this is something we want, it's fine to add it in a separate PR.

Should I create separate issue or just comment to #2279

I've created new PR #2515 without new issue

@lakshmih
Copy link
Contributor

We're running into some failures with this and would like some more time to check the verification code.

(unsigned)src, (unsigned)dst);
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The calculation for spitch, sslice, dpitch and dslice in lines 209 to 213 has to be changed as well. The specs says:

If src_row_pitch is 0, src_row_pitch is computed as region[0].
If src_slice_pitch is 0, src_slice_pitch is computed as region[1] × src_row_pitch.
If dst_row_pitch is 0, dst_row_pitch is computed as region[0].
If dst_slice_pitch is 0, dst_slice_pitch is computed as region[1] × dst_row_pitch.

So when the row or slice pitches are 0, the region values should be used.

Suggested change
size_t spitch = (src_row_pitch == 0) ? sregion[0] : src_row_pitch;
size_t sslice = (src_slice_pitch == 0) ? sregion[1] * spitch : src_slice_pitch;
size_t dpitch = (dst_row_pitch == 0) ? dregion[0] : dst_row_pitch;
size_t dslice = (dst_slice_pitch == 0) ? dregion[1] * dpitch : dst_slice_pitch;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: @bashbaug @kpet

So when the row or slice pitches are 0, the region values should be used.

To me this sounds like a specification issue. If anything other than the actual source/destination buffer width/height is used for the row/slice pitches, we will no longer be copying a rectangular (or cubic) region. Instead, the copy will become skewed because each row will start at an incorrect offset. Am I missing something ?

Copy link
Contributor Author

@shajder shajder Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joselopeqti I've applied your correction with a minor caveat:

size_t dpitch = (dst_row_pitch == 0) ? sregion[0] : dst_row_pitch;
size_t dslice =
(dst_slice_pitch == 0) ? sregion[1] * dpitch : dst_slice_pitch;

@bashbaug
Copy link
Contributor

Discussed in the March 17th teleconference. Removing "focused review" until the spec issue is resolved.

Marcin will file a spec issue to track resolution.

@shajder
Copy link
Contributor Author

shajder commented Mar 19, 2026

Marcin will file a spec issue to track resolution.

@bashbaug after double-checking the spec and the test, I've applied @joselopeqti's corrections. I believe the fallback of pitches to region[N]-related values when equal to zero may indeed be confusing for developers following the logic of our CTS test. On the other hand, a parameters of clCreateBuffer has no width, height, or depth - these are only conventional values in our test. In that sense, the fallback could legitimately be many things, and for clEnqueueCopyBufferRect the most reasonable choice is region[N]. I think we should leave it as is, without the issue.

@bashbaug
Copy link
Contributor

I think we should leave it as is, without the issue.

OK, sounds good, should we add back "focused review" then? In other words, is this ready to go?

@shajder
Copy link
Contributor Author

shajder commented Mar 20, 2026

OK, sounds good, should we add back "focused review" then? In other words, is this ready to go?

yes, it is ready, let me add the label

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants