Flora Cui
e99fcfee51
wsl/libhsakmt: remove redundant PAGE_SHIFT
...
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/95 >
2025-11-05 18:53:37 +08:00
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
237377aa02
wsl/libhsakmt: refactor ipc implementation
...
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/85 >
2025-11-05 18:53:36 +08:00
Flora Cui
77093f8f85
wsl/libhsakmt: extract is_ipc_sysmemfd()
...
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/85 >
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
Flora Cui
006ee57aa3
wsl/libhsakmt: add get_num_wddmdev()
...
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
f4390637fb
wsl/hsakmt: implement ipc signal
...
IPC Signal only support sys ram backend and CPU&GPU both accessible,
IPC Memory only support vram backend and only GPU accessible.
Reviewed-by: Flora Cui <flora.cui@amd.com >
Signed-off-by: tiancyin <tianci.yin@amd.com >
2025-11-05 18:53:35 +08:00
tiancyin
390708c594
wsl/hsakmt: implement ipc mem of rocr non-legacy mode
...
The legacy mode means buffer sharing through KFD, KFD provide a buffer
id to exporter, exporter pass it to importer, importer pass buffer id
to KFD to query and import this buffer.
The non-legcay mode relys on socket to pass dmabuf fd between processes.
In hsa-runtime, the legcay mode is the default mode, setting environment
variable HSA_ENABLE_IPC_MODE_LEGACY to 0 can force hsa-runtime to new
mode code path.
Reviewed-by: Flora Cui <flora.cui@amd.com >
Reviewed-by: Longlong Yao <Longlong.Yao@amd.com >
Signed-off-by: tiancyin <tianci.yin@amd.com >
2025-11-05 18:53:35 +08:00
Flora Cui
5db21f53da
wsl/hsakmt: add get_gpu_mem()
...
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/28 >
2025-11-05 18:53:35 +08:00
Longlong Yao
3c3af5c586
wsl/hsakmt: check hsakmt_is_dgpu for hsakmt
...
To align with Native Linux, use NumCPUCores in GPU and
NumFComputeCores in CPU to determine if the asic is dGPU.
This value is only for libhsakmt internal use.
Reviewed-by: Flora Cui <flora.cui@amd.com >
Signed-off-by: Longlong Yao <Longlong.Yao@amd.com >
Part-of: <http://10.67.69.192/wsl/rocr-runtime/-/merge_requests/18 >
2025-11-05 18:53:35 +08:00
Flora Cui
7734c0baad
wsl/hsakmt: move src/inc to include/impl
...
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/15 >
2025-11-05 18:53:35 +08:00
Flora Cui
9f5bda00ca
wsl/hsakmt: refactor topology related code
...
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/13 >
2025-11-05 18:53:35 +08:00
tiancyin
0fae2bb262
wsl/hsakmt: add supporting contiguous memory allocation
...
Reviewed-by: Longlong Yao <Longlong.Yao@amd.com >
Signed-off-by: tiancyin <tianci.yin@amd.com >
2025-11-05 18:53:35 +08:00
Flora Cui
31e133ae49
wsl/hsakmt: drop duplicated MIN&MAX
...
Signed-off-by: Flora Cui <flora.cui@amd.com >
Reviewed-by: lyndonli <Lyndon.Li@amd.com >
Part-of: <http://10.67.69.192/wsl/rocr-runtime/-/merge_requests/5 >
2025-11-05 18:53:35 +08:00
tiancyin
820f24b4df
wsl/hsakmt: make hsaKmtImportDMABufHandle as internal interface
...
Reviewed-by: Flora Cui <flora.cui@amd.com >
Signed-off-by: tiancyin <tianci.yin@amd.com >
2025-11-05 18:53:35 +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
Flora Cui
b062a23dfa
wsl/hsakmt: add mem flag to protect queue cmd buffer
...
Signed-off-by: Flora Cui <flora.cui@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
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
bc9b11d754
wsl/hsakmt: Remove pre-allocation free memory check
...
This change removes the check for sufficient free memory before allocation.
The previous check could cause performance degradation. Reserving a portion
of system memory helps prevent system hangs due to insufficient memory.
However, if free memory is still insufficient, memory allocation may still
lead to system hangs.
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/10 >
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
Longlong Yao
ccb3950068
wsl/hsakmt: clean up namespace
...
Signed-off-by: Longlong Yao <Longlong.Yao@amd.com >
Reviewed-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/7 >
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