Skip to content

Commit f9fab3f

Browse files
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 <[email protected]>
1 parent d944efa commit f9fab3f

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

level_zero/core/source/cmdqueue/cmdqueue_hw.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ struct CommandQueueHw : public CommandQueueImp {
191191
const NEO::StreamProperties &cmdListRequired,
192192
const NEO::StreamProperties &cmdListFinal);
193193

194+
inline void updateBaseAddressState(CommandList *lastCommandList);
195+
194196
size_t alignedChildStreamPadding{};
195197
};
196198

level_zero/core/source/cmdqueue/cmdqueue_hw.inl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandListsRegular(
192192
this->mergeOneCmdListPipelinedState(commandList);
193193
}
194194

195+
this->updateBaseAddressState(CommandList::fromHandle(phCommandLists[numCommandLists - 1]));
195196
this->collectPrintfContentsFromAllCommandsLists(phCommandLists, numCommandLists);
196197
this->migrateSharedAllocationsIfRequested(ctx.isMigrationRequested, phCommandLists[0]);
197198
this->prefetchMemoryIfRequested(ctx.performMemoryPrefetch);
@@ -1226,4 +1227,18 @@ void CommandQueueHw<gfxCoreFamily>::programRequiredStateComputeModeForCommandLis
12261227
csrState.stateComputeMode.setProperties(cmdListFinal.stateComputeMode);
12271228
}
12281229

1230+
template <GFXCORE_FAMILY gfxCoreFamily>
1231+
void CommandQueueHw<gfxCoreFamily>::updateBaseAddressState(CommandList *lastCommandList) {
1232+
auto csrHw = static_cast<NEO::CommandStreamReceiverHw<GfxFamily> *>(csr);
1233+
auto dsh = lastCommandList->commandContainer.getIndirectHeap(NEO::HeapType::DYNAMIC_STATE);
1234+
if (dsh != nullptr) {
1235+
csrHw->getDshState().updateAndCheck(dsh);
1236+
}
1237+
1238+
auto ssh = lastCommandList->commandContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE);
1239+
if (ssh != nullptr) {
1240+
csrHw->getSshState().updateAndCheck(ssh);
1241+
}
1242+
}
1243+
12291244
} // namespace L0

shared/source/command_stream/command_stream_receiver_hw.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
141141
}
142142
void initializeDeviceWithFirstSubmission() override;
143143

144+
HeapDirtyState &getDshState() {
145+
return dshState;
146+
}
144147
HeapDirtyState &getSshState() {
145148
return sshState;
146149
}

shared/test/unit_test/command_stream/command_stream_receiver_tests.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,6 +2218,30 @@ HWTEST_F(CommandStreamReceiverTest, givenSshDirtyStateWhenUpdatingStateWithNewHe
22182218
EXPECT_FALSE(check);
22192219
}
22202220

2221+
HWTEST_F(CommandStreamReceiverTest, givenDshDirtyStateWhenUpdatingStateWithNewHeapThenExpectDirtyStateTrue) {
2222+
MockGraphicsAllocation allocation{};
2223+
allocation.gpuAddress = 0xABCD00;
2224+
allocation.size = 0x1000;
2225+
2226+
IndirectHeap dummyHeap(&allocation, false);
2227+
2228+
auto dirtyStateCopy = static_cast<CommandStreamReceiverHw<FamilyType> *>(commandStreamReceiver)->getDshState();
2229+
2230+
bool check = dirtyStateCopy.updateAndCheck(&dummyHeap);
2231+
EXPECT_TRUE(check);
2232+
2233+
check = dirtyStateCopy.updateAndCheck(&dummyHeap);
2234+
EXPECT_FALSE(check);
2235+
2236+
auto dirtyState = static_cast<CommandStreamReceiverHw<FamilyType> *>(commandStreamReceiver)->getDshState();
2237+
2238+
check = dirtyState.updateAndCheck(&dummyHeap);
2239+
EXPECT_TRUE(check);
2240+
2241+
check = dirtyState.updateAndCheck(&dummyHeap);
2242+
EXPECT_FALSE(check);
2243+
}
2244+
22212245
using CommandStreamReceiverHwTest = Test<CommandStreamReceiverFixture>;
22222246

22232247
HWTEST2_F(CommandStreamReceiverHwTest, givenSshHeapNotProvidedWhenFlushTaskPerformedThenSbaProgammedSurfaceBaseAddressToZero, IsAtLeastXeHpCore) {

0 commit comments

Comments
 (0)