Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion source/adapters/level_zero/command_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,7 @@ ur_result_t validateCommandDesc(
logger::debug("Mutable features supported by device {}", SupportedFeatures);

// Kernel handle updates are not yet supported.
if (CommandDesc->hNewKernel != Command->Kernel) {
if (CommandDesc->hNewKernel && CommandDesc->hNewKernel != Command->Kernel) {
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
}

Expand Down
3 changes: 2 additions & 1 deletion source/adapters/opencl/command_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp(
*pUpdateKernelLaunch) {

// Kernel handle updates are not yet supported.
if (pUpdateKernelLaunch->hNewKernel != hCommand->Kernel) {
if (pUpdateKernelLaunch->hNewKernel &&
pUpdateKernelLaunch->hNewKernel != hCommand->Kernel) {
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
{{OPT}}USMSaxpyKernelTest.UpdateParameters/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
{{OPT}}USMMultiSaxpyKernelTest.UpdateParameters/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
{{OPT}}USMMultiSaxpyKernelTest.UpdateWithoutBlocking/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
{{OPT}}USMMultiSaxpyKernelTest.UpdateNullptrKernel/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
{{OPT}}NDRangeUpdateTest.Update3D/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
{{OPT}}NDRangeUpdateTest.Update2D/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
{{OPT}}NDRangeUpdateTest.Update1D/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,59 @@ TEST_P(USMMultiSaxpyKernelTest, UpdateParameters) {
Validate(new_output, new_X, new_Y, new_A, global_size);
}

// Checks that passing nullptr to hNewKernel even when kernel binary updates
// is not supported by the adapter.
TEST_P(USMMultiSaxpyKernelTest, UpdateNullptrKernel) {
ASSERT_SUCCESS(urCommandBufferEnqueueExp(updatable_cmd_buf_handle, queue, 0,
nullptr, nullptr));
ASSERT_SUCCESS(urQueueFinish(queue));

uint32_t *output = (uint32_t *)shared_ptrs[0];
uint32_t *X = (uint32_t *)shared_ptrs[1];
uint32_t *Y = (uint32_t *)shared_ptrs[2];
Validate(output, X, Y, A, global_size);

// New A at index 1
uint32_t new_A = 33;
ur_exp_command_buffer_update_value_arg_desc_t new_A_desc = {
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC, // stype
nullptr, // pNext
1, // argIndex
sizeof(new_A), // argSize
nullptr, // pProperties
&new_A, // hArgValue
};

// Update kernel inputs
ur_exp_command_buffer_update_kernel_launch_desc_t update_desc = {
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_DESC, // stype
nullptr, // pNext
nullptr, // hNewKernel
0, // numNewMemObjArgs
0, // numNewPointerArgs
1, // numNewValueArgs
n_dimensions, // newWorkDim
nullptr, // pNewMemObjArgList
nullptr, // pNewPointerArgList
&new_A_desc, // pNewValueArgList
nullptr, // pNewGlobalWorkOffset
nullptr, // pNewGlobalWorkSize
nullptr, // pNewLocalWorkSize
};

for (auto &handle : command_handles) {
ASSERT_SUCCESS(
urCommandBufferUpdateKernelLaunchExp(handle, &update_desc));
}
ASSERT_SUCCESS(urCommandBufferEnqueueExp(updatable_cmd_buf_handle, queue, 0,
nullptr, nullptr));
ASSERT_SUCCESS(urQueueFinish(queue));

// Verify that update occurred correctly
uint32_t *new_output = (uint32_t *)shared_ptrs[0];
Validate(new_output, X, Y, new_A, global_size);
}

TEST_P(USMMultiSaxpyKernelTest, UpdateWithoutBlocking) {
// Prepare new inputs
ur_exp_command_buffer_update_pointer_arg_desc_t new_input_descs[2];
Expand Down
Loading