wsl/libhsakmt: move handle aperture from device to thunk runtime

In multi-GPU, handle aperture is shared between all GPUs, not belongs to
specific one GPU, so move it from wddm device (which presents a specific GPU)
to thunk runtime which has gloable view, can manage handle aperture for all GPUs.

Reviewed-by: Flora Cui <flora.cui@amd.com>
Signed-off-by: tiancyin <tianci.yin@amd.com>
This commit is contained in:
tiancyin
2025-07-02 13:41:57 +08:00
committed by Frank Min
parent 8e07aca2ae
commit f8d1663b39
4 changed files with 81 additions and 60 deletions
+3 -3
View File
@@ -49,7 +49,7 @@ GpuMemory::~GpuMemory() {
FreeGpuVirtualAddress(GpuAddress(), Size());
FreePhysicalMemory();
if (desc_.handle_ape_addr > 0)
device_->HandleApertureFree(desc_.handle_ape_addr);
dxg_runtime->HandleApertureFree(desc_.handle_ape_addr);
}
ErrorCode GpuMemory::Init(const GpuMemoryCreateInfo &create_info) {
@@ -92,7 +92,7 @@ ErrorCode GpuMemory::Init(const GpuMemoryCreateInfo &create_info) {
if (IsPhysicalOnly()) {
code = CreatePhysicalMemory();
if (code == ErrorCode::Success)
code = device_->HandleApertureAlloc(desc_.size, &desc_.handle_ape_addr);
code = dxg_runtime->HandleApertureAlloc(desc_.size, &desc_.handle_ape_addr);
return code;
}
@@ -576,7 +576,7 @@ ErrorCode GpuMemory::ImportPhysicalHandle(const GpuMemoryCreateInfo &create_info
return ret;
} else {
desc_.flags.is_imported_vram_vmem = 1;
return device_->HandleApertureAlloc(desc_.size, &desc_.handle_ape_addr);
return dxg_runtime->HandleApertureAlloc(desc_.size, &desc_.handle_ape_addr);
}
}
}