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>
This commit is contained in:
Flora Cui
2025-06-30 13:50:50 +08:00
committed by Frank Min
orang tua b3c685585e
melakukan 67332944d2
3 mengubah file dengan 13 tambahan dan 1 penghapusan
+3 -1
Melihat File
@@ -59,7 +59,8 @@ struct hsakmtRuntime {
vendor_packet_process(0),
check_avail_sysram(false),
max_single_alloc_size(0),
enable_thunk_sub_allocator(0) {}
enable_thunk_sub_allocator(0),
default_node(1) {}
pthread_mutex_t hsakmt_mutex;
const char *dxg_device_name = "/dev/dxg";
@@ -77,6 +78,7 @@ struct hsakmtRuntime {
bool check_avail_sysram;
size_t max_single_alloc_size;
int enable_thunk_sub_allocator;
uint32_t default_node;
};
extern hsakmtRuntime *dxg_runtime;
+8
Melihat File
@@ -116,6 +116,14 @@ static HSAKMT_STATUS init_vars_from_env(void) {
if (envvar)
dxg_runtime->enable_thunk_sub_allocator = atoi(envvar);
envvar = getenv("ROCR_VISIBLE_DEVICES");
if (envvar) {
std::string devices(envvar);
size_t first_num_pos = devices.find_first_of("0123456789");
if (first_num_pos != std::string::npos)
dxg_runtime->default_node = std::stoi(devices.substr(first_num_pos)) + 1;
}
return HSAKMT_STATUS_SUCCESS;
}
+2
Melihat File
@@ -384,6 +384,8 @@ HSAKMT_STATUS topology_sysfs_get_system_props(HsaSystemProperties& props) {
dxg_topology->wdevices_.push_back(device);
}
props.NumNodes = dxg_topology->num_sysfs_nodes;
if (dxg_runtime->default_node > num_adapters)
dxg_runtime->default_node = num_adapters;
delete[] adapters;
return ret;