feature: support SVM heap in reserveVirtualMem

Related-To: NEO-11981

Signed-off-by: Wenbin Lu <wenbin.lu@intel.com>
This commit is contained in:
Wenbin Lu
2024-09-09 19:54:52 +00:00
committed by Compute-Runtime-Automation
parent e30b8c0300
commit bfaeeb01d6
18 changed files with 518 additions and 30 deletions

View File

@@ -40,7 +40,6 @@
#include "shared/source/os_interface/windows/wddm_allocation.h"
#include "shared/source/os_interface/windows/wddm_residency_allocations_container.h"
#include "shared/source/os_interface/windows/wddm_residency_controller.h"
#include "shared/source/release_helper/release_helper.h"
#include <algorithm>
#include <emmintrin.h>
@@ -74,6 +73,7 @@ WddmMemoryManager::WddmMemoryManager(ExecutionEnvironment &executionEnvironment)
if (customAlignment > 0) {
alignmentSelector.addCandidateAlignment(customAlignment, false, AlignmentSelector::anyWastage);
}
osMemory = OSMemory::create();
initialized = true;
}
@@ -1025,6 +1025,15 @@ void WddmMemoryManager::freeGpuAddress(AddressRange addressRange, uint32_t rootD
getWddm(rootDeviceIndex).freeGpuVirtualAddress(addressRange.address, addressRange.size);
}
AddressRange WddmMemoryManager::reserveCpuAddress(const uint64_t requiredStartAddress, size_t size) {
void *ptr = osMemory->osReserveCpuAddressRange(addrToPtr(requiredStartAddress), size, false);
return {castToUint64(ptr), size};
}
void WddmMemoryManager::freeCpuAddress(AddressRange addressRange) {
osMemory->osReleaseCpuAddressRange(addrToPtr(addressRange.address), addressRange.size);
}
bool WddmMemoryManager::mapGpuVaForOneHandleAllocation(WddmAllocation *allocation, const void *preferredGpuVirtualAddress) {
D3DGPU_VIRTUAL_ADDRESS addressToMap = castToUint64(preferredGpuVirtualAddress);
auto heapIndex = selectHeap(allocation, preferredGpuVirtualAddress != nullptr, is32bit || executionEnvironment.rootDeviceEnvironments[allocation->getRootDeviceIndex()]->isFullRangeSvm(), allocation->isAllocInFrontWindowPool());