Add getSupportedThreadArbitrationPolicies

Related-To: LOCI-2319
Signed-off-by: Young Jin Yoon <young.jin.yoon@intel.com>
This commit is contained in:
Young Jin Yoon
2021-09-09 08:32:45 +00:00
committed by Compute-Runtime-Automation
parent 6061b61aea
commit 415e6c4aa5
9 changed files with 68 additions and 1 deletions

View File

@ -83,6 +83,16 @@ size_t PreambleHelper<ICLFamily>::getThreadArbitrationCommandsSize() {
return sizeof(MI_LOAD_REGISTER_IMM) + sizeof(PIPE_CONTROL);
}
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++) {
retVal.push_back(i);
}
return retVal;
}
template <>
size_t PreambleHelper<ICLFamily>::getAdditionalCommandsSize(const Device &device) {
size_t totalSize = PreemptionHelper::getRequiredPreambleSize<ICLFamily>(device);

View File

@ -83,5 +83,13 @@ size_t PreambleHelper<SKLFamily>::getThreadArbitrationCommandsSize() {
return sizeof(MI_LOAD_REGISTER_IMM) + sizeof(PIPE_CONTROL);
}
template <>
std::vector<uint32_t> PreambleHelper<SKLFamily>::getSupportedThreadArbitrationPolicies() {
std::vector<uint32_t> retVal;
for (const uint32_t &p : DebugControlReg2::supportedArbitrationPolicy) {
retVal.push_back(p);
}
return retVal;
}
template struct PreambleHelper<SKLFamily>;
} // namespace NEO

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2020 Intel Corporation
* Copyright (C) 2018-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -33,6 +33,9 @@ constexpr uint32_t address = 0xE404;
constexpr uint32_t getRegData(const uint32_t &policy) {
return policy == ThreadArbitrationPolicy::RoundRobin ? 0x100 : 0x0;
};
static const uint32_t supportedArbitrationPolicy[] = {
ThreadArbitrationPolicy::AgeBased,
ThreadArbitrationPolicy::RoundRobin};
} // namespace DebugControlReg2
} // namespace NEO

View File

@ -16,6 +16,7 @@
#include <cstddef>
#include <cstdint>
#include <vector>
namespace NEO {
@ -60,6 +61,7 @@ struct PreambleHelper {
static bool isL3Configurable(const HardwareInfo &hwInfo);
static size_t getAdditionalCommandsSize(const Device &device);
static size_t getThreadArbitrationCommandsSize();
static std::vector<uint32_t> getSupportedThreadArbitrationPolicies();
static size_t getVFECommandsSize();
static size_t getKernelDebuggingCommandsSize(bool debuggingActive);
static void programGenSpecificPreambleWorkArounds(LinearStream *pCommandStream, const HardwareInfo &hwInfo);

View File

@ -29,6 +29,11 @@ size_t PreambleHelper<GfxFamily>::getThreadArbitrationCommandsSize() {
return 0;
}
template <typename GfxFamily>
std::vector<uint32_t> PreambleHelper<GfxFamily>::getSupportedThreadArbitrationPolicies() {
return std::vector<uint32_t>();
}
template <typename GfxFamily>
void PreambleHelper<GfxFamily>::programGenSpecificPreambleWorkArounds(LinearStream *pCommandStream, const HardwareInfo &hwInfo) {
}

View File

@ -145,3 +145,18 @@ GEN11TEST_F(ThreadArbitrationGen11, givenPreambleWhenItIsProgrammedThenThreadArb
GEN11TEST_F(ThreadArbitrationGen11, GivenDefaultWhenProgrammingPreambleThenArbitrationPolicyIsRoundRobin) {
EXPECT_EQ(ThreadArbitrationPolicy::RoundRobinAfterDependency, HwHelperHw<ICLFamily>::get().getDefaultThreadArbitrationPolicy());
}
GEN11TEST_F(ThreadArbitrationGen11, whenGetSupportThreadArbitrationPoliciesIsCalledThenAllPoliciesAreReturned) {
auto supportedPolicies = PreambleHelper<ICLFamily>::getSupportedThreadArbitrationPolicies();
EXPECT_EQ(3u, supportedPolicies.size());
EXPECT_NE(supportedPolicies.end(), std::find(supportedPolicies.begin(),
supportedPolicies.end(),
ThreadArbitrationPolicy::AgeBased));
EXPECT_NE(supportedPolicies.end(), std::find(supportedPolicies.begin(),
supportedPolicies.end(),
ThreadArbitrationPolicy::RoundRobin));
EXPECT_NE(supportedPolicies.end(), std::find(supportedPolicies.begin(),
supportedPolicies.end(),
ThreadArbitrationPolicy::RoundRobinAfterDependency));
}

View File

@ -179,6 +179,12 @@ GEN12LPTEST_F(ThreadArbitrationGen12Lp, givenPolicyWhenThreadArbitrationProgramm
EXPECT_EQ(0u, HwHelperHw<FamilyType>::get().getDefaultThreadArbitrationPolicy());
}
GEN12LPTEST_F(ThreadArbitrationGen12Lp, whenGetSupportThreadArbitrationPoliciesIsCalledThenEmptyVectorIsReturned) {
auto supportedPolicies = PreambleHelper<FamilyType>::getSupportedThreadArbitrationPolicies();
EXPECT_EQ(0u, supportedPolicies.size());
}
typedef PreambleFixture PreemptionWatermarkGen12LP;
GEN12LPTEST_F(PreemptionWatermarkGen12LP, WhenPreambleIsCreatedThenPreambleWorkAroundsIsNotProgrammed) {
PreambleHelper<FamilyType>::programGenSpecificPreambleWorkArounds(&linearStream, pDevice->getHardwareInfo());

View File

@ -86,6 +86,12 @@ BDWTEST_F(ThreadArbitrationGen8, givenPolicyWhenThreadArbitrationProgrammedThenD
EXPECT_EQ(0u, HwHelperHw<BDWFamily>::get().getDefaultThreadArbitrationPolicy());
}
BDWTEST_F(ThreadArbitrationGen8, whenGetSupportThreadArbitrationPoliciesIsCalledThenEmptyVectorIsReturned) {
auto supportedPolicies = PreambleHelper<BDWFamily>::getSupportedThreadArbitrationPolicies();
EXPECT_EQ(0u, supportedPolicies.size());
}
typedef PreambleFixture Gen8UrbEntryAllocationSize;
BDWTEST_F(Gen8UrbEntryAllocationSize, WhenPreambleIsCreatedThenUrbEntryAllocationSizeIsCorrect) {
uint32_t actualVal = PreambleHelper<FamilyType>::getUrbEntryAllocationSize();

View File

@ -104,6 +104,18 @@ SKLTEST_F(ThreadArbitration, GivenDefaultWhenProgrammingPreambleThenArbitrationP
EXPECT_EQ(ThreadArbitrationPolicy::RoundRobin, HwHelperHw<SKLFamily>::get().getDefaultThreadArbitrationPolicy());
}
SKLTEST_F(ThreadArbitration, whenGetSupportedThreadArbitrationPoliciesIsCalledThenAgeBasedAndRoundRobinAreReturned) {
auto supportedPolicies = PreambleHelper<SKLFamily>::getSupportedThreadArbitrationPolicies();
EXPECT_EQ(2u, supportedPolicies.size());
EXPECT_NE(supportedPolicies.end(), std::find(supportedPolicies.begin(),
supportedPolicies.end(),
ThreadArbitrationPolicy::AgeBased));
EXPECT_NE(supportedPolicies.end(), std::find(supportedPolicies.begin(),
supportedPolicies.end(),
ThreadArbitrationPolicy::RoundRobin));
}
GEN9TEST_F(PreambleVfeState, GivenWaOffWhenProgrammingVfeStateThenProgrammingIsCorrect) {
typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL;
testWaTable->waSendMIFLUSHBeforeVFE = 0;