Commit Graph

21 Commits

Author SHA1 Message Date
tiancyin ccc3849de8 wsl/libhsakmt: move IPC functions from device to thunk runtime
IPC use system memory, it has nothing to do with wddm device.

Reviewed-by: Flora Cui <flora.cui@amd.com>
Signed-off-by: tiancyin <tianci.yin@amd.com>
2025-11-05 18:53:37 +08:00
tiancyin 8c6a4d59d4 wsl/libhsakmt: move ReserveGpuVirtualAddress from device to thunk runtime
For multi-GPU supporting, local heap and system heap managers are
implemented in thunk runtime, so the heap allocation function
ReserveGpuVirtualAddress should be moved to runtime too.

Reviewed-by: Flora Cui <flora.cui@amd.com>
Signed-off-by: tiancyin <tianci.yin@amd.com>
2025-11-05 18:53:37 +08:00
tiancyin f8d1663b39 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>
2025-11-05 18:53:36 +08:00
tiancyin 8e07aca2ae wsl/libhsakmt: move system heap from device to thunk runtime
In multi-GPU, system heap space 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 system heap for all GPUs.

Introduce a new va_Mgr instance to manage system heap, since local heap
and system heap both comply with SVM(Shared Virtual Memory), without
this new mgr, every allocation has to call KMD at least once (each GPU
needs a call) to allocate GPU VA, the new mgr manage the space itself,
no longer call KMD.

Reviewed-by: Flora Cui <flora.cui@amd.com>
Signed-off-by: tiancyin <tianci.yin@amd.com>
2025-11-05 18:53:36 +08:00
tiancyin d5eb871bbb wsl/libhsakmt: move local heap and va_Mgr from device to thunk runtime
In multi-GPU, local heap space 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 local heap for all GPUs.

Reviewed-by: Flora Cui <flora.cui@amd.com>
Signed-off-by: tiancyin <tianci.yin@amd.com>
2025-11-05 18:53:36 +08:00
Flora Cui 67332944d2 wsl/libhsakmt: set default node
Signed-off-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Tianci Yin <tianci.yin@amd.com>
Part-of: <http://10.67.69.192/wsl/rocr-runtime/-/merge_requests/82>
2025-11-05 18:53:36 +08:00
Chengjun Yao 872476061a wsl/hsakmt: remove unessary struct _HsaVersionCapability
Signed-off-by: Chengjun Yao <Chengjun.Yao@amd.com>
Reviewed-by: Horatio Zhang <Hongkun.Zhang@amd.com>
Part-of: <http://10.67.69.192/wsl/rocr-runtime/-/merge_requests/73>
2025-11-05 18:53:36 +08:00
Flora Cui aff8e508df wsl/libhsakmt: move PAGE_SIZE/SHIFT to static global var
Signed-off-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Tianci Yin <tianci.yin@amd.com>
Part-of: <http://10.67.69.192/wsl/rocr-runtime/-/merge_requests/68>
2025-11-05 18:53:36 +08:00
Flora Cui e98a872650 wsl/libhsakmt/openclose: Dynamically allocate static global memory
Signed-off-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Tianci Yin <tianci.yin@amd.com>
Part-of: <http://10.67.69.192/wsl/rocr-runtime/-/merge_requests/68>
2025-11-05 18:53:36 +08:00
Shi.Leslie c3e8645230 wsl/hsakmt: Disable thunk sub-allocator by default
Signed-off-by: Shi.Leslie <Yuliang.Shi@amd.com>
Reviewed-by: Longlong Yao Longlong.Yao@amd.com
2025-11-05 18:53:36 +08:00
tiancyin b4df74f198 wsl/hsakmt: add sub-allocator
Reviewed-by: Shane Xiao <shane.xiao@amd.com>
Reviewed-by: lyndonli <Lyndon.Li@amd.com>
Signed-off-by: tiancyin <tianci.yin@amd.com>
2025-11-05 18:53:35 +08:00
Horatio Zhang f648688c45 wsl/hsakmt: Refactor logging function
Signed-off-by: Horatio Zhang <Hongkun.Zhang@amd.com>
Reviewed-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Shane Xiao <shane.xiao@amd.com>
Part-of: <http://10.67.69.192/wsl/libhsakmt/-/merge_requests/40>
2025-11-05 18:53:35 +08:00
Flora Cui 954807feff wsl/hsakmt: rename vendor_packet_support
to vendor_packet_process.
:1 process vender specific packet (acquire_mem, handle signal, update
rptr)
:0 skip vender specific packet (handle signal by cpu, update rptr by
gpu)

Signed-off-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Longlong Yao <Longlong.Yao@amd.com>
Part-of: <http://10.67.69.192/wsl/libhsakmt/-/merge_requests/35>
2025-11-05 18:53:35 +08:00
lyndonli c898104228 wsl/hsakmt: Introduce WSL_CHECK_AVAIL_SYSRAM environment variable
By default, this variable is 0. Set it to 1 to compare available
system memory with the requested amount before allocation. It helps
identify system hangs caused by excessive memory allocation.

Signed-off-by: lyndonli <Lyndon.Li@amd.com>
Reviewed-by: Flora Cui <flora.cui@amd.com>
Part-of: <http://10.67.69.192/wsl/libhsakmt/-/merge_requests/32>
2025-11-05 18:53:35 +08:00
Flora Cui 8663eeaa34 wsl: drop libdrm dependency
Signed-off-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Shi.Leslie <Yuliang.Shi@amd.com>
Part-of: <http://10.67.69.192/wsl/rocr-runtime/-/merge_requests/2>

wsl/libhsakmt: move drm headers to dedicated directory

to maintain a clean and organized codebase.

Signed-off-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Horatio Zhang <Hongkun.Zhang@amd.com>
Part-of: <http://10.67.69.192/wsl/rocr-runtime/-/merge_requests/3>
2025-11-05 18:53:35 +08:00
Flora Cui fa22e6a530 wsl/hsakmt: drop dlsym for hsa symbols
Signed-off-by: Flora Cui <flora.cui@amd.com>
2025-11-05 18:53:35 +08:00
tiancyin b5fb17fd66 wsl/hsakmt: implement drm interfaces for dropping libdrm*
Signed-off-by: tiancyin <tianci.yin@amd.com>
2025-11-05 18:53:35 +08:00
Horatio Zhang c7b5ff64e3 wsl/hsakmt: Remove fn_amdgpu_device_get_fd in openclose.cpp
There are already relevant implementations in this patch
dcf0fa2 ("wsl/thunk: implement drm interfaces for dropping libdrm*")

Signed-off-by: Horatio Zhang <Hongkun.Zhang@amd.com>
Reviewed-by: Flora Cui <flora.cui@amd.com>
Part-of: <http://10.67.69.192/wsl/libhsakmt/-/merge_requests/37>
2025-11-05 18:53:35 +08:00
Longlong Yao f402bf55eb wsl/hsakmt: add VendorPacket to VersionCapInfo
Provide the query for hsa-runtime to decide whether dispatch
vendor packet to wsl-thunk

Signed-off-by: Longlong Yao <Longlong.Yao@amd.com>
Reviewed-by: Flora Cui <flora.cui@amd.com>
Part-of: <http://10.67.69.192/wsl/libhsakmt/-/merge_requests/30>
2025-11-05 18:53:35 +08:00
lyndonli b4b0b54c79 wsl/hsakmt: Add clear_allocation_map
If fork() is called, clear allocation map
that is invalid in the child process.

Signed-off-by: lyndonli <Lyndon.Li@amd.com>
Reviewed-by: Shi.Leslie Yuliang.Shi@amd.com
Part-of: <http://10.67.69.192/wsl/libhsakmt/-/merge_requests/3>
2025-11-05 18:53:35 +08:00
Flora Cui 79a63cf292 wsl/hsakmt: initial commit
Signed-off-by: lyndonli <Lyndon.Li@amd.com>
Signed-off-by: Horatio Zhang <Hongkun.Zhang@amd.com>
Signed-off-by: Shi.Leslie <Yuliang.Shi@amd.com>
Signed-off-by: LonglongYao <Longlong.Yao@amd.com>
Signed-off-by: tiancyin <tianci.yin@amd.com>
Signed-off-by: Frank Min <Frank.Min@amd.com>
Signed-off-by: Aaron Liu <aaron.liu@amd.com>
Signed-off-by: Shane Xiao <shane.xiao@amd.com>
Signed-off-by: Lang Yu <lang.yu@amd.com>
Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Ruili Ji <ruiliji2@amd.com>
Signed-off-by: Qiang Yu <qiang.yu@amd.com>
Signed-off-by: Flora Cui <flora.cui@amd.com>
2025-11-05 18:53:15 +08:00