From 31aa18f1a9bd9ebb711c4b28b6ec5dea619d2999 Mon Sep 17 00:00:00 2001 From: Satyanvesh Dittakavi Date: Thu, 13 Jan 2022 14:04:42 +0000 Subject: [PATCH] SWDEV-317716 - Add uuid in device info structure Change-Id: Ie7f48d0faf7d722bd9bb8bd0f8962a7832dbe4f6 [ROCm/clr commit: 824704c87b98db64609af81727ccd108fabc2166] --- projects/clr/rocclr/device/device.hpp | 3 ++- projects/clr/rocclr/device/rocm/rocdevice.cpp | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/projects/clr/rocclr/device/device.hpp b/projects/clr/rocclr/device/device.hpp index f884184381..e73ef62452 100644 --- a/projects/clr/rocclr/device/device.hpp +++ b/projects/clr/rocclr/device/device.hpp @@ -571,7 +571,8 @@ struct Info : public amd::EmbeddedObject { uint32_t pcieRevisionId_; //! ASIC Revision uint32_t asicRevision_; - + //! Returns the unique identifier for the device + char uuid_[16]; //! Max numbers of threads per CU uint32_t maxThreadsPerCU_; diff --git a/projects/clr/rocclr/device/rocm/rocdevice.cpp b/projects/clr/rocclr/device/rocm/rocdevice.cpp index d3c11f6fc0..f16f4700c3 100644 --- a/projects/clr/rocclr/device/rocm/rocdevice.cpp +++ b/projects/clr/rocclr/device/rocm/rocdevice.cpp @@ -1075,6 +1075,17 @@ bool Device::populateOCLDeviceConstants() { ::strncpy(info_.boardName_, device_name, sizeof(info_.boardName_) - 1); } + char unique_id[32] = {0}; + if (HSA_STATUS_SUCCESS == + hsa_agent_get_info(_bkendDevice, static_cast(HSA_AMD_AGENT_INFO_UUID), + unique_id)) { + // ROCr gives the UUID info in the format GPU-XXXX with length 20 bytes + // Strip the first 4 bytes and store only the 16 bytes representing UUID + for (size_t i = 0; i < 16; i++) { + info_.uuid_[i] = unique_id[i+4]; + } + } + if (HSA_STATUS_SUCCESS != hsa_agent_get_info(_bkendDevice, (hsa_agent_info_t)HSA_AMD_AGENT_INFO_COOPERATIVE_COMPUTE_UNIT_COUNT,