Skip to content

Commit d1c6833

Browse files
committed
Add extra more basic CTS test
1 parent b881c0b commit d1c6833

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-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
@@ -38,6 +38,7 @@
3838
{{OPT}}KernelCommandEventSyncUpdateTest.InvalidWaitUpdate/*
3939
{{OPT}}KernelCommandEventSyncUpdateTest.InvalidSignalUpdate/*
4040
{{OPT}}LocalMemoryUpdateTest.UpdateParametersSameLocalSize/*
41+
{{OPT}}LocalMemoryUpdateTest.UpdateLocalOnly/*
4142
{{OPT}}LocalMemoryUpdateTest.UpdateParametersEmptyLocalSize/*
4243
{{OPT}}LocalMemoryUpdateTest.UpdateParametersSmallerLocalSize/*
4344
{{OPT}}LocalMemoryUpdateTest.UpdateParametersLargerLocalSize/*

test/conformance/exp_command_buffer/update/local_memory_update.cpp

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ struct LocalMemoryUpdateTestBase
1616
UUR_RETURN_ON_FATAL_FAILURE(
1717
urUpdatableCommandBufferExpExecutionTest::SetUp());
1818

19+
if (backend == UR_PLATFORM_BACKEND_LEVEL_ZERO) {
20+
GTEST_SKIP()
21+
<< "Local memory argument update not supported on Level Zero.";
22+
}
23+
1924
// HIP has extra args for local memory so we define an offset for arg indices here for updating
2025
hip_arg_offset = backend == UR_PLATFORM_BACKEND_HIP ? 3 : 0;
2126
ur_device_usm_access_capability_flags_t shared_usm_flags;
@@ -241,6 +246,70 @@ TEST_P(LocalMemoryUpdateTest, UpdateParametersSameLocalSize) {
241246
Validate(new_output, new_X, new_Y, new_A, global_size, local_size);
242247
}
243248

249+
// Test only passing local memory parameters to update with the original values.
250+
TEST_P(LocalMemoryUpdateTest, UpdateLocalOnly) {
251+
// Run command-buffer prior to update an verify output
252+
ASSERT_SUCCESS(urCommandBufferEnqueueExp(updatable_cmd_buf_handle, queue, 0,
253+
nullptr, nullptr));
254+
ASSERT_SUCCESS(urQueueFinish(queue));
255+
256+
uint32_t *output = (uint32_t *)shared_ptrs[0];
257+
uint32_t *X = (uint32_t *)shared_ptrs[1];
258+
uint32_t *Y = (uint32_t *)shared_ptrs[2];
259+
Validate(output, X, Y, A, global_size, local_size);
260+
261+
// Update inputs
262+
std::array<ur_exp_command_buffer_update_value_arg_desc_t, 2>
263+
new_value_descs;
264+
265+
// New local_mem_a at index 0
266+
new_value_descs[0] = {
267+
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC, // stype
268+
nullptr, // pNext
269+
0, // argIndex
270+
local_mem_a_size, // argSize
271+
nullptr, // pProperties
272+
nullptr, // hArgValue
273+
};
274+
275+
// New local_mem_b at index 1
276+
new_value_descs[1] = {
277+
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC, // stype
278+
nullptr, // pNext
279+
1 + hip_arg_offset, // argIndex
280+
local_mem_b_size, // argSize
281+
nullptr, // pProperties
282+
nullptr, // hArgValue
283+
};
284+
285+
// Update kernel inputs
286+
ur_exp_command_buffer_update_kernel_launch_desc_t update_desc = {
287+
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_DESC, // stype
288+
nullptr, // pNext
289+
kernel, // hNewKernel
290+
0, // numNewMemObjArgs
291+
0, // numNewPointerArgs
292+
new_value_descs.size(), // numNewValueArgs
293+
n_dimensions, // newWorkDim
294+
nullptr, // pNewMemObjArgList
295+
nullptr, // pNewPointerArgList
296+
new_value_descs.data(), // pNewValueArgList
297+
nullptr, // pNewGlobalWorkOffset
298+
nullptr, // pNewGlobalWorkSize
299+
nullptr, // pNewLocalWorkSize
300+
};
301+
302+
// Update kernel and enqueue command-buffer again
303+
ASSERT_SUCCESS(
304+
urCommandBufferUpdateKernelLaunchExp(command_handle, &update_desc));
305+
ASSERT_SUCCESS(urCommandBufferEnqueueExp(updatable_cmd_buf_handle, queue, 0,
306+
nullptr, nullptr));
307+
ASSERT_SUCCESS(urQueueFinish(queue));
308+
309+
// Verify that update occurred correctly
310+
Validate(output, X, Y, A, global_size, local_size);
311+
}
312+
244313
// Test updating A,X,Y parameters to new values and omitting local memory parameters
245314
// from the update.
246315
TEST_P(LocalMemoryUpdateTest, UpdateParametersEmptyLocalSize) {

0 commit comments

Comments
 (0)