refactor: extract method for getting CB peer device allocation

Signed-off-by: Naklicki, Mateusz <mateusz.naklicki@intel.com>
This commit is contained in:
Naklicki, Mateusz
2025-03-20 17:51:39 +00:00
committed by Compute-Runtime-Automation
parent 1d07198a4c
commit 890e5c4a5a
4 changed files with 74 additions and 10 deletions

View File

@@ -393,6 +393,7 @@ struct CommandListCoreFamily : public CommandListImp {
bool isCopyOffloadAllowed(const NEO::GraphicsAllocation &srcAllocation, const NEO::GraphicsAllocation &dstAllocation) const;
void setAdditionalKernelLaunchParams(CmdListKernelLaunchParams &launchParams, Kernel &kernel) const;
void dispatchInOrderPostOperationBarrier(Event *signalOperation, bool dcFlushRequired, bool copyOperation);
NEO::GraphicsAllocation *getDeviceCounterAllocForResidency(NEO::GraphicsAllocation *counterDeviceAlloc);
NEO::InOrderPatchCommandsContainer<GfxFamily> inOrderPatchCmds;

View File

@@ -2647,6 +2647,20 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendSignalEvent(ze_event_han
return ZE_RESULT_SUCCESS;
}
template <GFXCORE_FAMILY gfxCoreFamily>
NEO::GraphicsAllocation *CommandListCoreFamily<gfxCoreFamily>::getDeviceCounterAllocForResidency(NEO::GraphicsAllocation *counterDeviceAlloc) {
NEO::GraphicsAllocation *counterDeviceAllocForResidency = counterDeviceAlloc;
if (counterDeviceAllocForResidency && (counterDeviceAllocForResidency->getRootDeviceIndex() != device->getRootDeviceIndex())) {
DriverHandleImp *driverHandle = static_cast<DriverHandleImp *>(device->getDriverHandle());
counterDeviceAllocForResidency = driverHandle->getCounterPeerAllocation(device, *counterDeviceAllocForResidency);
UNRECOVERABLE_IF(!counterDeviceAllocForResidency);
UNRECOVERABLE_IF(counterDeviceAllocForResidency->getGpuAddress() != counterDeviceAlloc->getGpuAddress());
}
return counterDeviceAllocForResidency;
}
template <GFXCORE_FAMILY gfxCoreFamily>
void CommandListCoreFamily<gfxCoreFamily>::appendWaitOnInOrderDependency(std::shared_ptr<NEO::InOrderExecInfo> &inOrderExecInfo, CommandToPatchContainer *outListCommands,
uint64_t waitValue, uint32_t offset, bool relaxedOrderingAllowed, bool implicitDependency, bool skipAddingWaitEventsToResidency,
@@ -2655,16 +2669,7 @@ void CommandListCoreFamily<gfxCoreFamily>::appendWaitOnInOrderDependency(std::sh
UNRECOVERABLE_IF(waitValue > static_cast<uint64_t>(std::numeric_limits<uint32_t>::max()) && !isQwordInOrderCounter());
auto deviceAllocForResidency = inOrderExecInfo->getDeviceCounterAllocation();
if (deviceAllocForResidency && (deviceAllocForResidency->getRootDeviceIndex() != device->getRootDeviceIndex())) {
DriverHandleImp *driverHandle = static_cast<DriverHandleImp *>(device->getDriverHandle());
deviceAllocForResidency = driverHandle->getCounterPeerAllocation(device, *deviceAllocForResidency);
UNRECOVERABLE_IF(!deviceAllocForResidency);
UNRECOVERABLE_IF(deviceAllocForResidency->getGpuAddress() != inOrderExecInfo->getDeviceCounterAllocation()->getGpuAddress());
}
auto deviceAllocForResidency = this->getDeviceCounterAllocForResidency(inOrderExecInfo->getDeviceCounterAllocation());
if (!skipAddingWaitEventsToResidency) {
commandContainer.addToResidencyContainer(deviceAllocForResidency);
}