diff --git a/level_zero/core/source/cmdlist/cmdlist.h b/level_zero/core/source/cmdlist/cmdlist.h index 53cb855d1d..12eecb674f 100644 --- a/level_zero/core/source/cmdlist/cmdlist.h +++ b/level_zero/core/source/cmdlist/cmdlist.h @@ -188,7 +188,7 @@ struct CommandList : _ze_command_list_handle_t { return commandListPreemptionMode; } - uint32_t getThreadArbitrationPolicy() const { + int32_t getThreadArbitrationPolicy() const { return threadArbitrationPolicy; } @@ -256,7 +256,7 @@ struct CommandList : _ze_command_list_handle_t { uint32_t cmdListType = CommandListType::TYPE_REGULAR; uint32_t commandListPerThreadScratchSize = 0u; uint32_t commandListPerThreadPrivateScratchSize = 0u; - uint32_t threadArbitrationPolicy = NEO::ThreadArbitrationPolicy::RoundRobin; + int32_t threadArbitrationPolicy = NEO::ThreadArbitrationPolicy::NotPresent; uint32_t partitionCount = 1; bool isFlushTaskSubmissionEnabled = false; bool isSyncModeQueue = false; diff --git a/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl b/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl index 9574bbd5fc..e061cdc8c9 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl @@ -211,7 +211,7 @@ ze_result_t CommandListCoreFamily::appendLaunchKernelWithParams(z } KernelImp *kernelImp = static_cast(kernel); - if (kernelImp->getSchedulingHintExp() != std::numeric_limits::max()) { + if (kernelImp->getSchedulingHintExp() != NEO::ThreadArbitrationPolicy::NotPresent) { this->threadArbitrationPolicy = kernelImp->getSchedulingHintExp(); } diff --git a/level_zero/core/source/device/device_imp.cpp b/level_zero/core/source/device/device_imp.cpp index aa1ec6a156..cd2e9961a3 100644 --- a/level_zero/core/source/device/device_imp.cpp +++ b/level_zero/core/source/device/device_imp.cpp @@ -456,7 +456,7 @@ ze_result_t DeviceImp::getKernelProperties(ze_device_module_properties_t *pKerne reinterpret_cast(extendedProperties); auto supportedThreadArbitrationPolicies = hwInfoConfig.getKernelSupportedThreadArbitrationPolicies(); hintProperties->schedulingHintFlags = 0; - for (uint32_t &p : supportedThreadArbitrationPolicies) { + for (auto &p : supportedThreadArbitrationPolicies) { switch (p) { case NEO::ThreadArbitrationPolicy::AgeBased: hintProperties->schedulingHintFlags |= ZE_SCHEDULING_HINT_EXP_FLAG_OLDEST_FIRST; diff --git a/level_zero/core/source/kernel/kernel_imp.cpp b/level_zero/core/source/kernel/kernel_imp.cpp index b3599abe98..9a79dd4b98 100644 --- a/level_zero/core/source/kernel/kernel_imp.cpp +++ b/level_zero/core/source/kernel/kernel_imp.cpp @@ -1013,7 +1013,7 @@ ze_result_t KernelImp::setSchedulingHintExp(ze_scheduling_hint_exp_desc_t *pHint return ZE_RESULT_SUCCESS; } -uint32_t KernelImp::getSchedulingHintExp() { +int32_t KernelImp::getSchedulingHintExp() { if (NEO::DebugManager.flags.OverrideThreadArbitrationPolicy.get() != -1) { this->schedulingHintExpFlag = static_cast(NEO::DebugManager.flags.OverrideThreadArbitrationPolicy.get()); } diff --git a/level_zero/core/source/kernel/kernel_imp.h b/level_zero/core/source/kernel/kernel_imp.h index 2b33ba0c5f..f641aced7e 100644 --- a/level_zero/core/source/kernel/kernel_imp.h +++ b/level_zero/core/source/kernel/kernel_imp.h @@ -7,6 +7,7 @@ #pragma once +#include "shared/source/command_stream/thread_arbitration_policy.h" #include "shared/source/kernel/dispatch_kernel_encoder_interface.h" #include "shared/source/unified_memory/unified_memory.h" @@ -151,7 +152,7 @@ struct KernelImp : Kernel { } ze_result_t setSchedulingHintExp(ze_scheduling_hint_exp_desc_t *pHint) override; - uint32_t getSchedulingHintExp(); + int32_t getSchedulingHintExp(); NEO::ImplicitArgs *getImplicitArgs() const override { return pImplicitArgs.get(); } @@ -210,7 +211,7 @@ struct KernelImp : Kernel { bool kernelHasIndirectAccess = true; - uint32_t schedulingHintExpFlag = std::numeric_limits::max(); + int32_t schedulingHintExpFlag = NEO::ThreadArbitrationPolicy::NotPresent; std::unique_ptr pImplicitArgs; }; 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 8a7fe54adf..e9cfdeca10 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 @@ -114,7 +114,7 @@ HWTEST_F(CommandListAppendLaunchKernel, givenKernelWithThreadArbitrationPolicySe auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - ASSERT_EQ(commandList->threadArbitrationPolicy, 0u); + ASSERT_EQ(0, commandList->threadArbitrationPolicy); delete (pHint); } diff --git a/level_zero/core/test/unit_tests/sources/device/test_device.cpp b/level_zero/core/test/unit_tests/sources/device/test_device.cpp index 5cecc57fab..f84f180fa5 100644 --- a/level_zero/core/test/unit_tests/sources/device/test_device.cpp +++ b/level_zero/core/test/unit_tests/sources/device/test_device.cpp @@ -785,7 +785,7 @@ HWTEST_F(DeviceTest, whenPassingSchedulingHintExpStructToGetPropertiesThenProper EXPECT_NE(ZE_SCHEDULING_HINT_EXP_FLAG_FORCE_UINT32, schedulingHintProperties.schedulingHintFlags); auto supportedThreadArbitrationPolicies = NEO::PreambleHelper::getSupportedThreadArbitrationPolicies(); - for (uint32_t &p : supportedThreadArbitrationPolicies) { + for (auto &p : supportedThreadArbitrationPolicies) { switch (p) { case ThreadArbitrationPolicy::AgeBased: EXPECT_NE(0u, (schedulingHintProperties.schedulingHintFlags & @@ -807,10 +807,10 @@ HWTEST_F(DeviceTest, whenPassingSchedulingHintExpStructToGetPropertiesThenProper HWTEST2_F(DeviceTest, givenAllThreadArbitrationPoliciesWhenPassingSchedulingHintExpStructToGetPropertiesThenPropertiesWithAllFlagsAreReturned, MatchAny) { struct MockHwInfoConfig : NEO::HwInfoConfigHw { - std::vector getKernelSupportedThreadArbitrationPolicies() override { + std::vector getKernelSupportedThreadArbitrationPolicies() override { return threadArbPolicies; } - std::vector threadArbPolicies; + std::vector threadArbPolicies; }; const uint32_t rootDeviceIndex = 0u; @@ -847,10 +847,10 @@ HWTEST2_F(DeviceTest, givenAllThreadArbitrationPoliciesWhenPassingSchedulingHint HWTEST2_F(DeviceTest, givenIncorrectThreadArbitrationPolicyWhenPassingSchedulingHintExpStructToGetPropertiesThenNoneIsReturned, MatchAny) { struct MockHwInfoConfig : NEO::HwInfoConfigHw { - std::vector getKernelSupportedThreadArbitrationPolicies() override { + std::vector getKernelSupportedThreadArbitrationPolicies() override { return threadArbPolicies; } - std::vector threadArbPolicies; + std::vector threadArbPolicies; }; const uint32_t rootDeviceIndex = 0u; diff --git a/opencl/source/kernel/kernel.h b/opencl/source/kernel/kernel.h index 608785eab8..5790117ea0 100644 --- a/opencl/source/kernel/kernel.h +++ b/opencl/source/kernel/kernel.h @@ -309,7 +309,7 @@ class Kernel : public ReferenceTrackedObject { bool isBuiltIn = false; - uint32_t getThreadArbitrationPolicy() const { + int32_t getThreadArbitrationPolicy() const { return threadArbitrationPolicy; } KernelExecutionType getExecutionType() const { @@ -352,7 +352,7 @@ class Kernel : public ReferenceTrackedObject { bool areStatelessWritesUsed() { return containsStatelessWrites; } int setKernelThreadArbitrationPolicy(uint32_t propertyValue); cl_int setKernelExecutionType(cl_execution_info_kernel_type_intel executionType); - void setThreadArbitrationPolicy(uint32_t policy) { + void setThreadArbitrationPolicy(int32_t policy) { this->threadArbitrationPolicy = policy; } void getSuggestedLocalWorkSize(const cl_uint workDim, const size_t *globalWorkSize, const size_t *globalWorkOffset, @@ -455,7 +455,7 @@ class Kernel : public ReferenceTrackedObject { uint32_t patchedArgumentsNum = 0; uint32_t startOffset = 0; uint32_t statelessUncacheableArgsCount = 0; - uint32_t threadArbitrationPolicy = ThreadArbitrationPolicy::NotPresent; + int32_t threadArbitrationPolicy = ThreadArbitrationPolicy::NotPresent; KernelExecutionType executionType = KernelExecutionType::Default; std::vector patchInfoDataList; diff --git a/opencl/source/xe_hp_core/cl_hw_helper_xe_hp_core.cpp b/opencl/source/xe_hp_core/cl_hw_helper_xe_hp_core.cpp index baca9310ef..74653b77c9 100644 --- a/opencl/source/xe_hp_core/cl_hw_helper_xe_hp_core.cpp +++ b/opencl/source/xe_hp_core/cl_hw_helper_xe_hp_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Intel Corporation + * Copyright (C) 2021-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -59,7 +59,7 @@ bool ClHwHelperHw::isSupportedKernelThreadArbitrationPolicy() const { re template <> std::vector ClHwHelperHw::getSupportedThreadArbitrationPolicies() const { - return std::vector{}; + return {}; } template <> diff --git a/opencl/source/xe_hpg_core/cl_hw_helper_xe_hpg_core.cpp b/opencl/source/xe_hpg_core/cl_hw_helper_xe_hpg_core.cpp index 3bb8c620b0..c4bd940a58 100644 --- a/opencl/source/xe_hpg_core/cl_hw_helper_xe_hpg_core.cpp +++ b/opencl/source/xe_hpg_core/cl_hw_helper_xe_hpg_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Intel Corporation + * Copyright (C) 2021-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -46,7 +46,7 @@ bool ClHwHelperHw::requiresAuxResolves(const KernelInfo &kernelInfo, con template <> std::vector ClHwHelperHw::getSupportedThreadArbitrationPolicies() const { - return std::vector{}; + return {}; } template <> diff --git a/opencl/test/unit_test/command_queue/enqueue_handler_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_handler_tests.cpp index f5d8bcc7da..532f0f04f9 100644 --- a/opencl/test/unit_test/command_queue/enqueue_handler_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_handler_tests.cpp @@ -604,7 +604,7 @@ HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWhenClSetKernelExecInfoAlreadySe nullptr, nullptr); EXPECT_EQ(getNewKernelArbitrationPolicy(euThreadSetting), - static_cast(pDevice->getUltCommandStreamReceiver().streamProperties.stateComputeMode.threadArbitrationPolicy.value)); + pDevice->getUltCommandStreamReceiver().streamProperties.stateComputeMode.threadArbitrationPolicy.value); mockCmdQ->release(); } @@ -640,7 +640,7 @@ HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWhenNotSupportedPolicyChangeThen nullptr, nullptr); EXPECT_NE(getNewKernelArbitrationPolicy(euThreadSetting), - static_cast(pDevice->getUltCommandStreamReceiver().streamProperties.stateComputeMode.threadArbitrationPolicy.value)); + pDevice->getUltCommandStreamReceiver().streamProperties.stateComputeMode.threadArbitrationPolicy.value); EXPECT_EQ(0, pDevice->getUltCommandStreamReceiver().streamProperties.stateComputeMode.threadArbitrationPolicy.value); mockCmdQ->release(); diff --git a/opencl/test/unit_test/command_queue/enqueue_kernel_2_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_kernel_2_tests.cpp index c8887c28d6..5235a72f4e 100644 --- a/opencl/test/unit_test/command_queue/enqueue_kernel_2_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_kernel_2_tests.cpp @@ -760,7 +760,7 @@ HWTEST_F(EnqueueKernelTests, whenEnqueueingKernelThenCsrCorrectlySetsRequiredThr nullptr); pCommandQueue->flush(); EXPECT_EQ(HwHelperHw::get().getDefaultThreadArbitrationPolicy(), - static_cast(csr.streamProperties.stateComputeMode.threadArbitrationPolicy.value)); + csr.streamProperties.stateComputeMode.threadArbitrationPolicy.value); pCommandQueue->enqueueKernel( mockKernelWithInternalsWithIfpNotRequired.mockKernel, @@ -773,7 +773,7 @@ HWTEST_F(EnqueueKernelTests, whenEnqueueingKernelThenCsrCorrectlySetsRequiredThr nullptr); pCommandQueue->flush(); EXPECT_EQ(ThreadArbitrationPolicy::AgeBased, - static_cast(csr.streamProperties.stateComputeMode.threadArbitrationPolicy.value)); + csr.streamProperties.stateComputeMode.threadArbitrationPolicy.value); pCommandQueue->enqueueKernel( mockKernelWithInternalsWithIfpRequired.mockKernel, @@ -786,7 +786,7 @@ HWTEST_F(EnqueueKernelTests, whenEnqueueingKernelThenCsrCorrectlySetsRequiredThr nullptr); pCommandQueue->flush(); EXPECT_EQ(HwHelperHw::get().getDefaultThreadArbitrationPolicy(), - static_cast(csr.streamProperties.stateComputeMode.threadArbitrationPolicy.value)); + csr.streamProperties.stateComputeMode.threadArbitrationPolicy.value); } typedef HelloWorldFixture EnqueueKernelFixture; diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_1_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_1_tests.cpp index 061e2fa6cb..c250e39926 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_1_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_1_tests.cpp @@ -77,7 +77,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenOverrideThreadArbitrationPoli flushTask(commandStreamReceiver); EXPECT_EQ(ThreadArbitrationPolicy::RoundRobin, - static_cast(commandStreamReceiver.streamProperties.stateComputeMode.threadArbitrationPolicy.value)); + commandStreamReceiver.streamProperties.stateComputeMode.threadArbitrationPolicy.value); } HWTEST_F(CommandStreamReceiverFlushTaskTests, WhenFlushingTaskThenTaskCountIsIncremented) { @@ -1315,7 +1315,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDispatchFlagsWhenCallFlushTas dispatchFlags, *pDevice); - EXPECT_EQ(dispatchFlags.threadArbitrationPolicy, static_cast(mockCsr->streamProperties.stateComputeMode.threadArbitrationPolicy.value)); + EXPECT_EQ(dispatchFlags.threadArbitrationPolicy, mockCsr->streamProperties.stateComputeMode.threadArbitrationPolicy.value); } class CommandStreamReceiverFlushTaskMemoryCompressionTests : public UltCommandStreamReceiverTest, diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_2_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_2_tests.cpp index d5bdea18ea..08cbebd4f5 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_2_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_2_tests.cpp @@ -423,7 +423,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDefaultCommandStreamReceiverThenRoundRobinPolicyIsSelected) { auto pCommandStreamReceiver = new MockCsrHw(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); pDevice->resetCommandStreamReceiver(pCommandStreamReceiver); - EXPECT_EQ(static_cast(-1), pCommandStreamReceiver->peekThreadArbitrationPolicy()); + EXPECT_EQ(ThreadArbitrationPolicy::NotPresent, pCommandStreamReceiver->peekThreadArbitrationPolicy()); flushTask(*pCommandStreamReceiver); EXPECT_EQ(HwHelperHw::get().getDefaultThreadArbitrationPolicy(), pCommandStreamReceiver->peekThreadArbitrationPolicy()); diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_4_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_4_tests.cpp index 6e667f39c6..183483972a 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_4_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_4_tests.cpp @@ -670,19 +670,19 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenEnqueueWithoutArbitrationPoli auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); auto &csrThreadArbitrationPolicy = commandStreamReceiver.streamProperties.stateComputeMode.threadArbitrationPolicy.value; - uint32_t sentThreadArbitrationPolicy = ThreadArbitrationPolicy::RoundRobinAfterDependency; + int32_t sentThreadArbitrationPolicy = ThreadArbitrationPolicy::RoundRobinAfterDependency; flushTaskFlags.threadArbitrationPolicy = sentThreadArbitrationPolicy; flushTask(commandStreamReceiver); - EXPECT_EQ(static_cast(csrThreadArbitrationPolicy), sentThreadArbitrationPolicy); + EXPECT_EQ(csrThreadArbitrationPolicy, sentThreadArbitrationPolicy); flushTaskFlags.threadArbitrationPolicy = ThreadArbitrationPolicy::NotPresent; flushTask(commandStreamReceiver); - EXPECT_EQ(static_cast(csrThreadArbitrationPolicy), sentThreadArbitrationPolicy); + EXPECT_EQ(csrThreadArbitrationPolicy, sentThreadArbitrationPolicy); } struct PreambleThreadArbitrationMatcher { diff --git a/opencl/test/unit_test/command_stream/thread_arbitration_policy_helper.cpp b/opencl/test/unit_test/command_stream/thread_arbitration_policy_helper.cpp index 1ca72a209c..b9ca4c88a5 100644 --- a/opencl/test/unit_test/command_stream/thread_arbitration_policy_helper.cpp +++ b/opencl/test/unit_test/command_stream/thread_arbitration_policy_helper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2021 Intel Corporation + * Copyright (C) 2020-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -11,7 +11,7 @@ #include namespace NEO { -uint32_t getNewKernelArbitrationPolicy(uint32_t policy) { +int32_t getNewKernelArbitrationPolicy(uint32_t policy) { if (policy == CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_ROUND_ROBIN_INTEL) { return ThreadArbitrationPolicy::RoundRobin; } else if (policy == CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_OLDEST_FIRST_INTEL) { diff --git a/opencl/test/unit_test/command_stream/thread_arbitration_policy_helper.h b/opencl/test/unit_test/command_stream/thread_arbitration_policy_helper.h index 05c552ca3a..323168b1d7 100644 --- a/opencl/test/unit_test/command_stream/thread_arbitration_policy_helper.h +++ b/opencl/test/unit_test/command_stream/thread_arbitration_policy_helper.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Intel Corporation + * Copyright (C) 2020-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,5 +7,5 @@ #include namespace NEO { -uint32_t getNewKernelArbitrationPolicy(uint32_t policy); +int32_t getNewKernelArbitrationPolicy(uint32_t policy); } // namespace NEO \ No newline at end of file diff --git a/opencl/test/unit_test/command_stream/thread_arbitration_policy_helper_tests.cpp b/opencl/test/unit_test/command_stream/thread_arbitration_policy_helper_tests.cpp index a8a20d3789..7812bd0f7d 100644 --- a/opencl/test/unit_test/command_stream/thread_arbitration_policy_helper_tests.cpp +++ b/opencl/test/unit_test/command_stream/thread_arbitration_policy_helper_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2020 Intel Corporation + * Copyright (C) 2019-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -12,14 +12,14 @@ namespace NEO { TEST(ThreadArbitrationPolicy, givenClKrenelExecThreadArbitrationPolicyWhenGetNewKernelArbitrationPolicyIsCalledThenExpectedThreadArbitrationPolicyIsReturned) { - uint32_t retVal = ThreadArbitrationPolicy::getNewKernelArbitrationPolicy(CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_ROUND_ROBIN_INTEL); - EXPECT_EQ(retVal, static_cast(ThreadArbitrationPolicy::RoundRobin)); + int32_t retVal = ThreadArbitrationPolicy::getNewKernelArbitrationPolicy(CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_ROUND_ROBIN_INTEL); + EXPECT_EQ(retVal, ThreadArbitrationPolicy::RoundRobin); retVal = ThreadArbitrationPolicy::getNewKernelArbitrationPolicy(CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_OLDEST_FIRST_INTEL); - EXPECT_EQ(retVal, static_cast(ThreadArbitrationPolicy::AgeBased)); + EXPECT_EQ(retVal, ThreadArbitrationPolicy::AgeBased); retVal = ThreadArbitrationPolicy::getNewKernelArbitrationPolicy(CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_AFTER_DEPENDENCY_ROUND_ROBIN_INTEL); - EXPECT_EQ(retVal, static_cast(ThreadArbitrationPolicy::RoundRobinAfterDependency)); - uint32_t randomValue = -1; + EXPECT_EQ(retVal, ThreadArbitrationPolicy::RoundRobinAfterDependency); + uint32_t randomValue = 0xFFFFu; retVal = ThreadArbitrationPolicy::getNewKernelArbitrationPolicy(randomValue); - EXPECT_EQ(retVal, static_cast(ThreadArbitrationPolicy::NotPresent)); + EXPECT_EQ(retVal, ThreadArbitrationPolicy::NotPresent); } } // namespace NEO \ No newline at end of file diff --git a/opencl/test/unit_test/helpers/test_preamble_xehp_and_later.cpp b/opencl/test/unit_test/helpers/test_preamble_xehp_and_later.cpp index 97079e666f..459ae69dcd 100644 --- a/opencl/test/unit_test/helpers/test_preamble_xehp_and_later.cpp +++ b/opencl/test/unit_test/helpers/test_preamble_xehp_and_later.cpp @@ -29,7 +29,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ThreadArbitrationXeHPAndLater, givenPolicyWhenThrea PreambleHelper::programThreadArbitration(&cs, ThreadArbitrationPolicy::RoundRobin); EXPECT_EQ(0u, cs.getUsed()); - EXPECT_EQ(0u, HwHelperHw::get().getDefaultThreadArbitrationPolicy()); + EXPECT_EQ(ThreadArbitrationPolicy::AgeBased, HwHelperHw::get().getDefaultThreadArbitrationPolicy()); } using ProgramPipelineXeHPAndLater = PreambleFixture; diff --git a/opencl/test/unit_test/os_interface/hw_info_config_tests.cpp b/opencl/test/unit_test/os_interface/hw_info_config_tests.cpp index 9ac6c1a22c..d925d787f3 100644 --- a/opencl/test/unit_test/os_interface/hw_info_config_tests.cpp +++ b/opencl/test/unit_test/os_interface/hw_info_config_tests.cpp @@ -223,8 +223,8 @@ HWTEST_F(HwInfoConfigTest, givenVariousValuesWhenGettingAubStreamSteppingFromHwR uint32_t getSteppingFromHwRevId(const HardwareInfo &hwInfo) const override { return returnedStepping; } - std::vector getKernelSupportedThreadArbitrationPolicies() override { - return std::vector(); + std::vector getKernelSupportedThreadArbitrationPolicies() override { + return {}; } uint32_t returnedStepping = 0; }; diff --git a/opencl/test/unit_test/xe_hpc_core/pvc/command_stream_receiver_hw_tests_pvc.cpp b/opencl/test/unit_test/xe_hpc_core/pvc/command_stream_receiver_hw_tests_pvc.cpp index 0307c10f66..b8636d337b 100644 --- a/opencl/test/unit_test/xe_hpc_core/pvc/command_stream_receiver_hw_tests_pvc.cpp +++ b/opencl/test/unit_test/xe_hpc_core/pvc/command_stream_receiver_hw_tests_pvc.cpp @@ -48,7 +48,7 @@ PVCTEST_F(PvcCommandStreamReceiverFlushTaskTests, givenOverrideThreadArbitration flushTask(commandStreamReceiver); EXPECT_EQ(ThreadArbitrationPolicy::RoundRobin, - static_cast(commandStreamReceiver.streamProperties.stateComputeMode.threadArbitrationPolicy.value)); + commandStreamReceiver.streamProperties.stateComputeMode.threadArbitrationPolicy.value); } PVCTEST_F(PvcCommandStreamReceiverFlushTaskTests, givenNotExistPolicyWhenFlushingThenDefaultPolicyIsProgrammed) { @@ -58,12 +58,12 @@ PVCTEST_F(PvcCommandStreamReceiverFlushTaskTests, givenNotExistPolicyWhenFlushin auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); - uint32_t notExistPolicy = -2; + int32_t notExistPolicy = -2; flushTaskFlags.threadArbitrationPolicy = notExistPolicy; flushTask(commandStreamReceiver); - EXPECT_EQ(notExistPolicy, static_cast(commandStreamReceiver.streamProperties.stateComputeMode.threadArbitrationPolicy.value)); + EXPECT_EQ(notExistPolicy, commandStreamReceiver.streamProperties.stateComputeMode.threadArbitrationPolicy.value); } PVCTEST_F(PvcCommandStreamReceiverFlushTaskTests, givenRevisionBAndAboveWhenLastSpecialPipelineSelectModeIsTrueAndFlushTaskIsCalledThenDontReprogramPipelineSelect) { diff --git a/shared/source/command_stream/command_stream_receiver_hw_base.inl b/shared/source/command_stream/command_stream_receiver_hw_base.inl index 62a979027e..d2aa365222 100644 --- a/shared/source/command_stream/command_stream_receiver_hw_base.inl +++ b/shared/source/command_stream/command_stream_receiver_hw_base.inl @@ -263,7 +263,7 @@ CompletionStamp CommandStreamReceiverHw::flushTask( if (dispatchFlags.threadArbitrationPolicy == ThreadArbitrationPolicy::NotPresent) { if (this->streamProperties.stateComputeMode.threadArbitrationPolicy.value != -1) { // Reuse previous programming - dispatchFlags.threadArbitrationPolicy = static_cast(this->streamProperties.stateComputeMode.threadArbitrationPolicy.value); + dispatchFlags.threadArbitrationPolicy = this->streamProperties.stateComputeMode.threadArbitrationPolicy.value; } else { // Pick default if this is first submit dispatchFlags.threadArbitrationPolicy = hwHelper.getDefaultThreadArbitrationPolicy(); @@ -350,7 +350,7 @@ CompletionStamp CommandStreamReceiverHw::flushTask( programPerDssBackedBuffer(commandStreamCSR, device, dispatchFlags); if (this->streamProperties.stateComputeMode.threadArbitrationPolicy.isDirty) { - auto threadArbitrationPolicy = static_cast(this->streamProperties.stateComputeMode.threadArbitrationPolicy.value); + auto threadArbitrationPolicy = this->streamProperties.stateComputeMode.threadArbitrationPolicy.value; PreambleHelper::programThreadArbitration(&commandStreamCSR, threadArbitrationPolicy); } @@ -925,7 +925,7 @@ inline void CommandStreamReceiverHw::programStateSip(LinearStream &cm template inline void CommandStreamReceiverHw::programPreamble(LinearStream &csr, Device &device, uint32_t &newL3Config) { if (!this->isPreambleSent) { - auto threadArbitrationPolicy = static_cast(this->streamProperties.stateComputeMode.threadArbitrationPolicy.value); + auto threadArbitrationPolicy = this->streamProperties.stateComputeMode.threadArbitrationPolicy.value; PreambleHelper::programPreamble(&csr, device, newL3Config, threadArbitrationPolicy, this->preemptionAllocation); this->isPreambleSent = true; this->lastSentL3Config = newL3Config; diff --git a/shared/source/command_stream/csr_definitions.h b/shared/source/command_stream/csr_definitions.h index 9fc8aabcc7..f263cc687c 100644 --- a/shared/source/command_stream/csr_definitions.h +++ b/shared/source/command_stream/csr_definitions.h @@ -51,7 +51,7 @@ struct DispatchFlags { DispatchFlags() = delete; DispatchFlags(CsrDependencies csrDependenciesP, TimestampPacketContainer *barrierTimestampPacketNodesP, PipelineSelectArgs pipelineSelectArgsP, FlushStampTrackingObj *flushStampReferenceP, QueueThrottle throttleP, PreemptionMode preemptionModeP, uint32_t numGrfRequiredP, - uint32_t l3CacheSettingsP, uint32_t threadArbitrationPolicyP, uint32_t additionalKernelExecInfoP, + uint32_t l3CacheSettingsP, int32_t threadArbitrationPolicyP, uint32_t additionalKernelExecInfoP, KernelExecutionType kernelExecutionTypeP, MemoryCompressionState memoryCompressionStateP, uint64_t sliceCountP, bool blockingP, bool dcFlushP, bool useSLMP, bool guardCommandBufferWithPipeControlP, bool gsba32BitRequiredP, bool requiresCoherencyP, bool lowPriorityP, bool implicitFlushP, bool outOfOrderExecutionAllowedP, bool epilogueRequiredP, @@ -93,7 +93,7 @@ struct DispatchFlags { PreemptionMode preemptionMode = PreemptionMode::Disabled; uint32_t numGrfRequired = GrfConfig::DefaultGrfNumber; uint32_t l3CacheSettings = L3CachingSettings::l3CacheOn; - uint32_t threadArbitrationPolicy = ThreadArbitrationPolicy::NotPresent; + int32_t threadArbitrationPolicy = ThreadArbitrationPolicy::NotPresent; uint32_t additionalKernelExecInfo = AdditionalKernelExecInfo::NotApplicable; KernelExecutionType kernelExecutionType = KernelExecutionType::NotApplicable; MemoryCompressionState memoryCompressionState = MemoryCompressionState::NotApplicable; diff --git a/shared/source/command_stream/definitions/stream_properties.inl b/shared/source/command_stream/definitions/stream_properties.inl index 9eeda44b93..3a468af859 100644 --- a/shared/source/command_stream/definitions/stream_properties.inl +++ b/shared/source/command_stream/definitions/stream_properties.inl @@ -16,7 +16,7 @@ struct StateComputeModeProperties { StreamProperty pixelAsyncComputeThreadLimit{}; StreamProperty threadArbitrationPolicy{}; - void setProperties(bool requiresCoherency, uint32_t numGrfRequired, uint32_t threadArbitrationPolicy); + void setProperties(bool requiresCoherency, uint32_t numGrfRequired, int32_t threadArbitrationPolicy); void setProperties(const StateComputeModeProperties &properties); bool isDirty() const; void clearIsDirty(); diff --git a/shared/source/command_stream/stream_properties.cpp b/shared/source/command_stream/stream_properties.cpp index 9088bb31cb..d23a17c944 100644 --- a/shared/source/command_stream/stream_properties.cpp +++ b/shared/source/command_stream/stream_properties.cpp @@ -11,7 +11,7 @@ using namespace NEO; -void StateComputeModeProperties::setProperties(bool requiresCoherency, uint32_t numGrfRequired, uint32_t threadArbitrationPolicy) { +void StateComputeModeProperties::setProperties(bool requiresCoherency, uint32_t numGrfRequired, int32_t threadArbitrationPolicy) { clearIsDirty(); int32_t isCoherencyRequired = (requiresCoherency ? 1 : 0); diff --git a/shared/source/command_stream/thread_arbitration_policy.h b/shared/source/command_stream/thread_arbitration_policy.h index 0bde198c54..e53d4ad91a 100644 --- a/shared/source/command_stream/thread_arbitration_policy.h +++ b/shared/source/command_stream/thread_arbitration_policy.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -11,11 +11,11 @@ namespace NEO { namespace ThreadArbitrationPolicy { -enum : uint32_t { - AgeBased = 0x0u, - RoundRobin = 0x1u, - RoundRobinAfterDependency = 0x2u, - NotPresent = 0xffffu +enum : int32_t { + AgeBased = 0, + RoundRobin = 1, + RoundRobinAfterDependency = 2, + NotPresent = -1 }; } // namespace ThreadArbitrationPolicy diff --git a/shared/source/gen11/hw_helper_gen11.cpp b/shared/source/gen11/hw_helper_gen11.cpp index ffa3abf03f..a1fecf4c4d 100644 --- a/shared/source/gen11/hw_helper_gen11.cpp +++ b/shared/source/gen11/hw_helper_gen11.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2021 Intel Corporation + * Copyright (C) 2020-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -25,7 +25,7 @@ std::string HwHelperHw::getExtensions() const { } template <> -uint32_t HwHelperHw::getDefaultThreadArbitrationPolicy() const { +int32_t HwHelperHw::getDefaultThreadArbitrationPolicy() const { return ThreadArbitrationPolicy::RoundRobinAfterDependency; } diff --git a/shared/source/gen11/preamble_gen11.cpp b/shared/source/gen11/preamble_gen11.cpp index 536105bed5..b8186c52f7 100644 --- a/shared/source/gen11/preamble_gen11.cpp +++ b/shared/source/gen11/preamble_gen11.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 Intel Corporation + * Copyright (C) 2019-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -64,7 +64,7 @@ void PreambleHelper::addPipeControlBeforeVfeCmd(LinearStream *pComman } template <> -void PreambleHelper::programThreadArbitration(LinearStream *pCommandStream, uint32_t requiredThreadArbitrationPolicy) { +void PreambleHelper::programThreadArbitration(LinearStream *pCommandStream, int32_t requiredThreadArbitrationPolicy) { UNRECOVERABLE_IF(requiredThreadArbitrationPolicy == ThreadArbitrationPolicy::NotPresent); auto pipeControl = pCommandStream->getSpaceForCmd(); @@ -84,11 +84,11 @@ size_t PreambleHelper::getThreadArbitrationCommandsSize() { } template <> -std::vector PreambleHelper::getSupportedThreadArbitrationPolicies() { - std::vector retVal; - size_t policySize = sizeof(RowChickenReg4::regDataForArbitrationPolicy) / - sizeof(RowChickenReg4::regDataForArbitrationPolicy[0]); - for (uint32_t i = 0u; i < policySize; i++) { +std::vector PreambleHelper::getSupportedThreadArbitrationPolicies() { + std::vector retVal; + int32_t policySize = sizeof(RowChickenReg4::regDataForArbitrationPolicy) / + sizeof(RowChickenReg4::regDataForArbitrationPolicy[0]); + for (int32_t i = 0; i < policySize; i++) { retVal.push_back(i); } return retVal; diff --git a/shared/source/gen9/hw_helper_gen9.cpp b/shared/source/gen9/hw_helper_gen9.cpp index 916d587214..b26dc01af2 100644 --- a/shared/source/gen9/hw_helper_gen9.cpp +++ b/shared/source/gen9/hw_helper_gen9.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -30,7 +30,7 @@ uint32_t HwHelperHw::getMetricsLibraryGenId() const { } template <> -uint32_t HwHelperHw::getDefaultThreadArbitrationPolicy() const { +int32_t HwHelperHw::getDefaultThreadArbitrationPolicy() const { return ThreadArbitrationPolicy::RoundRobin; } diff --git a/shared/source/gen9/preamble_gen9.cpp b/shared/source/gen9/preamble_gen9.cpp index a87d72a0be..5fe5f0cac2 100644 --- a/shared/source/gen9/preamble_gen9.cpp +++ b/shared/source/gen9/preamble_gen9.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -64,7 +64,7 @@ void PreambleHelper::addPipeControlBeforeVfeCmd(LinearStream *pComman } template <> -void PreambleHelper::programThreadArbitration(LinearStream *pCommandStream, uint32_t requiredThreadArbitrationPolicy) { +void PreambleHelper::programThreadArbitration(LinearStream *pCommandStream, int32_t requiredThreadArbitrationPolicy) { UNRECOVERABLE_IF(requiredThreadArbitrationPolicy == ThreadArbitrationPolicy::NotPresent); auto pipeControl = pCommandStream->getSpaceForCmd(); @@ -84,9 +84,9 @@ size_t PreambleHelper::getThreadArbitrationCommandsSize() { } template <> -std::vector PreambleHelper::getSupportedThreadArbitrationPolicies() { - std::vector retVal; - for (const uint32_t &p : DebugControlReg2::supportedArbitrationPolicy) { +std::vector PreambleHelper::getSupportedThreadArbitrationPolicies() { + std::vector retVal; + for (const int32_t &p : DebugControlReg2::supportedArbitrationPolicy) { retVal.push_back(p); } return retVal; diff --git a/shared/source/gen9/reg_configs.h b/shared/source/gen9/reg_configs.h index f5ef27e918..9aba269adb 100644 --- a/shared/source/gen9/reg_configs.h +++ b/shared/source/gen9/reg_configs.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -30,10 +30,10 @@ struct L3CNTLREGConfig { namespace DebugControlReg2 { constexpr uint32_t address = 0xE404; -constexpr uint32_t getRegData(const uint32_t &policy) { +constexpr uint32_t getRegData(const int32_t &policy) { return policy == ThreadArbitrationPolicy::RoundRobin ? 0x100 : 0x0; }; -static const uint32_t supportedArbitrationPolicy[] = { +static const int32_t supportedArbitrationPolicy[] = { ThreadArbitrationPolicy::AgeBased, ThreadArbitrationPolicy::RoundRobin}; } // namespace DebugControlReg2 diff --git a/shared/source/helpers/hw_helper.h b/shared/source/helpers/hw_helper.h index 41a582d979..d28a20c654 100644 --- a/shared/source/helpers/hw_helper.h +++ b/shared/source/helpers/hw_helper.h @@ -104,7 +104,7 @@ class HwHelper { virtual void setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const HardwareInfo &hwInfo) const = 0; virtual bool isBankOverrideRequired(const HardwareInfo &hwInfo) const = 0; virtual uint32_t getGlobalTimeStampBits() const = 0; - virtual uint32_t getDefaultThreadArbitrationPolicy() const = 0; + virtual int32_t getDefaultThreadArbitrationPolicy() const = 0; virtual bool useOnlyGlobalTimestamps() const = 0; virtual bool useSystemMemoryPlacementForISA(const HardwareInfo &hwInfo) const = 0; virtual bool packedFormatsSupported() const = 0; @@ -318,7 +318,7 @@ class HwHelperHw : public HwHelper { bool isBankOverrideRequired(const HardwareInfo &hwInfo) const override; - uint32_t getDefaultThreadArbitrationPolicy() const override; + int32_t getDefaultThreadArbitrationPolicy() const override; bool useOnlyGlobalTimestamps() const override; diff --git a/shared/source/helpers/hw_helper_base.inl b/shared/source/helpers/hw_helper_base.inl index 570224d07f..2b105fd9aa 100644 --- a/shared/source/helpers/hw_helper_base.inl +++ b/shared/source/helpers/hw_helper_base.inl @@ -582,7 +582,7 @@ bool HwHelperHw::isBankOverrideRequired(const HardwareInfo &hwInfo) c } template -uint32_t HwHelperHw::getDefaultThreadArbitrationPolicy() const { +int32_t HwHelperHw::getDefaultThreadArbitrationPolicy() const { return 0; } diff --git a/shared/source/helpers/preamble.h b/shared/source/helpers/preamble.h index fcbbb4695b..c9c0b12e1c 100644 --- a/shared/source/helpers/preamble.h +++ b/shared/source/helpers/preamble.h @@ -38,7 +38,7 @@ struct PreambleHelper { const PipelineSelectArgs &pipelineSelectArgs, const HardwareInfo &hwInfo); static void appendProgramPipelineSelect(void *cmd, bool isSpecialModeSelected, const HardwareInfo &hwInfo); - static void programThreadArbitration(LinearStream *pCommandStream, uint32_t requiredThreadArbitrationPolicy); + static void programThreadArbitration(LinearStream *pCommandStream, int32_t requiredThreadArbitrationPolicy); static void programPreemption(LinearStream *pCommandStream, Device &device, GraphicsAllocation *preemptionCsr); static void addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo, EngineGroupType engineGroupType); static void appendProgramVFEState(const HardwareInfo &hwInfo, const StreamProperties &streamProperties, void *cmd); @@ -54,7 +54,7 @@ struct PreambleHelper { static uint64_t getScratchSpaceAddressOffsetForVfeState(LinearStream *pCommandStream, void *pVfeState); static void programAdditionalFieldsInVfeState(VFE_STATE_TYPE *mediaVfeState, const HardwareInfo &hwInfo, bool disableEUFusion); static void programPreamble(LinearStream *pCommandStream, Device &device, uint32_t l3Config, - uint32_t requiredThreadArbitrationPolicy, GraphicsAllocation *preemptionCsr); + int32_t requiredThreadArbitrationPolicy, GraphicsAllocation *preemptionCsr); static void programKernelDebugging(LinearStream *pCommandStream); static void programSemaphoreDelay(LinearStream *pCommandStream); static uint32_t getL3Config(const HardwareInfo &hwInfo, bool useSLM); @@ -64,7 +64,7 @@ struct PreambleHelper { const HardwareInfo &hwInfo); static size_t getAdditionalCommandsSize(const Device &device); static size_t getThreadArbitrationCommandsSize(); - static std::vector getSupportedThreadArbitrationPolicies(); + static std::vector getSupportedThreadArbitrationPolicies(); static size_t getVFECommandsSize(); static size_t getKernelDebuggingCommandsSize(bool debuggingActive); static void programGenSpecificPreambleWorkArounds(LinearStream *pCommandStream, const HardwareInfo &hwInfo); diff --git a/shared/source/helpers/preamble_base.inl b/shared/source/helpers/preamble_base.inl index e343332a67..24e1c7b0ee 100644 --- a/shared/source/helpers/preamble_base.inl +++ b/shared/source/helpers/preamble_base.inl @@ -21,7 +21,7 @@ namespace NEO { template -void PreambleHelper::programThreadArbitration(LinearStream *pCommandStream, uint32_t requiredThreadArbitrationPolicy) { +void PreambleHelper::programThreadArbitration(LinearStream *pCommandStream, int32_t requiredThreadArbitrationPolicy) { } template @@ -30,8 +30,8 @@ size_t PreambleHelper::getThreadArbitrationCommandsSize() { } template -std::vector PreambleHelper::getSupportedThreadArbitrationPolicies() { - return std::vector(); +std::vector PreambleHelper::getSupportedThreadArbitrationPolicies() { + return {}; } template @@ -75,7 +75,7 @@ size_t PreambleHelper::getCmdSizeForPipelineSelect(const HardwareInfo template void PreambleHelper::programPreamble(LinearStream *pCommandStream, Device &device, uint32_t l3Config, - uint32_t requiredThreadArbitrationPolicy, GraphicsAllocation *preemptionCsr) { + int32_t requiredThreadArbitrationPolicy, GraphicsAllocation *preemptionCsr) { programL3(pCommandStream, l3Config); programPreemption(pCommandStream, device, preemptionCsr); if (device.isDebuggerActive()) { diff --git a/shared/source/os_interface/hw_info_config.h b/shared/source/os_interface/hw_info_config.h index f0233857c3..d8435897f0 100644 --- a/shared/source/os_interface/hw_info_config.h +++ b/shared/source/os_interface/hw_info_config.h @@ -41,7 +41,7 @@ class HwInfoConfig { virtual uint64_t getCrossDeviceSharedMemCapabilities() = 0; virtual uint64_t getSharedSystemMemCapabilities(const HardwareInfo *hwInfo) = 0; virtual void getKernelExtendedProperties(uint32_t *fp16, uint32_t *fp32, uint32_t *fp64) = 0; - virtual std::vector getKernelSupportedThreadArbitrationPolicies() = 0; + virtual std::vector getKernelSupportedThreadArbitrationPolicies() = 0; virtual void convertTimestampsFromOaToCsDomain(uint64_t ×tampData) = 0; virtual uint32_t getDeviceMemoryMaxClkRate(const HardwareInfo *hwInfo) = 0; virtual bool isAdditionalStateBaseAddressWARequired(const HardwareInfo &hwInfo) const = 0; @@ -111,7 +111,7 @@ class HwInfoConfigHw : public HwInfoConfig { uint64_t getCrossDeviceSharedMemCapabilities() override; uint64_t getSharedSystemMemCapabilities(const HardwareInfo *hwInfo) override; void getKernelExtendedProperties(uint32_t *fp16, uint32_t *fp32, uint32_t *fp64) override; - std::vector getKernelSupportedThreadArbitrationPolicies() override; + std::vector getKernelSupportedThreadArbitrationPolicies() override; void convertTimestampsFromOaToCsDomain(uint64_t ×tampData) override; uint32_t getDeviceMemoryMaxClkRate(const HardwareInfo *hwInfo) override; bool isAdditionalStateBaseAddressWARequired(const HardwareInfo &hwInfo) const override; diff --git a/shared/source/os_interface/hw_info_config.inl b/shared/source/os_interface/hw_info_config.inl index 94d964fc81..f96089e55e 100644 --- a/shared/source/os_interface/hw_info_config.inl +++ b/shared/source/os_interface/hw_info_config.inl @@ -30,7 +30,7 @@ void HwInfoConfigHw::getKernelExtendedProperties(uint32_t *fp16, uin } template -std::vector HwInfoConfigHw::getKernelSupportedThreadArbitrationPolicies() { +std::vector HwInfoConfigHw::getKernelSupportedThreadArbitrationPolicies() { using GfxFamily = typename HwMapper::GfxFamily; return PreambleHelper::getSupportedThreadArbitrationPolicies(); } diff --git a/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp b/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp index b601e387ac..7a7cc85bfd 100644 --- a/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp @@ -347,7 +347,7 @@ uint32_t HwHelperHw::computeSlmValues(const HardwareInfo &hwInfo, uint32 } template <> -uint32_t HwHelperHw::getDefaultThreadArbitrationPolicy() const { +int32_t HwHelperHw::getDefaultThreadArbitrationPolicy() const { return ThreadArbitrationPolicy::AgeBased; } diff --git a/shared/test/common/gen12lp/test_preamble_gen12lp.cpp b/shared/test/common/gen12lp/test_preamble_gen12lp.cpp index ab67173cf7..c35b9b88bb 100644 --- a/shared/test/common/gen12lp/test_preamble_gen12lp.cpp +++ b/shared/test/common/gen12lp/test_preamble_gen12lp.cpp @@ -186,7 +186,7 @@ GEN12LPTEST_F(ThreadArbitrationGen12Lp, givenPolicyWhenThreadArbitrationProgramm PreambleHelper::programThreadArbitration(&cs, ThreadArbitrationPolicy::RoundRobin); EXPECT_EQ(0u, cs.getUsed()); - EXPECT_EQ(0u, HwHelperHw::get().getDefaultThreadArbitrationPolicy()); + EXPECT_EQ(ThreadArbitrationPolicy::AgeBased, HwHelperHw::get().getDefaultThreadArbitrationPolicy()); } GEN12LPTEST_F(ThreadArbitrationGen12Lp, whenGetSupportThreadArbitrationPoliciesIsCalledThenEmptyVectorIsReturned) { diff --git a/shared/test/common/gen8/test_preamble_gen8.cpp b/shared/test/common/gen8/test_preamble_gen8.cpp index 44d6275617..1650e9ee63 100644 --- a/shared/test/common/gen8/test_preamble_gen8.cpp +++ b/shared/test/common/gen8/test_preamble_gen8.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -81,7 +81,7 @@ BDWTEST_F(ThreadArbitrationGen8, givenPolicyWhenThreadArbitrationProgrammedThenD MockDevice device; EXPECT_EQ(0u, PreambleHelper::getAdditionalCommandsSize(device)); EXPECT_EQ(0u, PreambleHelper::getThreadArbitrationCommandsSize()); - EXPECT_EQ(0u, HwHelperHw::get().getDefaultThreadArbitrationPolicy()); + EXPECT_EQ(ThreadArbitrationPolicy::AgeBased, HwHelperHw::get().getDefaultThreadArbitrationPolicy()); } BDWTEST_F(ThreadArbitrationGen8, whenGetSupportThreadArbitrationPoliciesIsCalledThenEmptyVectorIsReturned) { diff --git a/shared/test/common/helpers/unit_test_helper.h b/shared/test/common/helpers/unit_test_helper.h index 1ddced86a6..b9a0b6c043 100644 --- a/shared/test/common/helpers/unit_test_helper.h +++ b/shared/test/common/helpers/unit_test_helper.h @@ -31,7 +31,7 @@ struct UnitTestHelper { static uint32_t getDefaultSshUsage(); - static uint32_t getAppropriateThreadArbitrationPolicy(uint32_t policy); + static uint32_t getAppropriateThreadArbitrationPolicy(int32_t policy); static auto getCoherencyTypeSupported(COHERENCY_TYPE coherencyType) -> decltype(coherencyType); diff --git a/shared/test/common/helpers/unit_test_helper.inl b/shared/test/common/helpers/unit_test_helper.inl index e399b3b852..c9239ccd91 100644 --- a/shared/test/common/helpers/unit_test_helper.inl +++ b/shared/test/common/helpers/unit_test_helper.inl @@ -13,8 +13,8 @@ bool UnitTestHelper::isPageTableManagerSupported(const HardwareInfo & } template -inline uint32_t UnitTestHelper::getAppropriateThreadArbitrationPolicy(uint32_t policy) { - return policy; +inline uint32_t UnitTestHelper::getAppropriateThreadArbitrationPolicy(int32_t policy) { + return static_cast(policy); } template diff --git a/shared/test/common/mocks/mock_csr.h b/shared/test/common/mocks/mock_csr.h index fd8b1bbb42..5e73ec7949 100644 --- a/shared/test/common/mocks/mock_csr.h +++ b/shared/test/common/mocks/mock_csr.h @@ -44,7 +44,7 @@ class MockCsrBase : public UltCommandStreamReceiver { madeNonResidentGfxAllocations.push_back(&gfxAllocation); } - uint32_t peekThreadArbitrationPolicy() { return static_cast(this->streamProperties.stateComputeMode.threadArbitrationPolicy.value); } + int32_t peekThreadArbitrationPolicy() { return this->streamProperties.stateComputeMode.threadArbitrationPolicy.value; } bool isMadeResident(GraphicsAllocation *gfxAllocation) { for (GraphicsAllocation *gfxAlloc : madeResidentGfxAllocations) { diff --git a/shared/test/common/mocks/mock_hw_info_config.cpp b/shared/test/common/mocks/mock_hw_info_config.cpp index e2dbb026df..20b49c13a0 100644 --- a/shared/test/common/mocks/mock_hw_info_config.cpp +++ b/shared/test/common/mocks/mock_hw_info_config.cpp @@ -174,8 +174,8 @@ LocalMemoryAccessMode HwInfoConfigHw::getLocalMemoryAccessMode(con } template <> -std::vector HwInfoConfigHw::getKernelSupportedThreadArbitrationPolicies() { - return std::vector(); +std::vector HwInfoConfigHw::getKernelSupportedThreadArbitrationPolicies() { + return {}; } template <> diff --git a/shared/test/common/xe_hpc_core/unit_test_helper_xe_hpc_core.cpp b/shared/test/common/xe_hpc_core/unit_test_helper_xe_hpc_core.cpp index 2013143130..6c74daca50 100644 --- a/shared/test/common/xe_hpc_core/unit_test_helper_xe_hpc_core.cpp +++ b/shared/test/common/xe_hpc_core/unit_test_helper_xe_hpc_core.cpp @@ -28,7 +28,7 @@ template <> const uint32_t UnitTestHelper::smallestTestableSimdSize = 16; template <> -uint32_t UnitTestHelper::getAppropriateThreadArbitrationPolicy(uint32_t policy) { +uint32_t UnitTestHelper::getAppropriateThreadArbitrationPolicy(int32_t policy) { using STATE_COMPUTE_MODE = typename Family::STATE_COMPUTE_MODE; switch (policy) { case ThreadArbitrationPolicy::RoundRobin: diff --git a/shared/test/unit_test/command_stream/stream_properties_tests_common.cpp b/shared/test/unit_test/command_stream/stream_properties_tests_common.cpp index 34e44005f4..7733999fcf 100644 --- a/shared/test/unit_test/command_stream/stream_properties_tests_common.cpp +++ b/shared/test/unit_test/command_stream/stream_properties_tests_common.cpp @@ -61,9 +61,9 @@ TEST(StreamPropertiesTests, whenSettingCooperativeKernelPropertiesThenCorrectVal TEST(StreamPropertiesTests, whenSettingStateComputeModePropertiesThenCorrectValuesAreSet) { DebugManagerStateRestore restorer; - uint32_t threadArbitrationPolicyValues[] = { + int32_t threadArbitrationPolicyValues[] = { ThreadArbitrationPolicy::AgeBased, ThreadArbitrationPolicy::RoundRobin, - ThreadArbitrationPolicy::RoundRobinAfterDependency, ThreadArbitrationPolicy::NotPresent}; + ThreadArbitrationPolicy::RoundRobinAfterDependency}; StreamProperties properties; for (auto requiresCoherency : ::testing::Bool()) { @@ -74,7 +74,7 @@ TEST(StreamPropertiesTests, whenSettingStateComputeModePropertiesThenCorrectValu EXPECT_EQ(requiresCoherency, properties.stateComputeMode.isCoherencyRequired.value); EXPECT_EQ(-1, properties.stateComputeMode.zPassAsyncComputeThreadLimit.value); EXPECT_EQ(-1, properties.stateComputeMode.pixelAsyncComputeThreadLimit.value); - EXPECT_EQ(threadArbitrationPolicy, static_cast(properties.stateComputeMode.threadArbitrationPolicy.value)); + EXPECT_EQ(threadArbitrationPolicy, properties.stateComputeMode.threadArbitrationPolicy.value); } } } @@ -94,7 +94,7 @@ TEST(StreamPropertiesTests, whenSettingStateComputeModePropertiesThenCorrectValu for (auto threadArbitrationPolicy : threadArbitrationPolicyValues) { DebugManager.flags.OverrideThreadArbitrationPolicy.set(threadArbitrationPolicy); properties.stateComputeMode.setProperties(false, 0u, 0u); - EXPECT_EQ(threadArbitrationPolicy, static_cast(properties.stateComputeMode.threadArbitrationPolicy.value)); + EXPECT_EQ(threadArbitrationPolicy, properties.stateComputeMode.threadArbitrationPolicy.value); } }