Skip to content

Commit f5a75b9

Browse files
author
Ewan Crawford
committed
Add extra more basic CTS test
1 parent 00867ce commit f5a75b9

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-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: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,70 @@ TEST_P(LocalMemoryUpdateTest, UpdateParametersSameLocalSize) {
241241
Validate(new_output, new_X, new_Y, new_A, global_size, local_size);
242242
}
243243

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

0 commit comments

Comments
 (0)