Update SBA in hybrid immediate and regular commandlist usages

Fix to check and update heap states.

Related-To: LOCI-3379
Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@intel.com>
This commit is contained in:
Aravind Gopalakrishnan
2022-09-27 23:51:57 +00:00
committed by Compute-Runtime-Automation
parent d944efabc9
commit f9fab3ff49
4 changed files with 44 additions and 0 deletions

View File

@@ -191,6 +191,8 @@ struct CommandQueueHw : public CommandQueueImp {
const NEO::StreamProperties &cmdListRequired,
const NEO::StreamProperties &cmdListFinal);
inline void updateBaseAddressState(CommandList *lastCommandList);
size_t alignedChildStreamPadding{};
};

View File

@@ -192,6 +192,7 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandListsRegular(
this->mergeOneCmdListPipelinedState(commandList);
}
this->updateBaseAddressState(CommandList::fromHandle(phCommandLists[numCommandLists - 1]));
this->collectPrintfContentsFromAllCommandsLists(phCommandLists, numCommandLists);
this->migrateSharedAllocationsIfRequested(ctx.isMigrationRequested, phCommandLists[0]);
this->prefetchMemoryIfRequested(ctx.performMemoryPrefetch);
@@ -1226,4 +1227,18 @@ void CommandQueueHw<gfxCoreFamily>::programRequiredStateComputeModeForCommandLis
csrState.stateComputeMode.setProperties(cmdListFinal.stateComputeMode);
}
template <GFXCORE_FAMILY gfxCoreFamily>
void CommandQueueHw<gfxCoreFamily>::updateBaseAddressState(CommandList *lastCommandList) {
auto csrHw = static_cast<NEO::CommandStreamReceiverHw<GfxFamily> *>(csr);
auto dsh = lastCommandList->commandContainer.getIndirectHeap(NEO::HeapType::DYNAMIC_STATE);
if (dsh != nullptr) {
csrHw->getDshState().updateAndCheck(dsh);
}
auto ssh = lastCommandList->commandContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE);
if (ssh != nullptr) {
csrHw->getSshState().updateAndCheck(ssh);
}
}
} // namespace L0

View File

@@ -141,6 +141,9 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
}
void initializeDeviceWithFirstSubmission() override;
HeapDirtyState &getDshState() {
return dshState;
}
HeapDirtyState &getSshState() {
return sshState;
}

View File

@@ -2218,6 +2218,30 @@ HWTEST_F(CommandStreamReceiverTest, givenSshDirtyStateWhenUpdatingStateWithNewHe
EXPECT_FALSE(check);
}
HWTEST_F(CommandStreamReceiverTest, givenDshDirtyStateWhenUpdatingStateWithNewHeapThenExpectDirtyStateTrue) {
MockGraphicsAllocation allocation{};
allocation.gpuAddress = 0xABCD00;
allocation.size = 0x1000;
IndirectHeap dummyHeap(&allocation, false);
auto dirtyStateCopy = static_cast<CommandStreamReceiverHw<FamilyType> *>(commandStreamReceiver)->getDshState();
bool check = dirtyStateCopy.updateAndCheck(&dummyHeap);
EXPECT_TRUE(check);
check = dirtyStateCopy.updateAndCheck(&dummyHeap);
EXPECT_FALSE(check);
auto dirtyState = static_cast<CommandStreamReceiverHw<FamilyType> *>(commandStreamReceiver)->getDshState();
check = dirtyState.updateAndCheck(&dummyHeap);
EXPECT_TRUE(check);
check = dirtyState.updateAndCheck(&dummyHeap);
EXPECT_FALSE(check);
}
using CommandStreamReceiverHwTest = Test<CommandStreamReceiverFixture>;
HWTEST2_F(CommandStreamReceiverHwTest, givenSshHeapNotProvidedWhenFlushTaskPerformedThenSbaProgammedSurfaceBaseAddressToZero, IsAtLeastXeHpCore) {