Skip to content

Commit 56f738c

Browse files
committed
[SYCL][HIP][UR] Allow urKernelSetArgMemObj to set the arg to nullptr
1 parent 0d6df96 commit 56f738c

File tree

1 file changed

+7
-1
lines changed
  • sycl/plugins/unified_runtime/ur/adapters/hip

1 file changed

+7
-1
lines changed

sycl/plugins/unified_runtime/ur/adapters/hip/kernel.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelSetArgMemObj(
284284
ur_kernel_handle_t hKernel, uint32_t argIndex, ur_mem_handle_t hArgValue) {
285285

286286
UR_ASSERT(hKernel != nullptr, UR_RESULT_ERROR_INVALID_NULL_HANDLE);
287-
UR_ASSERT(hArgValue != nullptr, UR_RESULT_ERROR_INVALID_NULL_HANDLE);
287+
288+
// Below sets kernel arg when zero-sized buffers are handled.
289+
// In such case the corresponding memory is null.
290+
if (hArgValue == nullptr) {
291+
hKernel->set_kernel_arg(argIndex, 0, nullptr);
292+
return UR_RESULT_SUCCESS;
293+
}
288294

289295
ur_result_t retErr = UR_RESULT_SUCCESS;
290296
try {

0 commit comments

Comments
 (0)