Remove dependency on sharedHandles when program SCM

Related-To: NEO-6056
Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
Krzysztof Gibala
2021-09-21 09:33:42 +00:00
committed by Compute-Runtime-Automation
parent 7c473d0a11
commit 9b3acc88fd
4 changed files with 25 additions and 33 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2020 Intel Corporation
* Copyright (C) 2019-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -8,6 +8,10 @@
#include "shared/source/helpers/state_compute_mode_helper.h"
namespace NEO {
template <>
bool StateComputeModeHelper<TGLLPFamily>::isStateComputeModeRequired(const CsrSizeRequestFlags &csrSizeRequestFlags, bool isThreadArbitionPolicyProgrammed) { return false; }
} // namespace NEO
bool StateComputeModeHelper<TGLLPFamily>::isStateComputeModeRequired(const CsrSizeRequestFlags &csrSizeRequestFlags, bool isThreadArbitionPolicyProgrammed) {
return csrSizeRequestFlags.coherencyRequestChanged || csrSizeRequestFlags.hasSharedHandles || csrSizeRequestFlags.numGrfRequiredChanged;
}
} // namespace NEO

View File

@ -8,8 +8,10 @@
#include "shared/source/helpers/state_compute_mode_helper.h"
namespace NEO {
template <>
bool StateComputeModeHelper<XeHpFamily>::isStateComputeModeRequired(const CsrSizeRequestFlags &csrSizeRequestFlags, bool isThreadArbitionPolicyProgrammed) {
return false;
return csrSizeRequestFlags.coherencyRequestChanged || csrSizeRequestFlags.numGrfRequiredChanged;
}
} // namespace NEO

View File

@ -47,7 +47,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ComputeModeRequirements, givenCoherencyWithSharedHa
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
auto cmdsSize = sizeof(STATE_COMPUTE_MODE) + sizeof(PIPE_CONTROL);
auto cmdsSize = 0u;
overrideComputeModeRequest<FamilyType>(false, false, true);
auto retSize = getCsrHw<FamilyType>()->getCmdSizeForComputeMode();
@ -57,6 +57,8 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ComputeModeRequirements, givenCoherencyWithSharedHa
retSize = getCsrHw<FamilyType>()->getCmdSizeForComputeMode();
EXPECT_EQ(cmdsSize, retSize);
cmdsSize = sizeof(STATE_COMPUTE_MODE) + sizeof(PIPE_CONTROL);
overrideComputeModeRequest<FamilyType>(true, true, true);
retSize = getCsrHw<FamilyType>()->getCmdSizeForComputeMode();
EXPECT_EQ(cmdsSize, retSize);
@ -214,7 +216,7 @@ HWTEST2_F(ComputeModeRequirements, givenCoherencyRequirementWithoutSharedHandles
csr->getMemoryManager()->freeGraphicsMemory(graphicAlloc);
}
HWTEST2_F(ComputeModeRequirements, givenCoherencyRequirementWithSharedHandlesWhenFlushTaskCalledThenAlwaysProgramCmds, ForceNonCoherentSupportedMatcher) {
HWTEST2_F(ComputeModeRequirements, givenCoherencyRequirementWithSharedHandlesWhenFlushTaskCalledThenProgramCmdsWhenNeeded, ForceNonCoherentSupportedMatcher) {
SetUpImpl<FamilyType>();
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
@ -232,7 +234,7 @@ HWTEST2_F(ComputeModeRequirements, givenCoherencyRequirementWithSharedHandlesWhe
csr->flushTask(stream, 0, stream, stream, stream, 0, flags, *device);
};
auto flushTaskAndFindCmds = [&](bool expectCoherent) {
auto flushTaskAndFindCmds = [&](bool expectCoherent, bool areCommandsProgrammed) {
flushTask(expectCoherent);
HardwareParse hwParser;
hwParser.parseCommands<FamilyType>(getCsrHw<FamilyType>()->commandStream, startOffset);
@ -252,20 +254,20 @@ HWTEST2_F(ComputeModeRequirements, givenCoherencyRequirementWithSharedHandlesWhe
EXPECT_NE(nullptr, pc);
}
}
EXPECT_TRUE(foundOne);
EXPECT_EQ(foundOne, areCommandsProgrammed);
};
flushTaskAndFindCmds(false); // first time
flushTaskAndFindCmds(false); // not changed
flushTaskAndFindCmds(true); // changed
flushTaskAndFindCmds(true); // not changed
flushTaskAndFindCmds(false); // changed
flushTaskAndFindCmds(false); // not changed
flushTaskAndFindCmds(false, true); // first time
flushTaskAndFindCmds(false, false); // not changed
flushTaskAndFindCmds(true, true); // changed
flushTaskAndFindCmds(true, false); // not changed
flushTaskAndFindCmds(false, true); // changed
flushTaskAndFindCmds(false, false); // not changed
csr->getMemoryManager()->freeGraphicsMemory(graphicsAlloc);
}
HWTEST2_F(ComputeModeRequirements, givenFlushWithoutSharedHandlesWhenPreviouslyUsedThenProgramPcAndSCM, ForceNonCoherentSupportedMatcher) {
HWTEST2_F(ComputeModeRequirements, givenFlushWithoutSharedHandlesWhenPreviouslyUsedThenPcAndSCMAreNotProgrammed, ForceNonCoherentSupportedMatcher) {
SetUpImpl<FamilyType>();
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
@ -284,22 +286,7 @@ HWTEST2_F(ComputeModeRequirements, givenFlushWithoutSharedHandlesWhenPreviouslyU
HardwareParse hwParser;
hwParser.parseCommands<FamilyType>(getCsrHw<FamilyType>()->commandStream, startOffset);
typename STATE_COMPUTE_MODE::FORCE_NON_COHERENT expectedCoherentValue = STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_GPU_NON_COHERENT;
uint32_t expectedCoherentMask = FamilyType::stateComputeModeForceNonCoherentMask | FamilyType::stateComputeModeLargeGrfModeMask;
bool foundOne = false;
for (auto it = hwParser.cmdList.begin(); it != hwParser.cmdList.end(); it++) {
auto cmd = genCmdCast<STATE_COMPUTE_MODE *>(*it);
if (cmd) {
EXPECT_EQ(expectedCoherentValue, cmd->getForceNonCoherent());
EXPECT_TRUE(isValueSet(cmd->getMaskBits(), expectedCoherentMask));
EXPECT_FALSE(foundOne);
foundOne = true;
auto pc = genCmdCast<PIPE_CONTROL *>(*(++it));
EXPECT_NE(nullptr, pc);
}
}
EXPECT_TRUE(foundOne);
EXPECT_EQ(0u, hwParser.cmdList.size());
csr->getMemoryManager()->freeGraphicsMemory(graphicAlloc);
}

View File

@ -53,8 +53,7 @@ void CommandStreamReceiverHw<GfxFamily>::programComputeMode(LinearStream &stream
template <>
inline bool CommandStreamReceiverHw<Family>::isComputeModeNeeded() const {
return csrSizeRequestFlags.coherencyRequestChanged || csrSizeRequestFlags.hasSharedHandles || csrSizeRequestFlags.numGrfRequiredChanged ||
StateComputeModeHelper<Family>::isStateComputeModeRequired(csrSizeRequestFlags, this->lastSentThreadArbitrationPolicy != this->requiredThreadArbitrationPolicy);
return StateComputeModeHelper<Family>::isStateComputeModeRequired(csrSizeRequestFlags, this->lastSentThreadArbitrationPolicy != this->requiredThreadArbitrationPolicy);
}
template <>