refactor: Add tlb flush before copy for regular command lists

Add tlb flush under debug key also for regular command lists

Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@intel.com>
This commit is contained in:
Aravind Gopalakrishnan
2024-03-20 05:26:39 +00:00
committed by Compute-Runtime-Automation
parent 1377437b3f
commit af65721cde
2 changed files with 36 additions and 0 deletions

View File

@@ -1472,6 +1472,11 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopy(void *dstptr,
appendEventForProfilingAllWalkers(signalEvent, nullptr, nullptr, true, singlePipeControlPacket, false);
if (isCopyOnly()) {
if (NEO::debugManager.flags.FlushTlbBeforeCopy.get() == 1) {
NEO::MiFlushArgs args{this->dummyBlitWa};
args.tlbFlush = true;
encodeMiFlush(0, 0, args);
}
ret = appendMemoryCopyBlit(dstAllocationStruct.alignedAllocationPtr,
dstAllocationStruct.alloc, dstAllocationStruct.offset,
srcAllocationStruct.alignedAllocationPtr,

View File

@@ -719,6 +719,37 @@ HWTEST2_F(AppendMemoryCopy, givenCopyCommandListWhenTimestampPassedToMemoryCopyT
EXPECT_EQ(cmdList.end(), itor);
}
HWTEST2_F(AppendMemoryCopy, givenCopyCommandListWhenForcingTlbFlushBeforeCopyThenMiFlushProgrammedAndTlbFlushDetected, IsAtLeastSkl) {
DebugManagerStateRestore restorer;
NEO::debugManager.flags.FlushTlbBeforeCopy.set(1);
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM;
using MI_FLUSH_DW = typename GfxFamily::MI_FLUSH_DW;
MockCommandListCoreFamily<gfxCoreFamily> commandList;
commandList.initialize(device, NEO::EngineGroupType::copy, 0u);
void *srcPtr = reinterpret_cast<void *>(0x1234);
void *dstPtr = reinterpret_cast<void *>(0x2345);
commandList.appendMemoryCopy(dstPtr, srcPtr, 0x100, nullptr, 0, nullptr, false, false);
EXPECT_EQ(commandList.appendMemoryCopyBlitCalled, 1u);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(
cmdList, ptrOffset(commandList.commandContainer.getCommandStream()->getCpuBase(), 0), commandList.commandContainer.getCommandStream()->getUsed()));
bool tlbFlushFound = false;
for (auto cmdIterator = cmdList.begin(); cmdIterator != cmdList.end(); cmdIterator++) {
auto miFlushCmd = genCmdCast<MI_FLUSH_DW *>(*cmdIterator);
if (miFlushCmd && miFlushCmd->getTlbInvalidate()) {
tlbFlushFound = true;
break;
}
}
EXPECT_TRUE(tlbFlushFound);
}
using SupportedPlatforms = IsWithinProducts<IGFX_SKYLAKE, IGFX_DG1>;
HWTEST2_F(AppendMemoryCopy,
givenCommandListUsesTimestampPassedToMemoryCopyWhenTwoKernelsAreUsedThenAppendProfilingCalledForSinglePacket, SupportedPlatforms) {