diff --git a/projects/clr/rocclr/device/rocm/rocdevice.cpp b/projects/clr/rocclr/device/rocm/rocdevice.cpp index 091f1814a5..ff5eebc005 100644 --- a/projects/clr/rocclr/device/rocm/rocdevice.cpp +++ b/projects/clr/rocclr/device/rocm/rocdevice.cpp @@ -503,11 +503,28 @@ bool Device::init() { if (end == std::string::npos) { end = ordinals.size(); } - std::string strIndex = ordinals.substr(pos, end - pos); - int index = atoi(strIndex.c_str()); + std::string str_id = ordinals.substr(pos, end - pos); + // If Uuid is specified, then convert it to index + // Uuid is an Ascii string with a maximum of 21 chars including NULL + // The string value is in the format GPU-
, encodes UUID as a 16 chars hex + if (str_id.find("GPU-") != std::string::npos) { + for (int i = 0; i < gpu_agents_.size(); i++) { + auto agent = gpu_agents_[i]; + char unique_id[32] = {0}; + if (HSA_STATUS_SUCCESS == + hsa_agent_get_info(agent, static_cast