From a01686a5384594fc6231eac3e0f2d7ebec4ca604 Mon Sep 17 00:00:00 2001 From: Zbigniew Zdanowicz Date: Thu, 11 May 2023 12:12:31 +0000 Subject: [PATCH] test: add command list ult Signed-off-by: Zbigniew Zdanowicz --- .../test_cmdlist_append_launch_kernel_1.cpp | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp index d73c742029..9fda490f3c 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp @@ -943,5 +943,38 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenImmediateCommandListWhenAppendLaun EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); } +HWTEST2_F(CommandListAppendLaunchKernel, whenUpdateStreamPropertiesIsCalledThenCorrectThreadArbitrationPolicyIsSet, IsAtLeastSkl) { + DebugManagerStateRestore restorer; + DebugManager.flags.ForceThreadArbitrationPolicyProgrammingWithScm.set(1); + + auto &gfxCoreHelper = device->getGfxCoreHelper(); + auto expectedThreadArbitrationPolicy = gfxCoreHelper.getDefaultThreadArbitrationPolicy(); + int32_t threadArbitrationPolicyValues[] = { + ThreadArbitrationPolicy::AgeBased, ThreadArbitrationPolicy::RoundRobin, + ThreadArbitrationPolicy::RoundRobinAfterDependency}; + + Mock<::L0::Kernel> kernel; + auto mockModule = std::unique_ptr(new Mock(device, nullptr)); + kernel.module = mockModule.get(); + + auto commandList = std::make_unique>>(); + auto result = commandList->initialize(device, NEO::EngineGroupType::Compute, 0u); + ASSERT_EQ(ZE_RESULT_SUCCESS, result); + + EXPECT_EQ(-1, commandList->requiredStreamState.stateComputeMode.threadArbitrationPolicy.value); + EXPECT_EQ(-1, commandList->finalStreamState.stateComputeMode.threadArbitrationPolicy.value); + + const ze_group_count_t launchKernelArgs = {}; + commandList->updateStreamProperties(kernel, false, &launchKernelArgs, false); + EXPECT_EQ(expectedThreadArbitrationPolicy, commandList->finalStreamState.stateComputeMode.threadArbitrationPolicy.value); + + for (auto threadArbitrationPolicy : threadArbitrationPolicyValues) { + DebugManager.flags.OverrideThreadArbitrationPolicy.set(threadArbitrationPolicy); + commandList->reset(); + commandList->updateStreamProperties(kernel, false, &launchKernelArgs, false); + EXPECT_EQ(threadArbitrationPolicy, commandList->finalStreamState.stateComputeMode.threadArbitrationPolicy.value); + } +} + } // namespace ult } // namespace L0