mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 05:35:19 +08:00
Use base pointer when looking for peer allocations
Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
64ca4b3456
commit
e5415dad5d
@@ -1658,7 +1658,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendBlitFill(void *ptr,
|
||||
auto allocData = driverHandle->getSvmAllocsManager()->getSVMAlloc(ptr);
|
||||
if (driverHandle->isRemoteResourceNeeded(ptr, gpuAllocation, allocData, device)) {
|
||||
if (allocData) {
|
||||
gpuAllocation = driverHandle->getPeerAllocation(device, allocData, ptr, nullptr);
|
||||
uint64_t pbase = allocData->gpuAllocations.getDefaultGraphicsAllocation()->getGpuAddress();
|
||||
gpuAllocation = driverHandle->getPeerAllocation(device, allocData, reinterpret_cast<void *>(pbase), nullptr);
|
||||
}
|
||||
if (gpuAllocation == nullptr) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
@@ -1794,7 +1795,7 @@ inline AlignedAllocationData CommandListCoreFamily<gfxCoreFamily>::getAlignedAll
|
||||
uint64_t pbase = allocData->gpuAllocations.getDefaultGraphicsAllocation()->getGpuAddress();
|
||||
uint64_t offset = sourcePtr - pbase;
|
||||
|
||||
alloc = driverHandle->getPeerAllocation(device, allocData, const_cast<void *>(buffer), &alignedPtr);
|
||||
alloc = driverHandle->getPeerAllocation(device, allocData, reinterpret_cast<void *>(pbase), &alignedPtr);
|
||||
alignedPtr += offset;
|
||||
} else {
|
||||
alignedPtr = sourcePtr;
|
||||
|
||||
@@ -444,7 +444,7 @@ void *DriverHandleImp::importFdHandle(ze_device_handle_t hDevice, ze_ipc_memory_
|
||||
|
||||
NEO::GraphicsAllocation *DriverHandleImp::getPeerAllocation(Device *device,
|
||||
NEO::SvmAllocationData *allocData,
|
||||
void *ptr,
|
||||
void *basePtr,
|
||||
uintptr_t *peerGpuAddress) {
|
||||
if (NEO::DebugManager.flags.EnableCrossDeviceAccess.get() == 0) {
|
||||
return nullptr;
|
||||
@@ -458,7 +458,7 @@ NEO::GraphicsAllocation *DriverHandleImp::getPeerAllocation(Device *device,
|
||||
|
||||
std::unique_lock<NEO::SpinLock> lock(deviceImp->peerAllocationsMutex);
|
||||
|
||||
auto iter = deviceImp->peerAllocations.allocations.find(ptr);
|
||||
auto iter = deviceImp->peerAllocations.allocations.find(basePtr);
|
||||
if (iter != deviceImp->peerAllocations.allocations.end()) {
|
||||
peerAllocData = &iter->second;
|
||||
alloc = peerAllocData->gpuAllocations.getDefaultGraphicsAllocation();
|
||||
@@ -476,7 +476,7 @@ NEO::GraphicsAllocation *DriverHandleImp::getPeerAllocation(Device *device,
|
||||
}
|
||||
|
||||
peerAllocData = this->getSvmAllocsManager()->getSVMAlloc(peerPtr);
|
||||
deviceImp->peerAllocations.allocations.insert(std::make_pair(ptr, *peerAllocData));
|
||||
deviceImp->peerAllocations.allocations.insert(std::make_pair(basePtr, *peerAllocData));
|
||||
}
|
||||
|
||||
if (peerGpuAddress) {
|
||||
|
||||
@@ -63,7 +63,7 @@ struct DriverHandleImp : public DriverHandle {
|
||||
uintptr_t *gpuAddress) override;
|
||||
NEO::GraphicsAllocation *getPeerAllocation(Device *device,
|
||||
NEO::SvmAllocationData *allocData,
|
||||
void *ptr,
|
||||
void *basePtr,
|
||||
uintptr_t *peerGpuAddress);
|
||||
void createHostPointerManager();
|
||||
void sortNeoDevices(std::vector<std::unique_ptr<NEO::Device>> &neoDevices);
|
||||
|
||||
@@ -623,7 +623,7 @@ ze_result_t KernelImp::setArgBuffer(uint32_t argIndex, size_t argSize, const voi
|
||||
uint64_t pbase = allocData->gpuAllocations.getDefaultGraphicsAllocation()->getGpuAddress();
|
||||
uint64_t offset = (uint64_t)requestedAddress - pbase;
|
||||
|
||||
alloc = driverHandle->getPeerAllocation(device, allocData, requestedAddress, &gpuAddress);
|
||||
alloc = driverHandle->getPeerAllocation(device, allocData, reinterpret_cast<void *>(pbase), &gpuAddress);
|
||||
if (alloc == nullptr) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user