Pass canonized gpuAddress in setCpuPtrAndGpuAddress

Related-To: NEO-6523
Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
Krzysztof Gibala
2022-06-06 20:34:20 +00:00
committed by Compute-Runtime-Automation
parent c51ce2a35c
commit 77dde01503
13 changed files with 90 additions and 35 deletions

View File

@@ -85,9 +85,9 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
void *getDriverAllocatedCpuPtr() const { return driverAllocatedCpuPointer; }
void setDriverAllocatedCpuPtr(void *allocatedCpuPtr) { driverAllocatedCpuPointer = allocatedCpuPtr; }
void setCpuPtrAndGpuAddress(void *cpuPtr, uint64_t gpuAddress) {
void setCpuPtrAndGpuAddress(void *cpuPtr, uint64_t canonizedGpuAddress) {
this->cpuPtr = cpuPtr;
this->gpuAddress = GmmHelper::canonize(gpuAddress);
this->gpuAddress = canonizedGpuAddress;
}
size_t getUnderlyingBufferSize() const { return size; }
void setSize(size_t size) { this->size = size; }

View File

@@ -98,7 +98,10 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryWithAlignment
}
memoryAllocation->setReservedAddressRange(gpuPtr, reserveSize);
gpuPtr = alignUp(gpuPtr, alignment);
memoryAllocation->setCpuPtrAndGpuAddress(ptr, reinterpret_cast<uint64_t>(gpuPtr));
auto gmmHelper = getGmmHelper(allocationData.rootDeviceIndex);
auto canonizedGpuAddress = gmmHelper->canonize(reinterpret_cast<uint64_t>(gpuPtr));
memoryAllocation->setCpuPtrAndGpuAddress(ptr, canonizedGpuAddress);
}
if (allocationData.type == AllocationType::DEBUG_CONTEXT_SAVE_AREA ||
@@ -144,7 +147,10 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryForNonSvmHost
GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryWithGpuVa(const AllocationData &allocationData) {
auto memoryAllocation = static_cast<MemoryAllocation *>(allocateGraphicsMemoryWithAlignment(allocationData));
memoryAllocation->setCpuPtrAndGpuAddress(memoryAllocation->getUnderlyingBuffer(), allocationData.gpuAddress);
auto gmmHelper = getGmmHelper(allocationData.rootDeviceIndex);
auto canonizedGpuAddress = gmmHelper->canonize(allocationData.gpuAddress);
memoryAllocation->setCpuPtrAndGpuAddress(memoryAllocation->getUnderlyingBuffer(), canonizedGpuAddress);
return memoryAllocation;
}