Skip to content

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.

Comment on lines 548 to 549
if ((err = copy_region(src, soffset, sregion, dst, doffset,
dregion)))
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand this part of the change. Shouldn't this continue to call test_functions.copy instead of copy_region directly?

Why are extra {curly braces} needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Corrected

int copy_region(size_t src, size_t soffset[3], size_t sregion[3], size_t dst,
size_t doffset[3], size_t dregion[3])
{
bool comp_pitch = (genrand_int32(mt) % 2) != 0 ? true : false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: I don't know what comp_pitch is supposed to mean. Could we spell "comp" out completely to add clarity?

Additionally, with this changes we either always seem to compute all four pitches, or we pass zero for all four pitches. Should we test different combinations of zero and non-zero pitches?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Corrected

@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 ?

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.

4 participants