Replace virtual method call for DC flush with stored bool value 1/n

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2022-10-11 10:37:19 +00:00
committed by Compute-Runtime-Automation
parent d3c78a5011
commit 31f97717db
18 changed files with 60 additions and 32 deletions

View File

@@ -372,6 +372,14 @@ class CommandStreamReceiver {
this->numClients--;
}
bool getDcFlushSupport() const {
return dcFlushSupport;
}
bool getDcFlushRequired(bool externalCondition) const {
return externalCondition ? dcFlushSupport : false;
}
protected:
void cleanupResources();
void printDeviceIndex();
@@ -489,6 +497,7 @@ class CommandStreamReceiver {
bool useGpuIdleImplicitFlush = false;
bool lastSentUseGlobalAtomics = false;
bool useNotifyEnableForPostSync = false;
bool dcFlushSupport = false;
};
typedef CommandStreamReceiver *(*CommandStreamReceiverCreateFunc)(bool withAubDump,

View File

@@ -79,6 +79,8 @@ CommandStreamReceiverHw<GfxFamily>::CommandStreamReceiverHw(ExecutionEnvironment
createScratchSpaceController();
configurePostSyncWriteOffset();
this->dcFlushSupport = NEO::MemorySynchronizationCommands<GfxFamily>::getDcFlushEnable(true, hwInfo);
}
template <typename GfxFamily>
@@ -227,7 +229,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
auto address = getTagAllocation()->getGpuAddress();
args.dcFlushEnable = MemorySynchronizationCommands<GfxFamily>::getDcFlushEnable(dispatchFlags.dcFlush, hwInfo);
args.dcFlushEnable = getDcFlushRequired(dispatchFlags.dcFlush);
args.notifyEnable = isUsedNotifyEnableForPostSync();
args.tlbInvalidation |= dispatchFlags.memoryMigrationRequired;
args.textureCacheInvalidationEnable |= dispatchFlags.textureCacheFlush;
@@ -786,7 +788,7 @@ inline bool CommandStreamReceiverHw<GfxFamily>::flushBatchedSubmissions() {
}
// make sure we flush DC if needed
if (epiloguePipeControlLocation && MemorySynchronizationCommands<GfxFamily>::getDcFlushEnable(true, hwInfo)) {
if (getDcFlushRequired(epiloguePipeControlLocation)) {
lastPipeControlArgs.dcFlushEnable = true;
if (DebugManager.flags.DisableDcFlushInEpilogue.get()) {
@@ -1221,7 +1223,7 @@ void CommandStreamReceiverHw<GfxFamily>::flushPipeControl() {
const auto &hwInfo = peekHwInfo();
PipeControlArgs args;
args.dcFlushEnable = MemorySynchronizationCommands<GfxFamily>::getDcFlushEnable(true, hwInfo);
args.dcFlushEnable = this->dcFlushSupport;
args.notifyEnable = isUsedNotifyEnableForPostSync();
args.workloadPartitionOffset = isMultiTileOperationEnabled();

View File

@@ -159,7 +159,7 @@ inline void CommandStreamReceiverHw<GfxFamily>::programStallingPostSyncCommandsF
auto barrierTimestampPacketGpuAddress = TimestampPacketHelper::getContextEndGpuAddress(tagNode);
const auto &hwInfo = peekHwInfo();
PipeControlArgs args;
args.dcFlushEnable = MemorySynchronizationCommands<GfxFamily>::getDcFlushEnable(true, hwInfo);
args.dcFlushEnable = this->dcFlushSupport;
MemorySynchronizationCommands<GfxFamily>::addBarrierWithPostSyncOperation(
cmdStream,
PostSyncMode::ImmediateData,

View File

@@ -63,7 +63,7 @@ inline void CommandStreamReceiverHw<GfxFamily>::addPipeControlBefore3dState(Line
std::ignore = isBasicWARequired;
PipeControlArgs args;
args.dcFlushEnable = MemorySynchronizationCommands<GfxFamily>::getDcFlushEnable(true, hwInfo);
args.dcFlushEnable = this->dcFlushSupport;
if (isExtendedWARequired) {
DEBUG_BREAK_IF(perDssBackedBuffer == nullptr);

View File

@@ -143,7 +143,7 @@ inline void CommandStreamReceiverHw<GfxFamily>::addPipeControlBeforeStateSip(Lin
auto hwInfoConfig = HwInfoConfig::get(hwInfo.platform.eProductFamily);
bool debuggingEnabled = device.getDebugger() != nullptr;
PipeControlArgs args;
args.dcFlushEnable = MemorySynchronizationCommands<GfxFamily>::getDcFlushEnable(true, hwInfo);
args.dcFlushEnable = this->dcFlushSupport;
const auto &[isBasicWARequired, isExtendedWARequired] = hwInfoConfig->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs());
std::ignore = isExtendedWARequired;
@@ -197,7 +197,7 @@ inline void CommandStreamReceiverHw<GfxFamily>::programStallingPostSyncCommandsF
auto barrierTimestampPacketGpuAddress = TimestampPacketHelper::getContextEndGpuAddress(tagNode);
const auto &hwInfo = peekHwInfo();
PipeControlArgs args;
args.dcFlushEnable = MemorySynchronizationCommands<GfxFamily>::getDcFlushEnable(true, hwInfo);
args.dcFlushEnable = this->dcFlushSupport;
if (isMultiTileOperationEnabled()) {
args.workloadPartitionOffset = true;
ImplicitScalingDispatch<GfxFamily>::dispatchBarrierCommands(cmdStream,

View File

@@ -27,7 +27,7 @@ void CommandStreamReceiverHw<Family>::programMediaSampler(LinearStream &stream,
if (dispatchFlags.pipelineSelectArgs.mediaSamplerRequired) {
if (!lastVmeSubslicesConfig) {
PipeControlArgs args;
args.dcFlushEnable = MemorySynchronizationCommands<Family>::getDcFlushEnable(true, hwInfo);
args.dcFlushEnable = this->dcFlushSupport;
args.renderTargetCacheFlushEnable = true;
args.instructionCacheInvalidateEnable = true;
args.textureCacheInvalidationEnable = true;
@@ -61,7 +61,7 @@ void CommandStreamReceiverHw<Family>::programMediaSampler(LinearStream &stream,
} else {
if (lastVmeSubslicesConfig) {
PipeControlArgs args;
args.dcFlushEnable = MemorySynchronizationCommands<Family>::getDcFlushEnable(true, hwInfo);
args.dcFlushEnable = this->dcFlushSupport;
args.renderTargetCacheFlushEnable = true;
args.instructionCacheInvalidateEnable = true;
args.textureCacheInvalidationEnable = true;

View File

@@ -191,3 +191,9 @@ HWTEST2_F(CommandEncoderTests, givenRequiredWorkGroupOrderWhenCallAdjustWalkOrde
EncodeDispatchKernel<FamilyType>::adjustWalkOrder(walkerCmd, fakeOrder, *defaultHwInfo);
EXPECT_EQ(0, memcmp(&walkerOnStart, &walkerCmd, sizeof(WALKER_TYPE))); // no change
}
HWTEST_F(CommandEncoderTests, givenDcFlushNotRequiredWhenGettingDcFlushValueThenReturnValueIsFalse) {
constexpr bool requiredFlag = false;
bool helperValue = MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(requiredFlag, *defaultHwInfo);
EXPECT_FALSE(helperValue);
}

View File

@@ -2199,3 +2199,12 @@ HWTEST2_F(CommandStreamReceiverHwTest, givenSshHeapNotProvidedWhenFlushTaskPerfo
itorCmd = find<_3DSTATE_BINDING_TABLE_POOL_ALLOC *>(commands.begin(), commands.end());
EXPECT_EQ(commands.end(), itorCmd);
}
HWTEST_F(CommandStreamReceiverHwTest, givenDcFlushFlagSetWhenGettingCsrFlagValueThenCsrValueMatchesHelperValue) {
auto &hwInfo = pDevice->getHardwareInfo();
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
bool csrValue = commandStreamReceiver.getDcFlushSupport();
bool helperValue = MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, hwInfo);
EXPECT_EQ(helperValue, csrValue);
}