mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
performance: add scratch space handling to immediate flush task
Related-To: NEO-7808 Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
e1b429db40
commit
1146f42bcb
@@ -277,6 +277,28 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushImmediateTask(
|
||||
flushData.stateComputeModeFullConfigurationNeeded = getStateComputeModeDirty();
|
||||
flushData.stateBaseAddressFullConfigurationNeeded = getGSBAStateDirty();
|
||||
|
||||
if (this->requiredScratchSize > 0 || this->requiredPrivateScratchSize > 0) {
|
||||
bool checkFeStateDirty = false;
|
||||
bool checkSbaStateDirty = false;
|
||||
scratchSpaceController->setRequiredScratchSpace(dispatchFlags.sshCpuBase,
|
||||
0u,
|
||||
this->requiredScratchSize,
|
||||
this->requiredPrivateScratchSize,
|
||||
this->taskCount,
|
||||
*this->osContext,
|
||||
checkSbaStateDirty,
|
||||
checkFeStateDirty);
|
||||
flushData.frontEndFullConfigurationNeeded |= checkFeStateDirty;
|
||||
flushData.stateBaseAddressFullConfigurationNeeded |= checkSbaStateDirty;
|
||||
|
||||
if (scratchSpaceController->getScratchSpaceAllocation()) {
|
||||
makeResident(*scratchSpaceController->getScratchSpaceAllocation());
|
||||
}
|
||||
if (scratchSpaceController->getPrivateScratchSpaceAllocation()) {
|
||||
makeResident(*scratchSpaceController->getPrivateScratchSpaceAllocation());
|
||||
}
|
||||
}
|
||||
|
||||
handleImmediateFlushPipelineSelectState(dispatchFlags, flushData);
|
||||
handleImmediateFlushFrontEndState(dispatchFlags, flushData);
|
||||
handleImmediateFlushStateComputeModeState(dispatchFlags, flushData);
|
||||
|
||||
@@ -137,7 +137,8 @@ struct CsrSizeRequestFlags {
|
||||
};
|
||||
|
||||
struct ImmediateDispatchFlags {
|
||||
StreamProperties *requiredState;
|
||||
StreamProperties *requiredState = nullptr;
|
||||
void *sshCpuBase = nullptr;
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -36,6 +36,7 @@ void CommandStreamReceiverFixture::setUp() {
|
||||
|
||||
requiredStreamProperties.initSupport(pDevice->getRootDeviceEnvironment());
|
||||
immediateFlushTaskFlags.requiredState = &requiredStreamProperties;
|
||||
immediateFlushTaskFlags.sshCpuBase = sshBuffer;
|
||||
}
|
||||
|
||||
void CommandStreamReceiverFixture::tearDown() {
|
||||
|
||||
@@ -3603,3 +3603,71 @@ HWTEST2_F(CommandStreamReceiverHwTest,
|
||||
bindingTableAddress = hwParserCsr.getCommand<_3DSTATE_BINDING_TABLE_POOL_ALLOC>();
|
||||
EXPECT_EQ(nullptr, bindingTableAddress);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandStreamReceiverHwTest,
|
||||
givenImmediateFlushTaskWhenNextDispatchRequiresScratchSpaceThenFrontEndCommandIsDispatched,
|
||||
IsAtLeastXeHpCore) {
|
||||
using CFE_STATE = typename FamilyType::CFE_STATE;
|
||||
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
commandStreamReceiver.storeMakeResidentAllocations = true;
|
||||
|
||||
EXPECT_TRUE(commandStreamReceiver.getMediaVFEStateDirty());
|
||||
|
||||
commandStreamReceiver.flushImmediateTask(commandStream, commandStream.getUsed(), immediateFlushTaskFlags, *pDevice);
|
||||
|
||||
HardwareParse hwParserCsr;
|
||||
hwParserCsr.parseCommands<FamilyType>(commandStreamReceiver.commandStream, 0);
|
||||
auto frontEndCmd = hwParserCsr.getCommand<CFE_STATE>();
|
||||
ASSERT_NE(nullptr, frontEndCmd);
|
||||
EXPECT_FALSE(commandStreamReceiver.getMediaVFEStateDirty());
|
||||
|
||||
commandStreamReceiver.setRequiredScratchSizes(0x100, 0);
|
||||
|
||||
size_t usedSize = commandStreamReceiver.commandStream.getUsed();
|
||||
commandStreamReceiver.flushImmediateTask(commandStream,
|
||||
commandStream.getUsed(),
|
||||
immediateFlushTaskFlags,
|
||||
*pDevice);
|
||||
|
||||
hwParserCsr.tearDown();
|
||||
hwParserCsr.parseCommands<FamilyType>(commandStreamReceiver.commandStream, usedSize);
|
||||
frontEndCmd = hwParserCsr.getCommand<CFE_STATE>();
|
||||
ASSERT_NE(nullptr, frontEndCmd);
|
||||
|
||||
EXPECT_TRUE(commandStreamReceiver.isMadeResident(commandStreamReceiver.getScratchSpaceController()->getScratchSpaceAllocation()));
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandStreamReceiverHwTest,
|
||||
givenImmediateFlushTaskWhenNextDispatchRequiresPrivateScratchSpaceThenFrontEndCommandIsDispatched,
|
||||
IsAtLeastXeHpCore) {
|
||||
using CFE_STATE = typename FamilyType::CFE_STATE;
|
||||
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
commandStreamReceiver.storeMakeResidentAllocations = true;
|
||||
|
||||
EXPECT_TRUE(commandStreamReceiver.getMediaVFEStateDirty());
|
||||
|
||||
commandStreamReceiver.flushImmediateTask(commandStream, commandStream.getUsed(), immediateFlushTaskFlags, *pDevice);
|
||||
|
||||
HardwareParse hwParserCsr;
|
||||
hwParserCsr.parseCommands<FamilyType>(commandStreamReceiver.commandStream, 0);
|
||||
auto frontEndCmd = hwParserCsr.getCommand<CFE_STATE>();
|
||||
ASSERT_NE(nullptr, frontEndCmd);
|
||||
EXPECT_FALSE(commandStreamReceiver.getMediaVFEStateDirty());
|
||||
|
||||
commandStreamReceiver.setRequiredScratchSizes(0, 0x100);
|
||||
|
||||
size_t usedSize = commandStreamReceiver.commandStream.getUsed();
|
||||
commandStreamReceiver.flushImmediateTask(commandStream,
|
||||
commandStream.getUsed(),
|
||||
immediateFlushTaskFlags,
|
||||
*pDevice);
|
||||
|
||||
hwParserCsr.tearDown();
|
||||
hwParserCsr.parseCommands<FamilyType>(commandStreamReceiver.commandStream, usedSize);
|
||||
frontEndCmd = hwParserCsr.getCommand<CFE_STATE>();
|
||||
ASSERT_NE(nullptr, frontEndCmd);
|
||||
|
||||
EXPECT_TRUE(commandStreamReceiver.isMadeResident(commandStreamReceiver.getScratchSpaceController()->getPrivateScratchSpaceAllocation()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user