Add support for USM shared in WSL for dGPU

This patch force KMD allocation path for USM host allocation
and also for host part of USM shared allocation

Related-To: NEO-6913
Signed-off-by: Kamil Diedrich <kamil.diedrich@intel.com>
This commit is contained in:
Kamil Diedrich
2022-10-20 08:59:02 +02:00
committed by Compute-Runtime-Automation
parent 90bc1a69d2
commit 1044a8aeee
5 changed files with 146 additions and 4 deletions

View File

@@ -146,7 +146,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryUsingKmdAndMapItToC
[[maybe_unused]] auto status = true;
if (executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getHardwareInfo()->capabilityTable.gpuAddressSpace >= MemoryConstants::max64BitAppAddress || is32bit) {
if (((preferredAllocationMethod == GfxMemoryAllocationMethod::UseUmdSystemPtr || allocationData.type != NEO::AllocationType::SVM_CPU) && executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getHardwareInfo()->capabilityTable.gpuAddressSpace >= MemoryConstants::max64BitAppAddress) || is32bit) {
status = mapGpuVirtualAddress(wddmAllocation.get(), cpuPtr);
} else {
status = mapGpuVirtualAddress(wddmAllocation.get(), nullptr);
@@ -224,7 +224,7 @@ GraphicsAllocation *WddmMemoryManager::allocateUSMHostGraphicsMemory(const Alloc
GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryWithAlignment(const AllocationData &allocationData) {
auto pageSize = NEO::OSInterface::osEnabled64kbPages ? MemoryConstants::pageSize64k : MemoryConstants::pageSize;
bool requiresNonStandardAlignment = allocationData.alignment > pageSize;
if ((preferredAllocationMethod == GfxMemoryAllocationMethod::UseUmdSystemPtr) || requiresNonStandardAlignment) {
if ((preferredAllocationMethod == GfxMemoryAllocationMethod::UseUmdSystemPtr) || (requiresNonStandardAlignment && allocationData.type != NEO::AllocationType::SVM_CPU)) {
return allocateSystemMemoryAndCreateGraphicsAllocationFromIt(allocationData);
} else {
return allocateGraphicsMemoryUsingKmdAndMapItToCpuVA(allocationData, NEO::OSInterface::osEnabled64kbPages);

View File

@@ -107,7 +107,7 @@ class WddmMemoryManager : public MemoryManager {
GraphicsAllocation *createAllocationFromHandle(osHandle handle, bool requireSpecificBitness, bool ntHandle, AllocationType allocationType, uint32_t rootDeviceIndex);
static bool validateAllocation(WddmAllocation *alloc);
MOCKABLE_VIRTUAL bool createWddmAllocation(WddmAllocation *allocation, void *requiredGpuPtr);
bool mapGpuVirtualAddress(WddmAllocation *graphicsAllocation, const void *requiredGpuPtr);
MOCKABLE_VIRTUAL bool mapGpuVirtualAddress(WddmAllocation *graphicsAllocation, const void *requiredGpuPtr);
bool mapGpuVaForOneHandleAllocation(WddmAllocation *graphicsAllocation, const void *requiredGpuPtr);
bool mapMultiHandleAllocationWithRetry(WddmAllocation *allocation, const void *requiredGpuPtr);
bool createGpuAllocationsWithRetry(WddmAllocation *graphicsAllocation);