Change ThreadArbitrationPolicy enum type to int32_t

Change ThreadArbitrationPolicy::NotPresent value to -1
Update initial values to ThreadArbitrationPolicy::NotPresent

Related-To: NEO-6728

Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski 2022-03-07 17:00:26 +00:00 committed by Compute-Runtime-Automation
parent c612480f16
commit 80b520bc9b
46 changed files with 109 additions and 108 deletions

View File

@ -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;

View File

@ -211,7 +211,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(z
}
KernelImp *kernelImp = static_cast<KernelImp *>(kernel);
if (kernelImp->getSchedulingHintExp() != std::numeric_limits<uint32_t>::max()) {
if (kernelImp->getSchedulingHintExp() != NEO::ThreadArbitrationPolicy::NotPresent) {
this->threadArbitrationPolicy = kernelImp->getSchedulingHintExp();
}

View File

@ -456,7 +456,7 @@ ze_result_t DeviceImp::getKernelProperties(ze_device_module_properties_t *pKerne
reinterpret_cast<ze_scheduling_hint_exp_properties_t *>(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;

View File

@ -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<uint32_t>(NEO::DebugManager.flags.OverrideThreadArbitrationPolicy.get());
}

View File

@ -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<uint32_t>::max();
int32_t schedulingHintExpFlag = NEO::ThreadArbitrationPolicy::NotPresent;
std::unique_ptr<NEO::ImplicitArgs> pImplicitArgs;
};

View File

@ -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);
}

View File

@ -785,7 +785,7 @@ HWTEST_F(DeviceTest, whenPassingSchedulingHintExpStructToGetPropertiesThenProper
EXPECT_NE(ZE_SCHEDULING_HINT_EXP_FLAG_FORCE_UINT32, schedulingHintProperties.schedulingHintFlags);
auto supportedThreadArbitrationPolicies = NEO::PreambleHelper<FamilyType>::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<productFamily> {
std::vector<uint32_t> getKernelSupportedThreadArbitrationPolicies() override {
std::vector<int32_t> getKernelSupportedThreadArbitrationPolicies() override {
return threadArbPolicies;
}
std::vector<uint32_t> threadArbPolicies;
std::vector<int32_t> threadArbPolicies;
};
const uint32_t rootDeviceIndex = 0u;
@ -847,10 +847,10 @@ HWTEST2_F(DeviceTest, givenAllThreadArbitrationPoliciesWhenPassingSchedulingHint
HWTEST2_F(DeviceTest, givenIncorrectThreadArbitrationPolicyWhenPassingSchedulingHintExpStructToGetPropertiesThenNoneIsReturned, MatchAny) {
struct MockHwInfoConfig : NEO::HwInfoConfigHw<productFamily> {
std::vector<uint32_t> getKernelSupportedThreadArbitrationPolicies() override {
std::vector<int32_t> getKernelSupportedThreadArbitrationPolicies() override {
return threadArbPolicies;
}
std::vector<uint32_t> threadArbPolicies;
std::vector<int32_t> threadArbPolicies;
};
const uint32_t rootDeviceIndex = 0u;

View File

@ -309,7 +309,7 @@ class Kernel : public ReferenceTrackedObject<Kernel> {
bool isBuiltIn = false;
uint32_t getThreadArbitrationPolicy() const {
int32_t getThreadArbitrationPolicy() const {
return threadArbitrationPolicy;
}
KernelExecutionType getExecutionType() const {
@ -352,7 +352,7 @@ class Kernel : public ReferenceTrackedObject<Kernel> {
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<Kernel> {
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<PatchInfoData> patchInfoDataList;

View File

@ -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<Family>::isSupportedKernelThreadArbitrationPolicy() const { re
template <>
std::vector<uint32_t> ClHwHelperHw<Family>::getSupportedThreadArbitrationPolicies() const {
return std::vector<uint32_t>{};
return {};
}
template <>

View File

@ -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<Family>::requiresAuxResolves(const KernelInfo &kernelInfo, con
template <>
std::vector<uint32_t> ClHwHelperHw<Family>::getSupportedThreadArbitrationPolicies() const {
return std::vector<uint32_t>{};
return {};
}
template <>

View File

@ -604,7 +604,7 @@ HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWhenClSetKernelExecInfoAlreadySe
nullptr,
nullptr);
EXPECT_EQ(getNewKernelArbitrationPolicy(euThreadSetting),
static_cast<uint32_t>(pDevice->getUltCommandStreamReceiver<FamilyType>().streamProperties.stateComputeMode.threadArbitrationPolicy.value));
pDevice->getUltCommandStreamReceiver<FamilyType>().streamProperties.stateComputeMode.threadArbitrationPolicy.value);
mockCmdQ->release();
}
@ -640,7 +640,7 @@ HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWhenNotSupportedPolicyChangeThen
nullptr,
nullptr);
EXPECT_NE(getNewKernelArbitrationPolicy(euThreadSetting),
static_cast<uint32_t>(pDevice->getUltCommandStreamReceiver<FamilyType>().streamProperties.stateComputeMode.threadArbitrationPolicy.value));
pDevice->getUltCommandStreamReceiver<FamilyType>().streamProperties.stateComputeMode.threadArbitrationPolicy.value);
EXPECT_EQ(0, pDevice->getUltCommandStreamReceiver<FamilyType>().streamProperties.stateComputeMode.threadArbitrationPolicy.value);
mockCmdQ->release();

View File

@ -760,7 +760,7 @@ HWTEST_F(EnqueueKernelTests, whenEnqueueingKernelThenCsrCorrectlySetsRequiredThr
nullptr);
pCommandQueue->flush();
EXPECT_EQ(HwHelperHw<FamilyType>::get().getDefaultThreadArbitrationPolicy(),
static_cast<uint32_t>(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<uint32_t>(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<FamilyType>::get().getDefaultThreadArbitrationPolicy(),
static_cast<uint32_t>(csr.streamProperties.stateComputeMode.threadArbitrationPolicy.value));
csr.streamProperties.stateComputeMode.threadArbitrationPolicy.value);
}
typedef HelloWorldFixture<HelloWorldFixtureFactory> EnqueueKernelFixture;

View File

@ -77,7 +77,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenOverrideThreadArbitrationPoli
flushTask(commandStreamReceiver);
EXPECT_EQ(ThreadArbitrationPolicy::RoundRobin,
static_cast<uint32_t>(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<uint32_t>(mockCsr->streamProperties.stateComputeMode.threadArbitrationPolicy.value));
EXPECT_EQ(dispatchFlags.threadArbitrationPolicy, mockCsr->streamProperties.stateComputeMode.threadArbitrationPolicy.value);
}
class CommandStreamReceiverFlushTaskMemoryCompressionTests : public UltCommandStreamReceiverTest,

View File

@ -423,7 +423,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests,
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDefaultCommandStreamReceiverThenRoundRobinPolicyIsSelected) {
auto pCommandStreamReceiver = new MockCsrHw<FamilyType>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
pDevice->resetCommandStreamReceiver(pCommandStreamReceiver);
EXPECT_EQ(static_cast<uint32_t>(-1), pCommandStreamReceiver->peekThreadArbitrationPolicy());
EXPECT_EQ(ThreadArbitrationPolicy::NotPresent, pCommandStreamReceiver->peekThreadArbitrationPolicy());
flushTask(*pCommandStreamReceiver);
EXPECT_EQ(HwHelperHw<FamilyType>::get().getDefaultThreadArbitrationPolicy(), pCommandStreamReceiver->peekThreadArbitrationPolicy());

View File

@ -670,19 +670,19 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenEnqueueWithoutArbitrationPoli
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
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<uint32_t>(csrThreadArbitrationPolicy), sentThreadArbitrationPolicy);
EXPECT_EQ(csrThreadArbitrationPolicy, sentThreadArbitrationPolicy);
flushTaskFlags.threadArbitrationPolicy = ThreadArbitrationPolicy::NotPresent;
flushTask(commandStreamReceiver);
EXPECT_EQ(static_cast<uint32_t>(csrThreadArbitrationPolicy), sentThreadArbitrationPolicy);
EXPECT_EQ(csrThreadArbitrationPolicy, sentThreadArbitrationPolicy);
}
struct PreambleThreadArbitrationMatcher {

View File

@ -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 <stdint.h>
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) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -7,5 +7,5 @@
#include <stdint.h>
namespace NEO {
uint32_t getNewKernelArbitrationPolicy(uint32_t policy);
int32_t getNewKernelArbitrationPolicy(uint32_t policy);
} // namespace NEO

View File

@ -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<uint32_t>(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<uint32_t>(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<uint32_t>(ThreadArbitrationPolicy::RoundRobinAfterDependency));
uint32_t randomValue = -1;
EXPECT_EQ(retVal, ThreadArbitrationPolicy::RoundRobinAfterDependency);
uint32_t randomValue = 0xFFFFu;
retVal = ThreadArbitrationPolicy::getNewKernelArbitrationPolicy(randomValue);
EXPECT_EQ(retVal, static_cast<uint32_t>(ThreadArbitrationPolicy::NotPresent));
EXPECT_EQ(retVal, ThreadArbitrationPolicy::NotPresent);
}
} // namespace NEO

View File

@ -29,7 +29,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ThreadArbitrationXeHPAndLater, givenPolicyWhenThrea
PreambleHelper<FamilyType>::programThreadArbitration(&cs, ThreadArbitrationPolicy::RoundRobin);
EXPECT_EQ(0u, cs.getUsed());
EXPECT_EQ(0u, HwHelperHw<FamilyType>::get().getDefaultThreadArbitrationPolicy());
EXPECT_EQ(ThreadArbitrationPolicy::AgeBased, HwHelperHw<FamilyType>::get().getDefaultThreadArbitrationPolicy());
}
using ProgramPipelineXeHPAndLater = PreambleFixture;

View File

@ -223,8 +223,8 @@ HWTEST_F(HwInfoConfigTest, givenVariousValuesWhenGettingAubStreamSteppingFromHwR
uint32_t getSteppingFromHwRevId(const HardwareInfo &hwInfo) const override {
return returnedStepping;
}
std::vector<uint32_t> getKernelSupportedThreadArbitrationPolicies() override {
return std::vector<uint32_t>();
std::vector<int32_t> getKernelSupportedThreadArbitrationPolicies() override {
return {};
}
uint32_t returnedStepping = 0;
};

View File

@ -48,7 +48,7 @@ PVCTEST_F(PvcCommandStreamReceiverFlushTaskTests, givenOverrideThreadArbitration
flushTask(commandStreamReceiver);
EXPECT_EQ(ThreadArbitrationPolicy::RoundRobin,
static_cast<uint32_t>(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<FamilyType>();
DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags();
uint32_t notExistPolicy = -2;
int32_t notExistPolicy = -2;
flushTaskFlags.threadArbitrationPolicy = notExistPolicy;
flushTask(commandStreamReceiver);
EXPECT_EQ(notExistPolicy, static_cast<uint32_t>(commandStreamReceiver.streamProperties.stateComputeMode.threadArbitrationPolicy.value));
EXPECT_EQ(notExistPolicy, commandStreamReceiver.streamProperties.stateComputeMode.threadArbitrationPolicy.value);
}
PVCTEST_F(PvcCommandStreamReceiverFlushTaskTests, givenRevisionBAndAboveWhenLastSpecialPipelineSelectModeIsTrueAndFlushTaskIsCalledThenDontReprogramPipelineSelect) {

View File

@ -263,7 +263,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
if (dispatchFlags.threadArbitrationPolicy == ThreadArbitrationPolicy::NotPresent) {
if (this->streamProperties.stateComputeMode.threadArbitrationPolicy.value != -1) {
// Reuse previous programming
dispatchFlags.threadArbitrationPolicy = static_cast<uint32_t>(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<GfxFamily>::flushTask(
programPerDssBackedBuffer(commandStreamCSR, device, dispatchFlags);
if (this->streamProperties.stateComputeMode.threadArbitrationPolicy.isDirty) {
auto threadArbitrationPolicy = static_cast<uint32_t>(this->streamProperties.stateComputeMode.threadArbitrationPolicy.value);
auto threadArbitrationPolicy = this->streamProperties.stateComputeMode.threadArbitrationPolicy.value;
PreambleHelper<GfxFamily>::programThreadArbitration(&commandStreamCSR, threadArbitrationPolicy);
}
@ -925,7 +925,7 @@ inline void CommandStreamReceiverHw<GfxFamily>::programStateSip(LinearStream &cm
template <typename GfxFamily>
inline void CommandStreamReceiverHw<GfxFamily>::programPreamble(LinearStream &csr, Device &device, uint32_t &newL3Config) {
if (!this->isPreambleSent) {
auto threadArbitrationPolicy = static_cast<uint32_t>(this->streamProperties.stateComputeMode.threadArbitrationPolicy.value);
auto threadArbitrationPolicy = this->streamProperties.stateComputeMode.threadArbitrationPolicy.value;
PreambleHelper<GfxFamily>::programPreamble(&csr, device, newL3Config, threadArbitrationPolicy, this->preemptionAllocation);
this->isPreambleSent = true;
this->lastSentL3Config = newL3Config;

View File

@ -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;

View File

@ -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();

View File

@ -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);

View File

@ -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

View File

@ -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<Family>::getExtensions() const {
}
template <>
uint32_t HwHelperHw<Family>::getDefaultThreadArbitrationPolicy() const {
int32_t HwHelperHw<Family>::getDefaultThreadArbitrationPolicy() const {
return ThreadArbitrationPolicy::RoundRobinAfterDependency;
}

View File

@ -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<ICLFamily>::addPipeControlBeforeVfeCmd(LinearStream *pComman
}
template <>
void PreambleHelper<ICLFamily>::programThreadArbitration(LinearStream *pCommandStream, uint32_t requiredThreadArbitrationPolicy) {
void PreambleHelper<ICLFamily>::programThreadArbitration(LinearStream *pCommandStream, int32_t requiredThreadArbitrationPolicy) {
UNRECOVERABLE_IF(requiredThreadArbitrationPolicy == ThreadArbitrationPolicy::NotPresent);
auto pipeControl = pCommandStream->getSpaceForCmd<PIPE_CONTROL>();
@ -84,11 +84,11 @@ size_t PreambleHelper<ICLFamily>::getThreadArbitrationCommandsSize() {
}
template <>
std::vector<uint32_t> PreambleHelper<ICLFamily>::getSupportedThreadArbitrationPolicies() {
std::vector<uint32_t> retVal;
size_t policySize = sizeof(RowChickenReg4::regDataForArbitrationPolicy) /
sizeof(RowChickenReg4::regDataForArbitrationPolicy[0]);
for (uint32_t i = 0u; i < policySize; i++) {
std::vector<int32_t> PreambleHelper<ICLFamily>::getSupportedThreadArbitrationPolicies() {
std::vector<int32_t> 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;

View File

@ -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<Family>::getMetricsLibraryGenId() const {
}
template <>
uint32_t HwHelperHw<Family>::getDefaultThreadArbitrationPolicy() const {
int32_t HwHelperHw<Family>::getDefaultThreadArbitrationPolicy() const {
return ThreadArbitrationPolicy::RoundRobin;
}

View File

@ -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<SKLFamily>::addPipeControlBeforeVfeCmd(LinearStream *pComman
}
template <>
void PreambleHelper<SKLFamily>::programThreadArbitration(LinearStream *pCommandStream, uint32_t requiredThreadArbitrationPolicy) {
void PreambleHelper<SKLFamily>::programThreadArbitration(LinearStream *pCommandStream, int32_t requiredThreadArbitrationPolicy) {
UNRECOVERABLE_IF(requiredThreadArbitrationPolicy == ThreadArbitrationPolicy::NotPresent);
auto pipeControl = pCommandStream->getSpaceForCmd<PIPE_CONTROL>();
@ -84,9 +84,9 @@ size_t PreambleHelper<SKLFamily>::getThreadArbitrationCommandsSize() {
}
template <>
std::vector<uint32_t> PreambleHelper<SKLFamily>::getSupportedThreadArbitrationPolicies() {
std::vector<uint32_t> retVal;
for (const uint32_t &p : DebugControlReg2::supportedArbitrationPolicy) {
std::vector<int32_t> PreambleHelper<SKLFamily>::getSupportedThreadArbitrationPolicies() {
std::vector<int32_t> retVal;
for (const int32_t &p : DebugControlReg2::supportedArbitrationPolicy) {
retVal.push_back(p);
}
return retVal;

View File

@ -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<IGFX_BROXTON> {
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

View File

@ -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;

View File

@ -582,7 +582,7 @@ bool HwHelperHw<GfxFamily>::isBankOverrideRequired(const HardwareInfo &hwInfo) c
}
template <typename GfxFamily>
uint32_t HwHelperHw<GfxFamily>::getDefaultThreadArbitrationPolicy() const {
int32_t HwHelperHw<GfxFamily>::getDefaultThreadArbitrationPolicy() const {
return 0;
}

View File

@ -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<uint32_t> getSupportedThreadArbitrationPolicies();
static std::vector<int32_t> getSupportedThreadArbitrationPolicies();
static size_t getVFECommandsSize();
static size_t getKernelDebuggingCommandsSize(bool debuggingActive);
static void programGenSpecificPreambleWorkArounds(LinearStream *pCommandStream, const HardwareInfo &hwInfo);

View File

@ -21,7 +21,7 @@
namespace NEO {
template <typename GfxFamily>
void PreambleHelper<GfxFamily>::programThreadArbitration(LinearStream *pCommandStream, uint32_t requiredThreadArbitrationPolicy) {
void PreambleHelper<GfxFamily>::programThreadArbitration(LinearStream *pCommandStream, int32_t requiredThreadArbitrationPolicy) {
}
template <typename GfxFamily>
@ -30,8 +30,8 @@ size_t PreambleHelper<GfxFamily>::getThreadArbitrationCommandsSize() {
}
template <typename GfxFamily>
std::vector<uint32_t> PreambleHelper<GfxFamily>::getSupportedThreadArbitrationPolicies() {
return std::vector<uint32_t>();
std::vector<int32_t> PreambleHelper<GfxFamily>::getSupportedThreadArbitrationPolicies() {
return {};
}
template <typename GfxFamily>
@ -75,7 +75,7 @@ size_t PreambleHelper<GfxFamily>::getCmdSizeForPipelineSelect(const HardwareInfo
template <typename GfxFamily>
void PreambleHelper<GfxFamily>::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()) {

View File

@ -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<uint32_t> getKernelSupportedThreadArbitrationPolicies() = 0;
virtual std::vector<int32_t> getKernelSupportedThreadArbitrationPolicies() = 0;
virtual void convertTimestampsFromOaToCsDomain(uint64_t &timestampData) = 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<uint32_t> getKernelSupportedThreadArbitrationPolicies() override;
std::vector<int32_t> getKernelSupportedThreadArbitrationPolicies() override;
void convertTimestampsFromOaToCsDomain(uint64_t &timestampData) override;
uint32_t getDeviceMemoryMaxClkRate(const HardwareInfo *hwInfo) override;
bool isAdditionalStateBaseAddressWARequired(const HardwareInfo &hwInfo) const override;

View File

@ -30,7 +30,7 @@ void HwInfoConfigHw<gfxProduct>::getKernelExtendedProperties(uint32_t *fp16, uin
}
template <PRODUCT_FAMILY gfxProduct>
std::vector<uint32_t> HwInfoConfigHw<gfxProduct>::getKernelSupportedThreadArbitrationPolicies() {
std::vector<int32_t> HwInfoConfigHw<gfxProduct>::getKernelSupportedThreadArbitrationPolicies() {
using GfxFamily = typename HwMapper<gfxProduct>::GfxFamily;
return PreambleHelper<GfxFamily>::getSupportedThreadArbitrationPolicies();
}

View File

@ -347,7 +347,7 @@ uint32_t HwHelperHw<Family>::computeSlmValues(const HardwareInfo &hwInfo, uint32
}
template <>
uint32_t HwHelperHw<Family>::getDefaultThreadArbitrationPolicy() const {
int32_t HwHelperHw<Family>::getDefaultThreadArbitrationPolicy() const {
return ThreadArbitrationPolicy::AgeBased;
}

View File

@ -186,7 +186,7 @@ GEN12LPTEST_F(ThreadArbitrationGen12Lp, givenPolicyWhenThreadArbitrationProgramm
PreambleHelper<FamilyType>::programThreadArbitration(&cs, ThreadArbitrationPolicy::RoundRobin);
EXPECT_EQ(0u, cs.getUsed());
EXPECT_EQ(0u, HwHelperHw<FamilyType>::get().getDefaultThreadArbitrationPolicy());
EXPECT_EQ(ThreadArbitrationPolicy::AgeBased, HwHelperHw<FamilyType>::get().getDefaultThreadArbitrationPolicy());
}
GEN12LPTEST_F(ThreadArbitrationGen12Lp, whenGetSupportThreadArbitrationPoliciesIsCalledThenEmptyVectorIsReturned) {

View File

@ -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<BDWFamily>::getAdditionalCommandsSize(device));
EXPECT_EQ(0u, PreambleHelper<BDWFamily>::getThreadArbitrationCommandsSize());
EXPECT_EQ(0u, HwHelperHw<BDWFamily>::get().getDefaultThreadArbitrationPolicy());
EXPECT_EQ(ThreadArbitrationPolicy::AgeBased, HwHelperHw<BDWFamily>::get().getDefaultThreadArbitrationPolicy());
}
BDWTEST_F(ThreadArbitrationGen8, whenGetSupportThreadArbitrationPoliciesIsCalledThenEmptyVectorIsReturned) {

View File

@ -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);

View File

@ -13,8 +13,8 @@ bool UnitTestHelper<GfxFamily>::isPageTableManagerSupported(const HardwareInfo &
}
template <typename GfxFamily>
inline uint32_t UnitTestHelper<GfxFamily>::getAppropriateThreadArbitrationPolicy(uint32_t policy) {
return policy;
inline uint32_t UnitTestHelper<GfxFamily>::getAppropriateThreadArbitrationPolicy(int32_t policy) {
return static_cast<uint32_t>(policy);
}
template <typename GfxFamily>

View File

@ -44,7 +44,7 @@ class MockCsrBase : public UltCommandStreamReceiver<GfxFamily> {
madeNonResidentGfxAllocations.push_back(&gfxAllocation);
}
uint32_t peekThreadArbitrationPolicy() { return static_cast<uint32_t>(this->streamProperties.stateComputeMode.threadArbitrationPolicy.value); }
int32_t peekThreadArbitrationPolicy() { return this->streamProperties.stateComputeMode.threadArbitrationPolicy.value; }
bool isMadeResident(GraphicsAllocation *gfxAllocation) {
for (GraphicsAllocation *gfxAlloc : madeResidentGfxAllocations) {

View File

@ -174,8 +174,8 @@ LocalMemoryAccessMode HwInfoConfigHw<IGFX_UNKNOWN>::getLocalMemoryAccessMode(con
}
template <>
std::vector<uint32_t> HwInfoConfigHw<IGFX_UNKNOWN>::getKernelSupportedThreadArbitrationPolicies() {
return std::vector<uint32_t>();
std::vector<int32_t> HwInfoConfigHw<IGFX_UNKNOWN>::getKernelSupportedThreadArbitrationPolicies() {
return {};
}
template <>

View File

@ -28,7 +28,7 @@ template <>
const uint32_t UnitTestHelper<Family>::smallestTestableSimdSize = 16;
template <>
uint32_t UnitTestHelper<Family>::getAppropriateThreadArbitrationPolicy(uint32_t policy) {
uint32_t UnitTestHelper<Family>::getAppropriateThreadArbitrationPolicy(int32_t policy) {
using STATE_COMPUTE_MODE = typename Family::STATE_COMPUTE_MODE;
switch (policy) {
case ThreadArbitrationPolicy::RoundRobin:

View File

@ -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<uint32_t>(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<uint32_t>(properties.stateComputeMode.threadArbitrationPolicy.value));
EXPECT_EQ(threadArbitrationPolicy, properties.stateComputeMode.threadArbitrationPolicy.value);
}
}