mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
Add per-DSS back buffer programming
Related-To: NEO-3220 Change-Id: Ide341205a283d8973b5c11f3a953eabbda14262f Signed-off-by: Pawel Wilma <pawel.wilma@intel.com>
This commit is contained in:
@@ -737,6 +737,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, flushTaskWithOnlyEnoughMemoryForPr
|
||||
commandStream.getSpace(sizeof(PIPE_CONTROL));
|
||||
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
commandStreamReceiver.timestampPacketWriteEnabled = false;
|
||||
// Force a PIPE_CONTROL through a taskLevel transition
|
||||
taskLevel = commandStreamReceiver.peekTaskLevel() + 1;
|
||||
|
||||
|
||||
@@ -1532,3 +1532,52 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDcFlushArgumentIsFalseWhenCal
|
||||
EXPECT_EQ(expectedDcFlush, pipeControl->getDcFlushEnable());
|
||||
EXPECT_TRUE(pipeControl->getCommandStreamerStallEnable());
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamReceiverFlushTaskTests, whenPerDssBackBufferIsAllocatedItIsClearedInCleanupResources) {
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
ASSERT_NE(nullptr, pDevice);
|
||||
commandStreamReceiver.createPerDssBackedBuffer(*pDevice);
|
||||
EXPECT_NE(nullptr, commandStreamReceiver.perDssBackedBuffer);
|
||||
commandStreamReceiver.cleanupResources();
|
||||
EXPECT_EQ(nullptr, commandStreamReceiver.perDssBackedBuffer);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamReceiverFlushTaskTests, whenPerDssBackBufferProgrammingEnabledThenAllocationIsCreated) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.ForcePerDssBackedBufferProgramming.set(true);
|
||||
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
DispatchFlags dispatchFlags;
|
||||
commandStreamReceiver.flushTask(commandStream,
|
||||
0,
|
||||
dsh,
|
||||
ioh,
|
||||
ssh,
|
||||
taskLevel,
|
||||
dispatchFlags,
|
||||
*pDevice);
|
||||
|
||||
EXPECT_EQ(1u, commandStreamReceiver.createPerDssBackedBufferCalled);
|
||||
EXPECT_NE(nullptr, commandStreamReceiver.perDssBackedBuffer);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamReceiverFlushTaskTests, whenPerDssBackBufferProgrammingEnabledAndPerDssBackedBufferAlreadyPresentThenNewAllocationIsNotCreated) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.ForcePerDssBackedBufferProgramming.set(true);
|
||||
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
auto memoryManager = pDevice->getMemoryManager();
|
||||
commandStreamReceiver.perDssBackedBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
DispatchFlags dispatchFlags;
|
||||
commandStreamReceiver.flushTask(commandStream,
|
||||
0,
|
||||
dsh,
|
||||
ioh,
|
||||
ssh,
|
||||
taskLevel,
|
||||
dispatchFlags,
|
||||
*pDevice);
|
||||
|
||||
EXPECT_EQ(0u, commandStreamReceiver.createPerDssBackedBufferCalled);
|
||||
}
|
||||
|
||||
@@ -168,6 +168,24 @@ HWTEST_F(UltCommandStreamReceiverTest, givenPreambleSentWhenEstimatingPreambleCm
|
||||
EXPECT_EQ(expectedDifference, actualDifference);
|
||||
}
|
||||
|
||||
HWTEST_F(UltCommandStreamReceiverTest, givenPerDssBackBufferProgrammingEnabledWhenEstimatingPreambleCmdSizeThenResultIncludesPerDssBackBufferProgramingCommandsSize) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.ForcePerDssBackedBufferProgramming.set(true);
|
||||
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
commandStreamReceiver.requiredThreadArbitrationPolicy = commandStreamReceiver.lastSentThreadArbitrationPolicy;
|
||||
|
||||
commandStreamReceiver.isPreambleSent = false;
|
||||
auto preambleNotSent = commandStreamReceiver.getRequiredCmdSizeForPreamble(*pDevice);
|
||||
|
||||
commandStreamReceiver.isPreambleSent = true;
|
||||
auto preambleSent = commandStreamReceiver.getRequiredCmdSizeForPreamble(*pDevice);
|
||||
|
||||
auto actualDifference = preambleNotSent - preambleSent;
|
||||
auto expectedDifference = PreambleHelper<FamilyType>::getThreadArbitrationCommandsSize() + PreambleHelper<FamilyType>::getAdditionalCommandsSize(*pDevice) + PreambleHelper<FamilyType>::getPerDssBackedBufferCommandsSize(pDevice->getHardwareInfo());
|
||||
EXPECT_EQ(expectedDifference, actualDifference);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, UltCommandStreamReceiverTest, givenMediaVfeStateDirtyEstimatingPreambleCmdSizeThenResultDependsVfeStateProgrammingCmdSize) {
|
||||
typedef typename FamilyType::MEDIA_VFE_STATE MEDIA_VFE_STATE;
|
||||
typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL;
|
||||
|
||||
@@ -115,7 +115,7 @@ GEN11TEST_F(ThreadArbitrationGen11, givenPreambleWhenItIsProgrammedThenThreadArb
|
||||
MockDevice mockDevice;
|
||||
PreambleHelper<FamilyType>::programPreamble(&linearStream, mockDevice, l3Config,
|
||||
ThreadArbitrationPolicy::RoundRobin,
|
||||
nullptr);
|
||||
nullptr, nullptr);
|
||||
|
||||
parseCommands<FamilyType>(cs);
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ SKLTEST_F(ThreadArbitration, givenPreambleWhenItIsProgrammedThenThreadArbitratio
|
||||
MockDevice mockDevice;
|
||||
PreambleHelper<SKLFamily>::programPreamble(&linearStream, mockDevice, l3Config,
|
||||
ThreadArbitrationPolicy::RoundRobin,
|
||||
nullptr);
|
||||
nullptr, nullptr);
|
||||
|
||||
parseCommands<SKLFamily>(cs);
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
|
||||
using BaseClass::getScratchSpaceController;
|
||||
using BaseClass::indirectHeap;
|
||||
using BaseClass::iohState;
|
||||
using BaseClass::perDssBackedBuffer;
|
||||
using BaseClass::programPreamble;
|
||||
using BaseClass::programStateSip;
|
||||
using BaseClass::requiresInstructionCacheFlush;
|
||||
@@ -177,6 +178,16 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
|
||||
CommandStreamReceiverHw<GfxFamily>::blitBuffer(blitProperites);
|
||||
}
|
||||
|
||||
bool createPerDssBackedBuffer(Device &device) override {
|
||||
createPerDssBackedBufferCalled++;
|
||||
bool result = BaseClass::createPerDssBackedBuffer(device);
|
||||
if (!perDssBackedBuffer) {
|
||||
AllocationProperties properties{MemoryConstants::pageSize, GraphicsAllocation::AllocationType::INTERNAL_HEAP};
|
||||
perDssBackedBuffer = executionEnvironment.memoryManager->allocateGraphicsMemoryWithProperties(properties);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
std::atomic<uint32_t> recursiveLockCounter;
|
||||
bool createPageTableManagerCalled = false;
|
||||
bool recordFlusheBatchBuffer = false;
|
||||
@@ -190,6 +201,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
|
||||
BatchBuffer latestFlushedBatchBuffer = {};
|
||||
uint32_t latestSentTaskCountValueDuringFlush = 0;
|
||||
uint32_t blitBufferCalled = 0;
|
||||
uint32_t createPerDssBackedBufferCalled = 0;
|
||||
std::atomic<uint32_t> latestWaitForCompletionWithTimeoutTaskCount{0};
|
||||
DispatchFlags recordedDispatchFlags;
|
||||
};
|
||||
|
||||
@@ -71,7 +71,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, PreambleTest, givenMidThreadPreemptionWhenPreambleIs
|
||||
MockGraphicsAllocation csrSurface(reinterpret_cast<void *>(minCsrAlignment), 1024);
|
||||
|
||||
PreambleHelper<FamilyType>::programPreamble(&preambleStream, *mockDevice, 0U,
|
||||
ThreadArbitrationPolicy::RoundRobin, &csrSurface);
|
||||
ThreadArbitrationPolicy::RoundRobin, &csrSurface, nullptr);
|
||||
|
||||
PreemptionHelper::programStateSip<FamilyType>(preemptionStream, *mockDevice);
|
||||
|
||||
@@ -142,7 +142,7 @@ HWTEST_F(PreambleTest, givenKernelDebuggingActiveWhenPreambleIsProgrammedThenPro
|
||||
LinearStream preambleStream(&*preambleBuffer.begin(), preambleBuffer.size());
|
||||
|
||||
PreambleHelper<FamilyType>::programPreamble(&preambleStream, *mockDevice, 0U,
|
||||
ThreadArbitrationPolicy::RoundRobin, nullptr);
|
||||
ThreadArbitrationPolicy::RoundRobin, nullptr, nullptr);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(preambleStream);
|
||||
@@ -156,7 +156,7 @@ HWTEST_F(PreambleTest, givenKernelDebuggingActiveWhenPreambleIsProgrammedThenPro
|
||||
StackVec<char, 8192> preambleBuffer2(8192);
|
||||
preambleStream.replaceBuffer(&*preambleBuffer2.begin(), preambleBuffer2.size());
|
||||
PreambleHelper<FamilyType>::programPreamble(&preambleStream, *mockDevice, 0U,
|
||||
ThreadArbitrationPolicy::RoundRobin, preemptionAllocation);
|
||||
ThreadArbitrationPolicy::RoundRobin, preemptionAllocation, nullptr);
|
||||
HardwareParse hwParser2;
|
||||
hwParser2.parseCommands<FamilyType>(preambleStream);
|
||||
cmdList = hwParser2.getCommandsList<MI_LOAD_REGISTER_IMM>();
|
||||
|
||||
@@ -116,4 +116,5 @@ DisableAuxTranslation = 0
|
||||
EnableFreeMemory = 0
|
||||
OverrideStatelessMocsIndex = -1
|
||||
AllocateSharedAllocationsWithCpuAndGpuStorage = -1
|
||||
EnableSharedSystemUsmSupport = -1
|
||||
EnableSharedSystemUsmSupport = -1
|
||||
ForcePerDssBackedBufferProgramming = 0
|
||||
|
||||
Reference in New Issue
Block a user