Skip to content

Commit 8482eb6

Browse files
kgibalaCompute-Runtime-Automation
authored andcommitted
Program PIPE CONTROL before SBA
Related-To: NEO-6056 Signed-off-by: Krzysztof Gibala <[email protected]>
1 parent 27bf56e commit 8482eb6

File tree

5 files changed

+53
-1
lines changed

5 files changed

+53
-1
lines changed

opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_1_tests.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,17 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenEnoughMemoryOnlyForPreambleAn
10201020
// This case handles when we have *just* enough space
10211021
auto expectedUsed = csrCS.getUsed() + sizeNeeded;
10221022

1023-
flushTask(commandStreamReceiver, flushTaskFlags.blocking, 0, flushTaskFlags.requiresCoherency, flushTaskFlags.lowPriority);
1023+
flushTaskFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(mockDevice->getHardwareInfo());
1024+
1025+
commandStreamReceiver.flushTask(
1026+
commandStream,
1027+
0,
1028+
dsh,
1029+
ioh,
1030+
ssh,
1031+
taskLevel,
1032+
flushTaskFlags,
1033+
*mockDevice);
10241034

10251035
// Verify that we didn't grab a new CS buffer
10261036
EXPECT_EQ(expectedUsed, csrCS.getUsed());

opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_tests_xehp_and_later.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,33 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverFlushTaskXeHPAndLaterTests, gi
9494
EXPECT_TRUE(pipeControlCmd->getHdcPipelineFlush());
9595
}
9696

97+
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverFlushTaskXeHPAndLaterTests, givenProgramAdditionalPipeControlBeforeStateComputeModeCommandDebugKeyAndStateBaseAddressWhenItIsRequiredThenThereIsPipeControlPriorToIt) {
98+
DebugManagerStateRestore dbgRestorer;
99+
DebugManager.flags.ProgramAdditionalPipeControlBeforeStateComputeModeCommand.set(true);
100+
101+
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
102+
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
103+
104+
configureCSRtoNonDirtyState<FamilyType>(false);
105+
ioh.replaceBuffer(ptrOffset(ioh.getCpuBase(), +1u), ioh.getMaxAvailableSpace() + MemoryConstants::pageSize * 3);
106+
flushTask(commandStreamReceiver);
107+
parseCommands<FamilyType>(commandStreamReceiver.getCS(0));
108+
109+
auto stateBaseAddressItor = find<STATE_BASE_ADDRESS *>(cmdList.begin(), cmdList.end());
110+
auto pipeControlItor = find<typename FamilyType::PIPE_CONTROL *>(cmdList.begin(), stateBaseAddressItor);
111+
EXPECT_NE(stateBaseAddressItor, pipeControlItor);
112+
auto pipeControlCmd = reinterpret_cast<typename FamilyType::PIPE_CONTROL *>(*pipeControlItor);
113+
EXPECT_TRUE(pipeControlCmd->getHdcPipelineFlush());
114+
EXPECT_TRUE(pipeControlCmd->getAmfsFlushEnable());
115+
EXPECT_TRUE(pipeControlCmd->getCommandStreamerStallEnable());
116+
EXPECT_TRUE(pipeControlCmd->getInstructionCacheInvalidateEnable());
117+
EXPECT_TRUE(pipeControlCmd->getTextureCacheInvalidationEnable());
118+
EXPECT_TRUE(pipeControlCmd->getConstantCacheInvalidationEnable());
119+
EXPECT_TRUE(pipeControlCmd->getStateCacheInvalidationEnable());
120+
EXPECT_EQ(MemorySynchronizationCommands<FamilyType>::isDcFlushAllowed(), pipeControlCmd->getDcFlushEnable());
121+
EXPECT_TRUE(pipeControlCmd->getHdcPipelineFlush());
122+
}
123+
97124
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverFlushTaskXeHPAndLaterTests, whenNotReprogrammingSshButInitProgrammingFlagsThenBindingTablePoolIsProgrammed) {
98125
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
99126

shared/source/command_stream/command_stream_receiver_hw_tgllp_and_later.inl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,19 @@ inline void CommandStreamReceiverHw<Family>::addPipeControlBeforeStateBaseAddres
6161
PipeControlArgs args(true);
6262
args.textureCacheInvalidationEnable = true;
6363
args.hdcPipelineFlush = true;
64+
65+
auto hwInfo = peekHwInfo();
66+
auto hwInfoConfig = HwInfoConfig::get(hwInfo.platform.eProductFamily);
67+
68+
if (hwInfoConfig->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo)) {
69+
args.hdcPipelineFlush = true;
70+
args.amfsFlushEnable = true;
71+
args.instructionCacheInvalidateEnable = true;
72+
args.dcFlushEnable = true;
73+
args.constantCacheInvalidationEnable = true;
74+
args.stateCacheInvalidationEnable = true;
75+
}
76+
6477
addPipeControlCmd(commandStream, args);
6578
}
6679
} // namespace NEO

shared/source/helpers/definitions/pipe_control_args_base.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ struct PipeControlArgsBase {
2222
bool compressionControlSurfaceCcsFlush = false;
2323
bool notifyEnable = false;
2424
bool workloadPartitionOffset = false;
25+
bool amfsFlushEnable = false;
2526

2627
protected:
2728
PipeControlArgsBase() = default;

shared/source/xe_hp_core/hw_helper_xe_hp_core.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ void MemorySynchronizationCommands<Family>::setPipeControlExtraProperties(PIPE_C
143143
pipeControl.setHdcPipelineFlush(args.hdcPipelineFlush);
144144
pipeControl.setCompressionControlSurfaceCcsFlush(args.compressionControlSurfaceCcsFlush);
145145
pipeControl.setWorkloadPartitionIdOffsetEnable(args.workloadPartitionOffset);
146+
pipeControl.setAmfsFlushEnable(args.amfsFlushEnable);
146147

147148
if (DebugManager.flags.FlushAllCaches.get()) {
148149
pipeControl.setHdcPipelineFlush(true);

0 commit comments

Comments
 (0)