From c6b1707d0eea8c94b2d9f2e8697c5e56c846c2b6 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Wed, 7 Dec 2022 03:17:11 +0000 Subject: [PATCH 01/75] Add fields for CP firmware and SDMA engine ucode Change-Id: I796b5a1c1e8be7fedda6207bcb740e3956aef8b2 --- rocminfo.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/rocminfo.cc b/rocminfo.cc index 8ed9111..a6b4663 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -135,6 +135,8 @@ struct agent_info_t { uint16_t workgroup_max_dim[3]; uint16_t bdf_id; bool fast_f16; + uint32_t pkt_processor_ucode_ver; + uint32_t sdma_ucode_ver; }; // This structure holds memory pool information acquired through hsa info @@ -492,6 +494,15 @@ AcquireAgentInfo(hsa_agent_t agent, agent_info_t *agent_i) { (hsa_agent_info_t)HSA_AMD_AGENT_INFO_MAX_WAVES_PER_CU, &agent_i->max_waves_per_cu); RET_IF_HSA_ERR(err); + + err = hsa_agent_get_info(agent, + (hsa_agent_info_t)HSA_AMD_AGENT_INFO_UCODE_VERSION, + &agent_i->pkt_processor_ucode_ver); + RET_IF_HSA_ERR(err); + err = hsa_agent_get_info(agent, + (hsa_agent_info_t)HSA_AMD_AGENT_INFO_SDMA_UCODE_VERSION, + &agent_i->sdma_ucode_ver); + RET_IF_HSA_ERR(err); } return err; } @@ -627,6 +638,9 @@ static void DisplayAgentInfo(agent_info_t *agent_i) { printLabelStr("z", int_to_string(agent_i->grid_max_dim.z), 2); printLabelInt("Max fbarriers/Workgrp:", agent_i->fbarrier_max_size, 1); + + printLabelInt("Packet Processor uCode::", agent_i->pkt_processor_ucode_ver, 1); + printLabelInt("SDMA engine uCode::", agent_i->sdma_ucode_ver, 1); } } From 2c92e790f02c281cda82a4ac4564c2772eddd2a7 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 20 Jan 2023 02:56:45 +0000 Subject: [PATCH 02/75] Add display for IOMMU Support Change-Id: I5af127ef1f9c1ae4b3b86b9e38272eb4f032191a --- rocminfo.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rocminfo.cc b/rocminfo.cc index a6b4663..c7bcba4 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -137,6 +137,7 @@ struct agent_info_t { bool fast_f16; uint32_t pkt_processor_ucode_ver; uint32_t sdma_ucode_ver; + hsa_amd_iommu_version_t iommu_support; }; // This structure holds memory pool information acquired through hsa info @@ -503,6 +504,10 @@ AcquireAgentInfo(hsa_agent_t agent, agent_info_t *agent_i) { (hsa_agent_info_t)HSA_AMD_AGENT_INFO_SDMA_UCODE_VERSION, &agent_i->sdma_ucode_ver); RET_IF_HSA_ERR(err); + err = hsa_agent_get_info(agent, + (hsa_agent_info_t)HSA_AMD_AGENT_INFO_IOMMU_SUPPORT, + &agent_i->iommu_support); + RET_IF_HSA_ERR(err); } return err; } @@ -641,6 +646,8 @@ static void DisplayAgentInfo(agent_info_t *agent_i) { printLabelInt("Packet Processor uCode::", agent_i->pkt_processor_ucode_ver, 1); printLabelInt("SDMA engine uCode::", agent_i->sdma_ucode_ver, 1); + printLabelStr("IOMMU Support::", + agent_i->iommu_support == HSA_IOMMU_SUPPORT_V2 ? "V2" : "None", 1); } } From 34cc693befdef50b35ef6f7c739edbb9511ae320 Mon Sep 17 00:00:00 2001 From: Mark Searles Date: Mon, 27 Mar 2023 08:56:00 -0700 Subject: [PATCH 03/75] Fix parsing of rocminfo output for ISAs with no features defined Patch is an internal port of https://github.com/RadeonOpenCompute/rocminfo/pull/59 Change-Id: Iea84f49a60abce73716a7451960c20ee0d2b7bca --- rocm_agent_enumerator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index ceb9e11..b901e47 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -92,7 +92,7 @@ def getGCNISA(line, match_from_beginning = False): return result.group(0) return None -@staticVars(search_name=re.compile("gfx[0-9a-fA-F]+:[-+:\w]+")) +@staticVars(search_name=re.compile("gfx[0-9a-fA-F]+(:[-+:\w]+)?")) def getGCNArchName(line): result = getGCNArchName.search_name.search(line) From eb1283f37734e34b442b1e30e2bb183acf9f82ca Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 21 Feb 2023 14:15:35 +0000 Subject: [PATCH 04/75] Add query for mwaitx support Change-Id: I775234ff570e3cedacd68adb4617e62dce76bd9e --- rocminfo.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rocminfo.cc b/rocminfo.cc index c7bcba4..c5a45b6 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -94,6 +94,7 @@ struct system_info_t { uint64_t max_wait = 0; hsa_endianness_t endianness; hsa_machine_model_t machine_model; + bool mwaitx_enabled; }; // This structure holds agent information acquired through hsa info related @@ -276,6 +277,11 @@ static hsa_status_t AcquireSystemInfo(system_info_t *sys_info) { err = hsa_system_get_info(HSA_SYSTEM_INFO_MACHINE_MODEL, &sys_info->machine_model); RET_IF_HSA_ERR(err); + + // Get mwaitx mode + err = hsa_system_get_info(HSA_AMD_SYSTEM_INFO_MWAITX_ENABLED, + &sys_info->mwaitx_enabled); + RET_IF_HSA_ERR(err); return err; } @@ -301,6 +307,10 @@ static void DisplaySystemInfo(system_info_t const *sys_info) { } else if (HSA_ENDIANNESS_BIG == sys_info->endianness) { printValueStr("BIG"); } + + printLabel("Mwaitx:"); + printf("%s\n", sys_info->mwaitx_enabled ? "ENABLED" : "DISABLED"); + printf("\n"); } From 2d34dc31f280a82b40eb06e2ca364fe102358a1d Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 25 Nov 2022 02:54:37 +0000 Subject: [PATCH 05/75] Add query to check DMABuf support Add query to check whether DMAbuf export is supported on this system Change-Id: I28caa87b67135d67ffcc94695e4656e7b691d259 --- rocminfo.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rocminfo.cc b/rocminfo.cc index c5a45b6..42f6cfd 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -95,6 +95,7 @@ struct system_info_t { hsa_endianness_t endianness; hsa_machine_model_t machine_model; bool mwaitx_enabled; + bool dmabuf_support; }; // This structure holds agent information acquired through hsa info related @@ -281,6 +282,9 @@ static hsa_status_t AcquireSystemInfo(system_info_t *sys_info) { // Get mwaitx mode err = hsa_system_get_info(HSA_AMD_SYSTEM_INFO_MWAITX_ENABLED, &sys_info->mwaitx_enabled); + // Get DMABuf support + err = hsa_system_get_info(HSA_AMD_SYSTEM_INFO_DMABUF_SUPPORTED, + &sys_info->dmabuf_support); RET_IF_HSA_ERR(err); return err; } @@ -311,6 +315,9 @@ static void DisplaySystemInfo(system_info_t const *sys_info) { printLabel("Mwaitx:"); printf("%s\n", sys_info->mwaitx_enabled ? "ENABLED" : "DISABLED"); + printLabel("DMAbuf Support:"); + printf("%s\n", sys_info->dmabuf_support ? "YES" : "NO"); + printf("\n"); } From c8db38ede26422066d0faaf4e736eb6dad9b8529 Mon Sep 17 00:00:00 2001 From: Mark Searles Date: Tue, 30 May 2023 13:19:07 -0700 Subject: [PATCH 06/75] Removing __linux__ definition in CMake Removing this definition as this should already be defined by compiler. This is causing compile errors on newer versions of llvm because the macro is being redefined. Change-Id: I3bf03617970d4b76dabce36ed980523673afadc5 --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cbcf9d0..ce13531 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,7 +123,6 @@ if(${BUILD_TYPE} STREQUAL "Debug") add_definitions(-DDEBUG) endif() -add_definitions(-D__linux__) add_definitions(-DLITTLEENDIAN_CPU=1) # From 3f97bbda930e4931d4b62ef2e7d06dbadd88b75d Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Thu, 20 Jul 2023 18:28:25 -0400 Subject: [PATCH 07/75] Support extended scope fine-grained memory Add display flag for extended scope fine-grained memory Change-Id: I73f965e12a7a68afcd71f93a7b6a1af453de0510 --- rocminfo.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rocminfo.cc b/rocminfo.cc index 42f6cfd..cdf8fd0 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -725,6 +725,11 @@ static void MakeGlobalFlagsString(uint32_t global_flag, std::string* out_str) { flags.push_back("COARSE GRAINED"); } + if (HSA_AMD_MEMORY_POOL_GLOBAL_FLAG_EXTENDED_SCOPE_FINE_GRAINED & global_flag) + { + flags.push_back("EXTENDED FINE GRAINED"); + } + if (flags.size() > 0) { *out_str += flags[0]; } From 23c483ca6580b1ec57b9050d273e5c76f4a749f2 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Mon, 14 Aug 2023 13:15:16 +0000 Subject: [PATCH 08/75] Adding coherent host access query Change-Id: I34030ab193b5e7890cf10c6a0c6ad493ac0e0283 --- rocminfo.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rocminfo.cc b/rocminfo.cc index cdf8fd0..1d6cfbf 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -137,6 +137,7 @@ struct agent_info_t { uint16_t workgroup_max_dim[3]; uint16_t bdf_id; bool fast_f16; + bool coherent_host_access; uint32_t pkt_processor_ucode_ver; uint32_t sdma_ucode_ver; hsa_amd_iommu_version_t iommu_support; @@ -471,6 +472,12 @@ AcquireAgentInfo(hsa_agent_t agent, agent_info_t *agent_i) { &agent_i->compute_unit); RET_IF_HSA_ERR(err); + // Get coherent Host access + err = hsa_agent_get_info(agent, + (hsa_agent_info_t) HSA_AMD_AGENT_INFO_SVM_DIRECT_HOST_ACCESS, + &agent_i->coherent_host_access); + RET_IF_HSA_ERR(err); + // Check if the agent is kernel agent if (agent_i->agent_feature & HSA_AGENT_FEATURE_KERNEL_DISPATCH) { // Get flaf of fast_f16 operation @@ -619,6 +626,9 @@ static void DisplayAgentInfo(agent_info_t *agent_i) { printLabelInt("Shader Arrs. per Eng.:", agent_i->shader_arrs_per_sh_eng, 1); printLabelInt("WatchPts on Addr. Ranges:", agent_i->max_addr_watch_pts, 1); + if (agent_i->device_type == HSA_DEVICE_TYPE_GPU) + printLabelStr("Coherent Host Access:", agent_i->coherent_host_access ? "TRUE":"FALSE", 1); + printLabel("Features:", false, 1); if (agent_i->agent_feature & HSA_AGENT_FEATURE_KERNEL_DISPATCH) { printf("%s", "KERNEL_DISPATCH "); From 3670ff21036a4d8fdf2481a3ad0f8644f478f060 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Thu, 24 Aug 2023 18:36:34 +0000 Subject: [PATCH 09/75] Add support for HSA_OVERRIDE_GFX_VERSION env var Change-Id: Iab75cbbba7da654dbf56f4206900d9c2ff5e4565 --- rocm_agent_enumerator | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index b901e47..33538df 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -209,9 +209,28 @@ def readFromKFD(): if search_result is not None: device_id = int(search_result.group(0).split(' ')[1], 10) if device_id != 0: - major_ver = int((device_id / 10000) % 100) - minor_ver = int((device_id / 100) % 100) - stepping_ver = int(device_id % 100) + gfx_override = os.environ.get("HSA_OVERRIDE_GFX_VERSION") + if gfx_override is not None: + try: + override_tokens = gfx_override.split('.') + major_ver=int(override_tokens[0]) + minor_ver=int(override_tokens[1]) + stepping_ver=int(override_tokens[2]) + if major_ver > 63 or minor_ver > 255 or stepping_ver > 255: + print('Invalid HSA_OVERRIDE_GFX_VERSION value') + major_ver = 0 + minor_ver = 0 + stepping_ver = 0 + except Exception as e: + print('Invalid HSA_OVERRIDE_GFX_VERSION format expected \"1.2.3\"') + major_ver = 0 + minor_ver = 0 + stepping_ver = 0 + else: + major_ver = int((device_id / 10000) % 100) + minor_ver = int((device_id / 100) % 100) + stepping_ver = int(device_id % 100) + target_list.append("gfx" + format(major_ver, 'd') + format(minor_ver, 'x') + format(stepping_ver, 'x')) line = f.readline() From f1f463d818490ac1ec13b8b14a231951ee30cd43 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 25 Aug 2023 01:04:34 +0000 Subject: [PATCH 10/75] Add recommended granule query Change-Id: I7eb10e267d0272759321ee30feddf2d6464d9443 --- rocminfo.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rocminfo.cc b/rocminfo.cc index 1d6cfbf..f3c8e89 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -151,6 +151,7 @@ typedef struct { size_t pool_size; bool alloc_allowed; size_t alloc_granule; + size_t alloc_rec_granule; size_t pool_alloc_alignment; bool pl_access; uint32_t global_flag; @@ -705,6 +706,11 @@ static hsa_status_t AcquirePoolInfo(hsa_amd_memory_pool_t pool, &pool_i->alloc_granule); RET_IF_HSA_ERR(err); + err = hsa_amd_memory_pool_get_info(pool, + HSA_AMD_MEMORY_POOL_INFO_RUNTIME_ALLOC_REC_GRANULE, + &pool_i->alloc_rec_granule); + RET_IF_HSA_ERR(err); + err = hsa_amd_memory_pool_get_info(pool, HSA_AMD_MEMORY_POOL_INFO_RUNTIME_ALLOC_ALIGNMENT, &pool_i->pool_alloc_alignment); @@ -790,6 +796,9 @@ static void DisplayPoolInfo(pool_info_t *pool_i, uint32_t indent) { std::string gr_str = std::to_string(pool_i->alloc_granule/1024)+"KB"; printLabelStr("Alloc Granule:", gr_str.c_str(), indent); + std::string rgr_str = std::to_string(pool_i->alloc_rec_granule / 1024) + "KB"; + printLabelStr("Alloc Recommended Granule:", rgr_str.c_str(), indent); + std::string al_str = std::to_string(pool_i->pool_alloc_alignment/1024)+"KB"; printLabelStr("Alloc Alignment:", al_str.c_str(), indent); From b249107c6ab443f2ec9131215f39a4fde4e8e240 Mon Sep 17 00:00:00 2001 From: Gregory Rodgers Date: Tue, 3 Oct 2023 18:47:21 +0000 Subject: [PATCH 11/75] Print amdgpu version Change-Id: Ibab6e51489d436b66c3bac4bbd0f52a400ad6b0b --- rocminfo.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/rocminfo.cc b/rocminfo.cc index f3c8e89..4b7b287 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -1118,7 +1118,17 @@ int CheckInitialState(void) { } } if (is_live){ - printf("%sROCk module is loaded%s\n", COL_WHT, COL_RESET); + std::ifstream amdgpu_version("/sys/module/amdgpu/version"); + if (amdgpu_version){ + std::stringstream buffer; + buffer << amdgpu_version.rdbuf(); + std::string vers; + std::getline(buffer, vers); + amdgpu_version.close(); + printf("%sROCk module version %s is loaded%s\n", COL_WHT, vers.c_str(), COL_RESET); + } else { + printf("%sROCk module is loaded%s\n", COL_WHT, COL_RESET); + } } else { printf("%sROCk module is NOT live, possibly no GPU devices%s\n", COL_RED, COL_RESET); From c9905a8ba1685845b4d6ddcfd24d3d3ef5110205 Mon Sep 17 00:00:00 2001 From: Ranjith Ramakrishnan Date: Sun, 17 Dec 2023 20:54:02 -0800 Subject: [PATCH 12/75] Correct the permission of rocminfo and rocm_agent_enumerator Both will have a permission of 755 Change-Id: I428c6419358a578595969b4bf0918e6384180dbc --- CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ce13531..7ef71be 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -173,12 +173,10 @@ target_compile_options(${ROCMINFO_EXE} PRIVATE ${ROCMINFO_CXX_FLAGS}) # Install directives ########################### install ( - FILES ${CMAKE_CURRENT_BINARY_DIR}/${ROCMINFO_EXE} - PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + TARGETS ${ROCMINFO_EXE} DESTINATION ${CMAKE_INSTALL_BINDIR} ) install ( - FILES ${CMAKE_CURRENT_BINARY_DIR}/rocm_agent_enumerator - PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/rocm_agent_enumerator DESTINATION ${CMAKE_INSTALL_BINDIR} ) ########################### From 429baf04fb9a7ec92bba03f10aba0725587934db Mon Sep 17 00:00:00 2001 From: Shweta Khatri Date: Mon, 18 Dec 2023 13:32:50 -0500 Subject: [PATCH 13/75] Fix invalid escape sequence in rocm_agent_enumerator, which are deprecated in Python3 In Python3, unescaped backslashes in regular expressions are deprecated, and these were generating SyntaxWarnings. Patch submitted by (Tianao Ge ) on github: https://github.com/ROCm/rocminfo/pull/55 Change-Id: Icbcf2803291add5b5f3971ac9901a8927d23f225 --- rocm_agent_enumerator | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index 33538df..6d44bd4 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -92,7 +92,7 @@ def getGCNISA(line, match_from_beginning = False): return result.group(0) return None -@staticVars(search_name=re.compile("gfx[0-9a-fA-F]+(:[-+:\w]+)?")) +@staticVars(search_name=re.compile(r"gfx[0-9a-fA-F]+(:[-+:\w]+)?")) def getGCNArchName(line): result = getGCNArchName.search_name.search(line) @@ -149,9 +149,9 @@ def readFromROCMINFO(search_arch_name = False): # search AMDGCN gfx ISA if search_arch_name is True: - line_search_term = re.compile("\A\s+Name:\s+(amdgcn-amd-amdhsa--gfx\d+)") + line_search_term = re.compile(r"\A\s+Name:\s+(amdgcn-amd-amdhsa--gfx\d+)") else: - line_search_term = re.compile("\A\s+Name:\s+(gfx\d+)") + line_search_term = re.compile(r"\A\s+Name:\s+(gfx\d+)") for line in rocminfo_output: if line_search_term.match(line) is not None: if search_arch_name is True: @@ -172,7 +172,7 @@ def readFromLSPCI(): except: lspci_output = [] - target_search_term = re.compile("1002:\w+") + target_search_term = re.compile(r"1002:\w+") for line in lspci_output: search_result = target_search_term.search(line) if search_result is not None: From 7b59f24005e1ae1c4d7a8069c00d94d92717fe86 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 17 Oct 2023 14:07:48 +0000 Subject: [PATCH 14/75] Add query for HSA Ext interface version Change-Id: Ibfac8c23b173793f7302f926c4695a1f99b328fe --- rocminfo.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rocminfo.cc b/rocminfo.cc index 4b7b287..9e88cd3 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -90,6 +90,7 @@ // calls, and is later used for reference when displaying the information. struct system_info_t { uint16_t major, minor; + uint16_t ext_major, ext_minor; uint64_t timestamp_frequency = 0; uint64_t max_wait = 0; hsa_endianness_t endianness; @@ -262,6 +263,14 @@ static hsa_status_t AcquireSystemInfo(system_info_t *sys_info) { err = hsa_system_get_info(HSA_SYSTEM_INFO_VERSION_MINOR, &sys_info->minor); RET_IF_HSA_ERR(err); + // Get HSA Ext Interface version + err = hsa_system_get_info(HSA_AMD_SYSTEM_INFO_EXT_VERSION_MAJOR, + &sys_info->ext_major); + RET_IF_HSA_ERR(err); + err = hsa_system_get_info(HSA_AMD_SYSTEM_INFO_EXT_VERSION_MINOR, + &sys_info->ext_minor); + RET_IF_HSA_ERR(err); + // Get timestamp frequency err = hsa_system_get_info(HSA_SYSTEM_INFO_TIMESTAMP_FREQUENCY, &sys_info->timestamp_frequency); @@ -288,12 +297,15 @@ static hsa_status_t AcquireSystemInfo(system_info_t *sys_info) { err = hsa_system_get_info(HSA_AMD_SYSTEM_INFO_DMABUF_SUPPORTED, &sys_info->dmabuf_support); RET_IF_HSA_ERR(err); + return err; } static void DisplaySystemInfo(system_info_t const *sys_info) { printLabel("Runtime Version:"); printf("%d.%d\n", sys_info->major, sys_info->minor); + printLabel("Runtime Ext Version:"); + printf("%d.%d\n", sys_info->ext_major, sys_info->ext_minor); printLabel("System Timestamp Freq.:"); printf("%fMHz\n", sys_info->timestamp_frequency / 1e6); printLabel("Sig. Max Wait Duration:"); From 17de0f909791c95bebe956d1ff695ea912f9063f Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Thu, 23 Nov 2023 21:09:10 +0000 Subject: [PATCH 15/75] Set -m64 flag only on x86-64 hosts -m64 only applies to x86-64, it's more reasonable to enable it only on x86_64 host. It fixes build on some other platforms as well. Provided by user r-value on github https: //github.com/RadeonOpenCompute/rocminfo/pull/63 Change-Id: I9c1c40d3fa39b0a61d28041fe4998b5e1ad0cdcd --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ef71be..71ccee3 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,13 +137,12 @@ set(ROCMINFO_CXX_FLAGS ${ROCMINFO_CXX_FLAGS} -fmerge-all-constants) set(ROCMINFO_CXX_FLAGS ${ROCMINFO_CXX_FLAGS} -fms-extensions) set(ROCMINFO_CXX_FLAGS ${ROCMINFO_CXX_FLAGS} -Werror) set(ROCMINFO_CXX_FLAGS ${ROCMINFO_CXX_FLAGS} -Wall) -set(ROCMINFO_CXX_FLAGS ${ROCMINFO_CXX_FLAGS} -m64) # # Extend the compiler flags for 64-bit builds # if((${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64") OR (${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "AMD64")) - set(ROCMINFO_CXX_FLAGS ${ROCMINFO_CXX_FLAGS} -msse -msse2) + set(ROCMINFO_CXX_FLAGS ${ROCMINFO_CXX_FLAGS} -m64 -msse -msse2) endif() # From e1716642ffce9d4a80c3c320cc57615a8d7954f0 Mon Sep 17 00:00:00 2001 From: Shweta Khatri Date: Thu, 4 Jan 2024 15:11:28 -0500 Subject: [PATCH 16/75] Use raw strings for regular expression Makes all re.compile function calls use raw string to prevent Syntax warning in future, if backslash escape characters are used in regular expressions https: //github.com/ROCm/rocminfo/pull/66 Suggested-by: Author: Yiyang Wu Date: Mon, 27 Nov 2023 16:07:20 +0000 Subject: [PATCH 17/75] Add query for memory properties Change-Id: I07c084c56b15c499ec564860b2a514e909ab7ca4 --- rocminfo.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rocminfo.cc b/rocminfo.cc index 9e88cd3..f5cf867 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -142,6 +142,7 @@ struct agent_info_t { uint32_t pkt_processor_ucode_ver; uint32_t sdma_ucode_ver; hsa_amd_iommu_version_t iommu_support; + uint8_t memory_properties[8]; }; // This structure holds memory pool information acquired through hsa info @@ -491,6 +492,12 @@ AcquireAgentInfo(hsa_agent_t agent, agent_info_t *agent_i) { &agent_i->coherent_host_access); RET_IF_HSA_ERR(err); + // Get memory properties + err = hsa_agent_get_info(agent, + (hsa_agent_info_t) HSA_AMD_AGENT_INFO_MEMORY_PROPERTIES, + agent_i->memory_properties); + RET_IF_HSA_ERR(err); + // Check if the agent is kernel agent if (agent_i->agent_feature & HSA_AGENT_FEATURE_KERNEL_DISPATCH) { // Get flaf of fast_f16 operation @@ -642,6 +649,11 @@ static void DisplayAgentInfo(agent_info_t *agent_i) { if (agent_i->device_type == HSA_DEVICE_TYPE_GPU) printLabelStr("Coherent Host Access:", agent_i->coherent_host_access ? "TRUE":"FALSE", 1); + printLabel("Memory Properties:", false, 1); + if (hsa_flag_isset64(agent_i->memory_properties, HSA_AMD_MEMORY_PROPERTY_AGENT_IS_APU)) + printf("%s", "APU"); + printf("\n"); + printLabel("Features:", false, 1); if (agent_i->agent_feature & HSA_AGENT_FEATURE_KERNEL_DISPATCH) { printf("%s", "KERNEL_DISPATCH "); From 9a91005354829ee12f60f61040ac89af8b7a54be Mon Sep 17 00:00:00 2001 From: amd-jmacaran Date: Tue, 23 Apr 2024 21:34:06 -0400 Subject: [PATCH 18/75] Add support for external CI builds using Azure Pipelines Change-Id: I7658fbc8c52bef551dae8c13413825507a0d8c0a --- .azuredevops/rocm-ci.yml | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .azuredevops/rocm-ci.yml diff --git a/.azuredevops/rocm-ci.yml b/.azuredevops/rocm-ci.yml new file mode 100644 index 0000000..afd8276 --- /dev/null +++ b/.azuredevops/rocm-ci.yml @@ -0,0 +1,43 @@ +resources: + repositories: + - repository: pipelines_repo + type: github + endpoint: External-CI-Token + name: ROCm/ROCm + pipelines: + - pipeline: rocr-runtime_pipeline + source: rocr-runtime + trigger: + branches: + include: + - master + +variables: +- group: common +- template: /.azuredevops/variables-global.yml@pipelines_repo + +trigger: + batch: true + branches: + include: + - master + paths: + exclude: + - .github + - License.txt + - README.md' + +pr: + autoCancel: true + branches: + include: + - master + paths: + exclude: + - .github + - License.txt + - README.md' + drafts: false + +jobs: + - template: ${{ variables.CI_COMPONENT_PATH }}/rocminfo.yml@pipelines_repo From 75803689d13cc6607aa584b36f3ca94b637a1059 Mon Sep 17 00:00:00 2001 From: amd-jmacaran Date: Thu, 25 Apr 2024 03:57:02 -0400 Subject: [PATCH 19/75] Change token name to match IT-created token Change-Id: Ie08eb15af669d4247c611c122ca0a77eb365f6dd --- .azuredevops/rocm-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azuredevops/rocm-ci.yml b/.azuredevops/rocm-ci.yml index afd8276..597df29 100644 --- a/.azuredevops/rocm-ci.yml +++ b/.azuredevops/rocm-ci.yml @@ -2,7 +2,7 @@ resources: repositories: - repository: pipelines_repo type: github - endpoint: External-CI-Token + endpoint: ROCm name: ROCm/ROCm pipelines: - pipeline: rocr-runtime_pipeline From 049ab553937742866a98ae9f24885c40d9379e67 Mon Sep 17 00:00:00 2001 From: Jiadong Zhu Date: Tue, 30 Apr 2024 15:22:51 +0800 Subject: [PATCH 20/75] Add WSL support for rocminfo This includes detecting the running environment, skipping kfd dependency check if in wsl platform and disabling unavailable information on wsl. V2: Use wslinfo to detect the environment. V3: Add back some queries for wsl, as the not_supported value shall be returned from hsa_runtime. Signed-off-by: Jiadong Zhu Suggested-by: Tianci Yin Change-Id: I686d551c795cb5c5532591623022856f59512205 --- rocminfo.cc | 56 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/rocminfo.cc b/rocminfo.cc index f5cf867..d5b0989 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -56,9 +56,14 @@ #include #include +#include +#include + #include "hsa/hsa.h" #include "hsa/hsa_ext_amd.h" +using namespace std; + #define COL_BLU "\x1B[34m" #define COL_KCYN "\x1B[36m" #define COL_GRN "\x1B[32m" @@ -189,6 +194,8 @@ static const uint32_t kLabelFieldSize = 25; static const uint32_t kValueFieldSize = 35; static const uint32_t kIndentSize = 2; +static bool wsl_env = false; + enum rocmi_int_format { ROCMI_INT_FORMAT_DEC = 1, ROCMI_INT_FORMAT_HEX = 2, @@ -224,6 +231,35 @@ std::string int_to_string(uint32_t i, return sd.str(); } +pair exec(const char* cmd) { + array buffer; + string result; + int return_code = -1; + auto pclose_wrapper = [&return_code](FILE* cmd){ return_code = pclose(cmd); }; + { // scope is important, have to make sure the ptr goes out of scope first + const unique_ptr pipe(popen(cmd, "r"), pclose_wrapper); + if (pipe) { + while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr) { + result += buffer.data(); + } + } + } + return make_pair(result, return_code); +} + +static void DetectWSLEnvironment() { + auto process_ret = exec("which wslinfo"); + if (process_ret.second) + return; + + process_ret = exec("wslinfo --msal-proxy-path"); + if (process_ret.second == 0 && + strcasestr(process_ret.first.c_str(), "msal.wsl.proxy.exe") != nullptr) { + printf("WSL environment detected.\n"); + wsl_env = true; + } +} + static void printLabelInt(char const *l, int d, uint32_t indent_lvl = 0) { std::string ind(kIndentSize * indent_lvl, ' '); @@ -294,6 +330,7 @@ static hsa_status_t AcquireSystemInfo(system_info_t *sys_info) { // Get mwaitx mode err = hsa_system_get_info(HSA_AMD_SYSTEM_INFO_MWAITX_ENABLED, &sys_info->mwaitx_enabled); + RET_IF_HSA_ERR(err); // Get DMABuf support err = hsa_system_get_info(HSA_AMD_SYSTEM_INFO_DMABUF_SUPPORTED, &sys_info->dmabuf_support); @@ -558,7 +595,8 @@ AcquireAgentInfo(hsa_agent_t agent, agent_info_t *agent_i) { static void DisplayAgentInfo(agent_info_t *agent_i) { printLabelStr("Name:", agent_i->name, 1); - printLabelStr("Uuid:", agent_i->uuid, 1); + if (!wsl_env || HSA_DEVICE_TYPE_CPU == agent_i->device_type) + printLabelStr("Uuid:", agent_i->uuid, 1); printLabelStr("Marketing Name:", agent_i->device_mkt_name, 1); printLabelStr("Vendor Name:", agent_i->vendor_name, 1); @@ -635,16 +673,20 @@ static void DisplayAgentInfo(agent_info_t *agent_i) { } printLabelStr("Chip ID:", int_to_string(agent_i->chip_id), 1); - printLabelStr("ASIC Revision:", int_to_string(agent_i->asic_revision), 1); + if (!wsl_env) + printLabelStr("ASIC Revision:", int_to_string(agent_i->asic_revision), 1); printLabelStr("Cacheline Size:", int_to_string(agent_i->cacheline_size), 1); - printLabelInt("Max Clock Freq. (MHz):", agent_i->max_clock_freq, 1); - printLabelInt("BDFID:", agent_i->bdf_id, 1); + if (!wsl_env || HSA_DEVICE_TYPE_GPU == agent_i->device_type) + printLabelInt("Max Clock Freq. (MHz):", agent_i->max_clock_freq, 1); + if (!wsl_env) + printLabelInt("BDFID:", agent_i->bdf_id, 1); printLabelInt("Internal Node ID:", agent_i->internal_node_id, 1); printLabelInt("Compute Unit:", agent_i->compute_unit, 1); printLabelInt("SIMDs per CU:", agent_i->simds_per_cu, 1); printLabelInt("Shader Engines:", agent_i->shader_engs, 1); printLabelInt("Shader Arrs. per Eng.:", agent_i->shader_arrs_per_sh_eng, 1); - printLabelInt("WatchPts on Addr. Ranges:", agent_i->max_addr_watch_pts, 1); + if (!wsl_env) + printLabelInt("WatchPts on Addr. Ranges:", agent_i->max_addr_watch_pts, 1); if (agent_i->device_type == HSA_DEVICE_TYPE_GPU) printLabelStr("Coherent Host Access:", agent_i->coherent_host_access ? "TRUE":"FALSE", 1); @@ -1255,7 +1297,9 @@ int CheckInitialState(void) { int main(int argc, char* argv[]) { hsa_status_t err; - if (CheckInitialState()) { + DetectWSLEnvironment(); + + if (!wsl_env && CheckInitialState()) { return 1; } err = hsa_init(); From 5e4f64e786790ad396422feb08c133f10b2904b5 Mon Sep 17 00:00:00 2001 From: Ranjith Ramakrishnan Date: Mon, 1 Apr 2024 12:01:19 -0700 Subject: [PATCH 21/75] SWDEV-442738 - Static package generation for rocminfo Package name will have suffix static-dev/devel rocminfo static package will depend on hsa static package Change-Id: I3e72b19403c10e74199067f2c725ed4a007ab150 --- CMakeLists.txt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 71ccee3..a55c816 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,9 @@ if(WIN32) return() endif() +# Generate static package, when BUILD_SHARED_LIBS is set to OFF. +# Default to ON +option(BUILD_SHARED_LIBS "Build using shared libraries" ON) ## Set default module path if not already set if(NOT DEFINED CMAKE_MODULE_PATH) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/") @@ -181,7 +184,12 @@ install ( ########################### # Packaging directives ########################### -set(CPACK_PACKAGE_NAME "${PROJECT_NAME}") +if(BUILD_SHARED_LIBS) + set(CPACK_PACKAGE_NAME "${PROJECT_NAME}") +else() + set(CPACK_RPM_PACKAGE_NAME "${PROJECT_NAME}-static-devel") + set(CPACK_DEBIAN_PACKAGE_NAME "${PROJECT_NAME}-static-dev") +endif() set(CPACK_PACKAGE_VENDOR "Advanced Micro Devices, Inc.") set(CPACK_PACKAGE_VERSION_MAJOR "${PKG_VERSION_MAJOR}") set(CPACK_PACKAGE_VERSION_MINOR "${PKG_VERSION_MINOR}") @@ -239,4 +247,8 @@ set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSIO set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") set(CPACK_RPM_FILE_NAME "RPM-DEFAULT") +if(NOT BUILD_SHARED_LIBS) + string(REPLACE "hsa-rocr" "hsa-rocr-static-dev" CPACK_DEBIAN_PACKAGE_DEPENDS ${CPACK_DEBIAN_PACKAGE_DEPENDS}) + string(REPLACE "hsa-rocr" "hsa-rocr-static-devel" CPACK_RPM_PACKAGE_REQUIRES ${CPACK_RPM_PACKAGE_REQUIRES}) +endif() include ( CPack ) From 1f4752295e1e2d5e9eb814a3df1208cf40ba1262 Mon Sep 17 00:00:00 2001 From: Ranjith Ramakrishnan Date: Wed, 1 May 2024 15:34:56 -0700 Subject: [PATCH 22/75] SWDEV-451078 - Update rocminfo package dependency list python3, glibc, libgcc/libgcc_s1, libstdc++/libstdc++6 added to the RPM package dependency list python3, libc6, libgcc-s1, libstdc++6 added to the DEB package dependency list Change-Id: I4843b1431c0d0edf1b0df1e12c82adb4ff53c8cd --- CMakeLists.txt | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a55c816..ff240bf 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -210,7 +210,7 @@ if(DEFINED ENV{ROCM_LIBPATCH_VERSION}) endif() #Debian package specific variables -set(CPACK_DEBIAN_PACKAGE_DEPENDS "hsa-rocr, kmod, pciutils") +set(CPACK_DEBIAN_PACKAGE_DEPENDS "hsa-rocr, kmod, pciutils, python3, libc6, libgcc-s1, libstdc++6") set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${CPACK_DEBIAN_PACKAGE_HOMEPAGE} CACHE STRING "https://github.com/RadeonOpenCompute/ROCm") if (DEFINED ENV{CPACK_DEBIAN_PACKAGE_RELEASE}) set(CPACK_DEBIAN_PACKAGE_RELEASE $ENV{CPACK_DEBIAN_PACKAGE_RELEASE}) @@ -222,7 +222,20 @@ if ( ROCM_DEP_ROCMCORE ) endif() #RPM package specific variables -set(CPACK_RPM_PACKAGE_REQUIRES "hsa-rocr kmod pciutils") +execute_process(COMMAND rpm --eval %{?dist} + RESULT_VARIABLE PROC_RESULT + OUTPUT_VARIABLE EVAL_RESULT + OUTPUT_STRIP_TRAILING_WHITESPACE) +message("RESULT_VARIABLE ${PROC_RESULT} OUTPUT_VARIABLE: ${EVAL_RESULT}") + +if(PROC_RESULT EQUAL "0" AND "${EVAL_RESULT}" STREQUAL ".el7") + # In Centos using parentheses is causing cpack errors. + # Set the dependencies specifically for centos + set(CPACK_RPM_PACKAGE_REQUIRES "hsa-rocr, kmod, pciutils, python3, glibc, libgcc, libstdc++") +else() + set(CPACK_RPM_PACKAGE_REQUIRES "hsa-rocr, kmod, pciutils, python3, glibc, (libgcc or libgcc_s1), (libstdc++ or libstdc++6)") +endif() # End EVAL_RESULT + if(DEFINED CPACK_PACKAGING_INSTALL_PREFIX) set ( CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}" ) endif() From 29dfe7d0fcb73a11295e5869e235e38c0c0aa863 Mon Sep 17 00:00:00 2001 From: amd-jmacaran Date: Tue, 21 May 2024 04:07:32 -0400 Subject: [PATCH 23/75] Support multiple External CI pipelines of same component. Specifying root-level pipelines for triggers, to allow engineering or specific-release pipelines to be made for the components/repos with the same name. Change-Id: I10f55ea490e61251a0c959e5e0ba2faba3d690fb --- .azuredevops/rocm-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.azuredevops/rocm-ci.yml b/.azuredevops/rocm-ci.yml index 597df29..a045d39 100644 --- a/.azuredevops/rocm-ci.yml +++ b/.azuredevops/rocm-ci.yml @@ -6,7 +6,7 @@ resources: name: ROCm/ROCm pipelines: - pipeline: rocr-runtime_pipeline - source: rocr-runtime + source: \ROCR-Runtime trigger: branches: include: @@ -25,7 +25,7 @@ trigger: exclude: - .github - License.txt - - README.md' + - README.md pr: autoCancel: true @@ -36,7 +36,7 @@ pr: exclude: - .github - License.txt - - README.md' + - README.md drafts: false jobs: From d1efacb47f4971e405f78fbdf70c799534e3fef4 Mon Sep 17 00:00:00 2001 From: Jiadong Zhu Date: Wed, 22 May 2024 10:46:09 +0800 Subject: [PATCH 24/75] Do not print to console for which command The command which would print warnings on some platform. Redirect both stdout and stderr to /dev/null while running the command. Signed-off-by: Jiadong Zhu Change-Id: Ibc377681a31a14a3e306ab4fcb14d8d0c853fa86 --- rocminfo.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rocminfo.cc b/rocminfo.cc index d5b0989..8686153 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -248,7 +248,7 @@ pair exec(const char* cmd) { } static void DetectWSLEnvironment() { - auto process_ret = exec("which wslinfo"); + auto process_ret = exec("which wslinfo > /dev/null 2>&1"); if (process_ret.second) return; From 84928a3158b23cf439cf827c04c3a3efa30ade87 Mon Sep 17 00:00:00 2001 From: abhimeda <138710508+abhimeda@users.noreply.github.com> Date: Thu, 14 Dec 2023 12:04:23 -0500 Subject: [PATCH 25/75] Create config.yml --- .github/ISSUE_TEMPLATE/config.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..0086358 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: true From 123fdf8171016b18940df3ec48414a225b6a931d Mon Sep 17 00:00:00 2001 From: abhimeda <138710508+abhimeda@users.noreply.github.com> Date: Thu, 14 Dec 2023 12:04:52 -0500 Subject: [PATCH 26/75] Delete .github directory --- .github/ISSUE_TEMPLATE/config.yml | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .github/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index 0086358..0000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1 +0,0 @@ -blank_issues_enabled: true From 912464bd96d013406a85bc8f44718bd8bf847fea Mon Sep 17 00:00:00 2001 From: abhimeda <138710508+abhimeda@users.noreply.github.com> Date: Thu, 14 Dec 2023 12:05:25 -0500 Subject: [PATCH 27/75] Create config.yml --- .github/ISSUE_TEMPLATE/config.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..0086358 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: true From 0e90773c269e93f1b86140ac2a26d96355596988 Mon Sep 17 00:00:00 2001 From: abhimeda <138710508+abhimeda@users.noreply.github.com> Date: Thu, 14 Dec 2023 12:06:03 -0500 Subject: [PATCH 28/75] Add files via upload --- .github/ISSUE_TEMPLATE/issue_report.yml | 175 ++++++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/issue_report.yml diff --git a/.github/ISSUE_TEMPLATE/issue_report.yml b/.github/ISSUE_TEMPLATE/issue_report.yml new file mode 100644 index 0000000..a05f61b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/issue_report.yml @@ -0,0 +1,175 @@ +name: Issue Report +description: File a report for ROCm related issues on Linux and Windows. For issues pertaining to documentation or non-bug related, please open a blank issue located below. +title: "[Issue]: " + +body: +- type: markdown + attributes: + value: | + Thank you for taking the time to fill out this report! + + You can acquire your OS, CPU, GPU (for filling out this report) with the following commands: + + Linux: + echo "OS:" && cat /etc/os-release | grep -E "^(NAME=|VERSION=)"; + echo "CPU: " && cat /proc/cpuinfo | grep "model name" | sort --unique; + echo "GPU:" && /opt/rocm/bin/rocminfo | grep -E "^\s*(Name|Marketing Name)"; + + Windows: + (Get-WmiObject Win32_OperatingSystem).Version + (Get-WmiObject win32_Processor).Name + (Get-WmiObject win32_VideoController).Name +- type: textarea + attributes: + label: Problem Description + description: Describe the issue you encountered. + validations: + required: true +- type: input + attributes: + label: Operating System + description: What is the name and version number of the OS? + placeholder: "e.g. Ubuntu 22.04.3 LTS (Jammy Jellyfish)" + validations: + required: true +- type: input + attributes: + label: CPU + description: What CPU did you encounter the issue on? + placeholder: "e.g. AMD Ryzen 9 5900HX with Radeon Graphics" + validations: + required: true +- type: dropdown + attributes: + label: GPU + description: What GPU(s) did you encounter the issue on (you can select multiple GPUs from the list) + multiple: true + options: + - AMD Instinct MI250X + - AMD Instinct MI250 + - AMD Instinct MI210 + - AMD Instinct MI100 + - AMD Instinct MI50 + - AMD Instinct MI25 + - AMD Radeon Pro V620 + - AMD Radeon Pro VII + - AMD Radeon RX 7900 XTX + - AMD Radeon VII + - AMD Radeon Pro W7900 + - AMD Radeon Pro W7800 + - AMD Radeon Pro W6800 + - AMD Radeon Pro W6600 + - AMD Radeon Pro W5500 + - AMD Radeon RX 7900 XT + - AMD Radeon RX 7600 + - AMD Radeon RX 6950 XT + - AMD Radeon RX 6900 XT + - AMD Radeon RX 6800 XT + - AMD Radeon RX 6800 + - AMD Radeon RX 6750 + - AMD Radeon RX 6700 XT + - AMD Radeon RX 6700 + - AMD Radeon RX 6650 XT + - AMD Radeon RX 6600 XT + - AMD Radeon RX 6600 + - Other + validations: + required: true +- type: input + attributes: + label: Other + description: If you selected Other, please specify +- type: dropdown + attributes: + label: ROCm Version + description: What version(s) of ROCm did you encounter the issue on? + multiple: true + options: + - ROCm 5.7.1 + - ROCm 5.7.0 + - ROCm 5.6.0 + - ROCm 5.5.1 + - ROCm 5.5.0 + validations: + required: true +- type: dropdown + attributes: + label: ROCm Component + description: (Optional) If this issue relates to a specific ROCm component, it can be mentioned here. + options: + - Other + - AMDMIGraphX + - amdsmi + - aomp + - aomp-extras + - clang-ocl + - clr + - composable_kernel + - flang + - half + - HIP + - hipBLAS + - HIPCC + - hipCUB + - HIP-Examples + - hipFFT + - hipfort + - HIPIFY + - hipSOLVER + - hipSPARSE + - hipTensor + - llvm-project + - MIOpen + - MIVisionX + - rccl + - rdc + - rocALUTION + - rocBLAS + - ROCdbgapi + - rocFFT + - ROCgdb + - ROCK-Kernel-Driver + - ROCm + - rocm_bandwidth_test + - rocm_smi_lib + - rocm-cmake + - ROCm-CompilerSupport + - rocm-core + - ROCm-Device-Libs + - rocminfo + - rocMLIR + - ROCmValidationSuite + - rocPRIM + - rocprofiler + - rocr_debug_agent + - rocRAND + - ROCR-Runtime + - rocSOLVER + - rocSPARSE + - rocThrust + - roctracer + - ROCT-Thunk-Interface + - rocWMMA + - rpp + - Tensile + default: 39 +- type: textarea + attributes: + label: Steps to Reproduce + description: (Optional) Detailed steps to reproduce the issue. + validations: + required: false + +- type: textarea + attributes: + label: (Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support + description: The output of rocminfo --support could help to better address the problem. + validations: + required: false + +- type: textarea + attributes: + label: Additional Information + description: (Optional) Any additional information that is relevant, e.g. relevant environment variables, dockerfiles, log files, dmesg output (on Linux), etc. + validations: + required: false \ No newline at end of file From 4bcedb59c036d2c5fbeba0298c5e4377be927bdd Mon Sep 17 00:00:00 2001 From: abhimeda <138710508+abhimeda@users.noreply.github.com> Date: Mon, 18 Dec 2023 14:48:32 -0500 Subject: [PATCH 29/75] added rocm v6, MI300, default component --- .github/ISSUE_TEMPLATE/issue_report.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/issue_report.yml b/.github/ISSUE_TEMPLATE/issue_report.yml index a05f61b..f55a286 100644 --- a/.github/ISSUE_TEMPLATE/issue_report.yml +++ b/.github/ISSUE_TEMPLATE/issue_report.yml @@ -45,6 +45,9 @@ body: description: What GPU(s) did you encounter the issue on (you can select multiple GPUs from the list) multiple: true options: + - AMD Instinct MI300 + - AMD Instinct MI300A + - AMD Instinct MI300X - AMD Instinct MI250X - AMD Instinct MI250 - AMD Instinct MI210 @@ -85,6 +88,7 @@ body: description: What version(s) of ROCm did you encounter the issue on? multiple: true options: + - ROCm 6.0.0 - ROCm 5.7.1 - ROCm 5.7.0 - ROCm 5.6.0 @@ -172,4 +176,4 @@ body: label: Additional Information description: (Optional) Any additional information that is relevant, e.g. relevant environment variables, dockerfiles, log files, dmesg output (on Linux), etc. validations: - required: false \ No newline at end of file + required: false From 08f844a1d91522e5fb2407b11682d66fbe567b6a Mon Sep 17 00:00:00 2001 From: shwetagkhatri <155576586+shwetagkhatri@users.noreply.github.com> Date: Thu, 4 Jan 2024 16:06:57 -0500 Subject: [PATCH 30/75] Create CODEOWNERS file --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..e091329 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @dayatsin-amd @shwetagkhatri From e68143cfb2a7daf6f45bea5bf8f2a674027abf8b Mon Sep 17 00:00:00 2001 From: Sam Wu <22262939+samjwu@users.noreply.github.com> Date: Mon, 6 May 2024 15:32:17 -0600 Subject: [PATCH 31/75] Add ReadtheDocs configuration --- .readthedocs.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .readthedocs.yaml diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..fbbc470 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,18 @@ +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +version: 2 + +sphinx: + configuration: docs/conf.py + +formats: [htmlzip, pdf, epub] + +python: + install: + - requirements: docs/sphinx/requirements.txt + +build: + os: ubuntu-22.04 + tools: + python: "3.10" From f3810ff868449f4a66d9d17b5a41a05c6e1e9d5c Mon Sep 17 00:00:00 2001 From: Sam Wu <22262939+samjwu@users.noreply.github.com> Date: Mon, 6 May 2024 15:33:09 -0600 Subject: [PATCH 32/75] Add Sphinx configuration files --- docs/.gitignore | 1 + docs/conf.py | 29 +++++++ docs/sphinx/.gitignore | 1 + docs/sphinx/_toc.yml.in | 7 ++ docs/sphinx/requirements.in | 1 + docs/sphinx/requirements.txt | 147 +++++++++++++++++++++++++++++++++++ 6 files changed, 186 insertions(+) create mode 100644 docs/.gitignore create mode 100644 docs/conf.py create mode 100644 docs/sphinx/.gitignore create mode 100644 docs/sphinx/_toc.yml.in create mode 100644 docs/sphinx/requirements.in create mode 100644 docs/sphinx/requirements.txt diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..69fa449 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1 @@ +_build/ diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..274742d --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,29 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +import re + + +html_theme = "rocm_docs_theme" +html_theme_options = {"flavor": "rocm"} + +extensions = ["rocm_docs"] +external_toc_path = "./sphinx/_toc.yml" + +with open('../CMakeLists.txt', encoding='utf-8') as f: + match = re.search(r'get_package_version_number\(\"?([0-9.]+)[^0-9.]+', f.read()) + if not match: + raise ValueError("VERSION not found!") + version_number = match[1] + +version = version_number +release = version_number +html_title = f"rocminfo {version} Documentation" +project = "rocminfo" +author = "Advanced Micro Devices, Inc." +copyright = ( + "Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved." +) diff --git a/docs/sphinx/.gitignore b/docs/sphinx/.gitignore new file mode 100644 index 0000000..732e971 --- /dev/null +++ b/docs/sphinx/.gitignore @@ -0,0 +1 @@ +_toc.yml diff --git a/docs/sphinx/_toc.yml.in b/docs/sphinx/_toc.yml.in new file mode 100644 index 0000000..0c4fb33 --- /dev/null +++ b/docs/sphinx/_toc.yml.in @@ -0,0 +1,7 @@ +# Anywhere {branch} is used, the branch name will be substituted. +# These comments will also be removed. +root: index +subtrees: + - caption: About + entries: + - file: license diff --git a/docs/sphinx/requirements.in b/docs/sphinx/requirements.in new file mode 100644 index 0000000..17703b4 --- /dev/null +++ b/docs/sphinx/requirements.in @@ -0,0 +1 @@ +rocm-docs-core==1.1.1 diff --git a/docs/sphinx/requirements.txt b/docs/sphinx/requirements.txt new file mode 100644 index 0000000..757de61 --- /dev/null +++ b/docs/sphinx/requirements.txt @@ -0,0 +1,147 @@ +# +# This file is autogenerated by pip-compile with Python 3.10 +# by the following command: +# +# pip-compile requirements.in +# +accessible-pygments==0.0.4 + # via pydata-sphinx-theme +alabaster==0.7.16 + # via sphinx +babel==2.15.0 + # via + # pydata-sphinx-theme + # sphinx +beautifulsoup4==4.12.3 + # via pydata-sphinx-theme +breathe==4.35.0 + # via rocm-docs-core +certifi==2024.2.2 + # via requests +cffi==1.16.0 + # via + # cryptography + # pynacl +charset-normalizer==3.3.2 + # via requests +click==8.1.7 + # via sphinx-external-toc +cryptography==42.0.7 + # via pyjwt +deprecated==1.2.14 + # via pygithub +docutils==0.21.2 + # via + # breathe + # myst-parser + # pydata-sphinx-theme + # sphinx +fastjsonschema==2.19.1 + # via rocm-docs-core +gitdb==4.0.11 + # via gitpython +gitpython==3.1.43 + # via rocm-docs-core +idna==3.7 + # via requests +imagesize==1.4.1 + # via sphinx +jinja2==3.1.4 + # via + # myst-parser + # sphinx +markdown-it-py==3.0.0 + # via + # mdit-py-plugins + # myst-parser +markupsafe==2.1.5 + # via jinja2 +mdit-py-plugins==0.4.0 + # via myst-parser +mdurl==0.1.2 + # via markdown-it-py +myst-parser==3.0.1 + # via rocm-docs-core +packaging==24.0 + # via + # pydata-sphinx-theme + # sphinx +pycparser==2.22 + # via cffi +pydata-sphinx-theme==0.15.2 + # via + # rocm-docs-core + # sphinx-book-theme +pygithub==2.3.0 + # via rocm-docs-core +pygments==2.18.0 + # via + # accessible-pygments + # pydata-sphinx-theme + # sphinx +pyjwt[crypto]==2.8.0 + # via pygithub +pynacl==1.5.0 + # via pygithub +pyyaml==6.0.1 + # via + # myst-parser + # rocm-docs-core + # sphinx-external-toc +requests==2.31.0 + # via + # pygithub + # sphinx +rocm-docs-core==1.1.1 + # via -r requirements.in +smmap==5.0.1 + # via gitdb +snowballstemmer==2.2.0 + # via sphinx +soupsieve==2.5 + # via beautifulsoup4 +sphinx==7.3.7 + # via + # breathe + # myst-parser + # pydata-sphinx-theme + # rocm-docs-core + # sphinx-book-theme + # sphinx-copybutton + # sphinx-design + # sphinx-external-toc + # sphinx-notfound-page +sphinx-book-theme==1.1.2 + # via rocm-docs-core +sphinx-copybutton==0.5.2 + # via rocm-docs-core +sphinx-design==0.5.0 + # via rocm-docs-core +sphinx-external-toc==1.0.1 + # via rocm-docs-core +sphinx-notfound-page==1.0.0 + # via rocm-docs-core +sphinxcontrib-applehelp==1.0.8 + # via sphinx +sphinxcontrib-devhelp==1.0.6 + # via sphinx +sphinxcontrib-htmlhelp==2.0.5 + # via sphinx +sphinxcontrib-jsmath==1.0.1 + # via sphinx +sphinxcontrib-qthelp==1.0.7 + # via sphinx +sphinxcontrib-serializinghtml==1.1.10 + # via sphinx +tomli==2.0.1 + # via sphinx +typing-extensions==4.11.0 + # via + # pydata-sphinx-theme + # pygithub +urllib3==2.2.1 + # via + # pygithub + # requests +wrapt==1.16.0 + # via deprecated From 5137d0c9fbd86f2317f654c6cb1b0cfa7705cc67 Mon Sep 17 00:00:00 2001 From: Sam Wu <22262939+samjwu@users.noreply.github.com> Date: Mon, 6 May 2024 15:33:21 -0600 Subject: [PATCH 33/75] Add documentation content --- docs/index.rst | 6 ++++++ docs/license.rst | 5 +++++ 2 files changed, 11 insertions(+) create mode 100644 docs/index.rst create mode 100644 docs/license.rst diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..ad1e828 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,6 @@ +=========================== +rocminfo Documentation +=========================== + +.. include:: ../README.md + :parser: myst_parser.sphinx_ diff --git a/docs/license.rst b/docs/license.rst new file mode 100644 index 0000000..6082363 --- /dev/null +++ b/docs/license.rst @@ -0,0 +1,5 @@ +======= +License +======= + +.. include:: ../License.txt From 4a793ca588f494439558cb8412eddc8624ba1952 Mon Sep 17 00:00:00 2001 From: Sam Wu <22262939+samjwu@users.noreply.github.com> Date: Mon, 6 May 2024 15:33:35 -0600 Subject: [PATCH 34/75] Add dependabot config --- .github/dependabot.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..d24c82f --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,17 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "pip" # See documentation for possible values + directory: "/docs/sphinx" # Location of package manifests + open-pull-requests-limit: 10 + schedule: + interval: "daily" + labels: + - "documentation" + - "dependencies" + reviewers: + - "samjwu" From c18246e465d25ae8c7b7bcfc4ff83817da8aa595 Mon Sep 17 00:00:00 2001 From: Sam Wu <22262939+samjwu@users.noreply.github.com> Date: Mon, 6 May 2024 15:33:55 -0600 Subject: [PATCH 35/75] Add doc team to CODEOWNERS --- .github/CODEOWNERS | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e091329..17a6867 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1,6 @@ * @dayatsin-amd @shwetagkhatri +# Documentation files +docs/* @ROCm/rocm-documentation @dayatsin-amd @shwetagkhatri +*.md @ROCm/rocm-documentation @dayatsin-amd @shwetagkhatri +*.rst @ROCm/rocm-documentation @dayatsin-amd @shwetagkhatri +.readthedocs.yaml @ROCm/rocm-documentation @dayatsin-amd @shwetagkhatri From 51dc160fc690e7fd364f344fda44737cb6ad6093 Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Wed, 15 May 2024 12:36:33 -0700 Subject: [PATCH 36/75] Create build.rst Create the build file --- docs/install/build.rst | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 docs/install/build.rst diff --git a/docs/install/build.rst b/docs/install/build.rst new file mode 100644 index 0000000..fe5141c --- /dev/null +++ b/docs/install/build.rst @@ -0,0 +1,29 @@ + + +Build ROCmInfo +***************** + +Use the standard cmake build procedure to build rocminfo. The location of ROCm root (parent directory containing ROCM headers and libraries) must be provided +as a cmake argument using the standard CMAKE_PREFIX_PATH cmake variable. + +After cloning the rocminfo git repo, please make sure to do a git-fetch --tags to get the tags residing on the repo. These tags are used for versioning. + +For example, + +.. code-block:: + + $ git fetch --tags origin + + Building from the CMakeLists.txt directory might look like this: + + mkdir -p build + + cd build + + cmake -DCMAKE_PREFIX_PATH=/opt/rocm .. + + make + + cd .. + +Upon a successful build, the binary, rocminfo, and the python script, rocm_agent_enumerator, will be in the `build` folder. From 50581dba5815628d8b1c81d97493b36c9d805bc2 Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Wed, 15 May 2024 12:48:16 -0700 Subject: [PATCH 37/75] Create use-rocm-agent-enumerator.rst Create how to --- docs/how-to/use-rocm-agent-enumerator.rst | 272 ++++++++++++++++++++++ 1 file changed, 272 insertions(+) create mode 100644 docs/how-to/use-rocm-agent-enumerator.rst diff --git a/docs/how-to/use-rocm-agent-enumerator.rst b/docs/how-to/use-rocm-agent-enumerator.rst new file mode 100644 index 0000000..d23d17d --- /dev/null +++ b/docs/how-to/use-rocm-agent-enumerator.rst @@ -0,0 +1,272 @@ + + +Using ROCmInfo +--------------- + +You can use ROCmInfo with the following commands: + +.. code-block:: + + #!/usr/bin/env python3 + + import os + import re + import subprocess + import sys + import time + + # get current working directory + CWD = os.path.dirname(os.path.realpath(__file__)) + + ISA_TO_ID = { + # Kaveri - Temporary + "gfx700" : [0x1304, 0x1305, 0x1306, 0x1307, 0x1309, 0x130a, 0x130b, 0x130c, + 0x130d, 0x130e, 0x130f, 0x1310, 0x1311, 0x1312, 0x1313, 0x1315, + 0x1316, 0x1317, 0x1318, 0x131b, 0x131c, 0x131d], + # Hawaii + "gfx701" : [0x67a0, 0x67a1, 0x67a2, 0x67a8, 0x67a9, 0x67aa, 0x67b0, 0x67b1, + 0x67b8, 0x67b9, 0x67ba, 0x67be], + # Carrizo + "gfx801" : [0x9870, 0x9874, 0x9875, 0x9876, 0x9877, 0x98e4], + # Tonga + "gfx802" : [0x6920, 0x6921, 0x6928, 0x6929, 0x692b, 0x692f, 0x6930, 0x6938, + 0x6939], + # Fiji + "gfx803" : [0x7300, 0x730f, + # Polaris10 + 0x67c0, 0x67c1, 0x67c2, 0x67c4, 0x67c7, 0x67c8, 0x67c9, 0x67ca, + 0x67cc, 0x67cf, 0x6fdf, + # Polaris11 + 0x67d0, 0x67df, 0x67e0, 0x67e1, 0x67e3, 0x67e7, 0x67e8, 0x67e9, + 0x67eb, 0x67ef, 0x67ff, + # Polaris12 + 0x6980, 0x6981, 0x6985, 0x6986, 0x6987, 0x6995, 0x6997, 0x699f, + # VegaM + 0x694c, 0x694e, 0x694f], + # Vega10 + "gfx900" : [0x6860, 0x6861, 0x6862, 0x6863, 0x6864, 0x6867, 0x6868, 0x6869, + 0x6869, 0x686a, 0x686b, 0x686c, 0x686d, 0x686e, 0x686f, 0x687f], + # Raven + "gfx902" : [0x15dd, 0x15d8], + # Vega12 + "gfx904" : [0x69a0, 0x69a1, 0x69a2, 0x69a3, 0x69af], + # Vega20 + "gfx906" : [0x66a0, 0x66a1, 0x66a2, 0x66a3, 0x66a4, 0x66a7, 0x66af], + # Arcturus + "gfx908" : [0x738c, 0x7388, 0x738e, 0x7390], + # Aldebaran + "gfx90a" : [0x7408, 0x740c, 0x740f, 0x7410], + # Renoir + "gfx90c" : [0x15e7, 0x1636, 0x1638, 0x164c], + # Navi10 + "gfx1010" : [0x7310, 0x7312, 0x7318, 0x7319, 0x731a, 0x731b, 0x731e, 0x731f], + # Navi12 + "gfx1011" : [0x7360, 0x7362], + # Navi14 + "gfx1012" : [0x7340, 0x7341, 0x7347, 0x734f], + # Cyan_Skillfish + "gfx1013" : [0x13f9, 0x13fa, 0x13fb, 0x13fc, 0x13f3], + # Sienna_Cichlid + "gfx1030" : [0x73a0, 0x73a1, 0x73a2, 0x73a3, 0x73a5, 0x73a8, 0x73a9, 0x73ab, + 0x73ac, 0x73ad, 0x73ae, 0x73af, 0x73bf], + # Navy_Flounder + "gfx1031" : [0x73c0, 0x73c1, 0x73c3, 0x73da, 0x73db, 0x73dc, 0x73dd, 0x73de, + 0x73df], + # Dimgray_Cavefish + "gfx1032" : [0x73e0, 0x73e1, 0x73e2, 0x73e3, 0x73e8, 0x73e9, 0x73ea, 0x73eb, + 0x73ec, 0x73ed, 0x73ef, 0x73ff], + # Van Gogh + "gfx1033" : [0x163f], + # Beige_Goby + "gfx1034" : [0x7420, 0x7421, 0x7422, 0x7423, 0x743f], + # Yellow_Carp + "gfx1035" : [0x164d, 0x1681] + } + + def staticVars(**kwargs): + def deco(func): + for k in kwargs: + setattr(func, k, kwargs[k]) + return func + return deco + + @staticVars(search_term=re.compile("gfx[0-9a-fA-F]+")) + def getGCNISA(line, match_from_beginning = False): + if match_from_beginning is True: + result = getGCNISA.search_term.match(line) + else: + result = getGCNISA.search_term.search(line) + + if result is not None: + return result.group(0) + return None + + @staticVars(search_name=re.compile("gfx[0-9a-fA-F]+:[-+:\w]+")) + def getGCNArchName(line): + result = getGCNArchName.search_name.search(line) + + if result is not None: + return result.group(0) + return None + + def readFromTargetLstFile(): + target_list = [] + + # locate target.lst using environment variable or + # it should be placed at the same directory with this script + target_lst_path = os.environ.get("ROCM_TARGET_LST"); + if target_lst_path == None: + target_lst_path = os.path.join(CWD, "target.lst") + if os.path.isfile(target_lst_path): + target_lst_file = open(target_lst_path, 'r') + for line in target_lst_file: + # for target.lst match from beginning so targets can be disabled by + # commenting it out + target = getGCNISA(line, match_from_beginning = True) + if target is not None: + target_list.append(target) + + return target_list + + def readFromROCMINFO(search_arch_name = False): + target_list = [] + # locate rocminfo binary which should be placed at the same directory with + # this script + rocminfo_executable = os.path.join(CWD, "rocminfo") + + try: + t0 = time.time() + while 1: + t1 = time.time() + # quit after retrying rocminfo for a minute. + if t1 - t0 > 60.0: + print("Timeout querying rocminfo. Are you compiling with more than 254 threads?") + break + # run rocminfo + rocminfo_output = subprocess.Popen(rocminfo_executable, stdout=subprocess.PIPE).communicate()[0].decode("utf-8").split('\n') + term1 = re.compile("Cannot allocate memory") + term2 = re.compile("HSA_STATUS_ERROR_OUT_OF_RESOURCES") + done = 1 + for line in rocminfo_output: + if term1.search(line) is not None or term2.search(line) is not None: + done = 0 + break + if done: + break + except: + rocminfo_output = [] + + # search AMDGCN gfx ISA + if search_arch_name is True: + line_search_term = re.compile("\A\s+Name:\s+(amdgcn-amd-amdhsa--gfx\d+)") + else: + line_search_term = re.compile("\A\s+Name:\s+(gfx\d+)") + for line in rocminfo_output: + if line_search_term.match(line) is not None: + if search_arch_name is True: + target = getGCNArchName(line) + else: + target = getGCNISA(line) + if target is not None: + target_list.append(target) + + return target_list + + def readFromLSPCI(): + target_list = [] + + try: + # run lspci + lspci_output = subprocess.Popen(["/usr/bin/lspci", "-n", "-d", "1002:"], stdout=subprocess.PIPE).communicate()[0].decode("utf-8").split('\n') + except: + lspci_output = [] + + target_search_term = re.compile("1002:\w+") + for line in lspci_output: + search_result = target_search_term.search(line) + if search_result is not None: + device_id = int(search_result.group(0).split(':')[1], 16) + # try lookup from ISA_TO_ID dict + for target in ISA_TO_ID.keys(): + for target_device_id in ISA_TO_ID[target]: + if device_id == target_device_id: + target_list.append(target) + break + + return target_list + + def readFromKFD(): + target_list = [] + + topology_dir = '/sys/class/kfd/kfd/topology/nodes/' + if os.path.isdir(topology_dir): + for node in sorted(os.listdir(topology_dir)): + node_path = os.path.join(topology_dir, node) + if os.path.isdir(node_path): + prop_path = node_path + '/properties' + if os.path.isfile(prop_path) and os.access(prop_path, os.R_OK): + target_search_term = re.compile("gfx_target_version.+") + with open(prop_path) as f: + try: + line = f.readline() + except PermissionError: + # We may have a subsystem (e.g. scheduler) limiting device visibility which + # could cause a permission error. + line = '' + while line != '' : + search_result = target_search_term.search(line) + if search_result is not None: + device_id = int(search_result.group(0).split(' ')[1], 10) + if device_id != 0: + major_ver = int((device_id / 10000) % 100) + minor_ver = int((device_id / 100) % 100) + stepping_ver = int(device_id % 100) + target_list.append("gfx" + format(major_ver, 'd') + format(minor_ver, 'x') + format(stepping_ver, 'x')) + line = f.readline() + + return target_list + + def main(): + if len(sys.argv) == 2 and sys.argv[1] == '-name' : + """ Prints the list of available AMD GCN target names extracted from rocminfo, a tool + shipped with this script to enumerate GPU agents available on a working ROCm stack.""" + target_list = readFromROCMINFO(True) + else: + """Prints the list of available AMD GCN ISA + + The program collects the list in 3 different ways, in the order of + precendence: + + 1. ROCM_TARGET_LST : a user defined environment variable, set to the path and + filename where to find the "target.lst" file. This can be + used in an install environment with sandbox, where + execution of "rocminfo" is not possible. + 2. target.lst : user-supplied text file. This is used in a container setting + where ROCm stack may usually not available. + 3. HSA topology : gathers the information from the HSA node topology in + /sys/class/kfd/kfd/topology/nodes/ + 4. lspci : enumerate PCI bus and locate supported devices from a hard-coded + lookup table. + 5. rocminfo : a tool shipped with this script to enumerate GPU agents + available on a working ROCm stack. + """ + target_list = readFromTargetLstFile() + + if len(target_list) == 0: + target_list = readFromKFD() + + if len(target_list) == 0: + target_list = readFromLSPCI() + + if len(target_list) == 0: + target_list = readFromROCMINFO() + + # workaround to cope with existing rocm_agent_enumerator behavior where gfx000 + # would always be returned + print("gfx000") + + for gfx in target_list: + print(gfx) + + if __name__ == "__main__": + main() From c9a24a75034e630f64ac6acebe7205f764abfd6b Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Wed, 15 May 2024 12:55:05 -0700 Subject: [PATCH 38/75] Update build.rst --- docs/install/build.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/install/build.rst b/docs/install/build.rst index fe5141c..a251722 100644 --- a/docs/install/build.rst +++ b/docs/install/build.rst @@ -27,3 +27,20 @@ For example, cd .. Upon a successful build, the binary, rocminfo, and the python script, rocm_agent_enumerator, will be in the `build` folder. + +ROCmInfo execution +------------------- + +"rocminfo" gives information about the HSA system attributes and agents. + +"rocm_agent_enumerator" prints the list of available AMD GCN ISA or architecture names. With the option '-name', it prints out available architectures names obtained from rocminfo. Otherwise, it generates ISA in one of five different ways: + +1. ROCM_TARGET_LST : a user defined environment variable, set to the path and filename where to find the "target.lst" file. This can be used in an install environment with sandbox, where execution of "rocminfo" is not possible. + +2. target.lst : user-supplied text file, in the same folder as "rocm_agent_enumerator". This is used in a container setting where ROCm stack may usually not available. + +3. HSA topology : gathers the information from the HSA node topology in /sys/class/kfd/kfd/topology/nodes/ + +4. lspci : enumerate PCI bus and locate supported devices from a hard-coded lookup table. + +5. rocminfo : a tool shipped with this script to enumerate GPU agents available on a working ROCm stack. From e8ff8f0229cf81757dcd72e96d7cf4dc198b4e88 Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Wed, 15 May 2024 14:02:03 -0700 Subject: [PATCH 39/75] Update index.rst --- docs/index.rst | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index ad1e828..d44f8bb 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,6 +1,26 @@ -=========================== -rocminfo Documentation -=========================== +.. meta:: + :description: Install ROCmInfo + :keywords: install, rocminfo, AMD, ROCm + + +For more information, see `GitHub. `_ + +.. grid:: 2 + :gutter: 3 + + .. grid-item-card:: Install + + * :doc:`ROCmInfo installation <./install/install>` + + + .. grid-item-card:: How to + + * :doc:`Use ROCm agent enumerator ` + + +To contribute to the documentation, refer to +`Contributing to ROCm `_. + +You can find licensing information on the +`Licensing `_ page. -.. include:: ../README.md - :parser: myst_parser.sphinx_ From 094bf53f68d373e391f4fb004f9818f4a0145f93 Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Wed, 15 May 2024 14:04:36 -0700 Subject: [PATCH 40/75] Update _toc.yml.in updated toc.yml.in --- docs/sphinx/_toc.yml.in | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/docs/sphinx/_toc.yml.in b/docs/sphinx/_toc.yml.in index 0c4fb33..edc11be 100644 --- a/docs/sphinx/_toc.yml.in +++ b/docs/sphinx/_toc.yml.in @@ -1,7 +1,18 @@ -# Anywhere {branch} is used, the branch name will be substituted. -# These comments will also be removed. +defaults: + numbered: False root: index subtrees: - - caption: About - entries: - - file: license +- caption: Install + entries: + - file: install/install.rst + title: ROCmInfo installation + + +- caption: How to + entries: + - file: how to/use-rocm-agent-enumerator.rst + title: Use ROCm agent enumerator + +- caption: About + entries: + - file: license.md From a9b085c93afdbd2b11f5c8a02117b0c84bcac309 Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Wed, 15 May 2024 14:05:43 -0700 Subject: [PATCH 41/75] Update _toc.yml.in --- docs/sphinx/_toc.yml.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sphinx/_toc.yml.in b/docs/sphinx/_toc.yml.in index edc11be..8cee375 100644 --- a/docs/sphinx/_toc.yml.in +++ b/docs/sphinx/_toc.yml.in @@ -10,7 +10,7 @@ subtrees: - caption: How to entries: - - file: how to/use-rocm-agent-enumerator.rst + - file: how-to/use-rocm-agent-enumerator.rst title: Use ROCm agent enumerator - caption: About From 63df16b225638f49e5e76c994909fd3c93149d5f Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Wed, 15 May 2024 14:06:36 -0700 Subject: [PATCH 42/75] Update _toc.yml.in --- docs/sphinx/_toc.yml.in | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/sphinx/_toc.yml.in b/docs/sphinx/_toc.yml.in index 8cee375..c783847 100644 --- a/docs/sphinx/_toc.yml.in +++ b/docs/sphinx/_toc.yml.in @@ -7,7 +7,6 @@ subtrees: - file: install/install.rst title: ROCmInfo installation - - caption: How to entries: - file: how-to/use-rocm-agent-enumerator.rst From db8839d293cedb9c08845907df6803b26cbb01c6 Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Wed, 15 May 2024 14:10:38 -0700 Subject: [PATCH 43/75] Update build.rst --- docs/install/build.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/install/build.rst b/docs/install/build.rst index a251722..ca09659 100644 --- a/docs/install/build.rst +++ b/docs/install/build.rst @@ -1,10 +1,13 @@ +.. meta:: + :description: Install ROCmInfo + :keywords: install, rocminfo, AMD, ROCm Build ROCmInfo ***************** Use the standard cmake build procedure to build rocminfo. The location of ROCm root (parent directory containing ROCM headers and libraries) must be provided -as a cmake argument using the standard CMAKE_PREFIX_PATH cmake variable. +as a cmake argument using the standard CMAKE_PREFIX_PATH CMake variable. After cloning the rocminfo git repo, please make sure to do a git-fetch --tags to get the tags residing on the repo. These tags are used for versioning. From 4204bf892baceb2943c39a4741ddb853446aa14e Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Wed, 15 May 2024 14:10:56 -0700 Subject: [PATCH 44/75] Update use-rocm-agent-enumerator.rst --- docs/how-to/use-rocm-agent-enumerator.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/how-to/use-rocm-agent-enumerator.rst b/docs/how-to/use-rocm-agent-enumerator.rst index d23d17d..a907875 100644 --- a/docs/how-to/use-rocm-agent-enumerator.rst +++ b/docs/how-to/use-rocm-agent-enumerator.rst @@ -1,3 +1,6 @@ +.. meta:: + :description: Install ROCmInfo + :keywords: install, rocminfo, AMD, ROCm Using ROCmInfo From 276f94fb56de802dcc2e23ac85141afadb8ffe4f Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Wed, 15 May 2024 14:13:51 -0700 Subject: [PATCH 45/75] Update index.rst --- docs/index.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index d44f8bb..b30de2e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -2,8 +2,13 @@ :description: Install ROCmInfo :keywords: install, rocminfo, AMD, ROCm +ROCmInfo documentation +************************* -For more information, see `GitHub. `_ +ROCmInfo is a ROCm application for reporting system information. + + +For more details, see `GitHub. `_ .. grid:: 2 :gutter: 3 @@ -15,7 +20,7 @@ For more information, see `GitHub. `_ .. grid-item-card:: How to - * :doc:`Use ROCm agent enumerator ` + * :doc:`Use ROCm agent enumerator ` To contribute to the documentation, refer to From 65f9fe50fc8af34cff64f76a17e1e45d40409e89 Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Wed, 15 May 2024 14:15:08 -0700 Subject: [PATCH 46/75] Update index.rst --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index b30de2e..bdde73e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -15,7 +15,7 @@ For more details, see `GitHub. `_ .. grid-item-card:: Install - * :doc:`ROCmInfo installation <./install/install>` + * :doc:`ROCmInfo installation <./install/build>` .. grid-item-card:: How to From db01ade30d35bfb3d6485c8710d3ac50ff22cd44 Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Wed, 15 May 2024 14:15:32 -0700 Subject: [PATCH 47/75] Update _toc.yml.in --- docs/sphinx/_toc.yml.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sphinx/_toc.yml.in b/docs/sphinx/_toc.yml.in index c783847..d6b2fb1 100644 --- a/docs/sphinx/_toc.yml.in +++ b/docs/sphinx/_toc.yml.in @@ -4,7 +4,7 @@ root: index subtrees: - caption: Install entries: - - file: install/install.rst + - file: install/build.rst title: ROCmInfo installation - caption: How to From 0ced4cefae4adef981fede2b80bfdcef1fa1139e Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Wed, 15 May 2024 14:17:05 -0700 Subject: [PATCH 48/75] Update use-rocm-agent-enumerator.rst --- docs/how-to/use-rocm-agent-enumerator.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/how-to/use-rocm-agent-enumerator.rst b/docs/how-to/use-rocm-agent-enumerator.rst index a907875..ae1f633 100644 --- a/docs/how-to/use-rocm-agent-enumerator.rst +++ b/docs/how-to/use-rocm-agent-enumerator.rst @@ -3,8 +3,8 @@ :keywords: install, rocminfo, AMD, ROCm -Using ROCmInfo ---------------- +Using ROCm agent enumertor +-------------------------- You can use ROCmInfo with the following commands: From 8e7e7e7d418bcb524c4a378697c85f5115fb4ae4 Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Wed, 15 May 2024 14:17:17 -0700 Subject: [PATCH 49/75] Update use-rocm-agent-enumerator.rst --- docs/how-to/use-rocm-agent-enumerator.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/how-to/use-rocm-agent-enumerator.rst b/docs/how-to/use-rocm-agent-enumerator.rst index ae1f633..95b7248 100644 --- a/docs/how-to/use-rocm-agent-enumerator.rst +++ b/docs/how-to/use-rocm-agent-enumerator.rst @@ -3,7 +3,7 @@ :keywords: install, rocminfo, AMD, ROCm -Using ROCm agent enumertor +Using ROCm agent enumerator -------------------------- You can use ROCmInfo with the following commands: From 266fe8acb60f97988fae968edc92a8d3241db907 Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Wed, 15 May 2024 14:17:34 -0700 Subject: [PATCH 50/75] Update use-rocm-agent-enumerator.rst --- docs/how-to/use-rocm-agent-enumerator.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/how-to/use-rocm-agent-enumerator.rst b/docs/how-to/use-rocm-agent-enumerator.rst index 95b7248..9f3d682 100644 --- a/docs/how-to/use-rocm-agent-enumerator.rst +++ b/docs/how-to/use-rocm-agent-enumerator.rst @@ -4,7 +4,7 @@ Using ROCm agent enumerator --------------------------- +----------------------------- You can use ROCmInfo with the following commands: From 22d80014de86297fdef4677abdfa4a19d667caaa Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Wed, 15 May 2024 14:18:39 -0700 Subject: [PATCH 51/75] Update build.rst --- docs/install/build.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/install/build.rst b/docs/install/build.rst index ca09659..b42e32a 100644 --- a/docs/install/build.rst +++ b/docs/install/build.rst @@ -3,7 +3,7 @@ :keywords: install, rocminfo, AMD, ROCm -Build ROCmInfo +Building ROCmInfo ***************** Use the standard cmake build procedure to build rocminfo. The location of ROCm root (parent directory containing ROCM headers and libraries) must be provided From c060f419717493dd54121036509076ec84853d55 Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Thu, 16 May 2024 14:34:34 -0700 Subject: [PATCH 52/75] Update index.rst --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index bdde73e..fd64183 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -13,7 +13,7 @@ For more details, see `GitHub. `_ .. grid:: 2 :gutter: 3 - .. grid-item-card:: Install + .. grid-item-card:: Build * :doc:`ROCmInfo installation <./install/build>` From fa9015d222d8f266714db8e574aec0dd4e14ab6f Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Thu, 16 May 2024 14:53:27 -0700 Subject: [PATCH 53/75] Update use-rocm-agent-enumerator.rst --- docs/how-to/use-rocm-agent-enumerator.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/how-to/use-rocm-agent-enumerator.rst b/docs/how-to/use-rocm-agent-enumerator.rst index 9f3d682..59b65d1 100644 --- a/docs/how-to/use-rocm-agent-enumerator.rst +++ b/docs/how-to/use-rocm-agent-enumerator.rst @@ -6,6 +6,12 @@ Using ROCm agent enumerator ----------------------------- +The following products support ROCm Info: + +- gfx000 +- gfx941 +- gfx1036 + You can use ROCmInfo with the following commands: .. code-block:: From 2da5c0b84023501f83b1545e20ed46141e6d840f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 May 2024 07:18:08 +0000 Subject: [PATCH 54/75] Bump rocm-docs-core from 1.1.1 to 1.1.3 in /docs/sphinx Bumps [rocm-docs-core](https://github.com/RadeonOpenCompute/rocm-docs-core) from 1.1.1 to 1.1.3. - [Release notes](https://github.com/RadeonOpenCompute/rocm-docs-core/releases) - [Changelog](https://github.com/ROCm/rocm-docs-core/blob/develop/CHANGELOG.md) - [Commits](https://github.com/RadeonOpenCompute/rocm-docs-core/compare/v1.1.1...v1.1.3) --- updated-dependencies: - dependency-name: rocm-docs-core dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- docs/sphinx/requirements.in | 2 +- docs/sphinx/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sphinx/requirements.in b/docs/sphinx/requirements.in index 17703b4..1ba9717 100644 --- a/docs/sphinx/requirements.in +++ b/docs/sphinx/requirements.in @@ -1 +1 @@ -rocm-docs-core==1.1.1 +rocm-docs-core==1.1.3 diff --git a/docs/sphinx/requirements.txt b/docs/sphinx/requirements.txt index 757de61..3aafdde 100644 --- a/docs/sphinx/requirements.txt +++ b/docs/sphinx/requirements.txt @@ -92,7 +92,7 @@ requests==2.31.0 # via # pygithub # sphinx -rocm-docs-core==1.1.1 +rocm-docs-core==1.1.3 # via -r requirements.in smmap==5.0.1 # via gitdb From c8056cc81214f236da9bde770562ee433744e9e6 Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Thu, 23 May 2024 11:15:29 -0700 Subject: [PATCH 55/75] Update build.rst minor edits --- docs/install/build.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/install/build.rst b/docs/install/build.rst index b42e32a..96e2195 100644 --- a/docs/install/build.rst +++ b/docs/install/build.rst @@ -6,10 +6,10 @@ Building ROCmInfo ***************** -Use the standard cmake build procedure to build rocminfo. The location of ROCm root (parent directory containing ROCM headers and libraries) must be provided -as a cmake argument using the standard CMAKE_PREFIX_PATH CMake variable. +Use the standard cmake build procedure to build ROCmInfo. The location of ROCm root (parent directory containing ROCM headers and libraries) must be provided +as a CMake argument using the standard CMAKE_PREFIX_PATH CMake variable. -After cloning the rocminfo git repo, please make sure to do a git-fetch --tags to get the tags residing on the repo. These tags are used for versioning. +After cloning the ROCmInfo git repo, you must perform a `git-fetch --tags` to get the tags residing on the repo. These tags are used for versioning. For example, @@ -46,4 +46,4 @@ ROCmInfo execution 4. lspci : enumerate PCI bus and locate supported devices from a hard-coded lookup table. -5. rocminfo : a tool shipped with this script to enumerate GPU agents available on a working ROCm stack. +5. ROCmInfo : a tool shipped with this script to enumerate GPU agents available on a working ROCm stack. From 2d04e1f79822f75af584aa1f6653e08bea62320a Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Thu, 23 May 2024 11:16:15 -0700 Subject: [PATCH 56/75] Update index.rst added more details to the ROCmInfo description --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index fd64183..db6ce3a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -5,7 +5,7 @@ ROCmInfo documentation ************************* -ROCmInfo is a ROCm application for reporting system information. +ROCmInfo is a ROCm application for reporting system information. It is a tool shipped to enumerate GPU agents available on a working ROCm stack. For more details, see `GitHub. `_ From dd3ae45b1947d2b855bf5f559f428b6cabb22311 Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Thu, 23 May 2024 11:17:54 -0700 Subject: [PATCH 57/75] Update use-rocm-agent-enumerator.rst --- docs/how-to/use-rocm-agent-enumerator.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/how-to/use-rocm-agent-enumerator.rst b/docs/how-to/use-rocm-agent-enumerator.rst index 59b65d1..104635a 100644 --- a/docs/how-to/use-rocm-agent-enumerator.rst +++ b/docs/how-to/use-rocm-agent-enumerator.rst @@ -6,7 +6,7 @@ Using ROCm agent enumerator ----------------------------- -The following products support ROCm Info: +The following products support ROCmInfo: - gfx000 - gfx941 From ddbc387744e48b4023795391f7210e03b1ef8537 Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Thu, 23 May 2024 11:53:10 -0700 Subject: [PATCH 58/75] Update use-rocm-agent-enumerator.rst --- docs/how-to/use-rocm-agent-enumerator.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/how-to/use-rocm-agent-enumerator.rst b/docs/how-to/use-rocm-agent-enumerator.rst index 104635a..debfa08 100644 --- a/docs/how-to/use-rocm-agent-enumerator.rst +++ b/docs/how-to/use-rocm-agent-enumerator.rst @@ -1,6 +1,6 @@ .. meta:: - :description: Install ROCmInfo - :keywords: install, rocminfo, AMD, ROCm + :description: agent, enumerator ROCmInfo + :keywords: install, rocminfo, AMD, ROCm, ROCmInfo Using ROCm agent enumerator From d077ba55d26e41823733f6b2a80c2134e626f10e Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Thu, 23 May 2024 11:55:27 -0700 Subject: [PATCH 59/75] Update build.rst corrected to ROCmInfo --- docs/install/build.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/install/build.rst b/docs/install/build.rst index 96e2195..03c9a17 100644 --- a/docs/install/build.rst +++ b/docs/install/build.rst @@ -29,7 +29,7 @@ For example, cd .. -Upon a successful build, the binary, rocminfo, and the python script, rocm_agent_enumerator, will be in the `build` folder. +Upon a successful build, the binary, ROCmInfo, and the Python script, rocm_agent_enumerator, will be in the `build` folder. ROCmInfo execution ------------------- From 9f30cda6c59f1e8eb43a8c617cb32d0b7e346bd6 Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Thu, 23 May 2024 11:56:48 -0700 Subject: [PATCH 60/75] Update build.rst --- docs/install/build.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/install/build.rst b/docs/install/build.rst index 03c9a17..e0bf8d1 100644 --- a/docs/install/build.rst +++ b/docs/install/build.rst @@ -36,7 +36,7 @@ ROCmInfo execution "rocminfo" gives information about the HSA system attributes and agents. -"rocm_agent_enumerator" prints the list of available AMD GCN ISA or architecture names. With the option '-name', it prints out available architectures names obtained from rocminfo. Otherwise, it generates ISA in one of five different ways: +"rocm_agent_enumerator" prints the list of available AMD GCN ISA or architecture names. With the option '-name', it prints out available architectures names obtained from ROCmInfo. Otherwise, it generates ISA in one of five different ways: 1. ROCM_TARGET_LST : a user defined environment variable, set to the path and filename where to find the "target.lst" file. This can be used in an install environment with sandbox, where execution of "rocminfo" is not possible. From ac08c20724b622c1627fd524a189faa253950e88 Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Thu, 23 May 2024 11:57:57 -0700 Subject: [PATCH 61/75] Added a description --- docs/how-to/use-rocm-agent-enumerator.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/how-to/use-rocm-agent-enumerator.rst b/docs/how-to/use-rocm-agent-enumerator.rst index debfa08..ae74e66 100644 --- a/docs/how-to/use-rocm-agent-enumerator.rst +++ b/docs/how-to/use-rocm-agent-enumerator.rst @@ -6,6 +6,8 @@ Using ROCm agent enumerator ----------------------------- +While ROCmInfo gives information about the HSA system attributes and agents, "rocm_agent_enumerator" prints the list of available AMD GCN ISA or architecture names. With the option '-name', it prints out available architectures names obtained from ROCmInfo. + The following products support ROCmInfo: - gfx000 From 9712407241cfe6fa2a99fc22073066cf47ea3bc7 Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Thu, 23 May 2024 12:48:53 -0700 Subject: [PATCH 62/75] Update index.rst minor tweak --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index db6ce3a..9f33d6c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -8,7 +8,7 @@ ROCmInfo documentation ROCmInfo is a ROCm application for reporting system information. It is a tool shipped to enumerate GPU agents available on a working ROCm stack. -For more details, see `GitHub. `_ +You can access ROCmInfo code at `GitHub. `_ .. grid:: 2 :gutter: 3 From 04f65ff97c586864675a40716cf7d8901c7aa987 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 May 2024 07:39:14 +0000 Subject: [PATCH 63/75] Bump rocm-docs-core from 1.1.3 to 1.2.0 in /docs/sphinx Bumps [rocm-docs-core](https://github.com/RadeonOpenCompute/rocm-docs-core) from 1.1.3 to 1.2.0. - [Release notes](https://github.com/RadeonOpenCompute/rocm-docs-core/releases) - [Changelog](https://github.com/ROCm/rocm-docs-core/blob/develop/CHANGELOG.md) - [Commits](https://github.com/RadeonOpenCompute/rocm-docs-core/compare/v1.1.3...v1.2.0) --- updated-dependencies: - dependency-name: rocm-docs-core dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- docs/sphinx/requirements.in | 2 +- docs/sphinx/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sphinx/requirements.in b/docs/sphinx/requirements.in index 1ba9717..3f2ef3d 100644 --- a/docs/sphinx/requirements.in +++ b/docs/sphinx/requirements.in @@ -1 +1 @@ -rocm-docs-core==1.1.3 +rocm-docs-core==1.2.0 diff --git a/docs/sphinx/requirements.txt b/docs/sphinx/requirements.txt index 3aafdde..c62f575 100644 --- a/docs/sphinx/requirements.txt +++ b/docs/sphinx/requirements.txt @@ -92,7 +92,7 @@ requests==2.31.0 # via # pygithub # sphinx -rocm-docs-core==1.1.3 +rocm-docs-core==1.2.0 # via -r requirements.in smmap==5.0.1 # via gitdb From bc36daead6187a6e670b0c8f3245760a65eee60e Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Tue, 28 May 2024 13:29:38 -0700 Subject: [PATCH 64/75] Create use-rocminfo.rst Added a new page --- docs/how-to/use-rocminfo.rst | 190 +++++++++++++++++++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100644 docs/how-to/use-rocminfo.rst diff --git a/docs/how-to/use-rocminfo.rst b/docs/how-to/use-rocminfo.rst new file mode 100644 index 0000000..102b05b --- /dev/null +++ b/docs/how-to/use-rocminfo.rst @@ -0,0 +1,190 @@ +.. meta:: + :description: Using ROCmInfo + :keywords: rocminfo, enumerator, info, AMD, ROCm, HSA, hsa + + +================ +Using ROCmInfo +================ + +The ROCmInfo command provides information about the Heterogenous System Architecture (HSA) system attributes and agents. Each agent represents a device and a device can be a CPU or a GPU. + +The output has the following two sections: + +* HSA System Attributes - List of general information of the system. + +* HSA agents - List of devices in the system. + +See the following example output of the ROCmInfo command on a system with MI300X: + +.. code-block:: + + HSA System Attributes + ===================== + Runtime Version: 1.1 + Runtime Ext Version: 1.6 + System Timestamp Freq.: 1000.000000MHz + Sig. Max Wait Duration: 18446744073709551615 (0xFFFFFFFFFFFFFFFF) (timestamp count) + Machine Model: LARGE + System Endianness: LITTLE + Mwaitx: DISABLED + DMAbuf Support: YES + ========== + HSA Agents + ========== + ******* + Agent 1 + ******* + Name: AMD Ryzen 9 7950X 16-Core Processor + Uuid: CPU-XX + Marketing Name: AMD Ryzen 9 7950X 16-Core Processor\ + Vendor Name: CPU\ + Feature: None specified + Profile: FULL_PROFILE + Float Round Mode: NEAR + Max Queue Number: 0(0x0) + Queue Min Size: 0(0x0)\ + Queue Max Size: 0(0x0) + Queue Type: MULTI + Node: 0 + Device Type: CPU + Cache Info: + L1: 32768(0x8000) KB + Chip ID: 0(0x0) + ASIC Revision: 0(0x0) + Cacheline Size: 64(0x40) + Max Clock Freq. (MHz): 4500 + BDFID: 0 + Internal Node ID: 0 + Compute Unit: 32 + SIMDs per CU: 0 + Shader Engines: 0 + Shader Arrs. per Eng.: 0 + WatchPts on Addr. Ranges:1 + Memory Properties: + Features: None + Pool Info: + Pool 1 + Segment: GLOBAL; FLAGS: FINE GRAINED + Size: 65111316(0x3e18514) KB + Allocatable: TRUE + Alloc Granule: 4KB + Alloc Recommended Granule:4KB + Alloc Alignment: 4KB + Accessible by all: TRUE + Pool 2 + Segment: GLOBAL; FLAGS: KERNARG, FINE GRAINED + Size: 65111316(0x3e18514) KB + Allocatable: TRUE + Alloc Granule: 4KB + Alloc Recommended Granule:4KB + Alloc Alignment: 4KB + Accessible by all: TRUE + Pool 3 + Segment: GLOBAL; FLAGS: COARSE GRAINED + Size: 65111316(0x3e18514) KB + Allocatable: TRUE + Alloc Granule: 4KB + Alloc Recommended Granule:4KB + Alloc Alignment: 4KB + Accessible by all: TRUE + ISA Info: + ******* + Agent 2 + ******* + Name: gfx941 + Uuid: GPU-a8673551b40c6374 + Marketing Name: AMD Instinct MI300X + Vendor Name: AMD + Feature: KERNEL_DISPATCH + Profile: BASE_PROFILE + Float Round Mode: NEAR + Max Queue Number: 128(0x80) + Queue Min Size: 64(0x40) + Queue Max Size: 131072(0x20000) + Queue Type: MULTI + Node: 1 + Device Type: GPU + Cache Info: + L1: 32(0x20) KB + L2: 4096(0x1000) KB + L3: 262144(0x40000) KB + Chip ID: 29857(0x74a1) + ASIC Revision: 0(0x0) + Cacheline Size: 64(0x40) + Max Clock Freq. (MHz): 1800 + BDFID: 768 + Internal Node ID: 1 + Compute Unit: 304 + SIMDs per CU: 4 + Shader Engines: 32 + Shader Arrs. per Eng.: 1 + WatchPts on Addr. Ranges:4 + Coherent Host Access: FALSE + Memory Properties: + Features: KERNEL_DISPATCH + Fast F16 Operation: TRUE + Wavefront Size: 64(0x40) + Workgroup Max Size: 1024(0x400) + Workgroup Max Size per Dimension: + x 1024(0x400) + y 1024(0x400) + z 1024(0x400) + Max Waves Per CU: 32(0x20) + Max Work-item Per CU: 2048(0x800) + Grid Max Size: 4294967295(0xffffffff) + Grid Max Size per Dimension: + x 4294967295(0xffffffff) + y 4294967295(0xffffffff) + z 4294967295(0xffffffff) + Max fbarriers/Workgrp: 32 + Packet Processor uCode:: 141 + SDMA engine uCode:: 19 + IOMMU Support:: None + Pool Info: + Pool 1 + Segment: GLOBAL; FLAGS: COARSE GRAINED + Size: 134201344(0x7ffc000) KB + Allocatable: TRUE + Alloc Granule: 4KB + Alloc Recommended Granule:2048KB + Alloc Alignment: 4KB + Accessible by all: FALSE + Pool 2 + Segment: GLOBAL; FLAGS: EXTENDED FINE GRAINED + Size: 134201344(0x7ffc000) KB + Allocatable: TRUE + Alloc Granule: 4KB + Alloc Recommended Granule:2048KB + Alloc Alignment: 4KB + Accessible by all: FALSE + Pool 3 + Segment: GROUP + Size: 64(0x40) KB + Allocatable: FALSE + Alloc Granule: 0KB + Alloc Recommended Granule:0KB + Alloc Alignment: 0KB + Accessible by all: FALSE + ISA Info: + ISA 1 + Name: amdgcn-amd-amdhsa--gfx941:sramecc+:xnack- + Machine Models: HSA_MACHINE_MODEL_LARGE + Profiles: HSA_PROFILE_BASE + Default Rounding Mode: NEAR + Default Rounding Mode: NEAR + Fast f16: TRUE + Workgroup Max Size: 1024(0x400 + + Workgroup Max Size per Dimension: + x 1024(0x400) + y 1024(0x400) + z 1024(0x400) + Grid Max Size: 4294967295(0xffffffff) + Grid Max Size per Dimension: + x 4294967295(0xffffffff) + y 4294967295(0xffffffff) + z 4294967295(0xffffffff) + + *** Done *** + From b4a7201d25fbe24b99eb14a197721c29ac42d610 Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Tue, 28 May 2024 13:34:16 -0700 Subject: [PATCH 65/75] Update use-rocm-agent-enumerator.rst --- docs/how-to/use-rocm-agent-enumerator.rst | 277 +--------------------- 1 file changed, 8 insertions(+), 269 deletions(-) diff --git a/docs/how-to/use-rocm-agent-enumerator.rst b/docs/how-to/use-rocm-agent-enumerator.rst index ae74e66..a009697 100644 --- a/docs/how-to/use-rocm-agent-enumerator.rst +++ b/docs/how-to/use-rocm-agent-enumerator.rst @@ -6,278 +6,17 @@ Using ROCm agent enumerator ----------------------------- -While ROCmInfo gives information about the HSA system attributes and agents, "rocm_agent_enumerator" prints the list of available AMD GCN ISA or architecture names. With the option '-name', it prints out available architectures names obtained from ROCmInfo. +The rocm_agent_enumerator prints the list of available AMD GCN ISA or acthitecture names. With the option ‘-name’. it prints out available architecture names that can be used by third-party scripts to determine which ISAs are needed to execute code on all GPUs in the system. -The following products support ROCmInfo: +This is an example output of the rocm_agent_enumerator command on a system with an MI-300X installation, -- gfx000 -- gfx941 -- gfx1036 +.. code-block:: -You can use ROCmInfo with the following commands: + gfx000 + gfx941 -.. code-block:: - #!/usr/bin/env python3 +.. Note:: + +The gfx000 represents the CPU agent. - import os - import re - import subprocess - import sys - import time - - # get current working directory - CWD = os.path.dirname(os.path.realpath(__file__)) - - ISA_TO_ID = { - # Kaveri - Temporary - "gfx700" : [0x1304, 0x1305, 0x1306, 0x1307, 0x1309, 0x130a, 0x130b, 0x130c, - 0x130d, 0x130e, 0x130f, 0x1310, 0x1311, 0x1312, 0x1313, 0x1315, - 0x1316, 0x1317, 0x1318, 0x131b, 0x131c, 0x131d], - # Hawaii - "gfx701" : [0x67a0, 0x67a1, 0x67a2, 0x67a8, 0x67a9, 0x67aa, 0x67b0, 0x67b1, - 0x67b8, 0x67b9, 0x67ba, 0x67be], - # Carrizo - "gfx801" : [0x9870, 0x9874, 0x9875, 0x9876, 0x9877, 0x98e4], - # Tonga - "gfx802" : [0x6920, 0x6921, 0x6928, 0x6929, 0x692b, 0x692f, 0x6930, 0x6938, - 0x6939], - # Fiji - "gfx803" : [0x7300, 0x730f, - # Polaris10 - 0x67c0, 0x67c1, 0x67c2, 0x67c4, 0x67c7, 0x67c8, 0x67c9, 0x67ca, - 0x67cc, 0x67cf, 0x6fdf, - # Polaris11 - 0x67d0, 0x67df, 0x67e0, 0x67e1, 0x67e3, 0x67e7, 0x67e8, 0x67e9, - 0x67eb, 0x67ef, 0x67ff, - # Polaris12 - 0x6980, 0x6981, 0x6985, 0x6986, 0x6987, 0x6995, 0x6997, 0x699f, - # VegaM - 0x694c, 0x694e, 0x694f], - # Vega10 - "gfx900" : [0x6860, 0x6861, 0x6862, 0x6863, 0x6864, 0x6867, 0x6868, 0x6869, - 0x6869, 0x686a, 0x686b, 0x686c, 0x686d, 0x686e, 0x686f, 0x687f], - # Raven - "gfx902" : [0x15dd, 0x15d8], - # Vega12 - "gfx904" : [0x69a0, 0x69a1, 0x69a2, 0x69a3, 0x69af], - # Vega20 - "gfx906" : [0x66a0, 0x66a1, 0x66a2, 0x66a3, 0x66a4, 0x66a7, 0x66af], - # Arcturus - "gfx908" : [0x738c, 0x7388, 0x738e, 0x7390], - # Aldebaran - "gfx90a" : [0x7408, 0x740c, 0x740f, 0x7410], - # Renoir - "gfx90c" : [0x15e7, 0x1636, 0x1638, 0x164c], - # Navi10 - "gfx1010" : [0x7310, 0x7312, 0x7318, 0x7319, 0x731a, 0x731b, 0x731e, 0x731f], - # Navi12 - "gfx1011" : [0x7360, 0x7362], - # Navi14 - "gfx1012" : [0x7340, 0x7341, 0x7347, 0x734f], - # Cyan_Skillfish - "gfx1013" : [0x13f9, 0x13fa, 0x13fb, 0x13fc, 0x13f3], - # Sienna_Cichlid - "gfx1030" : [0x73a0, 0x73a1, 0x73a2, 0x73a3, 0x73a5, 0x73a8, 0x73a9, 0x73ab, - 0x73ac, 0x73ad, 0x73ae, 0x73af, 0x73bf], - # Navy_Flounder - "gfx1031" : [0x73c0, 0x73c1, 0x73c3, 0x73da, 0x73db, 0x73dc, 0x73dd, 0x73de, - 0x73df], - # Dimgray_Cavefish - "gfx1032" : [0x73e0, 0x73e1, 0x73e2, 0x73e3, 0x73e8, 0x73e9, 0x73ea, 0x73eb, - 0x73ec, 0x73ed, 0x73ef, 0x73ff], - # Van Gogh - "gfx1033" : [0x163f], - # Beige_Goby - "gfx1034" : [0x7420, 0x7421, 0x7422, 0x7423, 0x743f], - # Yellow_Carp - "gfx1035" : [0x164d, 0x1681] - } - - def staticVars(**kwargs): - def deco(func): - for k in kwargs: - setattr(func, k, kwargs[k]) - return func - return deco - - @staticVars(search_term=re.compile("gfx[0-9a-fA-F]+")) - def getGCNISA(line, match_from_beginning = False): - if match_from_beginning is True: - result = getGCNISA.search_term.match(line) - else: - result = getGCNISA.search_term.search(line) - - if result is not None: - return result.group(0) - return None - - @staticVars(search_name=re.compile("gfx[0-9a-fA-F]+:[-+:\w]+")) - def getGCNArchName(line): - result = getGCNArchName.search_name.search(line) - - if result is not None: - return result.group(0) - return None - - def readFromTargetLstFile(): - target_list = [] - - # locate target.lst using environment variable or - # it should be placed at the same directory with this script - target_lst_path = os.environ.get("ROCM_TARGET_LST"); - if target_lst_path == None: - target_lst_path = os.path.join(CWD, "target.lst") - if os.path.isfile(target_lst_path): - target_lst_file = open(target_lst_path, 'r') - for line in target_lst_file: - # for target.lst match from beginning so targets can be disabled by - # commenting it out - target = getGCNISA(line, match_from_beginning = True) - if target is not None: - target_list.append(target) - - return target_list - - def readFromROCMINFO(search_arch_name = False): - target_list = [] - # locate rocminfo binary which should be placed at the same directory with - # this script - rocminfo_executable = os.path.join(CWD, "rocminfo") - - try: - t0 = time.time() - while 1: - t1 = time.time() - # quit after retrying rocminfo for a minute. - if t1 - t0 > 60.0: - print("Timeout querying rocminfo. Are you compiling with more than 254 threads?") - break - # run rocminfo - rocminfo_output = subprocess.Popen(rocminfo_executable, stdout=subprocess.PIPE).communicate()[0].decode("utf-8").split('\n') - term1 = re.compile("Cannot allocate memory") - term2 = re.compile("HSA_STATUS_ERROR_OUT_OF_RESOURCES") - done = 1 - for line in rocminfo_output: - if term1.search(line) is not None or term2.search(line) is not None: - done = 0 - break - if done: - break - except: - rocminfo_output = [] - - # search AMDGCN gfx ISA - if search_arch_name is True: - line_search_term = re.compile("\A\s+Name:\s+(amdgcn-amd-amdhsa--gfx\d+)") - else: - line_search_term = re.compile("\A\s+Name:\s+(gfx\d+)") - for line in rocminfo_output: - if line_search_term.match(line) is not None: - if search_arch_name is True: - target = getGCNArchName(line) - else: - target = getGCNISA(line) - if target is not None: - target_list.append(target) - - return target_list - - def readFromLSPCI(): - target_list = [] - - try: - # run lspci - lspci_output = subprocess.Popen(["/usr/bin/lspci", "-n", "-d", "1002:"], stdout=subprocess.PIPE).communicate()[0].decode("utf-8").split('\n') - except: - lspci_output = [] - - target_search_term = re.compile("1002:\w+") - for line in lspci_output: - search_result = target_search_term.search(line) - if search_result is not None: - device_id = int(search_result.group(0).split(':')[1], 16) - # try lookup from ISA_TO_ID dict - for target in ISA_TO_ID.keys(): - for target_device_id in ISA_TO_ID[target]: - if device_id == target_device_id: - target_list.append(target) - break - - return target_list - - def readFromKFD(): - target_list = [] - - topology_dir = '/sys/class/kfd/kfd/topology/nodes/' - if os.path.isdir(topology_dir): - for node in sorted(os.listdir(topology_dir)): - node_path = os.path.join(topology_dir, node) - if os.path.isdir(node_path): - prop_path = node_path + '/properties' - if os.path.isfile(prop_path) and os.access(prop_path, os.R_OK): - target_search_term = re.compile("gfx_target_version.+") - with open(prop_path) as f: - try: - line = f.readline() - except PermissionError: - # We may have a subsystem (e.g. scheduler) limiting device visibility which - # could cause a permission error. - line = '' - while line != '' : - search_result = target_search_term.search(line) - if search_result is not None: - device_id = int(search_result.group(0).split(' ')[1], 10) - if device_id != 0: - major_ver = int((device_id / 10000) % 100) - minor_ver = int((device_id / 100) % 100) - stepping_ver = int(device_id % 100) - target_list.append("gfx" + format(major_ver, 'd') + format(minor_ver, 'x') + format(stepping_ver, 'x')) - line = f.readline() - - return target_list - - def main(): - if len(sys.argv) == 2 and sys.argv[1] == '-name' : - """ Prints the list of available AMD GCN target names extracted from rocminfo, a tool - shipped with this script to enumerate GPU agents available on a working ROCm stack.""" - target_list = readFromROCMINFO(True) - else: - """Prints the list of available AMD GCN ISA - - The program collects the list in 3 different ways, in the order of - precendence: - - 1. ROCM_TARGET_LST : a user defined environment variable, set to the path and - filename where to find the "target.lst" file. This can be - used in an install environment with sandbox, where - execution of "rocminfo" is not possible. - 2. target.lst : user-supplied text file. This is used in a container setting - where ROCm stack may usually not available. - 3. HSA topology : gathers the information from the HSA node topology in - /sys/class/kfd/kfd/topology/nodes/ - 4. lspci : enumerate PCI bus and locate supported devices from a hard-coded - lookup table. - 5. rocminfo : a tool shipped with this script to enumerate GPU agents - available on a working ROCm stack. - """ - target_list = readFromTargetLstFile() - - if len(target_list) == 0: - target_list = readFromKFD() - - if len(target_list) == 0: - target_list = readFromLSPCI() - - if len(target_list) == 0: - target_list = readFromROCMINFO() - - # workaround to cope with existing rocm_agent_enumerator behavior where gfx000 - # would always be returned - print("gfx000") - - for gfx in target_list: - print(gfx) - - if __name__ == "__main__": - main() From fd7eff181cbc6b1aa9d095c5db0f07f3a04dde0c Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Tue, 28 May 2024 13:35:04 -0700 Subject: [PATCH 66/75] Update use-rocm-agent-enumerator.rst --- docs/how-to/use-rocm-agent-enumerator.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/how-to/use-rocm-agent-enumerator.rst b/docs/how-to/use-rocm-agent-enumerator.rst index a009697..2ce8495 100644 --- a/docs/how-to/use-rocm-agent-enumerator.rst +++ b/docs/how-to/use-rocm-agent-enumerator.rst @@ -6,9 +6,9 @@ Using ROCm agent enumerator ----------------------------- -The rocm_agent_enumerator prints the list of available AMD GCN ISA or acthitecture names. With the option ‘-name’. it prints out available architecture names that can be used by third-party scripts to determine which ISAs are needed to execute code on all GPUs in the system. +The rocm_agent_enumerator tool prints the list of available AMD GCN ISA or acthitecture names. With the option ‘-name’, it prints out available architecture names that can be used by third-party scripts to determine which ISAs are needed to execute code on all GPUs in the system. -This is an example output of the rocm_agent_enumerator command on a system with an MI-300X installation, +See the following example output of the rocm_agent_enumerator command on a system with an MI-300X installation, .. code-block:: From 983603cb3408eb93d07b88a3c55fb3a2b09f5543 Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Tue, 28 May 2024 13:41:48 -0700 Subject: [PATCH 67/75] Update _toc.yml.in --- docs/sphinx/_toc.yml.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/sphinx/_toc.yml.in b/docs/sphinx/_toc.yml.in index d6b2fb1..2cde262 100644 --- a/docs/sphinx/_toc.yml.in +++ b/docs/sphinx/_toc.yml.in @@ -9,6 +9,8 @@ subtrees: - caption: How to entries: + - file: how-to/use-rocminfo.rst + title: Use ROCmInfo - file: how-to/use-rocm-agent-enumerator.rst title: Use ROCm agent enumerator From b3e9a9d29d2a644215b7d0aac9d54120b63a7846 Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Tue, 28 May 2024 13:48:20 -0700 Subject: [PATCH 68/75] Update index.rst --- docs/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/index.rst b/docs/index.rst index 9f33d6c..3b6b804 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -21,6 +21,7 @@ You can access ROCmInfo code at `GitHub. `_ .. grid-item-card:: How to * :doc:`Use ROCm agent enumerator ` + * :doc:`Use ROCmInfo ` To contribute to the documentation, refer to From 042930b0d1cb0628b29e9b9e7c949e49d3f6a23f Mon Sep 17 00:00:00 2001 From: Roopa Malavally <56051583+Rmalavally@users.noreply.github.com> Date: Tue, 28 May 2024 14:11:38 -0700 Subject: [PATCH 69/75] Update index.rst --- docs/index.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index 3b6b804..5aaa420 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -20,8 +20,9 @@ You can access ROCmInfo code at `GitHub. `_ .. grid-item-card:: How to - * :doc:`Use ROCm agent enumerator ` * :doc:`Use ROCmInfo ` + * :doc:`Use ROCm agent enumerator ` + To contribute to the documentation, refer to From 2bd32b0daff2f03506a11c49f5b54777c0afd17e Mon Sep 17 00:00:00 2001 From: amd-jmacaran Date: Wed, 5 Jun 2024 01:51:43 -0400 Subject: [PATCH 70/75] External CI: change supported branches Change-Id: I3c3db1243d067720fd141eeb204d9b0b3e7a9fd6 --- .azuredevops/rocm-ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.azuredevops/rocm-ci.yml b/.azuredevops/rocm-ci.yml index a045d39..06d6e24 100644 --- a/.azuredevops/rocm-ci.yml +++ b/.azuredevops/rocm-ci.yml @@ -20,7 +20,8 @@ trigger: batch: true branches: include: - - master + - amd-staging + - amd-master paths: exclude: - .github @@ -31,7 +32,8 @@ pr: autoCancel: true branches: include: - - master + - amd-staging + - amd-master paths: exclude: - .github From 311429fe7a18ad1d3f2c262ac81fb7455593a49c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 19:43:18 +0000 Subject: [PATCH 71/75] Bump rocm-docs-core from 1.2.0 to 1.2.1 in /docs/sphinx Bumps [rocm-docs-core](https://github.com/RadeonOpenCompute/rocm-docs-core) from 1.2.0 to 1.2.1. - [Release notes](https://github.com/RadeonOpenCompute/rocm-docs-core/releases) - [Changelog](https://github.com/ROCm/rocm-docs-core/blob/v1.2.1/CHANGELOG.md) - [Commits](https://github.com/RadeonOpenCompute/rocm-docs-core/compare/v1.2.0...v1.2.1) --- updated-dependencies: - dependency-name: rocm-docs-core dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Change-Id: I60c3d94a447b71ca0ce26a87b7f55b055b9aef9f --- docs/sphinx/requirements.in | 2 +- docs/sphinx/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sphinx/requirements.in b/docs/sphinx/requirements.in index 3f2ef3d..987734c 100644 --- a/docs/sphinx/requirements.in +++ b/docs/sphinx/requirements.in @@ -1 +1 @@ -rocm-docs-core==1.2.0 +rocm-docs-core==1.2.1 diff --git a/docs/sphinx/requirements.txt b/docs/sphinx/requirements.txt index c62f575..14560b0 100644 --- a/docs/sphinx/requirements.txt +++ b/docs/sphinx/requirements.txt @@ -92,7 +92,7 @@ requests==2.31.0 # via # pygithub # sphinx -rocm-docs-core==1.2.0 +rocm-docs-core==1.2.1 # via -r requirements.in smmap==5.0.1 # via gitdb From 7de51c82486c8662732342623804b0984e55119f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Jun 2024 07:29:15 +0000 Subject: [PATCH 72/75] Bump rocm-docs-core from 1.2.1 to 1.4.0 in /docs/sphinx Bumps [rocm-docs-core](https://github.com/ROCm/rocm-docs-core) from 1.2.1 to 1.4.0. - [Release notes](https://github.com/ROCm/rocm-docs-core/releases) - [Changelog](https://github.com/ROCm/rocm-docs-core/blob/develop/CHANGELOG.md) - [Commits](https://github.com/ROCm/rocm-docs-core/compare/v1.2.1...v1.4.0) --- updated-dependencies: - dependency-name: rocm-docs-core dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Change-Id: I60c2d94a447b71ca0ce26a87b7f55b055b8aff8e --- docs/sphinx/requirements.in | 2 +- docs/sphinx/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sphinx/requirements.in b/docs/sphinx/requirements.in index 987734c..189f044 100644 --- a/docs/sphinx/requirements.in +++ b/docs/sphinx/requirements.in @@ -1 +1 @@ -rocm-docs-core==1.2.1 +rocm-docs-core==1.4.0 diff --git a/docs/sphinx/requirements.txt b/docs/sphinx/requirements.txt index 14560b0..c31d293 100644 --- a/docs/sphinx/requirements.txt +++ b/docs/sphinx/requirements.txt @@ -92,7 +92,7 @@ requests==2.31.0 # via # pygithub # sphinx -rocm-docs-core==1.2.1 +rocm-docs-core==1.4.0 # via -r requirements.in smmap==5.0.1 # via gitdb From 0600911f0b59ee21982d51d21d85daa857dcd2a8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 Jul 2024 07:26:40 +0000 Subject: [PATCH 73/75] Bump rocm-docs-core from 1.4.0 to 1.5.0 in /docs/sphinx Bumps [rocm-docs-core](https://github.com/ROCm/rocm-docs-core) from 1.4.0 to 1.5.0. - [Release notes](https://github.com/ROCm/rocm-docs-core/releases) - [Changelog](https://github.com/ROCm/rocm-docs-core/blob/develop/CHANGELOG.md) - [Commits](https://github.com/ROCm/rocm-docs-core/compare/v1.4.0...v1.5.0) --- updated-dependencies: - dependency-name: rocm-docs-core dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Change-Id: I60c2d94a447b71ca0ce26a87b7f55b055b8bef9e --- docs/sphinx/requirements.in | 2 +- docs/sphinx/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sphinx/requirements.in b/docs/sphinx/requirements.in index 189f044..c7df173 100644 --- a/docs/sphinx/requirements.in +++ b/docs/sphinx/requirements.in @@ -1 +1 @@ -rocm-docs-core==1.4.0 +rocm-docs-core==1.5.0 diff --git a/docs/sphinx/requirements.txt b/docs/sphinx/requirements.txt index c31d293..a21583b 100644 --- a/docs/sphinx/requirements.txt +++ b/docs/sphinx/requirements.txt @@ -92,7 +92,7 @@ requests==2.31.0 # via # pygithub # sphinx -rocm-docs-core==1.4.0 +rocm-docs-core==1.5.0 # via -r requirements.in smmap==5.0.1 # via gitdb From aa8a83815e235145130270a9b543be7a2c695cef Mon Sep 17 00:00:00 2001 From: Ranjith Ramakrishnan Date: Mon, 5 Aug 2024 09:38:04 -0700 Subject: [PATCH 74/75] Prevent the modification of interpreter directives CPACK is converting /usr/bin/env python3 to /usr/libexec/platform-python in RHEL8. Undefining __brp_mangle_shebangs will prevent the same Change-Id: I0803d0a6cc1ddc991e8e9a8e6617436930ef013a --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ff240bf..426657d 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -247,6 +247,9 @@ endif() if ( ROCM_DEP_ROCMCORE ) string ( APPEND CPACK_RPM_PACKAGE_REQUIRES " rocm-core" ) endif() +# Cpack converts !/usr/bin/env python3 to /usr/libexec/platform-python in RHEL8. +# prevent the BRP(buildroot policy) script from checking and modifying interpreter directives +set(CPACK_RPM_SPEC_MORE_DEFINE "%undefine __brp_mangle_shebangs") #Set rpm distro if(CPACK_RPM_PACKAGE_RELEASE) From d00aee6407f232c4b69b486177a09e19e238251f Mon Sep 17 00:00:00 2001 From: YiyangWu Date: Wed, 18 Aug 2021 21:05:20 +0800 Subject: [PATCH 75/75] Check /sys/module/amdgpu for ROCk instead of lsmod Closes: #42 Signed-off-by: YiyangWu --- rocminfo.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rocminfo.cc b/rocminfo.cc index 8686153..4d99f30 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -1201,9 +1201,14 @@ int CheckInitialState(void) { return -1; } } else { - printf("%sROCk module is NOT loaded, possibly no GPU devices%s\n", + int module_dir; + module_dir = open("/sys/module/amdgpu", O_DIRECTORY); + if (module_dir < 0) { + printf("%sROCk module is NOT loaded, possibly no GPU devices%s\n", COL_RED, COL_RESET); - return -1; + return -1; + } + close(module_dir); } // Check if user belongs to the group for /dev/kfd (e.g. "video" or