Skip to content

Commit 7c0b644

Browse files
committed
Apply temporary fixes for conformance tests
* Execution range update is not supported by the L0 driver right now. Currently it supports only kernel arguments update. * There is a synchronization issue with immediate submission when used for command buffers. It is reproducible even without changes of this PR, so should be fixed separately. For now use batched submission for command buffer update tests.
1 parent 5b613ab commit 7c0b644

File tree

4 files changed

+65
-24
lines changed

4 files changed

+65
-24
lines changed

test/conformance/exp_command_buffer/buffer_fill_kernel_update.cpp

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ TEST_P(BufferFillCommandTest, UpdateParameters) {
123123

124124
// Test updating the global size so that the fill outputs to a larger buffer
125125
TEST_P(BufferFillCommandTest, UpdateGlobalSize) {
126+
if (!updatable_execution_range_support) {
127+
GTEST_SKIP() << "Execution range update is not supported.";
128+
}
129+
126130
ASSERT_SUCCESS(urCommandBufferEnqueueExp(updatable_cmd_buf_handle, queue, 0,
127131
nullptr, nullptr));
128132
ASSERT_SUCCESS(urQueueFinish(queue));
@@ -181,7 +185,7 @@ TEST_P(BufferFillCommandTest, SeparateUpdateCalls) {
181185
ValidateBuffer(buffer, sizeof(val) * global_size, val);
182186

183187
size_t new_global_size =
184-
global_size; //64; // Try same value for testing purposes.
188+
updatable_execution_range_support ? 64 : global_size;
185189
const size_t new_buffer_size = sizeof(val) * new_global_size;
186190
ASSERT_SUCCESS(urMemBufferCreate(context, UR_MEM_FLAG_READ_WRITE,
187191
new_buffer_size, nullptr, &new_buffer));
@@ -248,25 +252,28 @@ TEST_P(BufferFillCommandTest, SeparateUpdateCalls) {
248252
ASSERT_SUCCESS(urCommandBufferUpdateKernelLaunchExp(command_handle,
249253
&input_update_desc));
250254

251-
/*ur_exp_command_buffer_update_kernel_launch_desc_t global_size_update_desc = {
252-
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_DESC, // stype
253-
nullptr, // pNext
254-
0, // numNewMemObjArgs
255-
0, // numNewPointerArgs
256-
0, // numNewValueArgs
257-
0, // numNewExecInfos
258-
0, // newWorkDim
259-
nullptr, // pNewMemObjArgList
260-
nullptr, // pNewPointerArgList
261-
nullptr, // pNewValueArgList
262-
nullptr, // pNewExecInfoList
263-
nullptr, // pNewGlobalWorkOffset
264-
&new_global_size, // pNewGlobalWorkSize
265-
nullptr, // pNewLocalWorkSize
266-
};
267-
268-
ASSERT_SUCCESS(urCommandBufferUpdateKernelLaunchExp(
269-
command_handle, &global_size_update_desc));*/
255+
if (updatable_execution_range_support) {
256+
ur_exp_command_buffer_update_kernel_launch_desc_t
257+
global_size_update_desc = {
258+
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_DESC, // stype
259+
nullptr, // pNext
260+
0, // numNewMemObjArgs
261+
0, // numNewPointerArgs
262+
0, // numNewValueArgs
263+
0, // numNewExecInfos
264+
0, // newWorkDim
265+
nullptr, // pNewMemObjArgList
266+
nullptr, // pNewPointerArgList
267+
nullptr, // pNewValueArgList
268+
nullptr, // pNewExecInfoList
269+
nullptr, // pNewGlobalWorkOffset
270+
&new_global_size, // pNewGlobalWorkSize
271+
nullptr, // pNewLocalWorkSize
272+
};
273+
274+
ASSERT_SUCCESS(urCommandBufferUpdateKernelLaunchExp(
275+
command_handle, &global_size_update_desc));
276+
}
270277

271278
ASSERT_SUCCESS(urCommandBufferEnqueueExp(updatable_cmd_buf_handle, queue, 0,
272279
nullptr, nullptr));

test/conformance/exp_command_buffer/fixtures.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,24 +112,52 @@ struct urUpdatableCommandBufferExpExecutionTest
112112
GTEST_SKIP() << "Updating EXP command-buffers is not supported.";
113113
}
114114

115+
// Currently level zero driver doesn't support updating execution range.
116+
// Also disable immediate command lists because there is synchronization issue causing test failures.
117+
if (backend == UR_PLATFORM_BACKEND_LEVEL_ZERO) {
118+
setenv("UR_L0_USE_IMMEDIATE_COMMANDLISTS", "0", 0);
119+
updatable_execution_range_support = false;
120+
}
121+
115122
// Create a command-buffer with update enabled.
116123
ur_exp_command_buffer_desc_t desc{
117124
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC, nullptr, true};
118125

119126
ASSERT_SUCCESS(urCommandBufferCreateExp(context, device, &desc,
120127
&updatable_cmd_buf_handle));
121128
ASSERT_NE(updatable_cmd_buf_handle, nullptr);
129+
130+
// Currently there are synchronization issue with immediate submission when used for command buffers.
131+
// So, create queue with batched submission for this test suite if the backend is Level Zero.
132+
if (backend == UR_PLATFORM_BACKEND_LEVEL_ZERO) {
133+
ur_queue_flags_t flags = UR_QUEUE_FLAG_SUBMISSION_BATCHED;
134+
ur_queue_properties_t props = {
135+
/*.stype =*/UR_STRUCTURE_TYPE_QUEUE_PROPERTIES,
136+
/*.pNext =*/nullptr,
137+
/*.flags =*/flags,
138+
};
139+
ASSERT_SUCCESS(urQueueCreate(context, device, &props, &queue));
140+
ASSERT_NE(queue, nullptr);
141+
} else {
142+
queue = urCommandBufferExpExecutionTest::queue;
143+
}
122144
}
123145

124146
void TearDown() override {
125147
if (updatable_cmd_buf_handle) {
126148
EXPECT_SUCCESS(urCommandBufferReleaseExp(updatable_cmd_buf_handle));
127149
}
150+
if (backend == UR_PLATFORM_BACKEND_LEVEL_ZERO) {
151+
ASSERT_SUCCESS(urQueueRelease(queue));
152+
}
153+
128154
UUR_RETURN_ON_FATAL_FAILURE(
129155
urCommandBufferExpExecutionTest::TearDown());
130156
}
131157

132158
ur_exp_command_buffer_handle_t updatable_cmd_buf_handle = nullptr;
159+
ur_bool_t updatable_execution_range_support = true;
160+
ur_queue_handle_t queue;
133161
};
134162

135163
struct urCommandBufferCommandExpTest

test/conformance/exp_command_buffer/ndrange_update.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ struct NDRangeUpdateTest
1515
UUR_RETURN_ON_FATAL_FAILURE(
1616
urUpdatableCommandBufferExpExecutionTest::SetUp());
1717

18+
if (!updatable_execution_range_support) {
19+
GTEST_SKIP() << "Execution range update is not supported.";
20+
}
21+
1822
ur_device_usm_access_capability_flags_t shared_usm_flags;
1923
ASSERT_SUCCESS(
2024
uur::GetDeviceUSMSingleSharedSupport(device, shared_usm_flags));

test/conformance/exp_command_buffer/usm_fill_kernel_update.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ TEST_P(USMFillCommandTest, UpdateParameters) {
8787
ASSERT_SUCCESS(urQueueFinish(queue));
8888
Validate((uint32_t *)shared_ptr, global_size, val);
8989

90-
// Allocate a new USM pointer of larger size
91-
size_t new_global_size = global_size; // 64;
90+
// Allocate a new USM pointer of larger size if feature is supported.
91+
size_t new_global_size =
92+
updatable_execution_range_support ? 64 : global_size;
9293
const size_t new_allocation_size = sizeof(val) * new_global_size;
9394
ASSERT_SUCCESS(urUSMSharedAlloc(context, device, nullptr, nullptr,
9495
new_allocation_size, &new_shared_ptr));
@@ -128,8 +129,9 @@ TEST_P(USMFillCommandTest, UpdateParameters) {
128129
&new_input_desc, // pNewValueArgList
129130
nullptr, // pNewExecInfoList
130131
nullptr, // pNewGlobalWorkOffset
131-
nullptr, //&new_global_size, // pNewGlobalWorkSize
132-
nullptr, // pNewLocalWorkSize
132+
updatable_execution_range_support ? &new_global_size
133+
: nullptr, // pNewGlobalWorkSize
134+
nullptr, // pNewLocalWorkSize
133135
};
134136

135137
// Update kernel and enqueue command-buffer again

0 commit comments

Comments
 (0)