fix: process immediate command list internal residency

Related-To: NEO-14625, NEO-14624

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2025-04-10 13:46:00 +00:00
committed by Compute-Runtime-Automation
parent 407142b1c5
commit 9e5ff37b5c
4 changed files with 44 additions and 0 deletions

View File

@@ -488,6 +488,8 @@ inline ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::executeCommand
}
static_cast<CommandQueueHw<gfxCoreFamily> *>(this->cmdQImmediate)->patchCommands(*this, 0u, false);
} else {
cmdQImp->makeResidentForResidencyContainer(this->commandContainer.getResidencyContainer());
}
NEO::CompletionStamp completionStamp;

View File

@@ -385,4 +385,11 @@ QueueProperties CommandQueue::extractQueueProperties(const ze_command_queue_desc
return queueProperties;
}
void CommandQueueImp::makeResidentForResidencyContainer(const NEO::ResidencyContainer &residencyContainer) {
for (auto alloc : residencyContainer) {
alloc->prepareHostPtrForResidency(csr);
csr->makeResident(*alloc);
}
}
} // namespace L0

View File

@@ -117,6 +117,7 @@ struct CommandQueueImp : public CommandQueue {
void triggerBbStartJump() {
forceBbStartJump = true;
}
void makeResidentForResidencyContainer(const NEO::ResidencyContainer &residencyContainer);
protected:
MOCKABLE_VIRTUAL NEO::SubmissionStatus submitBatchBuffer(size_t offset, NEO::ResidencyContainer &residencyContainer, void *endingCmdPtr,

View File

@@ -1821,5 +1821,39 @@ HWTEST_F(ImmediateCommandListTest,
EXPECT_EQ(1u, kernel->printPrintfOutputCalledTimes);
}
HWTEST_F(ImmediateCommandListTest,
givenImmediateCmdListWhenAppendingRegularCmdListThenInternalResidencyContainerProcessed) {
ze_result_t returnValue = ZE_RESULT_SUCCESS;
ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.count = 1;
ze_event_desc_t eventDesc = {};
eventDesc.index = 0;
eventDesc.signal = ZE_EVENT_SCOPE_FLAG_HOST;
auto eventPool = std::unique_ptr<L0::EventPool>(EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, returnValue));
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
auto event = std::unique_ptr<L0::Event>(Event::create<typename FamilyType::TimestampPacketType>(eventPool.get(), &eventDesc, device));
ASSERT_NE(nullptr, event.get());
auto eventAllocation = event->getAllocation(device);
auto cmdBufferAllocation = commandListImmediate->getCmdContainer().getCommandStream()->getGraphicsAllocation();
auto &ultCsr = neoDevice->getUltCommandStreamReceiver<FamilyType>();
ultCsr.storeMakeResidentAllocations = true;
returnValue = commandList->close();
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
auto commandListHandle = commandList->toHandle();
auto eventHandle = event->toHandle();
returnValue = commandListImmediate->appendCommandLists(1, &commandListHandle, eventHandle, 0, nullptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
EXPECT_TRUE(ultCsr.isMadeResident(eventAllocation));
EXPECT_TRUE(ultCsr.isMadeResident(cmdBufferAllocation));
}
} // namespace ult
} // namespace L0