Skip to content

[SYCL][NATIVECPU] fix for urEnqueueUSMFill when pattern size is equal to fill size #18366

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions unified-runtime/source/adapters/native_cpu/enqueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,14 +538,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMFill(
UR_ASSERT(pPattern, UR_RESULT_ERROR_INVALID_NULL_POINTER);
UR_ASSERT(patternSize != 0, UR_RESULT_ERROR_INVALID_SIZE)
UR_ASSERT(size != 0, UR_RESULT_ERROR_INVALID_SIZE)
UR_ASSERT(patternSize < size, UR_RESULT_ERROR_INVALID_SIZE)
UR_ASSERT(patternSize <= size, UR_RESULT_ERROR_INVALID_SIZE)
UR_ASSERT(size % patternSize == 0, UR_RESULT_ERROR_INVALID_SIZE)
// TODO: add check for allocation size once the query is supported

switch (patternSize) {
case 1:
memset(ptr, *static_cast<const uint8_t *>(pPattern),
size * patternSize);
memset(ptr, *static_cast<const uint8_t *>(pPattern), size);
break;
case 2: {
const auto pattern = *static_cast<const uint16_t *>(pPattern);
Expand Down