refactor: remove unused dc flush mitigation

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2025-05-09 06:55:52 +00:00
committed by Compute-Runtime-Automation
parent 4e823f9e6e
commit 1d1414febc
48 changed files with 75 additions and 735 deletions

View File

@@ -78,17 +78,6 @@ void CommandList::removeHostPtrAllocations() {
hostPtrMap.clear();
}
void CommandList::forceDcFlushForDcFlushMitigation() {
if (this->device && this->device->getProductHelper().isDcFlushMitigated()) {
for (const auto &engine : this->device->getNEODevice()->getMemoryManager()->getRegisteredEngines(this->device->getNEODevice()->getRootDeviceIndex())) {
if (engine.commandStreamReceiver->isDirectSubmissionEnabled()) {
engine.commandStreamReceiver->registerDcFlushForDcMitigation();
engine.commandStreamReceiver->flushTagUpdate();
}
}
}
}
void CommandList::removeMemoryPrefetchAllocations() {
if (this->performMemoryPrefetch) {
auto prefetchManager = this->device->getDriverHandle()->getMemoryManager()->getPrefetchManager();
@@ -99,13 +88,6 @@ void CommandList::removeMemoryPrefetchAllocations() {
}
}
void CommandList::registerCsrDcFlushForDcMitigation(NEO::CommandStreamReceiver &csr) {
if (this->requiresDcFlushForDcMitigation) {
csr.registerDcFlushForDcMitigation();
this->requiresDcFlushForDcMitigation = false;
}
}
NEO::GraphicsAllocation *CommandList::getAllocationFromHostPtrMap(const void *buffer, uint64_t bufferSize, bool copyOffload) {
auto allocation = hostPtrMap.lower_bound(buffer);
if (allocation != hostPtrMap.end()) {

View File

@@ -218,7 +218,6 @@ struct CommandList : _ze_command_list_handle_t {
return commandListPerThreadScratchSize[slotId];
}
void forceDcFlushForDcFlushMitigation();
void setAdditionalDispatchKernelArgsFromLaunchParams(NEO::EncodeDispatchKernelArgs &dispatchKernelArgs, const CmdListKernelLaunchParams &launchParams) const;
ze_result_t validateLaunchParams(const CmdListKernelLaunchParams &launchParams) const;
@@ -430,8 +429,6 @@ struct CommandList : _ze_command_list_handle_t {
return wasPending;
}
void registerCsrDcFlushForDcMitigation(NEO::CommandStreamReceiver &csr);
NEO::EngineGroupType getEngineGroupType() const {
return engineGroupType;
}
@@ -538,7 +535,6 @@ struct CommandList : _ze_command_list_handle_t {
bool heaplessStateInitEnabled = false;
bool scratchAddressPatchingEnabled = false;
bool taskCountUpdateFenceRequired = false;
bool requiresDcFlushForDcMitigation = false;
bool statelessBuiltinsEnabled = false;
bool localDispatchSupport = false;
bool l3FlushAfterPostSyncRequired = false;

View File

@@ -158,8 +158,6 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::reset() {
this->inOrderPatchCmds.clear();
this->forceDcFlushForDcFlushMitigation();
return ZE_RESULT_SUCCESS;
}

View File

@@ -505,7 +505,6 @@ inline ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::executeCommand
if (cmdQ->peekIsCopyOnlyCommandQueue()) {
completionStamp = flushBcsTask(*commandStream, commandStreamStart, hasStallingCmds, hasRelaxedOrderingDependencies, requireTaskCountUpdate, appendOperation, csr);
} else {
this->registerCsrDcFlushForDcMitigation(*csr);
completionStamp = (this->*computeFlushMethod)(*commandStream, commandStreamStart, hasStallingCmds, hasRelaxedOrderingDependencies, appendOperation, requireTaskCountUpdate);
}

View File

@@ -566,10 +566,6 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
}
if (kernelImp->usesRayTracing()) {
if (this->device->getProductHelper().isDcFlushMitigated()) {
this->requiresDcFlushForDcMitigation = true;
}
NEO::PipeControlArgs args{};
args.stateCacheInvalidationEnable = true;
NEO::MemorySynchronizationCommands<GfxFamily>::addSingleBarrier(*commandContainer.getCommandStream(), args);

View File

@@ -75,8 +75,6 @@ ze_result_t CommandListImp::destroy() {
}
}
this->forceDcFlushForDcFlushMitigation();
delete this;
return ZE_RESULT_SUCCESS;
}

View File

@@ -819,8 +819,6 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::setupCmdListsAndContextParams(
ctx.cmdListScratchAddressPatchingEnabled |= commandList->getCmdListScratchAddressPatchingEnabled();
commandList->registerCsrDcFlushForDcMitigation(*this->getCsr());
ctx.spaceForResidency += estimateCommandListResidencySize(commandList);
}
}
@@ -1381,7 +1379,6 @@ void CommandQueueHw<gfxCoreFamily>::dispatchTaskCountPostSyncRegular(
NEO::PipeControlArgs args;
args.dcFlushEnable = this->csr->getDcFlushSupport();
args.dcFlushEnable |= this->csr->checkDcFlushRequiredForDcMitigationAndReset();
args.workloadPartitionOffset = this->partitionCount > 1;
args.notifyEnable = this->csr->isUsedNotifyEnableForPostSync();
NEO::MemorySynchronizationCommands<GfxFamily>::addBarrierWithPostSyncOperation(

View File

@@ -112,7 +112,6 @@ struct WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>
using BaseClass::pipeControlMultiKernelEventSync;
using BaseClass::pipelineSelectStateTracking;
using BaseClass::requiredStreamState;
using BaseClass::requiresDcFlushForDcMitigation;
using BaseClass::requiresQueueUncachedMocs;
using BaseClass::scratchAddressPatchingEnabled;
using BaseClass::setAdditionalBlitProperties;

View File

@@ -1630,30 +1630,6 @@ HWTEST2_F(CommandListAppendLaunchRayTracingKernelTest, givenKernelUsingRayTracin
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
}
HWTEST2_F(CommandListAppendLaunchRayTracingKernelTest, givenDcFlushMitigationWhenAppendLaunchKernelWithRayTracingIsCalledThenRequireDcFlush, RayTracingMatcher) {
VariableBackup<GraphicsAllocation *> rtMemoryBackedBuffer{&neoDevice->rtMemoryBackedBuffer, buffer1};
DebugManagerStateRestore restorer;
debugManager.flags.AllowDcFlush.set(0);
Mock<::L0::KernelImp> kernel;
auto pMockModule = std::unique_ptr<Module>(new Mock<Module>(device, nullptr));
kernel.module = pMockModule.get();
kernel.setGroupSize(4, 1, 1);
ze_group_count_t groupCount{8, 1, 1};
auto pCommandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<FamilyType::gfxCoreFamily>>>();
auto result = pCommandList->initialize(device, NEO::EngineGroupType::compute, 0);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
kernel.immutableData.kernelDescriptor->kernelAttributes.flags.hasRTCalls = true;
CmdListKernelLaunchParams launchParams = {};
result = pCommandList->appendLaunchKernel(kernel.toHandle(), groupCount, nullptr, 0, nullptr, launchParams, false);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(pCommandList->requiresDcFlushForDcMitigation, device->getProductHelper().isDcFlushMitigated());
}
using RayTracingCmdListTest = Test<RayTracingCmdListFixture>;
template <typename FamilyType>
@@ -1773,28 +1749,6 @@ HWTEST2_F(RayTracingCmdListTest,
ultCsr->isMadeResident(rtAllocation, residentCount);
}
HWTEST2_F(RayTracingCmdListTest,
givenDcFlushMitigationWhenRegularAppendLaunchKernelAndExecuteThenRegisterDcFlushForDcFlushMitigation,
RayTracingMatcher) {
DebugManagerStateRestore restorer;
debugManager.flags.AllowDcFlush.set(0);
auto ultCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(commandQueue->getCsr());
ze_group_count_t groupCount{1, 1, 1};
CmdListKernelLaunchParams launchParams = {};
auto result = commandList->appendLaunchKernel(kernel->toHandle(), groupCount, nullptr, 0, nullptr, launchParams, false);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
result = commandList->close();
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
ze_command_list_handle_t cmdListHandle = commandList->toHandle();
result = commandQueue->executeCommandLists(1, &cmdListHandle, nullptr, true, nullptr, nullptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(ultCsr->registeredDcFlushForDcFlushMitigation, device->getProductHelper().isDcFlushMitigated());
}
HWTEST2_F(RayTracingCmdListTest,
givenRayTracingKernelWhenRegularCmdListExecutedAndImmediateExecutedAgainThenDispatch3dBtdCommandOnceMakeResidentTwiceAndPipeControlWithStateCacheFlushAfterWalker,
RayTracingMatcher) {
@@ -1899,22 +1853,6 @@ HWTEST2_F(RayTracingCmdListTest,
ultCsr->isMadeResident(rtAllocation, residentCount);
}
HWTEST2_F(RayTracingCmdListTest,
givenDcFlushMitigationWhenImmediateAppendLaunchKernelThenRegisterDcFlushForDcFlushMitigation,
RayTracingMatcher) {
DebugManagerStateRestore restorer;
debugManager.flags.AllowDcFlush.set(0);
commandListImmediate->isSyncModeQueue = true;
auto ultCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(commandQueue->getCsr());
ze_group_count_t groupCount{1, 1, 1};
CmdListKernelLaunchParams launchParams = {};
auto result = commandListImmediate->appendLaunchKernel(kernel->toHandle(), groupCount, nullptr, 0, nullptr, launchParams, false);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(ultCsr->registeredDcFlushForDcFlushMitigation, device->getProductHelper().isDcFlushMitigated());
}
HWTEST2_F(RayTracingCmdListTest,
givenRayTracingKernelWhenImmediateCmdListExecutedAndRegularExecutedAgainThenDispatch3dBtdCommandOnceMakeResidentTwiceAndPipeControlWithStateCacheFlushAfterWalker,
RayTracingMatcher) {