Skip to content

Commit 96948b1

Browse files
authored
Merge pull request #1559 from Bensuo/ewan/buffer_fill_test_fix
Fix CTS test for HIP accessors
2 parents 07151fa + 30da057 commit 96948b1

File tree

2 files changed

+25
-17
lines changed

2 files changed

+25
-17
lines changed

test/conformance/exp_command_buffer/buffer_fill_kernel_update.cpp

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,32 @@ struct BufferFillCommandTest
1919
&buffer));
2020

2121
// First argument is buffer to fill
22-
ASSERT_SUCCESS(urKernelSetArgMemObj(kernel, 0, nullptr, buffer));
23-
24-
// second arg is hidden accessor
25-
struct {
26-
size_t offsets[1] = {0};
27-
} accessor;
28-
ASSERT_SUCCESS(urKernelSetArgValue(kernel, 1, sizeof(accessor), nullptr,
29-
&accessor));
30-
31-
// Second argument is scalar to fill with.
22+
unsigned current_arg_index = 0;
3223
ASSERT_SUCCESS(
33-
urKernelSetArgValue(kernel, 2, sizeof(val), nullptr, &val));
24+
urKernelSetArgMemObj(kernel, current_arg_index++, nullptr, buffer));
25+
26+
// Add accessor arguments depending on backend.
27+
// HIP has 3 offset parameters and other backends only have 1.
28+
if (backend == UR_PLATFORM_BACKEND_HIP) {
29+
size_t val = 0;
30+
ASSERT_SUCCESS(urKernelSetArgValue(kernel, current_arg_index++,
31+
sizeof(size_t), nullptr, &val));
32+
ASSERT_SUCCESS(urKernelSetArgValue(kernel, current_arg_index++,
33+
sizeof(size_t), nullptr, &val));
34+
ASSERT_SUCCESS(urKernelSetArgValue(kernel, current_arg_index++,
35+
sizeof(size_t), nullptr, &val));
36+
} else {
37+
struct {
38+
size_t offsets[1] = {0};
39+
} accessor;
40+
ASSERT_SUCCESS(urKernelSetArgValue(kernel, current_arg_index++,
41+
sizeof(accessor), nullptr,
42+
&accessor));
43+
}
44+
45+
// Second user defined argument is scalar to fill with.
46+
ASSERT_SUCCESS(urKernelSetArgValue(kernel, current_arg_index++,
47+
sizeof(val), nullptr, &val));
3448

3549
// Append kernel command to command-buffer and close command-buffer
3650
ASSERT_SUCCESS(urCommandBufferAppendKernelLaunchExp(
Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
{{OPT}}BufferFillCommandTest.UpdateParameters/AMD_HIP_BACKEND{{.*}}
2-
{{OPT}}BufferFillCommandTest.UpdateGlobalSize/AMD_HIP_BACKEND{{.*}}
3-
{{OPT}}BufferFillCommandTest.SeparateUpdateCalls/AMD_HIP_BACKEND{{.*}}
4-
{{OPT}}BufferFillCommandTest.OverrideUpdate/AMD_HIP_BACKEND{{.*}}
5-
{{OPT}}BufferFillCommandTest.OverrideArgList/AMD_HIP_BACKEND{{.*}}
61
{{OPT}}USMFillCommandTest.UpdateParameters/AMD_HIP_BACKEND{{.*}}
72
{{OPT}}USMMultipleFillCommandTest.UpdateAllKernels/AMD_HIP_BACKEND{{.*}}
83
{{OPT}}BufferSaxpyKernelTest.UpdateParameters/AMD_HIP_BACKEND{{.*}}
@@ -14,4 +9,3 @@
149
{{OPT}}urCommandBufferReleaseCommandExpTest.InvalidNullHandle/AMD_HIP_BACKEND{{.*}}
1510
{{OPT}}urCommandBufferRetainCommandExpTest.Success/AMD_HIP_BACKEND{{.*}}
1611
{{OPT}}urCommandBufferRetainCommandExpTest.InvalidNullHandle/AMD_HIP_BACKEND{{.*}}
17-
{{OPT}}{{Segmentation fault|Aborted}}

0 commit comments

Comments
 (0)