Skip to content

Commit 8d60ded

Browse files
committed
Add regression conformance test for nullptr hNewKernel
1 parent 0a0d71d commit 8d60ded

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

test/conformance/exp_command_buffer/exp_command_buffer_adapter_native_cpu.match

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
{{OPT}}USMSaxpyKernelTest.UpdateParameters/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
2222
{{OPT}}USMMultiSaxpyKernelTest.UpdateParameters/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
2323
{{OPT}}USMMultiSaxpyKernelTest.UpdateWithoutBlocking/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
24+
{{OPT}}USMMultiSaxpyKernelTest.UpdateNullptrKernel/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
2425
{{OPT}}NDRangeUpdateTest.Update3D/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
2526
{{OPT}}NDRangeUpdateTest.Update2D/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
2627
{{OPT}}NDRangeUpdateTest.Update1D/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}

test/conformance/exp_command_buffer/update/usm_saxpy_kernel_update.cpp

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,59 @@ TEST_P(USMMultiSaxpyKernelTest, UpdateParameters) {
284284
Validate(new_output, new_X, new_Y, new_A, global_size);
285285
}
286286

287+
// Checks that passing nullptr to hNewKernel even when kernel binary updates
288+
// is not supported by the adapter.
289+
TEST_P(USMMultiSaxpyKernelTest, UpdateNullptrKernel) {
290+
ASSERT_SUCCESS(urCommandBufferEnqueueExp(updatable_cmd_buf_handle, queue, 0,
291+
nullptr, nullptr));
292+
ASSERT_SUCCESS(urQueueFinish(queue));
293+
294+
uint32_t *output = (uint32_t *)shared_ptrs[0];
295+
uint32_t *X = (uint32_t *)shared_ptrs[1];
296+
uint32_t *Y = (uint32_t *)shared_ptrs[2];
297+
Validate(output, X, Y, A, global_size);
298+
299+
// New A at index 1
300+
uint32_t new_A = 33;
301+
ur_exp_command_buffer_update_value_arg_desc_t new_A_desc = {
302+
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC, // stype
303+
nullptr, // pNext
304+
1, // argIndex
305+
sizeof(new_A), // argSize
306+
nullptr, // pProperties
307+
&new_A, // hArgValue
308+
};
309+
310+
// Update kernel inputs
311+
ur_exp_command_buffer_update_kernel_launch_desc_t update_desc = {
312+
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_DESC, // stype
313+
nullptr, // pNext
314+
nullptr, // hNewKernel
315+
0, // numNewMemObjArgs
316+
0, // numNewPointerArgs
317+
1, // numNewValueArgs
318+
n_dimensions, // newWorkDim
319+
nullptr, // pNewMemObjArgList
320+
nullptr, // pNewPointerArgList
321+
&new_A_desc, // pNewValueArgList
322+
nullptr, // pNewGlobalWorkOffset
323+
nullptr, // pNewGlobalWorkSize
324+
nullptr, // pNewLocalWorkSize
325+
};
326+
327+
for (auto &handle : command_handles) {
328+
ASSERT_SUCCESS(
329+
urCommandBufferUpdateKernelLaunchExp(handle, &update_desc));
330+
}
331+
ASSERT_SUCCESS(urCommandBufferEnqueueExp(updatable_cmd_buf_handle, queue, 0,
332+
nullptr, nullptr));
333+
ASSERT_SUCCESS(urQueueFinish(queue));
334+
335+
// Verify that update occurred correctly
336+
uint32_t *new_output = (uint32_t *)shared_ptrs[0];
337+
Validate(new_output, X, Y, new_A, global_size);
338+
}
339+
287340
TEST_P(USMMultiSaxpyKernelTest, UpdateWithoutBlocking) {
288341
// Prepare new inputs
289342
ur_exp_command_buffer_update_pointer_arg_desc_t new_input_descs[2];

0 commit comments

Comments
 (0)