Skip to content

Commit 7c1ea18

Browse files
kgibalaCompute-Runtime-Automation
authored andcommitted
Enable adding extra pipe control on specific platforms
Related-To: NEO-6056 Signed-off-by: Krzysztof Gibala <[email protected]>
1 parent 3fafdf3 commit 7c1ea18

10 files changed

+92
-15
lines changed

opencl/test/unit_test/helpers/hw_helper_tests.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,6 +1279,11 @@ HWTEST_F(HwHelperTest, whenGettingNumberOfCacheRegionsThenReturnZero) {
12791279
EXPECT_EQ(0u, hwHelper.getNumCacheRegions());
12801280
}
12811281

1282+
HWTEST_F(HwHelperTest, givenHwHelperWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledThenFalseIsReturned) {
1283+
auto &hwHelper = HwHelper::get(renderCoreFamily);
1284+
EXPECT_FALSE(hwHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(*defaultHwInfo));
1285+
}
1286+
12821287
HWCMDTEST_F(IGFX_GEN8_CORE, HwHelperTest, whenCheckingForSmallKernelPreferenceThenFalseIsReturned) {
12831288
auto &hwHelper = HwHelper::get(renderCoreFamily);
12841289
EXPECT_FALSE(hwHelper.preferSmallWorkgroupSizeForKernel(0u, this->pClDevice->getHardwareInfo()));
@@ -1342,3 +1347,21 @@ HWTEST2_F(HwHelperTest, givenXeHPAndBelowPlatformPlatformWhenCheckingIfEngineTyp
13421347
const auto &hwHelper = HwHelper::get(renderCoreFamily);
13431348
EXPECT_FALSE(hwHelper.isEngineTypeRemappingToHwSpecificRequired());
13441349
}
1350+
1351+
HWTEST2_F(HwHelperTest, givenProgramAdditionalPipeControlBeforeStateComputeModeCommandWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledThenTrueIsReturned, IsXEHP) {
1352+
DebugManagerStateRestore restorer;
1353+
DebugManager.flags.ProgramAdditionalPipeControlBeforeStateComputeModeCommand.set(true);
1354+
1355+
const auto &hwHelper = HwHelper::get(renderCoreFamily);
1356+
auto hwInfo = *defaultHwInfo;
1357+
1358+
EXPECT_TRUE(hwHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo));
1359+
}
1360+
1361+
HWTEST2_F(HwHelperTest, givenHwHelperWithMultipleCSSWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledThenTrueIsReturned, IsXEHP) {
1362+
const auto &hwHelper = HwHelper::get(renderCoreFamily);
1363+
auto hwInfo = *defaultHwInfo;
1364+
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 2;
1365+
1366+
EXPECT_TRUE(hwHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo));
1367+
}

opencl/test/unit_test/xe_hp_core/compute_mode_tests_xe_hp_core.cpp

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212

1313
using namespace NEO;
1414

15-
HWTEST2_F(ComputeModeRequirements, GivenProgramAdditionalPipeControlBeforeStateComputeModeCommandThenCorrectCommandsAreAdded, IsXeHpCore) {
15+
HWTEST2_F(ComputeModeRequirements, GivenProgramAdditionalPipeControlBeforeStateComputeModeCommandThenCorrectCommandsAreAdded, IsXEHP) {
1616
DebugManagerStateRestore dbgRestorer;
1717
DebugManager.flags.ProgramAdditionalPipeControlBeforeStateComputeModeCommand.set(true);
1818

1919
SetUpImpl<FamilyType>();
20+
2021
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
2122
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
2223

@@ -55,7 +56,51 @@ HWTEST2_F(ComputeModeRequirements, GivenProgramAdditionalPipeControlBeforeStateC
5556
EXPECT_TRUE(memcmp(&expectedScmCmd, stateComputeModelCmd, sizeof(STATE_COMPUTE_MODE)) == 0);
5657
}
5758

58-
HWTEST2_F(ComputeModeRequirements, GivenProgramAdditionalPipeControlBeforeStateComputeModeCommandThenCommandSizeIsCalculatedAndCorrectCommandSizeIsReturned, IsXeHpCore) {
59+
HWTEST2_F(ComputeModeRequirements, GivenMultipleCCSEnabledSetupThenCorrectCommandsAreAdded, IsXEHP) {
60+
HardwareInfo hwInfo = *defaultHwInfo;
61+
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 2;
62+
63+
SetUpImpl<FamilyType>();
64+
65+
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
66+
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
67+
68+
auto cmdsSize = sizeof(STATE_COMPUTE_MODE) + sizeof(PIPE_CONTROL);
69+
char buff[1024] = {0};
70+
LinearStream stream(buff, 1024);
71+
72+
auto expectedScmCmd = FamilyType::cmdInitStateComputeMode;
73+
expectedScmCmd.setForceNonCoherent(STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_GPU_NON_COHERENT);
74+
auto expectedBitsMask = FamilyType::stateComputeModeForceNonCoherentMask | FamilyType::stateComputeModeLargeGrfModeMask;
75+
76+
overrideComputeModeRequest<FamilyType>(true, false, false, false);
77+
getCsrHw<FamilyType>()->programComputeMode(stream, flags, hwInfo);
78+
EXPECT_EQ(cmdsSize, stream.getUsed());
79+
80+
auto startOffset = getCsrHw<FamilyType>()->commandStream.getUsed();
81+
82+
HardwareParse hwParser;
83+
hwParser.parseCommands<FamilyType>(stream, startOffset);
84+
85+
auto pipeControlIterator = find<PIPE_CONTROL *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
86+
auto pipeControlCmd = genCmdCast<PIPE_CONTROL *>(*pipeControlIterator);
87+
88+
EXPECT_TRUE(pipeControlCmd->getHdcPipelineFlush());
89+
EXPECT_TRUE(pipeControlCmd->getAmfsFlushEnable());
90+
EXPECT_TRUE(pipeControlCmd->getCommandStreamerStallEnable());
91+
EXPECT_TRUE(pipeControlCmd->getInstructionCacheInvalidateEnable());
92+
EXPECT_TRUE(pipeControlCmd->getTextureCacheInvalidationEnable());
93+
EXPECT_TRUE(pipeControlCmd->getDcFlushEnable());
94+
EXPECT_TRUE(pipeControlCmd->getConstantCacheInvalidationEnable());
95+
EXPECT_TRUE(pipeControlCmd->getStateCacheInvalidationEnable());
96+
97+
auto stateComputeModelCmd = reinterpret_cast<STATE_COMPUTE_MODE *>(ptrOffset(stream.getCpuBase(), sizeof(PIPE_CONTROL)));
98+
EXPECT_TRUE(isValueSet(stateComputeModelCmd->getMaskBits(), expectedBitsMask));
99+
expectedScmCmd.setMaskBits(stateComputeModelCmd->getMaskBits());
100+
EXPECT_TRUE(memcmp(&expectedScmCmd, stateComputeModelCmd, sizeof(STATE_COMPUTE_MODE)) == 0);
101+
}
102+
103+
HWTEST2_F(ComputeModeRequirements, GivenProgramAdditionalPipeControlBeforeStateComputeModeCommandThenCommandSizeIsCalculatedAndCorrectCommandSizeIsReturned, IsXEHP) {
59104
DebugManagerStateRestore dbgRestorer;
60105
DebugManager.flags.ProgramAdditionalPipeControlBeforeStateComputeModeCommand.set(true);
61106

shared/source/command_stream/command_stream_receiver_hw.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
7272
size_t getCmdSizeForPerDssBackedBuffer(const HardwareInfo &hwInfo);
7373

7474
bool isComputeModeNeeded() const;
75-
bool isAdditionalPipeControlNeeded() const;
7675
bool isPipelineSelectAlreadyProgrammed() const;
7776
void programComputeMode(LinearStream &csr, DispatchFlags &dispatchFlags, const HardwareInfo &hwInfo);
7877

shared/source/command_stream/command_stream_receiver_hw_base.inl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,11 +1356,6 @@ inline bool CommandStreamReceiverHw<GfxFamily>::isComputeModeNeeded() const {
13561356
return false;
13571357
}
13581358

1359-
template <typename GfxFamily>
1360-
inline bool CommandStreamReceiverHw<GfxFamily>::isAdditionalPipeControlNeeded() const {
1361-
return false;
1362-
}
1363-
13641359
template <typename GfxFamily>
13651360
inline MemoryCompressionState CommandStreamReceiverHw<GfxFamily>::getMemoryCompressionState(bool auxTranslationRequired, const HardwareInfo &hwInfo) const {
13661361
return MemoryCompressionState::NotApplicable;

shared/source/command_stream/command_stream_receiver_hw_tgllp_and_later.inl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ void CommandStreamReceiverHw<GfxFamily>::programComputeMode(LinearStream &stream
1919
programAdditionalPipelineSelect(stream, dispatchFlags.pipelineSelectArgs, true);
2020
this->lastSentCoherencyRequest = static_cast<int8_t>(dispatchFlags.requiresCoherency);
2121

22-
if (DebugManager.flags.ProgramAdditionalPipeControlBeforeStateComputeModeCommand.get()) {
22+
auto &hwHelper = HwHelperHw<Family>::get();
23+
if (hwHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo)) {
2324
auto pPipeControlSpace = stream.getSpaceForCmd<PIPE_CONTROL>();
2425

2526
auto pipeControl = GfxFamily::cmdInitPipeControl;

shared/source/command_stream/command_stream_receiver_hw_xehp_and_later.inl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ size_t CommandStreamReceiverHw<GfxFamily>::getCmdSizeForComputeMode() {
5555
}
5656

5757
size_t size = 0;
58+
auto hwInfo = peekHwInfo();
5859
if (isComputeModeNeeded()) {
59-
if (isAdditionalPipeControlNeeded()) {
60+
auto &hwHelper = HwHelperHw<Family>::get();
61+
if (hwHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo)) {
6062
size += sizeof(typename GfxFamily::PIPE_CONTROL);
6163
}
6264
size += sizeof(typename GfxFamily::STATE_COMPUTE_MODE);

shared/source/helpers/hw_helper.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ class HwHelper {
106106
virtual bool isAdditionalFeatureFlagRequired(const FeatureTable *featureTable) const = 0;
107107
virtual uint32_t getMinimalSIMDSize() = 0;
108108
virtual bool isWorkaroundRequired(uint32_t lowestSteppingWithBug, uint32_t steppingWithFix, const HardwareInfo &hwInfo) const = 0;
109+
virtual bool isPipeControlPriorToNonPipelinedStateCommandsWARequired(const HardwareInfo &hwInfo) const = 0;
109110
virtual bool isOffsetToSkipSetFFIDGPWARequired(const HardwareInfo &hwInfo) const = 0;
110111
virtual bool is3DPipelineSelectWARequired(const HardwareInfo &hwInfo) const = 0;
111112
virtual bool isFusedEuDispatchEnabled(const HardwareInfo &hwInfo) const = 0;
@@ -287,6 +288,8 @@ class HwHelperHw : public HwHelper {
287288

288289
bool isWorkaroundRequired(uint32_t lowestSteppingWithBug, uint32_t steppingWithFix, const HardwareInfo &hwInfo) const override;
289290

291+
bool isPipeControlPriorToNonPipelinedStateCommandsWARequired(const HardwareInfo &hwInfo) const override;
292+
290293
bool isOffsetToSkipSetFFIDGPWARequired(const HardwareInfo &hwInfo) const override;
291294

292295
bool is3DPipelineSelectWARequired(const HardwareInfo &hwInfo) const override;

shared/source/helpers/hw_helper_base.inl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,11 @@ bool HwHelperHw<GfxFamily>::isWorkaroundRequired(uint32_t lowestSteppingWithBug,
383383
return (lowestHwRevIdWithBug <= hwInfo.platform.usRevId && hwInfo.platform.usRevId < hwRevIdWithFix);
384384
}
385385

386+
template <typename GfxFamily>
387+
inline bool HwHelperHw<GfxFamily>::isPipeControlPriorToNonPipelinedStateCommandsWARequired(const HardwareInfo &hwInfo) const {
388+
return false;
389+
}
390+
386391
template <typename GfxFamily>
387392
bool HwHelperHw<GfxFamily>::is3DPipelineSelectWARequired(const HardwareInfo &hwInfo) const {
388393
return false;

shared/source/xe_hp_core/command_stream_receiver_hw_xe_hp_core.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,6 @@ size_t CommandStreamReceiverHw<Family>::getCmdSizeForPerDssBackedBuffer(const Ha
6868
return 0;
6969
}
7070

71-
template <>
72-
inline bool CommandStreamReceiverHw<Family>::isAdditionalPipeControlNeeded() const {
73-
return DebugManager.flags.ProgramAdditionalPipeControlBeforeStateComputeModeCommand.get();
74-
}
75-
7671
template <>
7772
void BlitCommandsHelper<Family>::appendClearColor(const BlitProperties &blitProperties, typename Family::XY_COPY_BLT &blitCmd) {
7873
using XY_COPY_BLT = typename Family::XY_COPY_BLT;

shared/source/xe_hp_core/hw_helper_xe_hp_core.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ inline bool HwHelperHw<Family>::isSpecialWorkgroupSizeRequired(const HardwareInf
4848
}
4949
}
5050

51+
template <>
52+
inline bool HwHelperHw<Family>::isPipeControlPriorToNonPipelinedStateCommandsWARequired(const HardwareInfo &hwInfo) const {
53+
if ((hwInfo.platform.eProductFamily == IGFX_XE_HP_SDV && hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled > 1) ||
54+
DebugManager.flags.ProgramAdditionalPipeControlBeforeStateComputeModeCommand.get() == 1) {
55+
return true;
56+
}
57+
return false;
58+
}
59+
5160
template <>
5261
bool HwHelperHw<Family>::isNewResidencyModelSupported() const {
5362
return true;

0 commit comments

Comments
 (0)