diff --git a/test/conformance/exp_command_buffer/buffer_fill_kernel_update.cpp b/test/conformance/exp_command_buffer/buffer_fill_kernel_update.cpp index 8a57c91afb..3928e76cf1 100644 --- a/test/conformance/exp_command_buffer/buffer_fill_kernel_update.cpp +++ b/test/conformance/exp_command_buffer/buffer_fill_kernel_update.cpp @@ -123,6 +123,10 @@ TEST_P(BufferFillCommandTest, UpdateParameters) { // Test updating the global size so that the fill outputs to a larger buffer TEST_P(BufferFillCommandTest, UpdateGlobalSize) { + if (!updatable_execution_range_support) { + GTEST_SKIP() << "Execution range update is not supported."; + } + ASSERT_SUCCESS(urCommandBufferEnqueueExp(updatable_cmd_buf_handle, queue, 0, nullptr, nullptr)); ASSERT_SUCCESS(urQueueFinish(queue)); @@ -181,7 +185,7 @@ TEST_P(BufferFillCommandTest, SeparateUpdateCalls) { ValidateBuffer(buffer, sizeof(val) * global_size, val); size_t new_global_size = - global_size; //64; // Try same value for testing purposes. + updatable_execution_range_support ? 64 : global_size; const size_t new_buffer_size = sizeof(val) * new_global_size; ASSERT_SUCCESS(urMemBufferCreate(context, UR_MEM_FLAG_READ_WRITE, new_buffer_size, nullptr, &new_buffer)); @@ -248,25 +252,28 @@ TEST_P(BufferFillCommandTest, SeparateUpdateCalls) { ASSERT_SUCCESS(urCommandBufferUpdateKernelLaunchExp(command_handle, &input_update_desc)); - /*ur_exp_command_buffer_update_kernel_launch_desc_t global_size_update_desc = { - UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_DESC, // stype - nullptr, // pNext - 0, // numNewMemObjArgs - 0, // numNewPointerArgs - 0, // numNewValueArgs - 0, // numNewExecInfos - 0, // newWorkDim - nullptr, // pNewMemObjArgList - nullptr, // pNewPointerArgList - nullptr, // pNewValueArgList - nullptr, // pNewExecInfoList - nullptr, // pNewGlobalWorkOffset - &new_global_size, // pNewGlobalWorkSize - nullptr, // pNewLocalWorkSize - }; - - ASSERT_SUCCESS(urCommandBufferUpdateKernelLaunchExp( - command_handle, &global_size_update_desc));*/ + if (updatable_execution_range_support) { + ur_exp_command_buffer_update_kernel_launch_desc_t + global_size_update_desc = { + UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_DESC, // stype + nullptr, // pNext + 0, // numNewMemObjArgs + 0, // numNewPointerArgs + 0, // numNewValueArgs + 0, // numNewExecInfos + 0, // newWorkDim + nullptr, // pNewMemObjArgList + nullptr, // pNewPointerArgList + nullptr, // pNewValueArgList + nullptr, // pNewExecInfoList + nullptr, // pNewGlobalWorkOffset + &new_global_size, // pNewGlobalWorkSize + nullptr, // pNewLocalWorkSize + }; + + ASSERT_SUCCESS(urCommandBufferUpdateKernelLaunchExp( + command_handle, &global_size_update_desc)); + } ASSERT_SUCCESS(urCommandBufferEnqueueExp(updatable_cmd_buf_handle, queue, 0, nullptr, nullptr)); diff --git a/test/conformance/exp_command_buffer/fixtures.h b/test/conformance/exp_command_buffer/fixtures.h index c8a198224b..cee2696968 100644 --- a/test/conformance/exp_command_buffer/fixtures.h +++ b/test/conformance/exp_command_buffer/fixtures.h @@ -112,6 +112,13 @@ struct urUpdatableCommandBufferExpExecutionTest GTEST_SKIP() << "Updating EXP command-buffers is not supported."; } + // Currently level zero driver doesn't support updating execution range. + // Also disable immediate command lists because there is synchronization issue causing test failures. + if (backend == UR_PLATFORM_BACKEND_LEVEL_ZERO) { + setenv("UR_L0_USE_IMMEDIATE_COMMANDLISTS", "0", 0); + updatable_execution_range_support = false; + } + // Create a command-buffer with update enabled. ur_exp_command_buffer_desc_t desc{ UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC, nullptr, true}; @@ -119,17 +126,38 @@ struct urUpdatableCommandBufferExpExecutionTest ASSERT_SUCCESS(urCommandBufferCreateExp(context, device, &desc, &updatable_cmd_buf_handle)); ASSERT_NE(updatable_cmd_buf_handle, nullptr); + + // Currently there are synchronization issue with immediate submission when used for command buffers. + // So, create queue with batched submission for this test suite if the backend is Level Zero. + if (backend == UR_PLATFORM_BACKEND_LEVEL_ZERO) { + ur_queue_flags_t flags = UR_QUEUE_FLAG_SUBMISSION_BATCHED; + ur_queue_properties_t props = { + /*.stype =*/UR_STRUCTURE_TYPE_QUEUE_PROPERTIES, + /*.pNext =*/nullptr, + /*.flags =*/flags, + }; + ASSERT_SUCCESS(urQueueCreate(context, device, &props, &queue)); + ASSERT_NE(queue, nullptr); + } else { + queue = urCommandBufferExpExecutionTest::queue; + } } void TearDown() override { if (updatable_cmd_buf_handle) { EXPECT_SUCCESS(urCommandBufferReleaseExp(updatable_cmd_buf_handle)); } + if (backend == UR_PLATFORM_BACKEND_LEVEL_ZERO) { + ASSERT_SUCCESS(urQueueRelease(queue)); + } + UUR_RETURN_ON_FATAL_FAILURE( urCommandBufferExpExecutionTest::TearDown()); } ur_exp_command_buffer_handle_t updatable_cmd_buf_handle = nullptr; + ur_bool_t updatable_execution_range_support = true; + ur_queue_handle_t queue; }; struct urCommandBufferCommandExpTest diff --git a/test/conformance/exp_command_buffer/ndrange_update.cpp b/test/conformance/exp_command_buffer/ndrange_update.cpp index e5631f9176..217bd87f2a 100644 --- a/test/conformance/exp_command_buffer/ndrange_update.cpp +++ b/test/conformance/exp_command_buffer/ndrange_update.cpp @@ -15,6 +15,10 @@ struct NDRangeUpdateTest UUR_RETURN_ON_FATAL_FAILURE( urUpdatableCommandBufferExpExecutionTest::SetUp()); + if (!updatable_execution_range_support) { + GTEST_SKIP() << "Execution range update is not supported."; + } + ur_device_usm_access_capability_flags_t shared_usm_flags; ASSERT_SUCCESS( uur::GetDeviceUSMSingleSharedSupport(device, shared_usm_flags)); diff --git a/test/conformance/exp_command_buffer/usm_fill_kernel_update.cpp b/test/conformance/exp_command_buffer/usm_fill_kernel_update.cpp index d6c70aea61..5962bd3487 100644 --- a/test/conformance/exp_command_buffer/usm_fill_kernel_update.cpp +++ b/test/conformance/exp_command_buffer/usm_fill_kernel_update.cpp @@ -87,8 +87,9 @@ TEST_P(USMFillCommandTest, UpdateParameters) { ASSERT_SUCCESS(urQueueFinish(queue)); Validate((uint32_t *)shared_ptr, global_size, val); - // Allocate a new USM pointer of larger size - size_t new_global_size = global_size; // 64; + // Allocate a new USM pointer of larger size if feature is supported. + size_t new_global_size = + updatable_execution_range_support ? 64 : global_size; const size_t new_allocation_size = sizeof(val) * new_global_size; ASSERT_SUCCESS(urUSMSharedAlloc(context, device, nullptr, nullptr, new_allocation_size, &new_shared_ptr)); @@ -128,8 +129,9 @@ TEST_P(USMFillCommandTest, UpdateParameters) { &new_input_desc, // pNewValueArgList nullptr, // pNewExecInfoList nullptr, // pNewGlobalWorkOffset - nullptr, //&new_global_size, // pNewGlobalWorkSize - nullptr, // pNewLocalWorkSize + updatable_execution_range_support ? &new_global_size + : nullptr, // pNewGlobalWorkSize + nullptr, // pNewLocalWorkSize }; // Update kernel and enqueue command-buffer again