Skip to content

Commit 037cc7b

Browse files
authored
[SYCL][NATIVECPU] fix for urEnqueueUSMFill when pattern size is equal to fill size (#18366)
This PR makes `urEnqueueUSMFill` in the NativeCPU adapter to correctly return `UR_RESULT_SUCCESS` when the pattern size is equal to the fill size (previously returned `UR_RESULT_ERROR_INVALID_SIZE`). This fixes at least `test-e2e/Basic/memop/memop_no_unnamed_lambda.cpp` on NativeCPU. This PR also removes an unneeded multiply in that function.
1 parent a30775d commit 037cc7b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

unified-runtime/source/adapters/native_cpu/enqueue.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,14 +538,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMFill(
538538
UR_ASSERT(pPattern, UR_RESULT_ERROR_INVALID_NULL_POINTER);
539539
UR_ASSERT(patternSize != 0, UR_RESULT_ERROR_INVALID_SIZE)
540540
UR_ASSERT(size != 0, UR_RESULT_ERROR_INVALID_SIZE)
541-
UR_ASSERT(patternSize < size, UR_RESULT_ERROR_INVALID_SIZE)
541+
UR_ASSERT(patternSize <= size, UR_RESULT_ERROR_INVALID_SIZE)
542542
UR_ASSERT(size % patternSize == 0, UR_RESULT_ERROR_INVALID_SIZE)
543543
// TODO: add check for allocation size once the query is supported
544544

545545
switch (patternSize) {
546546
case 1:
547-
memset(ptr, *static_cast<const uint8_t *>(pPattern),
548-
size * patternSize);
547+
memset(ptr, *static_cast<const uint8_t *>(pPattern), size);
549548
break;
550549
case 2: {
551550
const auto pattern = *static_cast<const uint16_t *>(pPattern);

0 commit comments

Comments
 (0)