From 5292ddc602d96c539f4a63ca78d21aef73524bf3 Mon Sep 17 00:00:00 2001 From: Robert Gregory Date: Mon, 23 Oct 2017 15:29:48 -0400 Subject: [PATCH 001/162] Initial empty repository From 5c6e06c80f7790691c82e7d9ac715fd280a73317 Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Fri, 3 Nov 2017 11:54:11 -0500 Subject: [PATCH 002/162] Rename to rocminfo Change-Id: Ifd0ba9aaa4078dc2771e15bb254ba1c4ec2acf1e --- CMakeLists.txt | 188 ++++++++++ rocminfo.cc | 929 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1117 insertions(+) create mode 100755 CMakeLists.txt create mode 100755 rocminfo.cc diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 index 0000000000..ae6e6898e4 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,188 @@ +# +# Minimum version of cmake required +# +cmake_minimum_required(VERSION 2.8.0) +# +# GCC 4.8 or higher compiler required. +# +# Required Defines on cmake command line +# +# 1) Set location of ROCR header files (required) +# +# ROCM_DIR="Root for RocM install" +# +# 2) Set ROCRTST_BLD_TYPE to either "Debug" or "Release". +# If not set, the default value is "Debug" is bound. +# +# ROCRTST_BLD_TYPE=Debug or ROCRTST_BLD_TYPE=Release +# +# 3) Set ROCRTST_BLD_BITS to either "32" or "64" +# If not set, the default value of "64" is bound. +# +# ROCRTST_BLD_BITS=32 or ROCRTST_BLD_BITS=64 +# +# Building rocminfo +# +# 1) Create build folder e.g. "rocminfo/build" - any name will do +# 2) Cd into build folder +# 3) Run cmake, passing in the above defines, as needed/required: +# "cmake -DROCM_DIR= .." +# 4) Run "make" +# +# Upon a successful build, the executable "rocminfo" will be in the +# build directory. +# +# Currently support for Windows platform is not present +# +if(WIN32) + message("This sample is not supported on Windows platform") + return() +endif() +# +# Process input variables +# + +# Required Defines first: + +set(ROCR_INC_DIR ${ROCM_DIR}/include) +set(ROCR_LIB_DIR ${ROCM_DIR}/lib) +# +# Determine ROCR Header files are present +# +if(NOT EXISTS ${ROCR_INC_DIR}/hsa/hsa.h) + message("ERROR: ${ROCR_INC_DIR}/hsa/hsa.h does not exist. Check value of ROCM_DIR define") + return() +endif() + +# Determine ROCR Library files are present +# +if("${ROCRTST_BLD_BITS}" STREQUAL 32) + set (ONLY64STR "") + set (IS64BIT 0) +else() + set (ONLY64STR "64") + set (IS64BIT 1) +endif() +# +if (${IS64BIT} EQUAL 0) + if(NOT EXISTS ${ROCR_LIB_DIR}/libhsa-runtime.so) + message("ERROR: ${ROCR_LIB_DIR}/libhsa-runtime.so doesn't exist. Check value of ROCM_DIR define") + return() + endif() +else() + if(NOT EXISTS ${ROCR_LIB_DIR}/libhsa-runtime64.so) + message("ERROR: Define ROCR_LIB_DIR pointing to ROCR libraries is not set") + return() + endif() +endif() + +string(TOLOWER "${ROCRTST_BLD_TYPE}" tmp) +if("${tmp}" STREQUAL release) + set(BUILD_TYPE "Release") + set(ISDEBUG 0) +else() + set(BUILD_TYPE "Debug") + set(ISDEBUG 1) +endif() + +# Set Name for Samples Project +# + +set(PROJECT_NAME "sample${ONLY64STR}") +project (${PROJECT_NAME}) + +# +# Print out the build configuration being used: +# +# Build Src directory +# Build Binary directory +# Build Type: Debug Vs Release, 32 Vs 64 +# Compiler Version, etc +# +message("") +message("Build Configuration:") +message("-------------IS64BIT: " ${IS64BIT}) +message("-----------BuildType: " ${BUILD_TYPE}) +message("------------Compiler: " ${CMAKE_CXX_COMPILER}) +message("-------------Version: " ${CMAKE_CXX_COMPILER_VERSION}) +message("--------Proj Src Dir: " ${PROJECT_SOURCE_DIR}) +message("--------Proj Bld Dir: " ${PROJECT_BINARY_DIR}) +message("--------Proj Lib Dir: " ${PROJECT_BINARY_DIR}/lib) +message("--------Proj Exe Dir: " ${PROJECT_BINARY_DIR}/bin) +message("") + +set(ROCMINFO_EXE "rocminfo") + +# +# Set the build type based on user input +# +set(CMAKE_BUILD_TYPE ${BUILD_TYPE}) +# +# Flag to enable / disable verbose output. +# +SET( CMAKE_VERBOSE_MAKEFILE on ) +# +# Compiler pre-processor definitions. +# +# Define MACRO "DEBUG" if build type is "Debug" +if(${BUILD_TYPE} STREQUAL "Debug") +add_definitions(-DDEBUG) +endif() + +add_definitions(-D__linux__) +add_definitions(-DLITTLEENDIAN_CPU=1) + +# +# Linux Compiler options +# +set(CMAKE_CXX_FLAGS "-std=c++11 ") + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-math-errno") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-threadsafe-statics") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmerge-all-constants") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fms-extensions") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") + +# +# Extend the compiler flags for 64-bit builds +# +if (IS64BIT) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -msse -msse2") +else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") +endif() + +# +# Add compiler flags to include symbol information for debug builds +# +if(ISDEBUG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb -O0") +endif() + +# +# Linux Linker options +## +# Specify the directory containing various libraries of ROCR +# to be linked against for building ROC Perf applications +# +link_directories(${ROCR_LIB_DIR}) + +# +# Extend the list of libraries to be used for linking ROC Perf Apps +# +set(ROCR_LIBS ${ROCR_LIBS} hsa-runtime${ONLY64STR}) + +include_directories(${ROCR_INC_DIR} ${OPENCL_INC_DIR}) + +########################### +# SAMPLE SPECIFIC SECTION +########################### + +# RocR Info +aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} ROCMINFO_SOURCES) +add_executable(${ROCMINFO_EXE} ${ROCMINFO_SOURCES}) +target_link_libraries(${ROCMINFO_EXE} ${ROCR_LIBS} c stdc++ dl pthread rt) + diff --git a/rocminfo.cc b/rocminfo.cc new file mode 100755 index 0000000000..0738cf2ba9 --- /dev/null +++ b/rocminfo.cc @@ -0,0 +1,929 @@ +/* + * ============================================================================= + * ROC Runtime Conformance Release License + * ============================================================================= + * The University of Illinois/NCSA + * Open Source License (NCSA) + * + * Copyright (c) 2017, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Developed by: + * + * AMD Research and AMD ROC Software Development + * + * Advanced Micro Devices, Inc. + * + * www.amd.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal with the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimers. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimers in + * the documentation and/or other materials provided with the distribution. + * - Neither the names of , + * nor the names of its contributors may be used to endorse or promote + * products derived from this Software without specific prior written + * permission. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS WITH THE SOFTWARE. + * + */ +#include +#include +#include +#include "hsa/hsa.h" +#include "hsa/hsa_ext_amd.h" + +#define RET_IF_HSA_ERR(err) { \ + if ((err) != HSA_STATUS_SUCCESS) { \ + printf("hsa api call failure at line %d, file: %s. Call returned %d\n", \ + __LINE__, __FILE__, err); \ + return (err); \ + } \ +} + +// This structure holds system information acquired through hsa info related +// calls, and is later used for reference when displaying the information. +typedef struct { + uint16_t major, minor; + uint64_t timestamp_frequency = 0; + uint64_t max_wait = 0; + hsa_endianness_t endianness; + hsa_machine_model_t machine_model; +} system_info_t; + +// This structure holds agent information acquired through hsa info related +// calls, and is later used for reference when displaying the information. +typedef struct { + char name[64]; + char vendor_name[64]; + hsa_agent_feature_t agent_feature; + hsa_profile_t agent_profile; + hsa_default_float_rounding_mode_t float_rounding_mode; + uint32_t max_queue; + uint32_t queue_min_size; + uint32_t queue_max_size; + hsa_queue_type_t queue_type; + uint32_t node; + hsa_device_type_t device_type; + uint32_t cache_size[4]; + uint32_t chip_id; + uint32_t cacheline_size; + uint32_t max_clock_freq; + uint32_t compute_unit; + uint32_t wavefront_size; + uint32_t workgroup_max_size; + uint32_t grid_max_size; + uint32_t fbarrier_max_size; + uint32_t waves_per_cu; + hsa_isa_t agent_isa; + hsa_dim3_t grid_max_dim; + uint16_t workgroup_max_dim[3]; + uint16_t bdf_id; + bool fast_f16; +} agent_info_t; + +// This structure holds memory pool information acquired through hsa info +// related calls, and is later used for reference when displaying the +// information. +typedef struct { + uint32_t segment; + size_t pool_size; + bool alloc_allowed; + size_t alloc_granule; + size_t pool_alloc_alignment; + bool pl_access; + uint32_t global_flag; +} pool_info_t; + +// This structure holds ISA information acquired through hsa info +// related calls, and is later used for reference when displaying the +// information. +typedef struct { + char *name_str; + uint32_t workgroup_max_size; + hsa_dim3_t grid_max_dim; + uint64_t grid_max_size; + uint32_t fbarrier_max_size; + uint16_t workgroup_max_dim[3]; + bool def_rounding_modes[3]; + bool base_rounding_modes[3]; + bool mach_models[2]; + bool profiles[2]; + bool fast_f16; +} isa_info_t; + +// This structure holds cache information acquired through hsa info +// related calls, and is later used for reference when displaying the +// information. +typedef struct { + char *name_str; + uint8_t level; + uint32_t size; +} cache_info_t; + +static const uint32_t kLabelFieldSize = 25; +static const uint32_t kValueFieldSize = 35; +static const uint32_t kIndentSize = 2; + +static void printLabelInt(char const *l, int d, uint32_t indent_lvl = 0) { + std::string ind(kIndentSize * indent_lvl, ' '); + + printf("%s%-*s%-*u\n", ind.c_str(), kLabelFieldSize, l, kValueFieldSize, d); +} +static void printLabelStr(char const *l, char const *s, + uint32_t indent_lvl = 0) { + std::string ind(kIndentSize * indent_lvl, ' '); + printf("%s%-*s%-*s\n", ind.c_str(), kLabelFieldSize, l, kValueFieldSize, s); +} +static void printLabel(char const *l, bool newline = false, + uint32_t indent_lvl = 0) { + std::string ind(kIndentSize * indent_lvl, ' '); + + printf("%s%-*s", ind.c_str(), kLabelFieldSize, l); + + if (newline) { + printf("\n"); + } +} +static void printValueStr(char const *s, bool newline = true) { + printf("%-*s\n", kValueFieldSize, s); +} + +// Acquire system information +static hsa_status_t AcquireSystemInfo(system_info_t *sys_info) { + hsa_status_t err; + + // Get Major and Minor version of runtime + err = hsa_system_get_info(HSA_SYSTEM_INFO_VERSION_MAJOR, &sys_info->major); + RET_IF_HSA_ERR(err); + err = hsa_system_get_info(HSA_SYSTEM_INFO_VERSION_MINOR, &sys_info->minor); + RET_IF_HSA_ERR(err); + + // Get timestamp frequency + err = hsa_system_get_info(HSA_SYSTEM_INFO_TIMESTAMP_FREQUENCY, + &sys_info->timestamp_frequency); + RET_IF_HSA_ERR(err); + + // Get maximum duration of a signal wait operation + err = hsa_system_get_info(HSA_SYSTEM_INFO_SIGNAL_MAX_WAIT, + &sys_info->max_wait); + RET_IF_HSA_ERR(err); + + // Get Endianness of the system + err = hsa_system_get_info(HSA_SYSTEM_INFO_ENDIANNESS, &sys_info->endianness); + RET_IF_HSA_ERR(err); + + // Get machine model info + err = hsa_system_get_info(HSA_SYSTEM_INFO_MACHINE_MODEL, + &sys_info->machine_model); + 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("System Timestamp Freq.:"); + printf("%fMHz\n", sys_info->timestamp_frequency / 1e6); + printLabel("Sig. Max Wait Duration:"); + printf("%lu (number of timestamp)\n", sys_info->max_wait); + + printLabel("Machine Model:"); + if (HSA_MACHINE_MODEL_SMALL == sys_info->machine_model) { + printValueStr("SMALL"); + } else if (HSA_MACHINE_MODEL_LARGE == sys_info->machine_model) { + printValueStr("LARGE"); + } + + printLabel("System Endianness:"); + if (HSA_ENDIANNESS_LITTLE == sys_info->endianness) { + printValueStr("LITTLE"); + } else if (HSA_ENDIANNESS_BIG == sys_info->endianness) { + printValueStr("BIG"); + } + printf("\n"); +} + +static hsa_status_t +AcquireAgentInfo(hsa_agent_t agent, agent_info_t *agent_i) { + hsa_status_t err; + // Get agent name and vendor + err = hsa_agent_get_info(agent, HSA_AGENT_INFO_NAME, agent_i->name); + RET_IF_HSA_ERR(err); + err = hsa_agent_get_info(agent, HSA_AGENT_INFO_VENDOR_NAME, + &agent_i->vendor_name); + RET_IF_HSA_ERR(err); + + // Get agent feature + err = hsa_agent_get_info(agent, HSA_AGENT_INFO_FEATURE, + &agent_i->agent_feature); + RET_IF_HSA_ERR(err); + + // Get profile supported by the agent + err = hsa_agent_get_info(agent, HSA_AGENT_INFO_PROFILE, + &agent_i->agent_profile); + RET_IF_HSA_ERR(err); + + // Get floating-point rounding mode + err = hsa_agent_get_info(agent, HSA_AGENT_INFO_DEFAULT_FLOAT_ROUNDING_MODE, + &agent_i->float_rounding_mode); + RET_IF_HSA_ERR(err); + + // Get max number of queue + err = hsa_agent_get_info(agent, HSA_AGENT_INFO_QUEUES_MAX, + &agent_i->max_queue); + RET_IF_HSA_ERR(err); + + // Get queue min size + err = hsa_agent_get_info(agent, HSA_AGENT_INFO_QUEUE_MIN_SIZE, + &agent_i->queue_min_size); + RET_IF_HSA_ERR(err); + + // Get queue max size + err = hsa_agent_get_info(agent, HSA_AGENT_INFO_QUEUE_MAX_SIZE, + &agent_i->queue_max_size); + RET_IF_HSA_ERR(err); + + // Get queue type + err = hsa_agent_get_info(agent, HSA_AGENT_INFO_QUEUE_TYPE, + &agent_i->queue_type); + RET_IF_HSA_ERR(err); + + // Get agent node + err = hsa_agent_get_info(agent, HSA_AGENT_INFO_NODE, &agent_i->node); + RET_IF_HSA_ERR(err); + + // Get device type + err = hsa_agent_get_info(agent, HSA_AGENT_INFO_DEVICE, + &agent_i->device_type); + RET_IF_HSA_ERR(err); + + if (HSA_DEVICE_TYPE_GPU == agent_i->device_type) { + err = hsa_agent_get_info(agent, HSA_AGENT_INFO_ISA, &agent_i->agent_isa); + RET_IF_HSA_ERR(err); + } + + // Get cache size + err = hsa_agent_get_info(agent, HSA_AGENT_INFO_CACHE_SIZE, + agent_i->cache_size); + RET_IF_HSA_ERR(err); + + // Get chip id + err = hsa_agent_get_info(agent, + (hsa_agent_info_t) HSA_AMD_AGENT_INFO_CHIP_ID, + &agent_i->chip_id); + RET_IF_HSA_ERR(err); + + // Get cacheline size + err = hsa_agent_get_info(agent, + (hsa_agent_info_t) HSA_AMD_AGENT_INFO_CACHELINE_SIZE, + &agent_i->cacheline_size); + RET_IF_HSA_ERR(err); + + // Get Max clock frequency + err = hsa_agent_get_info(agent, + (hsa_agent_info_t) HSA_AMD_AGENT_INFO_MAX_CLOCK_FREQUENCY, + &agent_i->max_clock_freq); + RET_IF_HSA_ERR(err); + + // Get Agent BDFID + err = hsa_agent_get_info(agent, + (hsa_agent_info_t)HSA_AMD_AGENT_INFO_BDFID, &agent_i->bdf_id); + RET_IF_HSA_ERR(err); + + // Get number of Compute Unit + err = hsa_agent_get_info(agent, + (hsa_agent_info_t) HSA_AMD_AGENT_INFO_COMPUTE_UNIT_COUNT, + &agent_i->compute_unit); + 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 + err = hsa_agent_get_info(agent, + HSA_AGENT_INFO_FAST_F16_OPERATION, &agent_i->fast_f16); + RET_IF_HSA_ERR(err); + + // Get wavefront size + err = hsa_agent_get_info(agent, + HSA_AGENT_INFO_WAVEFRONT_SIZE, &agent_i->wavefront_size); + RET_IF_HSA_ERR(err); + + // Get max total number of work-items in a workgroup + err = hsa_agent_get_info(agent, HSA_AGENT_INFO_WORKGROUP_MAX_SIZE, + &agent_i->workgroup_max_size); + RET_IF_HSA_ERR(err); + + // Get max number of work-items of each dimension of a work-group + err = hsa_agent_get_info(agent, HSA_AGENT_INFO_WORKGROUP_MAX_DIM, + &agent_i->workgroup_max_dim); + RET_IF_HSA_ERR(err); + + // Get max number of a grid per dimension + err = hsa_agent_get_info(agent, HSA_AGENT_INFO_GRID_MAX_DIM, + &agent_i->grid_max_dim); + RET_IF_HSA_ERR(err); + + // Get max total number of work-items in a grid + err = hsa_agent_get_info(agent, HSA_AGENT_INFO_GRID_MAX_SIZE, + &agent_i->grid_max_size); + RET_IF_HSA_ERR(err); + + // Get max number of fbarriers per work group + err = hsa_agent_get_info(agent, HSA_AGENT_INFO_FBARRIER_MAX_SIZE, + &agent_i->fbarrier_max_size); + RET_IF_HSA_ERR(err); + + err = hsa_agent_get_info(agent, + (hsa_agent_info_t)HSA_AMD_AGENT_INFO_MAX_WAVES_PER_CU, + &agent_i->waves_per_cu); + RET_IF_HSA_ERR(err); + } + return err; +} + +static void DisplayAgentInfo(agent_info_t *agent_i) { + printLabelStr("Name:", agent_i->name, 1); + printLabelStr("Vendor Name:", agent_i->vendor_name, 1); + + printLabel("Feature:", false, 1); + if (agent_i->agent_feature & HSA_AGENT_FEATURE_KERNEL_DISPATCH + && agent_i->agent_feature & HSA_AGENT_FEATURE_AGENT_DISPATCH) { + printValueStr("KERNEL_DISPATCH & AGENT_DISPATCH"); + } else if (agent_i->agent_feature & HSA_AGENT_FEATURE_KERNEL_DISPATCH) { + printValueStr("KERNEL_DISPATCH"); + } else if (agent_i->agent_feature & HSA_AGENT_FEATURE_AGENT_DISPATCH) { + printValueStr("AGENT_DISPATCH"); + } else { + printValueStr("None specified"); + } + + printLabel("Profile:", false, 1); + if (HSA_PROFILE_BASE == agent_i->agent_profile) { + printValueStr("BASE_PROFILE"); + } else if (HSA_PROFILE_FULL == agent_i->agent_profile) { + printValueStr("FULL_PROFILE"); + } else { + printValueStr("Unknown"); + } + + printLabel("Float Round Mode:", false, 1); + if (HSA_DEFAULT_FLOAT_ROUNDING_MODE_ZERO == agent_i->float_rounding_mode) { + printValueStr("ZERO"); + } else if (HSA_DEFAULT_FLOAT_ROUNDING_MODE_NEAR == + agent_i->float_rounding_mode) { + printValueStr("NEAR"); + } else { + printValueStr("Not Supported"); + } + + printLabelInt("Max Queue Number:", agent_i->max_queue, 1); + printLabelInt("Queue Min Size:", agent_i->queue_min_size, 1); + printLabelInt("Queue Max Size:", agent_i->queue_max_size, 1); + + if (HSA_QUEUE_TYPE_MULTI == agent_i->queue_type) { + printLabelStr("Queue Type:", "MULTI", 1); + } else if (HSA_QUEUE_TYPE_SINGLE == agent_i->queue_type) { + printLabelStr("Queue Type:", "SINGLE", 1); + } else { + printLabelStr("Queue Type:", "Unknown", 1); + } + + printLabelInt("Node:", agent_i->node, 1); + + printLabel("Device Type:", false, 1); + if (HSA_DEVICE_TYPE_CPU == agent_i->device_type) { + printValueStr("CPU"); + } else if (HSA_DEVICE_TYPE_GPU == agent_i->device_type) { + printValueStr("GPU"); + } else { + printValueStr("DSP"); + } + + printLabel("Cache Info:", true, 1); + + for (int i = 0; i < 4; i++) { + if (agent_i->cache_size[i]) { + std::string tmp_str("L"); + tmp_str += std::to_string(i+1); + tmp_str += ":"; + printLabel(tmp_str.c_str(), false, 2); + + tmp_str = std::to_string(agent_i->cache_size[i]/1024); + tmp_str += "KB"; + printValueStr(tmp_str.c_str()); + } + } + + printLabelInt("Chip ID:", agent_i->chip_id, 1); + printLabelInt("Cacheline Size:", agent_i->cacheline_size, 1); + printLabelInt("Max Clock Frequency (MHz):", agent_i->max_clock_freq, 1); + printLabelInt("BDFID:", agent_i->bdf_id, 1); + printLabelInt("Compute Unit:", agent_i->compute_unit, 1); + + printLabel("Features:", false, 1); + if (agent_i->agent_feature & HSA_AGENT_FEATURE_KERNEL_DISPATCH) { + printf("%s", "KERNEL_DISPATCH "); + } + if (agent_i->agent_feature & HSA_AGENT_FEATURE_AGENT_DISPATCH) { + printf("%s", "AGENT_DISPATCH"); + } + if (agent_i->agent_feature == 0) { + printf("None"); + } + printf("\n"); + + if (agent_i->agent_feature & HSA_AGENT_FEATURE_KERNEL_DISPATCH) { + printLabelStr("Fast F16 Operation:", agent_i->fast_f16 ? "TRUE":"FALSE", 1); + + printLabelInt("Wavefront Size:", agent_i->wavefront_size, 1); + printLabelInt("Workgroup Max Size:", agent_i->workgroup_max_size, 1); + + printLabel("Workgroup Max Size Per Dimension:", true, 1); + std::string dim; + for (int i = 0; i < 3; i++) { + dim = "Dim[" + std::to_string(i) + "]:"; + printLabelInt(dim.c_str(), + reinterpret_cast(&agent_i->workgroup_max_dim)[i], 2); + } + printLabelInt("Grid Max Size:", agent_i->grid_max_size, 1); + printLabelInt("Waves Per CU:", agent_i->waves_per_cu, 1); + printLabelInt("Max Work-item Per CU:", + agent_i->wavefront_size*agent_i->waves_per_cu, 1); + printLabel("Grid Max Size per Dimension:", true, 1); + for (int i = 0; i < 3; i++) { + dim = "Dim[" + std::to_string(i) + "]:"; + printLabelInt(dim.c_str(), + reinterpret_cast(&agent_i->grid_max_dim)[i], 2); + } + + printLabelInt("Max number Of fbarriers Per Workgroup:", + agent_i->fbarrier_max_size, 1); + } +} + +static hsa_status_t AcquirePoolInfo(hsa_amd_memory_pool_t pool, + pool_info_t *pool_i) { + hsa_status_t err; + + err = hsa_amd_memory_pool_get_info(pool, + HSA_AMD_MEMORY_POOL_INFO_GLOBAL_FLAGS, &pool_i->global_flag); + RET_IF_HSA_ERR(err); + + err = hsa_amd_memory_pool_get_info(pool, HSA_AMD_MEMORY_POOL_INFO_SEGMENT, + &pool_i->segment); + RET_IF_HSA_ERR(err); + + // Get the size of the POOL + err = hsa_amd_memory_pool_get_info(pool, HSA_AMD_MEMORY_POOL_INFO_SIZE, + &pool_i->pool_size); + RET_IF_HSA_ERR(err); + + err = hsa_amd_memory_pool_get_info(pool, + HSA_AMD_MEMORY_POOL_INFO_RUNTIME_ALLOC_ALLOWED, + &pool_i->alloc_allowed); + RET_IF_HSA_ERR(err); + + err = hsa_amd_memory_pool_get_info(pool, + HSA_AMD_MEMORY_POOL_INFO_RUNTIME_ALLOC_GRANULE, + &pool_i->alloc_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); + RET_IF_HSA_ERR(err); + + err = hsa_amd_memory_pool_get_info(pool, + HSA_AMD_MEMORY_POOL_INFO_ACCESSIBLE_BY_ALL, + &pool_i->pl_access); + RET_IF_HSA_ERR(err); + + return HSA_STATUS_SUCCESS; +} + +static void MakeGlobalFlagsString(uint32_t global_flag, std::string* out_str) { + *out_str = ""; + + std::vector flags; + + if (HSA_AMD_MEMORY_POOL_GLOBAL_FLAG_KERNARG_INIT & global_flag) { + flags.push_back("KERNARG"); + } + + if (HSA_AMD_MEMORY_POOL_GLOBAL_FLAG_FINE_GRAINED & global_flag) { + flags.push_back("FINE GRAINED"); + } + + if (HSA_AMD_MEMORY_POOL_GLOBAL_FLAG_COARSE_GRAINED & global_flag) { + flags.push_back("COARSE GRAINED"); + } + + if (flags.size() > 0) { + *out_str += flags[0]; + } + + for (size_t i = 1; i < flags.size(); i++) { + *out_str += ", " + flags[i]; + } +} + +static void DumpSegment(pool_info_t *pool_i, uint32_t ind_lvl) { + std::string seg_str; + std::string tmp_str; + + printLabel("Segment:", false, ind_lvl); + + switch (pool_i->segment) { + case HSA_AMD_SEGMENT_GLOBAL: + MakeGlobalFlagsString(pool_i->global_flag, &tmp_str); + seg_str += "GLOBAL; FLAGS: " + tmp_str; + break; + + case HSA_AMD_SEGMENT_READONLY: + seg_str += "READONLY"; + break; + + case HSA_AMD_SEGMENT_PRIVATE: + seg_str += "PRIVATE"; + break; + + case HSA_AMD_SEGMENT_GROUP: + seg_str += "GROUP"; + break; + + default: + printf("Not Supported\n"); + break; + } + printValueStr(seg_str.c_str()); +} + +static void DisplayPoolInfo(pool_info_t *pool_i, uint32_t indent) { + DumpSegment(pool_i, indent); + + std::string sz_str = std::to_string(pool_i->pool_size/1024) + "KB"; + printLabelStr("Size:", sz_str.c_str(), indent); + printLabelStr("Allocatable:", (pool_i->alloc_allowed ? "TRUE" : "FALSE"), + indent); + std::string gr_str = std::to_string(pool_i->alloc_granule/1024)+"KB"; + printLabelStr("Alloc Granule:", gr_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); + + printLabelStr("Acessible by all:", (pool_i->pl_access ? "TRUE" : "FALSE"), + indent); +} + +static hsa_status_t +AcquireAndDisplayMemPoolInfo(const hsa_amd_memory_pool_t pool, + uint32_t indent) { + hsa_status_t err; + pool_info_t pool_i; + + err = AcquirePoolInfo(pool, &pool_i); + RET_IF_HSA_ERR(err); + + DisplayPoolInfo(&pool_i, 3); + + return err; +} + +static hsa_status_t get_pool_info(hsa_amd_memory_pool_t pool, void* data) { + hsa_status_t err; + int* p_int = reinterpret_cast(data); + (*p_int)++; + + std::string pool_str("Pool "); + pool_str += std::to_string(*p_int); + printLabel(pool_str.c_str(), true, 2); + + err = AcquireAndDisplayMemPoolInfo(pool, 3); + RET_IF_HSA_ERR(err); + + return err; +} + +static hsa_status_t AcquireISAInfo(hsa_isa_t isa, isa_info_t *isa_i) { + hsa_status_t err; + uint32_t name_len; + err = hsa_isa_get_info_alt(isa, HSA_ISA_INFO_NAME_LENGTH, &name_len); + RET_IF_HSA_ERR(err); + + isa_i->name_str = new char[name_len]; + if (isa_i->name_str == nullptr) { + return HSA_STATUS_ERROR_OUT_OF_RESOURCES; + } + + err = hsa_isa_get_info_alt(isa, HSA_ISA_INFO_NAME, isa_i->name_str); + RET_IF_HSA_ERR(err); + + err = hsa_isa_get_info_alt(isa, HSA_ISA_INFO_MACHINE_MODELS, + isa_i->mach_models); + RET_IF_HSA_ERR(err); + + err = hsa_isa_get_info_alt(isa, HSA_ISA_INFO_PROFILES, isa_i->profiles); + RET_IF_HSA_ERR(err); + + err = hsa_isa_get_info_alt(isa, HSA_ISA_INFO_DEFAULT_FLOAT_ROUNDING_MODES, + isa_i->def_rounding_modes); + RET_IF_HSA_ERR(err); + + err = hsa_isa_get_info_alt(isa, + HSA_ISA_INFO_BASE_PROFILE_DEFAULT_FLOAT_ROUNDING_MODES, + isa_i->base_rounding_modes); + RET_IF_HSA_ERR(err); + + err = hsa_isa_get_info_alt(isa, HSA_ISA_INFO_FAST_F16_OPERATION, + &isa_i->fast_f16); + RET_IF_HSA_ERR(err); + + err = hsa_isa_get_info_alt(isa, HSA_ISA_INFO_WORKGROUP_MAX_DIM, + &isa_i->workgroup_max_dim); + RET_IF_HSA_ERR(err); + + err = hsa_isa_get_info_alt(isa, HSA_ISA_INFO_WORKGROUP_MAX_SIZE, + &isa_i->workgroup_max_size); + RET_IF_HSA_ERR(err); + + err = hsa_isa_get_info_alt(isa, HSA_ISA_INFO_GRID_MAX_DIM, + &isa_i->grid_max_dim); + RET_IF_HSA_ERR(err); + + err = hsa_isa_get_info_alt(isa, HSA_ISA_INFO_GRID_MAX_SIZE, + &isa_i->grid_max_size); + RET_IF_HSA_ERR(err); + + err = hsa_isa_get_info_alt(isa, HSA_ISA_INFO_FBARRIER_MAX_SIZE, + &isa_i->fbarrier_max_size); + RET_IF_HSA_ERR(err); + + return err; +} + +static void DisplayISAInfo(isa_info_t *isa_i, uint32_t indent) { + printLabelStr("Name:", isa_i->name_str, indent); + + std::string models(""); + if (isa_i->mach_models[HSA_MACHINE_MODEL_SMALL]) { + models = "HSA_MACHINE_MODEL_SMALL "; + } + if (isa_i->mach_models[HSA_MACHINE_MODEL_LARGE]) { + models += "HSA_MACHINE_MODEL_LARGE"; + } + printLabelStr("Machine Models:", models.c_str(), indent); + + std::string profiles(""); + if (isa_i->profiles[HSA_PROFILE_BASE]) { + profiles = "HSA_PROFILE_BASE "; + } + if (isa_i->profiles[HSA_PROFILE_FULL]) { + profiles += "HSA_PROFILE_FULL"; + } + printLabelStr("Profiles:", profiles.c_str(), indent); + + std::string rounding_modes(""); + if (isa_i->def_rounding_modes[HSA_DEFAULT_FLOAT_ROUNDING_MODE_DEFAULT]) { + rounding_modes = "DEFAULT "; + } + if (isa_i->def_rounding_modes[HSA_DEFAULT_FLOAT_ROUNDING_MODE_ZERO]) { + rounding_modes += "ZERO "; + } + if (isa_i->def_rounding_modes[HSA_DEFAULT_FLOAT_ROUNDING_MODE_NEAR]) { + rounding_modes += "NEAR"; + } + printLabelStr("Default Rounding Mode:", rounding_modes.c_str(), indent); + + rounding_modes = ""; + if (isa_i->base_rounding_modes[HSA_DEFAULT_FLOAT_ROUNDING_MODE_DEFAULT]) { + rounding_modes = "DEFAULT "; + } + if (isa_i->base_rounding_modes[HSA_DEFAULT_FLOAT_ROUNDING_MODE_ZERO]) { + rounding_modes += "ZERO "; + } + if (isa_i->base_rounding_modes[HSA_DEFAULT_FLOAT_ROUNDING_MODE_NEAR]) { + rounding_modes += "NEAR"; + } + printLabelStr("Default Rounding Mode:", rounding_modes.c_str(), indent); + + printLabelStr("Fast f16:", (isa_i->fast_f16 ? "TRUE" : "FALSE"), indent); + + printLabel("Workgroup Max Dimension:", true, indent); + std::string dim; + for (int i = 0; i < 3; i++) { + dim = "Dim[" + std::to_string(i) + "]:"; + printLabelInt(dim.c_str(), + reinterpret_cast(&isa_i->workgroup_max_dim)[i], indent+1); + } + + printLabelInt("Workgroup Max Size:", isa_i->workgroup_max_size, indent); + + printLabel("Grid Max Dimension:", true, indent); + printLabelInt("x", isa_i->grid_max_dim.x, indent+1); + printLabelInt("y", isa_i->grid_max_dim.y, indent+1); + printLabelInt("z", isa_i->grid_max_dim.z, indent+1); + + printLabelInt("Grid Max Size:", isa_i->grid_max_size, indent); + printLabelInt("FBarrier Max Size:", isa_i->fbarrier_max_size, indent); +} + +static hsa_status_t +AcquireAndDisplayISAInfo(const hsa_isa_t isa, uint32_t indent) { + hsa_status_t err; + isa_info_t isa_i; + + isa_i.name_str = nullptr; + err = AcquireISAInfo(isa, &isa_i); + RET_IF_HSA_ERR(err); + + DisplayISAInfo(&isa_i, 3); + + if (isa_i.name_str != nullptr) { + delete []isa_i.name_str; + } + return err; +} +static hsa_status_t get_isa_info(hsa_isa_t isa, void* data) { + hsa_status_t err; + int* isa_int = reinterpret_cast(data); + (*isa_int)++; + + std::string isa_str("ISA "); + isa_str += std::to_string(*isa_int); + printLabel(isa_str.c_str(), true, 2); + + err = AcquireAndDisplayISAInfo(isa, 3); + RET_IF_HSA_ERR(err); + + return err; +} +// Cache info dump is ifdef'd out as it generates a lot of output that is +// not that interesting. Define ENABLE_CACHE_DUMP if this is of interest. +#ifdef ENABLE_CACHE_DUMP +static void DisplayCacheInfo(cache_info_t *cache_i, uint32_t indent) { + printLabelStr("Name:", cache_i->name_str, indent); + + printLabelInt("Level:", cache_i->level, indent); + printLabelInt("Size:", cache_i->size, indent); +} + +static hsa_status_t AcquireCacheInfo(hsa_cache_t cache, cache_info_t *cache_i) { + hsa_status_t err; + uint32_t name_len; + err = hsa_cache_get_info(cache, HSA_CACHE_INFO_NAME_LENGTH, &name_len); + RET_IF_HSA_ERR(err); + + cache_i->name_str = new char[name_len]; + if (cache_i->name_str == nullptr) { + return HSA_STATUS_ERROR_OUT_OF_RESOURCES; + } + + err = hsa_cache_get_info(cache, HSA_CACHE_INFO_NAME, cache_i->name_str); + RET_IF_HSA_ERR(err); + + err = hsa_cache_get_info(cache, HSA_CACHE_INFO_LEVEL, &cache_i->level); + RET_IF_HSA_ERR(err); + + err = hsa_cache_get_info(cache, HSA_CACHE_INFO_SIZE, &cache_i->size); + RET_IF_HSA_ERR(err); + return err; +} + +static hsa_status_t +AcquireAndDisplayCacheInfo(const hsa_cache_t cache, uint32_t indent) { + hsa_status_t err; + cache_info_t cache_i; + + err = AcquireCacheInfo(cache, &cache_i); + RET_IF_HSA_ERR(err); + + DisplayCacheInfo(&cache_i, 3); + + if (cache_i.name_str != nullptr) { + delete []cache_i.name_str; + } + + return err; +} + +static hsa_status_t get_cache_info(hsa_cache_t cache, void* data) { + hsa_status_t err; + int* cache_int = reinterpret_cast(data); + (*cache_int)++; + + std::string cache_str("Cache L"); + cache_str += std::to_string(*cache_int); + printLabel(cache_str.c_str(), true, 2); + + err = AcquireAndDisplayCacheInfo(cache, 3); + RET_IF_HSA_ERR(err); + + return err; +} +#endif // ENABLE_CACHE_DUMP +static hsa_status_t +AcquireAndDisplayAgentInfo(hsa_agent_t agent, void* data) { + int pool_number = 0; + int isa_number = 0; + + hsa_status_t err; + agent_info_t agent_i; + + int *agent_number = reinterpret_cast(data); + (*agent_number)++; + + err = AcquireAgentInfo(agent, &agent_i); + RET_IF_HSA_ERR(err); + + std::string ind(kIndentSize, ' '); + + printLabel("*******", true); + std::string agent_ind("Agent "); + agent_ind += std::to_string(*agent_number).c_str(); + printLabel(agent_ind.c_str(), true); + printLabel("*******", true); + + DisplayAgentInfo(&agent_i); + + printLabel("Pool Info:", true, 1); + err = hsa_amd_agent_iterate_memory_pools(agent, get_pool_info, &pool_number); + RET_IF_HSA_ERR(err); + + printLabel("ISA Info:", true, 1); + err = hsa_agent_iterate_isas(agent, get_isa_info, &isa_number); + if (err == HSA_STATUS_ERROR_INVALID_AGENT) { + printLabel("N/A", true, 2); + return HSA_STATUS_SUCCESS; + } + RET_IF_HSA_ERR(err); + +#if ENABLE_CACHE_DUMP + int cache_number = 0; + printLabel("Cache Info:", true, 1); + err = hsa_agent_iterate_caches(agent, get_cache_info, &cache_number); + if (err == HSA_STATUS_ERROR_INVALID_AGENT) { + printLabel("N/A", true, 2); + return HSA_STATUS_SUCCESS; + } +#endif + RET_IF_HSA_ERR(err); + + return HSA_STATUS_SUCCESS; +} + +// Print out all static information known to HSA about the target system. +// Throughout this program, the Acquire-type functions make HSA calls to +// interate through HSA objects and then perform HSA get_info calls to +// acccumulate information about those objects. Corresponding to each +// Acquire-type function is a Display* function which display the +// accumulated data in a formatted way. +int main(int argc, char* argv[]) { + hsa_status_t err; + + err = hsa_init(); + RET_IF_HSA_ERR(err); + + // Acquire and display system information + system_info_t sys_info; + + // This function will call HSA get_info functions to gather information + // about the system. + err = AcquireSystemInfo(&sys_info); + RET_IF_HSA_ERR(err); + + printLabel("=====================", true); + printLabel("HSA System Attributes", true); + printLabel("=====================", true); + DisplaySystemInfo(&sys_info); + + // Iterate through every agent and get and display their info + printLabel("==========", true); + printLabel("HSA Agents", true); + printLabel("==========", true); + uint32_t agent_ind = 0; + err = hsa_iterate_agents(AcquireAndDisplayAgentInfo, &agent_ind); + RET_IF_HSA_ERR(err); + + printLabel("*** Done ***", true); + + err = hsa_shut_down(); + RET_IF_HSA_ERR(err); +} + +#undef RET_IF_HSA_ERR From 6b014b249619d953df4a86aa8b6394aafd4f0ec9 Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Wed, 8 Nov 2017 08:05:08 -0600 Subject: [PATCH 003/162] Add README.md Change-Id: I02b43a10f4f88a73c7e4e63221bec32d0d1d5bf6 --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000000..d8a9a579b5 --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# rocminfo +ROCm Application for Reporting System Info + +## To Build +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. For example, building from the CMakeLists.txt directory might look like this: + +mkdir -p build + +cd build + +cmake -DROCM_DIR= .. + +make + +cd .. + + +Upon a successful build the binary, rocminfo, will be in the build folder. + From 0da670409f3408fa70cb4889c1b16f28b08b472f Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Wed, 8 Nov 2017 08:05:08 -0600 Subject: [PATCH 004/162] Add README.md and License.txt Change-Id: I02b43a10f4f88a73c7e4e63221bec32d0d1d5bf6 --- License.txt | 38 ++++++++++++++++++++++++++++++++++++++ README.md | 22 ++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 License.txt create mode 100644 README.md diff --git a/License.txt b/License.txt new file mode 100644 index 0000000000..4cc6799e85 --- /dev/null +++ b/License.txt @@ -0,0 +1,38 @@ +The University of Illinois/NCSA +Open Source License (NCSA) + +Copyright (c) 2014-2017, Advanced Micro Devices, Inc. All rights reserved. + +Developed by: + + AMD Research and AMD HSA Software Development + + Advanced Micro Devices, Inc. + + www.amd.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal with the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + + - Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimers. + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimers in + the documentation and/or other materials provided with the distribution. + - Neither the names of Advanced Micro Devices, Inc, + nor the names of its contributors may be used to endorse or promote + products derived from this Software without specific prior written + permission. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS WITH THE SOFTWARE. + diff --git a/README.md b/README.md new file mode 100644 index 0000000000..54c3f9fc5d --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +# rocminfo +ROCm Application for Reporting System Info + +## To Build +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. For example, building from the CMakeLists.txt directory +might look like this: + +mkdir -p build + +cd build + +cmake -DROCM_DIR= .. + +make + +cd .. + + +Upon a successful build the binary, rocminfo, will be in the build folder. + From 8b018900f64c96d8e01340b1608d98a9b571276a Mon Sep 17 00:00:00 2001 From: "Wen-Heng (Jack) Chung" Date: Thu, 9 Nov 2017 12:33:53 -0600 Subject: [PATCH 005/162] Initial commit to introduce rocm_agent_enumerator into rocminfo This is a python port of rocm_agent_enumerator, which is used by HIP/HCC to determine available AMDGPU targets on a system. Its previous implementation was written in C++ which makes it somewhat hard to deploy onto different distros / architectures. A python port should remove such issue. --- CMakeLists.txt | 7 ++ rocm_agent_enumerator | 147 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 154 insertions(+) create mode 100755 rocm_agent_enumerator diff --git a/CMakeLists.txt b/CMakeLists.txt index ae6e6898e4..7bd7fd81c9 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -177,6 +177,13 @@ set(ROCR_LIBS ${ROCR_LIBS} hsa-runtime${ONLY64STR}) include_directories(${ROCR_INC_DIR} ${OPENCL_INC_DIR}) +########################### +# rocm_agent_enumerator +########################### + +configure_file(rocm_agent_enumerator rocm_agent_enumerator COPYONLY) + + ########################### # SAMPLE SPECIFIC SECTION ########################### diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator new file mode 100755 index 0000000000..60df28511a --- /dev/null +++ b/rocm_agent_enumerator @@ -0,0 +1,147 @@ +#!/usr/bin/python + +import os +import re +import subprocess +import sys + +# get current working directory +CWD = os.path.dirname(os.path.realpath(__file__)) + +ISA_TO_ID = { + # Kaveri - Temporary + "gfx700" : [0x130f], + # 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, + # Polaris11 + 0x67d0, 0x67df, 0x67e0, 0x67e1, 0x67e3, 0x67e7, 0x67e8, 0x67e9, + 0x67eb, 0x67ef, 0x67ff, + # Polaris12 + 0x6980, 0x6981, 0x6985, 0x6986, 0x6987, 0x6995, 0x6997, 0x699f], + # Vega10 + "gfx900" : [0x6860, 0x6861, 0x6862, 0x6863, 0x6864, 0x6867, 0x6868, 0x686c, + 0x687f] +} + +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\d+")) +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 + +def readFromTargetLstFile(): + target_list = [] + + # locate target.lst which should be placed at the same directory with this + # script + 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(): + target_list = [] + + # locate rocminfo binary which should be placed at the same directory with + # this script + rocminfo_executable = os.path.join(CWD, "rocminfo") + + try: + # run rocminfo + rocminfo_output = subprocess.Popen(rocminfo_executable, stdout=subprocess.PIPE).communicate()[0].split('\n') + except Error as e: + pass + + # search AMDGCN gfx ISA + 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: + 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].split('\n') + except Error as e: + pass + + 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 main(): + """Prints the list of available AMD GCN ISA + + The program collects the list in 3 different ways, in the order of + precendence: + + 1. target.lst : user-supplied text file. This is used in a container setting + where ROCm stack may usually not available. + 2. rocminfo : a tool shipped with this script to enumerate GPU agents + available on a working ROCm stack. + 3. lspci : enumerate PCI bus and locate supported devices from a hard-coded + lookup table. + """ + target_list = readFromTargetLstFile() + + if len(target_list) == 0: + target_list = readFromROCMINFO() + + if len(target_list) == 0: + target_list = readFromLSPCI() + + # 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 6d1234484a57a3587d415734d05a70e4f545ec71 Mon Sep 17 00:00:00 2001 From: "Wen-Heng (Jack) Chung" Date: Thu, 9 Nov 2017 13:20:45 -0600 Subject: [PATCH 006/162] Improve error handling logic --- rocm_agent_enumerator | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index 60df28511a..6700937f3c 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -79,8 +79,8 @@ def readFromROCMINFO(): try: # run rocminfo rocminfo_output = subprocess.Popen(rocminfo_executable, stdout=subprocess.PIPE).communicate()[0].split('\n') - except Error as e: - pass + except: + rocminfo_output = [] # search AMDGCN gfx ISA line_search_term = re.compile("\A\s+Name:\s+(gfx\d+)") @@ -98,8 +98,8 @@ def readFromLSPCI(): try: # run lspci lspci_output = subprocess.Popen(["/usr/bin/lspci", "-n", "-d", "1002:"], stdout=subprocess.PIPE).communicate()[0].split('\n') - except Error as e: - pass + except: + lspci_output = [] target_search_term = re.compile("1002:\w+") for line in lspci_output: From f5334a2ba38cbab37d6d0d17b41b9df415b7f617 Mon Sep 17 00:00:00 2001 From: Gregory Stoner Date: Sat, 23 Dec 2017 13:00:37 -0600 Subject: [PATCH 007/162] Add support for RX580 --- rocm_agent_enumerator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index 6700937f3c..742b096ee9 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -23,7 +23,7 @@ ISA_TO_ID = { "gfx803" : [0x7300, 0x730f, # Polaris10 0x67c0, 0x67c1, 0x67c2, 0x67c4, 0x67c7, 0x67c8, 0x67c9, 0x67ca, - 0x67cc, 0x67cf, + 0x67cc, 0x67cf,67df, # Polaris11 0x67d0, 0x67df, 0x67e0, 0x67e1, 0x67e3, 0x67e7, 0x67e8, 0x67e9, 0x67eb, 0x67ef, 0x67ff, From 57a7080ebb482a98246197d54c82182a117a925c Mon Sep 17 00:00:00 2001 From: Gregory Stoner Date: Sat, 23 Dec 2017 13:01:11 -0600 Subject: [PATCH 008/162] Update rocm_agent_enumerator --- rocm_agent_enumerator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index 742b096ee9..6bcdfff68f 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -23,7 +23,7 @@ ISA_TO_ID = { "gfx803" : [0x7300, 0x730f, # Polaris10 0x67c0, 0x67c1, 0x67c2, 0x67c4, 0x67c7, 0x67c8, 0x67c9, 0x67ca, - 0x67cc, 0x67cf,67df, + 0x67cc, 0x67cf,0x67df, # Polaris11 0x67d0, 0x67df, 0x67e0, 0x67e1, 0x67e3, 0x67e7, 0x67e8, 0x67e9, 0x67eb, 0x67ef, 0x67ff, From fd277f36c0539cc63876166fea71a7cef2204c72 Mon Sep 17 00:00:00 2001 From: Gregory Stoner Date: Sat, 23 Dec 2017 13:09:02 -0600 Subject: [PATCH 009/162] Update rocm_agent_enumerator --- rocm_agent_enumerator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index 6bcdfff68f..6700937f3c 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -23,7 +23,7 @@ ISA_TO_ID = { "gfx803" : [0x7300, 0x730f, # Polaris10 0x67c0, 0x67c1, 0x67c2, 0x67c4, 0x67c7, 0x67c8, 0x67c9, 0x67ca, - 0x67cc, 0x67cf,0x67df, + 0x67cc, 0x67cf, # Polaris11 0x67d0, 0x67df, 0x67e0, 0x67e1, 0x67e3, 0x67e7, 0x67e8, 0x67e9, 0x67eb, 0x67ef, 0x67ff, From f99ef9da4feb281e99891ce50d698bf762bbac46 Mon Sep 17 00:00:00 2001 From: James Edwards Date: Wed, 28 Feb 2018 16:57:14 -0600 Subject: [PATCH 010/162] Add install and packaging to CMakeList.txt file. --- CMakeLists.txt | 65 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 60 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bd7fd81c9..b5fa9dd0de 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,7 +88,8 @@ endif() # Set Name for Samples Project # -set(PROJECT_NAME "sample${ONLY64STR}") +set(ROCMINFO_EXE "rocminfo") +set(PROJECT_NAME ${ROCMINFO_EXE}) project (${PROJECT_NAME}) # @@ -111,7 +112,6 @@ message("--------Proj Lib Dir: " ${PROJECT_BINARY_DIR}/lib) message("--------Proj Exe Dir: " ${PROJECT_BINARY_DIR}/bin) message("") -set(ROCMINFO_EXE "rocminfo") # # Set the build type based on user input @@ -185,11 +185,66 @@ configure_file(rocm_agent_enumerator rocm_agent_enumerator COPYONLY) ########################### -# SAMPLE SPECIFIC SECTION -########################### - # RocR Info +########################### aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} ROCMINFO_SOURCES) add_executable(${ROCMINFO_EXE} ${ROCMINFO_SOURCES}) target_link_libraries(${ROCMINFO_EXE} ${ROCR_LIBS} c stdc++ dl pthread rt) +########################### +# Install directives +########################### +install ( + FILES ${CMAKE_CURRENT_BINARY_DIR}/${ROCMINFO_EXE} + PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + DESTINATION bin ) +install ( + FILES ${CMAKE_CURRENT_BINARY_DIR}/rocm_agent_enumerator + PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + DESTINATION bin ) + +########################### +# Packaging directives +########################### +set(CPACK_PACKAGE_NAME "${PROJECT_NAME}") + +if (NOT DEFINED CPACK_PACKAGE_VENDOR) + set(CPACK_PACKAGE_VENDOR "AMD") +endif () + +if (NOT DEFINED CPACK_PACKAGE_VERSION_MAJOR) + set(CPACK_PACKAGE_VERSION_MAJOR "1") +endif () + +if (NOT DEFINED CPACK_PACKAGE_VERSION_MINOR) + set(CPACK_PACKAGE_VERSION_MINOR "0") +endif () + +if (NOT DEFINED CPACK_PACKAGE_VERSION_PATCH) + set(CPACK_PACKAGE_VERSION_PATCH "0") +endif () + +if (NOT DEFINED CPACK_PACKAGE_CONTACT) + set(CPACK_PACKAGE_CONTACT "Advanced Micro Devices Inc.") +endif () + +if (NOT DEFINED CPACK_PACKAGE_DESCRIPTION_SUMMARY) + set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Radeon Open Compute (ROCm) Runtime rocminfo tool") +endif () + +########################### +# Debian package specific variables +########################### +set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${CPACK_DEBIAN_PACKAGE_HOMEPAGE} CACHE STRING "https://github.com/RadeonOpenCompute/ROCm") + +########################### +# RPM package specific variables +########################### +if ( DEFINED CPACK_PACKAGING_INSTALL_PREFIX ) + set ( CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/bin" ) +endif ( ) + +########################### +# Include packaging +########################### +include ( CPack ) From a8dc4b3e377076eacd91afb706e42c704ad80768 Mon Sep 17 00:00:00 2001 From: James Adrian Edwards Date: Mon, 5 Mar 2018 14:31:08 -0600 Subject: [PATCH 011/162] Add dependencies and support for rocm-cmake style packaging. --- CMakeLists.txt | 204 +++++++++---------------------------------------- 1 file changed, 38 insertions(+), 166 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b5fa9dd0de..7dcded5abf 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,136 +1,41 @@ -# -# Minimum version of cmake required -# cmake_minimum_required(VERSION 2.8.0) -# -# GCC 4.8 or higher compiler required. -# -# Required Defines on cmake command line -# -# 1) Set location of ROCR header files (required) -# -# ROCM_DIR="Root for RocM install" -# -# 2) Set ROCRTST_BLD_TYPE to either "Debug" or "Release". -# If not set, the default value is "Debug" is bound. -# -# ROCRTST_BLD_TYPE=Debug or ROCRTST_BLD_TYPE=Release -# -# 3) Set ROCRTST_BLD_BITS to either "32" or "64" -# If not set, the default value of "64" is bound. -# -# ROCRTST_BLD_BITS=32 or ROCRTST_BLD_BITS=64 -# -# Building rocminfo -# -# 1) Create build folder e.g. "rocminfo/build" - any name will do -# 2) Cd into build folder -# 3) Run cmake, passing in the above defines, as needed/required: -# "cmake -DROCM_DIR= .." -# 4) Run "make" -# -# Upon a successful build, the executable "rocminfo" will be in the -# build directory. -# -# Currently support for Windows platform is not present -# -if(WIN32) - message("This sample is not supported on Windows platform") - return() -endif() -# -# Process input variables -# -# Required Defines first: - -set(ROCR_INC_DIR ${ROCM_DIR}/include) -set(ROCR_LIB_DIR ${ROCM_DIR}/lib) -# -# Determine ROCR Header files are present -# -if(NOT EXISTS ${ROCR_INC_DIR}/hsa/hsa.h) - message("ERROR: ${ROCR_INC_DIR}/hsa/hsa.h does not exist. Check value of ROCM_DIR define") - return() -endif() - -# Determine ROCR Library files are present -# -if("${ROCRTST_BLD_BITS}" STREQUAL 32) - set (ONLY64STR "") - set (IS64BIT 0) -else() - set (ONLY64STR "64") - set (IS64BIT 1) -endif() -# -if (${IS64BIT} EQUAL 0) - if(NOT EXISTS ${ROCR_LIB_DIR}/libhsa-runtime.so) - message("ERROR: ${ROCR_LIB_DIR}/libhsa-runtime.so doesn't exist. Check value of ROCM_DIR define") - return() - endif() -else() - if(NOT EXISTS ${ROCR_LIB_DIR}/libhsa-runtime64.so) - message("ERROR: Define ROCR_LIB_DIR pointing to ROCR libraries is not set") - return() - endif() -endif() - -string(TOLOWER "${ROCRTST_BLD_TYPE}" tmp) -if("${tmp}" STREQUAL release) - set(BUILD_TYPE "Release") - set(ISDEBUG 0) -else() - set(BUILD_TYPE "Debug") - set(ISDEBUG 1) -endif() - -# Set Name for Samples Project -# +# Default installation path +set(CMAKE_INSTALL_PREFIX "/opt/rocm" CACHE PATH "") set(ROCMINFO_EXE "rocminfo") set(PROJECT_NAME ${ROCMINFO_EXE}) project (${PROJECT_NAME}) -# -# Print out the build configuration being used: -# -# Build Src directory -# Build Binary directory -# Build Type: Debug Vs Release, 32 Vs 64 -# Compiler Version, etc -# -message("") -message("Build Configuration:") -message("-------------IS64BIT: " ${IS64BIT}) -message("-----------BuildType: " ${BUILD_TYPE}) -message("------------Compiler: " ${CMAKE_CXX_COMPILER}) -message("-------------Version: " ${CMAKE_CXX_COMPILER_VERSION}) -message("--------Proj Src Dir: " ${PROJECT_SOURCE_DIR}) -message("--------Proj Bld Dir: " ${PROJECT_BINARY_DIR}) -message("--------Proj Lib Dir: " ${PROJECT_BINARY_DIR}/lib) -message("--------Proj Exe Dir: " ${PROJECT_BINARY_DIR}/bin) -message("") +find_package(ROCM PATHS /opt/rocm) +include(ROCMSetupVersion) +include(ROCMCreatePackage) +rocm_setup_version(VERSION 1.0.0) + +find_path(ROCR_INC_DIR hsa/hsa.h PATH_SUFFIXES include PATHS /opt/rocm) +if(NOT ROCR_INC_DIR) + message(FATAL_ERROR "Can't find hsa.h.") +endif() + +find_path(ROCR_LIB_DIR libhsa-runtime64.so PATH_SUFFIXES lib PATHS /opt/rocm) +if(NOT ROCR_INC_DIR) + message(FATAL_ERROR "Can't find libhsa-runtime64.so.") +endif() -# -# Set the build type based on user input -# -set(CMAKE_BUILD_TYPE ${BUILD_TYPE}) # # Flag to enable / disable verbose output. # SET( CMAKE_VERBOSE_MAKEFILE on ) + # # Compiler pre-processor definitions. # -# Define MACRO "DEBUG" if build type is "Debug" -if(${BUILD_TYPE} STREQUAL "Debug") -add_definitions(-DDEBUG) -endif() - add_definitions(-D__linux__) add_definitions(-DLITTLEENDIAN_CPU=1) +if (CMAKE_BUILD_TYPE STREQUAL "Debug") + add_definitions(-DDEBUG) +endif () # # Linux Compiler options @@ -145,22 +50,12 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmerge-all-constants") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fms-extensions") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") - -# -# Extend the compiler flags for 64-bit builds -# -if (IS64BIT) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -msse -msse2") -else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") -endif() - -# -# Add compiler flags to include symbol information for debug builds -# -if(ISDEBUG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb -O0") -endif() +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2") +if (CMAKE_BUILD_TYPE STREQUAL "Debug") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb -O0") +endif () # # Linux Linker options @@ -173,14 +68,13 @@ link_directories(${ROCR_LIB_DIR}) # # Extend the list of libraries to be used for linking ROC Perf Apps # -set(ROCR_LIBS ${ROCR_LIBS} hsa-runtime${ONLY64STR}) +set(ROCR_LIBS ${ROCR_LIBS} hsa-runtime64) -include_directories(${ROCR_INC_DIR} ${OPENCL_INC_DIR}) +include_directories(${ROCR_INC_DIR}) ########################### # rocm_agent_enumerator ########################### - configure_file(rocm_agent_enumerator rocm_agent_enumerator COPYONLY) @@ -206,31 +100,8 @@ install ( ########################### # Packaging directives ########################### -set(CPACK_PACKAGE_NAME "${PROJECT_NAME}") - -if (NOT DEFINED CPACK_PACKAGE_VENDOR) - set(CPACK_PACKAGE_VENDOR "AMD") -endif () - -if (NOT DEFINED CPACK_PACKAGE_VERSION_MAJOR) - set(CPACK_PACKAGE_VERSION_MAJOR "1") -endif () - -if (NOT DEFINED CPACK_PACKAGE_VERSION_MINOR) - set(CPACK_PACKAGE_VERSION_MINOR "0") -endif () - -if (NOT DEFINED CPACK_PACKAGE_VERSION_PATCH) - set(CPACK_PACKAGE_VERSION_PATCH "0") -endif () - -if (NOT DEFINED CPACK_PACKAGE_CONTACT) - set(CPACK_PACKAGE_CONTACT "Advanced Micro Devices Inc.") -endif () - -if (NOT DEFINED CPACK_PACKAGE_DESCRIPTION_SUMMARY) - set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Radeon Open Compute (ROCm) Runtime rocminfo tool") -endif () +set(CPACK_DEBIAN_PACKAGE_DEPENDS "hsa-rocr-dev, python3") +set(CPACK_RPM_PACKAGE_REQUIRES "hsa-rocr-dev, python3") ########################### # Debian package specific variables @@ -240,11 +111,12 @@ set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${CPACK_DEBIAN_PACKAGE_HOMEPAGE} CACHE STRING ########################### # RPM package specific variables ########################### -if ( DEFINED CPACK_PACKAGING_INSTALL_PREFIX ) - set ( CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/bin" ) -endif ( ) +if (DEFINED CPACK_PACKAGING_INSTALL_PREFIX) + set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/bin") +endif( ) -########################### -# Include packaging -########################### -include ( CPack ) +rocm_create_package( + NAME rocminfo + DESCRIPTION "Radeon Open Compute (ROCm) Runtime rocminfo tool" + MAINTAINER "Advanced Micro Devices Inc." +) From 99adf5d85fc65ac46d36c90f346f746427188d4c Mon Sep 17 00:00:00 2001 From: James Edwards Date: Mon, 5 Mar 2018 14:40:52 -0600 Subject: [PATCH 012/162] Update README.md --- README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 54c3f9fc5d..58728529f3 100644 --- a/README.md +++ b/README.md @@ -4,19 +4,22 @@ ROCm Application for Reporting System Info ## To Build 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. For example, building from the CMakeLists.txt directory +as a cmake argument using the standard CMAKE_PREFIX_PATH cmake variable. Building +the package also requires the rocm-cmake helper files. + +For example, building from the CMakeLists.txt directory might look like this: mkdir -p build -cd build +cd buildhttp://www.google.com/ -cmake -DROCM_DIR= .. +cmake -DCMAKE_PREFIX_PATH=/opt/rocm .. make cd .. -Upon a successful build the binary, rocminfo, 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. From 8c81b1146f947a50dffc01375c7c85abc4a2bd82 Mon Sep 17 00:00:00 2001 From: James Edwards Date: Mon, 5 Mar 2018 14:48:01 -0600 Subject: [PATCH 013/162] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 58728529f3..7e6e12828b 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ might look like this: mkdir -p build -cd buildhttp://www.google.com/ +cd build cmake -DCMAKE_PREFIX_PATH=/opt/rocm .. From 26378662dbdba410b390d71abf7807f02ad84bbb Mon Sep 17 00:00:00 2001 From: James Edwards Date: Fri, 9 Mar 2018 14:25:34 -0600 Subject: [PATCH 014/162] Update CMakeLists.txt --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dcded5abf..90407dcd2d 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,8 +100,8 @@ install ( ########################### # Packaging directives ########################### -set(CPACK_DEBIAN_PACKAGE_DEPENDS "hsa-rocr-dev, python3") -set(CPACK_RPM_PACKAGE_REQUIRES "hsa-rocr-dev, python3") +set(CPACK_DEBIAN_PACKAGE_DEPENDS "hsa-rocr-dev, python") +set(CPACK_RPM_PACKAGE_REQUIRES "hsa-rocr-dev, python") ########################### # Debian package specific variables From cfbbb5239544de7e68e420726521c50462c84775 Mon Sep 17 00:00:00 2001 From: justxi Date: Thu, 22 Mar 2018 19:41:59 +0100 Subject: [PATCH 015/162] Add files via upload --- rocm_agent_enumerator | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index 6700937f3c..7a733395e2 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -78,7 +78,7 @@ def readFromROCMINFO(): try: # run rocminfo - rocminfo_output = subprocess.Popen(rocminfo_executable, stdout=subprocess.PIPE).communicate()[0].split('\n') + rocminfo_output = subprocess.Popen(rocminfo_executable, stdout=subprocess.PIPE).communicate()[0].decode("utf-8").split('\n') except: rocminfo_output = [] @@ -138,10 +138,10 @@ def main(): # workaround to cope with existing rocm_agent_enumerator behavior where gfx000 # would always be returned - print "gfx000" + print("gfx000") for gfx in target_list: - print gfx + print(gfx) if __name__ == "__main__": main() From ca841958afe1e192caded3e41fd057092b1ada9c Mon Sep 17 00:00:00 2001 From: Anthony Cowley Date: Fri, 27 Apr 2018 00:46:58 -0400 Subject: [PATCH 016/162] cmake: fix typo in ROCR_LIB_DIR detection --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 90407dcd2d..ddec0d2cf1 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ if(NOT ROCR_INC_DIR) endif() find_path(ROCR_LIB_DIR libhsa-runtime64.so PATH_SUFFIXES lib PATHS /opt/rocm) -if(NOT ROCR_INC_DIR) +if(NOT ROCR_LIB_DIR) message(FATAL_ERROR "Can't find libhsa-runtime64.so.") endif() From 590f612fd5ae0594dae878a6c43d61655370186d Mon Sep 17 00:00:00 2001 From: Siu Chi Chan Date: Tue, 8 May 2018 18:40:37 -0400 Subject: [PATCH 017/162] fix incorrect tyep casting for workgroup_max_dim and grid_max_dim --- rocminfo.cc | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/rocminfo.cc b/rocminfo.cc index 0738cf2ba9..b9f54b92db 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -459,18 +459,17 @@ static void DisplayAgentInfo(agent_info_t *agent_i) { for (int i = 0; i < 3; i++) { dim = "Dim[" + std::to_string(i) + "]:"; printLabelInt(dim.c_str(), - reinterpret_cast(&agent_i->workgroup_max_dim)[i], 2); + static_cast(agent_i->workgroup_max_dim[i]), 2); } printLabelInt("Grid Max Size:", agent_i->grid_max_size, 1); printLabelInt("Waves Per CU:", agent_i->waves_per_cu, 1); printLabelInt("Max Work-item Per CU:", agent_i->wavefront_size*agent_i->waves_per_cu, 1); + printLabel("Grid Max Size per Dimension:", true, 1); - for (int i = 0; i < 3; i++) { - dim = "Dim[" + std::to_string(i) + "]:"; - printLabelInt(dim.c_str(), - reinterpret_cast(&agent_i->grid_max_dim)[i], 2); - } + printLabelInt("Dim[0]", agent_i->grid_max_dim.x, 2); + printLabelInt("Dim[1]", agent_i->grid_max_dim.y, 2); + printLabelInt("Dim[2]", agent_i->grid_max_dim.z, 2); printLabelInt("Max number Of fbarriers Per Workgroup:", agent_i->fbarrier_max_size, 1); @@ -729,15 +728,15 @@ static void DisplayISAInfo(isa_info_t *isa_i, uint32_t indent) { for (int i = 0; i < 3; i++) { dim = "Dim[" + std::to_string(i) + "]:"; printLabelInt(dim.c_str(), - reinterpret_cast(&isa_i->workgroup_max_dim)[i], indent+1); + static_cast(isa_i->workgroup_max_dim[i]), indent+1); } printLabelInt("Workgroup Max Size:", isa_i->workgroup_max_size, indent); - printLabel("Grid Max Dimension:", true, indent); - printLabelInt("x", isa_i->grid_max_dim.x, indent+1); - printLabelInt("y", isa_i->grid_max_dim.y, indent+1); - printLabelInt("z", isa_i->grid_max_dim.z, indent+1); + printLabel("Grid Max Size per Dimension:", true, indent); + printLabelInt("Dim[0]", isa_i->grid_max_dim.x, indent+1); + printLabelInt("Dim[1]", isa_i->grid_max_dim.y, indent+1); + printLabelInt("Dim[2]", isa_i->grid_max_dim.z, indent+1); printLabelInt("Grid Max Size:", isa_i->grid_max_size, indent); printLabelInt("FBarrier Max Size:", isa_i->fbarrier_max_size, indent); From 6ccaea75801c8d881cbbe84b8f8fd2de1c60761d Mon Sep 17 00:00:00 2001 From: Siu Chi Chan Date: Wed, 9 May 2018 15:58:54 -0400 Subject: [PATCH 018/162] change naming from Dim[n] to (x,y,z) print out the max grid/group size before the "per Dimension" info --- rocminfo.cc | 49 +++++++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/rocminfo.cc b/rocminfo.cc index b9f54b92db..264c39803e 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -452,24 +452,22 @@ static void DisplayAgentInfo(agent_info_t *agent_i) { printLabelStr("Fast F16 Operation:", agent_i->fast_f16 ? "TRUE":"FALSE", 1); printLabelInt("Wavefront Size:", agent_i->wavefront_size, 1); - printLabelInt("Workgroup Max Size:", agent_i->workgroup_max_size, 1); - printLabel("Workgroup Max Size Per Dimension:", true, 1); - std::string dim; - for (int i = 0; i < 3; i++) { - dim = "Dim[" + std::to_string(i) + "]:"; - printLabelInt(dim.c_str(), - static_cast(agent_i->workgroup_max_dim[i]), 2); - } - printLabelInt("Grid Max Size:", agent_i->grid_max_size, 1); + printLabelInt("Workgroup Max Size:", agent_i->workgroup_max_size, 1); + printLabel("Workgroup Max Size per Dimension:", true, 1); + printLabelInt("x", static_cast(agent_i->workgroup_max_dim[0]), 2); + printLabelInt("y", static_cast(agent_i->workgroup_max_dim[1]), 2); + printLabelInt("z", static_cast(agent_i->workgroup_max_dim[2]), 2); + printLabelInt("Waves Per CU:", agent_i->waves_per_cu, 1); printLabelInt("Max Work-item Per CU:", agent_i->wavefront_size*agent_i->waves_per_cu, 1); + printLabelInt("Grid Max Size:", agent_i->grid_max_size, 1); printLabel("Grid Max Size per Dimension:", true, 1); - printLabelInt("Dim[0]", agent_i->grid_max_dim.x, 2); - printLabelInt("Dim[1]", agent_i->grid_max_dim.y, 2); - printLabelInt("Dim[2]", agent_i->grid_max_dim.z, 2); + printLabelInt("x", agent_i->grid_max_dim.x, 2); + printLabelInt("y", agent_i->grid_max_dim.y, 2); + printLabelInt("z", agent_i->grid_max_dim.z, 2); printLabelInt("Max number Of fbarriers Per Workgroup:", agent_i->fbarrier_max_size, 1); @@ -723,22 +721,21 @@ static void DisplayISAInfo(isa_info_t *isa_i, uint32_t indent) { printLabelStr("Fast f16:", (isa_i->fast_f16 ? "TRUE" : "FALSE"), indent); - printLabel("Workgroup Max Dimension:", true, indent); - std::string dim; - for (int i = 0; i < 3; i++) { - dim = "Dim[" + std::to_string(i) + "]:"; - printLabelInt(dim.c_str(), - static_cast(isa_i->workgroup_max_dim[i]), indent+1); - } - printLabelInt("Workgroup Max Size:", isa_i->workgroup_max_size, indent); - - printLabel("Grid Max Size per Dimension:", true, indent); - printLabelInt("Dim[0]", isa_i->grid_max_dim.x, indent+1); - printLabelInt("Dim[1]", isa_i->grid_max_dim.y, indent+1); - printLabelInt("Dim[2]", isa_i->grid_max_dim.z, indent+1); - + printLabel("Workgroup Max Size per Dimension:", true, indent); + printLabelInt("x", + static_cast(isa_i->workgroup_max_dim[0]), indent+1); + printLabelInt("y", + static_cast(isa_i->workgroup_max_dim[1]), indent+1); + printLabelInt("z", + static_cast(isa_i->workgroup_max_dim[2]), indent+1); + printLabelInt("Grid Max Size:", isa_i->grid_max_size, indent); + printLabel("Grid Max Size per Dimension:", true, indent); + printLabelInt("x", isa_i->grid_max_dim.x, indent+1); + printLabelInt("y", isa_i->grid_max_dim.y, indent+1); + printLabelInt("z", isa_i->grid_max_dim.z, indent+1); + printLabelInt("FBarrier Max Size:", isa_i->fbarrier_max_size, indent); } From ad54c50ababed047c004571b2b2b60ff52692a56 Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Mon, 12 Nov 2018 20:41:59 -0600 Subject: [PATCH 019/162] Add hex representation of some values to output --- rocminfo.cc | 128 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 92 insertions(+), 36 deletions(-) diff --git a/rocminfo.cc b/rocminfo.cc index 264c39803e..69d02c164d 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -45,6 +45,8 @@ #include #include #include +#include + #include "hsa/hsa.h" #include "hsa/hsa_ext_amd.h" @@ -140,6 +142,43 @@ static const uint32_t kLabelFieldSize = 25; static const uint32_t kValueFieldSize = 35; static const uint32_t kIndentSize = 2; +enum rocmi_int_format { + ROCMI_INT_FORMAT_DEC = 1, + ROCMI_INT_FORMAT_HEX = 2, +}; + +// Make the most common format the default +std::string int_to_string(uint32_t i, + uint32_t fmt = ROCMI_INT_FORMAT_DEC|ROCMI_INT_FORMAT_HEX) { + std::stringstream sd; + std::string ret = ""; + bool need_parens = false; + + if (fmt & ROCMI_INT_FORMAT_DEC) { + if (need_parens) { + sd << "("; + } + sd << i; + if (need_parens) { + sd << ") "; + } + need_parens = true; + } + + if (fmt & ROCMI_INT_FORMAT_HEX) { + if (need_parens) { + sd << "(0x"; + } + sd << std::hex << i; + if (need_parens) { + sd << ") "; + } + need_parens = true; + } + + return sd.str(); +} + static void printLabelInt(char const *l, int d, uint32_t indent_lvl = 0) { std::string ind(kIndentSize * indent_lvl, ' '); @@ -150,6 +189,12 @@ static void printLabelStr(char const *l, char const *s, std::string ind(kIndentSize * indent_lvl, ' '); printf("%s%-*s%-*s\n", ind.c_str(), kLabelFieldSize, l, kValueFieldSize, s); } +static void printLabelStr(char const *l, std::string const &s, + uint32_t indent_lvl = 0) { + std::string ind(kIndentSize * indent_lvl, ' '); + printf("%s%-*s%-*s\n", ind.c_str(), kLabelFieldSize, l, kValueFieldSize, + s.c_str()); +} static void printLabel(char const *l, bool newline = false, uint32_t indent_lvl = 0) { std::string ind(kIndentSize * indent_lvl, ' '); @@ -201,7 +246,8 @@ static void DisplaySystemInfo(system_info_t const *sys_info) { printLabel("System Timestamp Freq.:"); printf("%fMHz\n", sys_info->timestamp_frequency / 1e6); printLabel("Sig. Max Wait Duration:"); - printf("%lu (number of timestamp)\n", sys_info->max_wait); + printf("%lu (0x%lX) (timestamp count)\n", sys_info->max_wait, + sys_info->max_wait); printLabel("Machine Model:"); if (HSA_MACHINE_MODEL_SMALL == sys_info->machine_model) { @@ -392,9 +438,11 @@ static void DisplayAgentInfo(agent_info_t *agent_i) { printValueStr("Not Supported"); } - printLabelInt("Max Queue Number:", agent_i->max_queue, 1); - printLabelInt("Queue Min Size:", agent_i->queue_min_size, 1); - printLabelInt("Queue Max Size:", agent_i->queue_max_size, 1); + printLabelStr("Max Queue Number:", int_to_string(agent_i->max_queue), 1); + + printLabelStr("Queue Min Size:", int_to_string(agent_i->queue_min_size), 1); + + printLabelStr("Queue Max Size:", int_to_string(agent_i->queue_max_size), 1); if (HSA_QUEUE_TYPE_MULTI == agent_i->queue_type) { printLabelStr("Queue Type:", "MULTI", 1); @@ -424,17 +472,18 @@ static void DisplayAgentInfo(agent_info_t *agent_i) { tmp_str += ":"; printLabel(tmp_str.c_str(), false, 2); - tmp_str = std::to_string(agent_i->cache_size[i]/1024); + // tmp_str = std::to_string(agent_i->cache_size[i]/1024); + tmp_str = int_to_string(agent_i->cache_size[i]/1024); tmp_str += "KB"; printValueStr(tmp_str.c_str()); } } - printLabelInt("Chip ID:", agent_i->chip_id, 1); - printLabelInt("Cacheline Size:", agent_i->cacheline_size, 1); + printLabelStr("Chip ID:", int_to_string(agent_i->chip_id), 1); + printLabelStr("Cacheline Size:", int_to_string(agent_i->cacheline_size), 1); printLabelInt("Max Clock Frequency (MHz):", agent_i->max_clock_freq, 1); - printLabelInt("BDFID:", agent_i->bdf_id, 1); - printLabelInt("Compute Unit:", agent_i->compute_unit, 1); + printLabelStr("BDFID:", int_to_string(agent_i->bdf_id), 1); + printLabelStr("Compute Unit:", int_to_string(agent_i->compute_unit), 1); printLabel("Features:", false, 1); if (agent_i->agent_feature & HSA_AGENT_FEATURE_KERNEL_DISPATCH) { @@ -449,25 +498,31 @@ static void DisplayAgentInfo(agent_info_t *agent_i) { printf("\n"); if (agent_i->agent_feature & HSA_AGENT_FEATURE_KERNEL_DISPATCH) { - printLabelStr("Fast F16 Operation:", agent_i->fast_f16 ? "TRUE":"FALSE", 1); + printLabelStr("Fast F16 Operation:", + agent_i->fast_f16 ? "TRUE":"FALSE", 1); - printLabelInt("Wavefront Size:", agent_i->wavefront_size, 1); + printLabelStr("Wavefront Size:", + int_to_string(agent_i->wavefront_size), 1); - printLabelInt("Workgroup Max Size:", agent_i->workgroup_max_size, 1); + printLabelStr("Workgroup Max Size:", + int_to_string(agent_i->workgroup_max_size), 1); printLabel("Workgroup Max Size per Dimension:", true, 1); - printLabelInt("x", static_cast(agent_i->workgroup_max_dim[0]), 2); - printLabelInt("y", static_cast(agent_i->workgroup_max_dim[1]), 2); - printLabelInt("z", static_cast(agent_i->workgroup_max_dim[2]), 2); + printLabelStr("x", + int_to_string(static_cast(agent_i->workgroup_max_dim[0])), 2); + printLabelStr("y", + int_to_string(static_cast(agent_i->workgroup_max_dim[1])), 2); + printLabelStr("z", + int_to_string(static_cast(agent_i->workgroup_max_dim[2])), 2); - printLabelInt("Waves Per CU:", agent_i->waves_per_cu, 1); - printLabelInt("Max Work-item Per CU:", - agent_i->wavefront_size*agent_i->waves_per_cu, 1); + printLabelStr("Waves Per CU:", int_to_string(agent_i->waves_per_cu), 1); + printLabelStr("Max Work-item Per CU:", + int_to_string(agent_i->wavefront_size*agent_i->waves_per_cu), 1); - printLabelInt("Grid Max Size:", agent_i->grid_max_size, 1); + printLabelStr("Grid Max Size:", int_to_string(agent_i->grid_max_size), 1); printLabel("Grid Max Size per Dimension:", true, 1); - printLabelInt("x", agent_i->grid_max_dim.x, 2); - printLabelInt("y", agent_i->grid_max_dim.y, 2); - printLabelInt("z", agent_i->grid_max_dim.z, 2); + printLabelStr("x", int_to_string(agent_i->grid_max_dim.x), 2); + printLabelStr("y", int_to_string(agent_i->grid_max_dim.y), 2); + printLabelStr("z", int_to_string(agent_i->grid_max_dim.z), 2); printLabelInt("Max number Of fbarriers Per Workgroup:", agent_i->fbarrier_max_size, 1); @@ -574,8 +629,8 @@ static void DumpSegment(pool_info_t *pool_i, uint32_t ind_lvl) { static void DisplayPoolInfo(pool_info_t *pool_i, uint32_t indent) { DumpSegment(pool_i, indent); - std::string sz_str = std::to_string(pool_i->pool_size/1024) + "KB"; - printLabelStr("Size:", sz_str.c_str(), indent); + size_t sz = pool_i->pool_size/1024; + printLabelStr("Size:", int_to_string(sz) + "KB", indent); printLabelStr("Allocatable:", (pool_i->alloc_allowed ? "TRUE" : "FALSE"), indent); std::string gr_str = std::to_string(pool_i->alloc_granule/1024)+"KB"; @@ -721,20 +776,21 @@ static void DisplayISAInfo(isa_info_t *isa_i, uint32_t indent) { printLabelStr("Fast f16:", (isa_i->fast_f16 ? "TRUE" : "FALSE"), indent); - printLabelInt("Workgroup Max Size:", isa_i->workgroup_max_size, indent); + printLabelStr("Workgroup Max Size:", + int_to_string(isa_i->workgroup_max_size), indent); printLabel("Workgroup Max Size per Dimension:", true, indent); - printLabelInt("x", - static_cast(isa_i->workgroup_max_dim[0]), indent+1); - printLabelInt("y", - static_cast(isa_i->workgroup_max_dim[1]), indent+1); - printLabelInt("z", - static_cast(isa_i->workgroup_max_dim[2]), indent+1); - - printLabelInt("Grid Max Size:", isa_i->grid_max_size, indent); + printLabelStr("x", int_to_string( + static_cast(isa_i->workgroup_max_dim[0])), indent+1); + printLabelStr("y", int_to_string( + static_cast(isa_i->workgroup_max_dim[1])), indent+1); + printLabelStr("z", int_to_string( + static_cast(isa_i->workgroup_max_dim[2])), indent+1); + + printLabelStr("Grid Max Size:", int_to_string(isa_i->grid_max_size), indent); printLabel("Grid Max Size per Dimension:", true, indent); - printLabelInt("x", isa_i->grid_max_dim.x, indent+1); - printLabelInt("y", isa_i->grid_max_dim.y, indent+1); - printLabelInt("z", isa_i->grid_max_dim.z, indent+1); + printLabelStr("x", int_to_string(isa_i->grid_max_dim.x), indent+1); + printLabelStr("y", int_to_string(isa_i->grid_max_dim.y), indent+1); + printLabelStr("z", int_to_string(isa_i->grid_max_dim.z), indent+1); printLabelInt("FBarrier Max Size:", isa_i->fbarrier_max_size, indent); } From 7b9832382328ab8affbcfa812e4f03baf5cb1cae Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Thu, 21 Mar 2019 14:50:12 -0500 Subject: [PATCH 020/162] Add some missing HSA info. fields --- rocminfo.cc | 76 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 67 insertions(+), 9 deletions(-) diff --git a/rocminfo.cc b/rocminfo.cc index 69d02c164d..719c778081 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -73,6 +73,7 @@ typedef struct { typedef struct { char name[64]; char vendor_name[64]; + char device_mkt_name[64]; hsa_agent_feature_t agent_feature; hsa_profile_t agent_profile; hsa_default_float_rounding_mode_t float_rounding_mode; @@ -86,12 +87,19 @@ typedef struct { uint32_t chip_id; uint32_t cacheline_size; uint32_t max_clock_freq; + uint32_t internal_node_id; + uint32_t max_addr_watch_pts; + // HSA_AMD_AGENT_INFO_MEMORY_WIDTH is deprecated, so exclude + // uint32_t mem_max_freq; Not supported by get_info uint32_t compute_unit; uint32_t wavefront_size; uint32_t workgroup_max_size; uint32_t grid_max_size; uint32_t fbarrier_max_size; - uint32_t waves_per_cu; + uint32_t max_waves_per_cu; + uint32_t simds_per_cu; + uint32_t shader_engs; + uint32_t shader_arrs_per_sh_eng; hsa_isa_t agent_isa; hsa_dim3_t grid_max_dim; uint16_t workgroup_max_dim[3]; @@ -275,6 +283,12 @@ AcquireAgentInfo(hsa_agent_t agent, agent_info_t *agent_i) { &agent_i->vendor_name); RET_IF_HSA_ERR(err); + // Get device marketing name + err = hsa_agent_get_info(agent, + (hsa_agent_info_t)HSA_AMD_AGENT_INFO_PRODUCT_NAME, + &agent_i->device_mkt_name); + RET_IF_HSA_ERR(err); + // Get agent feature err = hsa_agent_get_info(agent, HSA_AGENT_INFO_FEATURE, &agent_i->agent_feature); @@ -347,11 +361,49 @@ AcquireAgentInfo(hsa_agent_t agent, agent_info_t *agent_i) { &agent_i->max_clock_freq); RET_IF_HSA_ERR(err); + // Internal Driver node ID + err = hsa_agent_get_info(agent, + (hsa_agent_info_t) HSA_AMD_AGENT_INFO_DRIVER_NODE_ID, + &agent_i->internal_node_id); + RET_IF_HSA_ERR(err); + + // Max number of watch points on mem. addr. ranges to generate exeception + // events + err = hsa_agent_get_info(agent, + (hsa_agent_info_t) HSA_AMD_AGENT_INFO_MAX_ADDRESS_WATCH_POINTS, + &agent_i->max_addr_watch_pts); + RET_IF_HSA_ERR(err); + // Get Agent BDFID err = hsa_agent_get_info(agent, (hsa_agent_info_t)HSA_AMD_AGENT_INFO_BDFID, &agent_i->bdf_id); RET_IF_HSA_ERR(err); + // Get Max Memory Clock + // Not supported by hsa_agent_get_info + // err = hsa_agent_get_info(agent,d + // (hsa_agent_info_t)HSA_AMD_AGENT_INFO_MEMORY_MAX_FREQUENCY, + // &agent_i->mem_max_freq); + // RET_IF_HSA_ERR(err); + + // Get Num SIMDs per CU + err = hsa_agent_get_info(agent, + (hsa_agent_info_t)HSA_AMD_AGENT_INFO_NUM_SIMDS_PER_CU, + &agent_i->simds_per_cu); + RET_IF_HSA_ERR(err); + + // Get Num Shader Engines + err = hsa_agent_get_info(agent, + (hsa_agent_info_t)HSA_AMD_AGENT_INFO_NUM_SHADER_ENGINES, + &agent_i->shader_engs); + RET_IF_HSA_ERR(err); + + // Get Num Shader Arrays per Shader engine + err = hsa_agent_get_info(agent, + (hsa_agent_info_t)HSA_AMD_AGENT_INFO_NUM_SHADER_ARRAYS_PER_SE, + &agent_i->shader_arrs_per_sh_eng); + RET_IF_HSA_ERR(err); + // Get number of Compute Unit err = hsa_agent_get_info(agent, (hsa_agent_info_t) HSA_AMD_AGENT_INFO_COMPUTE_UNIT_COUNT, @@ -397,7 +449,7 @@ AcquireAgentInfo(hsa_agent_t agent, agent_info_t *agent_i) { err = hsa_agent_get_info(agent, (hsa_agent_info_t)HSA_AMD_AGENT_INFO_MAX_WAVES_PER_CU, - &agent_i->waves_per_cu); + &agent_i->max_waves_per_cu); RET_IF_HSA_ERR(err); } return err; @@ -405,6 +457,7 @@ 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("Marketing Name:", agent_i->device_mkt_name, 1); printLabelStr("Vendor Name:", agent_i->vendor_name, 1); printLabel("Feature:", false, 1); @@ -481,9 +534,14 @@ static void DisplayAgentInfo(agent_info_t *agent_i) { printLabelStr("Chip ID:", int_to_string(agent_i->chip_id), 1); printLabelStr("Cacheline Size:", int_to_string(agent_i->cacheline_size), 1); - printLabelInt("Max Clock Frequency (MHz):", agent_i->max_clock_freq, 1); - printLabelStr("BDFID:", int_to_string(agent_i->bdf_id), 1); - printLabelStr("Compute Unit:", int_to_string(agent_i->compute_unit), 1); + printLabelInt("Max Clock Freq. (MHz):", agent_i->max_clock_freq, 1); + 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); printLabel("Features:", false, 1); if (agent_i->agent_feature & HSA_AGENT_FEATURE_KERNEL_DISPATCH) { @@ -514,9 +572,10 @@ static void DisplayAgentInfo(agent_info_t *agent_i) { printLabelStr("z", int_to_string(static_cast(agent_i->workgroup_max_dim[2])), 2); - printLabelStr("Waves Per CU:", int_to_string(agent_i->waves_per_cu), 1); + printLabelStr("Max Waves Per CU:", + int_to_string(agent_i->max_waves_per_cu), 1); printLabelStr("Max Work-item Per CU:", - int_to_string(agent_i->wavefront_size*agent_i->waves_per_cu), 1); + int_to_string(agent_i->wavefront_size*agent_i->max_waves_per_cu), 1); printLabelStr("Grid Max Size:", int_to_string(agent_i->grid_max_size), 1); printLabel("Grid Max Size per Dimension:", true, 1); @@ -524,8 +583,7 @@ static void DisplayAgentInfo(agent_info_t *agent_i) { printLabelStr("y", int_to_string(agent_i->grid_max_dim.y), 2); printLabelStr("z", int_to_string(agent_i->grid_max_dim.z), 2); - printLabelInt("Max number Of fbarriers Per Workgroup:", - agent_i->fbarrier_max_size, 1); + printLabelInt("Max fbarriers/Workgrp:", agent_i->fbarrier_max_size, 1); } } From 84039ef53f47e535333e78b6ce13a4b03edfcead Mon Sep 17 00:00:00 2001 From: Ramesh Errabolu Date: Tue, 21 May 2019 13:19:11 -0500 Subject: [PATCH 021/162] Improve error message reporting (#13) --- rocminfo.cc | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 3 deletions(-) diff --git a/rocminfo.cc b/rocminfo.cc index 719c778081..ad946bcc5c 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -42,6 +42,11 @@ * DEALINGS WITH THE SOFTWARE. * */ +#include +#include +#include +#include + #include #include #include @@ -50,10 +55,25 @@ #include "hsa/hsa.h" #include "hsa/hsa_ext_amd.h" +#define RET_IF_HSA_INIT_ERR(err) { \ + if ((err) != HSA_STATUS_SUCCESS) { \ + CheckInitError(err); \ + RET_IF_HSA_ERR(err); \ + } \ +} + #define RET_IF_HSA_ERR(err) { \ if ((err) != HSA_STATUS_SUCCESS) { \ - printf("hsa api call failure at line %d, file: %s. Call returned %d\n", \ - __LINE__, __FILE__, err); \ + char err_val[12]; \ + char* err_str = NULL; \ + if (hsa_status_string(err, \ + (const char**)&err_str) != HSA_STATUS_SUCCESS) { \ + sprintf(&(err_val[0]), "%#x", (uint32_t)err); \ + err_str = &(err_val[0]); \ + } \ + printf("hsa api call failure at: %s:%d\n", \ + __FILE__, __LINE__); \ + printf("Call returned %s\n", err_str); \ return (err); \ } \ } @@ -997,6 +1017,44 @@ AcquireAndDisplayAgentInfo(hsa_agent_t agent, void* data) { return HSA_STATUS_SUCCESS; } +void CheckInitError(hsa_status_t err) { + + printf("ROCm initialization failed\n"); + + // Check kernel module for ROCk is loaded + FILE *fd = popen("lsmod | grep amdgpu", "r"); + char buf[16]; + if (fread (buf, 1, sizeof (buf), fd) <= 0) { + printf("ROCk module is NOT loaded, possibly no GPU devices\n"); + return; + } + + // Check if user belongs to group "video" + // @note: User who are not members of "video" + // group cannot access DRM services + int status = -1; + bool member = false; + char gr_name[] = "video"; + struct group* grp = NULL; + do { + grp = getgrent(); + if (grp == NULL) { + break; + } + status = memcmp(gr_name, grp->gr_name, sizeof(gr_name)); + if (status == 0) { + member = true; + break; + } + } while (grp != NULL); + if (member == false) { + printf("User is not member of \"video\" group\n"); + return; + } + + return; +} + // Print out all static information known to HSA about the target system. // Throughout this program, the Acquire-type functions make HSA calls to // interate through HSA objects and then perform HSA get_info calls to @@ -1007,7 +1065,7 @@ int main(int argc, char* argv[]) { hsa_status_t err; err = hsa_init(); - RET_IF_HSA_ERR(err); + RET_IF_HSA_INIT_ERR(err); // Acquire and display system information system_info_t sys_info; From 43f664436d231765aaca86aeb68543eb7aede3f8 Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Sat, 22 Jun 2019 16:29:42 -0500 Subject: [PATCH 022/162] Undo previous commit of github CMakeLists.txt file Change-Id: Ic650b913377112bff6c25176d9446311f33f6c78 --- CMakeLists.txt | 204 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 166 insertions(+), 38 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ddec0d2cf1..b5fa9dd0de 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,41 +1,136 @@ +# +# Minimum version of cmake required +# cmake_minimum_required(VERSION 2.8.0) +# +# GCC 4.8 or higher compiler required. +# +# Required Defines on cmake command line +# +# 1) Set location of ROCR header files (required) +# +# ROCM_DIR="Root for RocM install" +# +# 2) Set ROCRTST_BLD_TYPE to either "Debug" or "Release". +# If not set, the default value is "Debug" is bound. +# +# ROCRTST_BLD_TYPE=Debug or ROCRTST_BLD_TYPE=Release +# +# 3) Set ROCRTST_BLD_BITS to either "32" or "64" +# If not set, the default value of "64" is bound. +# +# ROCRTST_BLD_BITS=32 or ROCRTST_BLD_BITS=64 +# +# Building rocminfo +# +# 1) Create build folder e.g. "rocminfo/build" - any name will do +# 2) Cd into build folder +# 3) Run cmake, passing in the above defines, as needed/required: +# "cmake -DROCM_DIR= .." +# 4) Run "make" +# +# Upon a successful build, the executable "rocminfo" will be in the +# build directory. +# +# Currently support for Windows platform is not present +# +if(WIN32) + message("This sample is not supported on Windows platform") + return() +endif() +# +# Process input variables +# -# Default installation path -set(CMAKE_INSTALL_PREFIX "/opt/rocm" CACHE PATH "") +# Required Defines first: + +set(ROCR_INC_DIR ${ROCM_DIR}/include) +set(ROCR_LIB_DIR ${ROCM_DIR}/lib) +# +# Determine ROCR Header files are present +# +if(NOT EXISTS ${ROCR_INC_DIR}/hsa/hsa.h) + message("ERROR: ${ROCR_INC_DIR}/hsa/hsa.h does not exist. Check value of ROCM_DIR define") + return() +endif() + +# Determine ROCR Library files are present +# +if("${ROCRTST_BLD_BITS}" STREQUAL 32) + set (ONLY64STR "") + set (IS64BIT 0) +else() + set (ONLY64STR "64") + set (IS64BIT 1) +endif() +# +if (${IS64BIT} EQUAL 0) + if(NOT EXISTS ${ROCR_LIB_DIR}/libhsa-runtime.so) + message("ERROR: ${ROCR_LIB_DIR}/libhsa-runtime.so doesn't exist. Check value of ROCM_DIR define") + return() + endif() +else() + if(NOT EXISTS ${ROCR_LIB_DIR}/libhsa-runtime64.so) + message("ERROR: Define ROCR_LIB_DIR pointing to ROCR libraries is not set") + return() + endif() +endif() + +string(TOLOWER "${ROCRTST_BLD_TYPE}" tmp) +if("${tmp}" STREQUAL release) + set(BUILD_TYPE "Release") + set(ISDEBUG 0) +else() + set(BUILD_TYPE "Debug") + set(ISDEBUG 1) +endif() + +# Set Name for Samples Project +# set(ROCMINFO_EXE "rocminfo") set(PROJECT_NAME ${ROCMINFO_EXE}) project (${PROJECT_NAME}) -find_package(ROCM PATHS /opt/rocm) -include(ROCMSetupVersion) -include(ROCMCreatePackage) +# +# Print out the build configuration being used: +# +# Build Src directory +# Build Binary directory +# Build Type: Debug Vs Release, 32 Vs 64 +# Compiler Version, etc +# +message("") +message("Build Configuration:") +message("-------------IS64BIT: " ${IS64BIT}) +message("-----------BuildType: " ${BUILD_TYPE}) +message("------------Compiler: " ${CMAKE_CXX_COMPILER}) +message("-------------Version: " ${CMAKE_CXX_COMPILER_VERSION}) +message("--------Proj Src Dir: " ${PROJECT_SOURCE_DIR}) +message("--------Proj Bld Dir: " ${PROJECT_BINARY_DIR}) +message("--------Proj Lib Dir: " ${PROJECT_BINARY_DIR}/lib) +message("--------Proj Exe Dir: " ${PROJECT_BINARY_DIR}/bin) +message("") -rocm_setup_version(VERSION 1.0.0) - -find_path(ROCR_INC_DIR hsa/hsa.h PATH_SUFFIXES include PATHS /opt/rocm) -if(NOT ROCR_INC_DIR) - message(FATAL_ERROR "Can't find hsa.h.") -endif() - -find_path(ROCR_LIB_DIR libhsa-runtime64.so PATH_SUFFIXES lib PATHS /opt/rocm) -if(NOT ROCR_LIB_DIR) - message(FATAL_ERROR "Can't find libhsa-runtime64.so.") -endif() +# +# Set the build type based on user input +# +set(CMAKE_BUILD_TYPE ${BUILD_TYPE}) # # Flag to enable / disable verbose output. # SET( CMAKE_VERBOSE_MAKEFILE on ) - # # Compiler pre-processor definitions. # +# Define MACRO "DEBUG" if build type is "Debug" +if(${BUILD_TYPE} STREQUAL "Debug") +add_definitions(-DDEBUG) +endif() + add_definitions(-D__linux__) add_definitions(-DLITTLEENDIAN_CPU=1) -if (CMAKE_BUILD_TYPE STREQUAL "Debug") - add_definitions(-DDEBUG) -endif () # # Linux Compiler options @@ -50,12 +145,22 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmerge-all-constants") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fms-extensions") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2") -if (CMAKE_BUILD_TYPE STREQUAL "Debug") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb -O0") -endif () + +# +# Extend the compiler flags for 64-bit builds +# +if (IS64BIT) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -msse -msse2") +else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") +endif() + +# +# Add compiler flags to include symbol information for debug builds +# +if(ISDEBUG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb -O0") +endif() # # Linux Linker options @@ -68,13 +173,14 @@ link_directories(${ROCR_LIB_DIR}) # # Extend the list of libraries to be used for linking ROC Perf Apps # -set(ROCR_LIBS ${ROCR_LIBS} hsa-runtime64) +set(ROCR_LIBS ${ROCR_LIBS} hsa-runtime${ONLY64STR}) -include_directories(${ROCR_INC_DIR}) +include_directories(${ROCR_INC_DIR} ${OPENCL_INC_DIR}) ########################### # rocm_agent_enumerator ########################### + configure_file(rocm_agent_enumerator rocm_agent_enumerator COPYONLY) @@ -100,8 +206,31 @@ install ( ########################### # Packaging directives ########################### -set(CPACK_DEBIAN_PACKAGE_DEPENDS "hsa-rocr-dev, python") -set(CPACK_RPM_PACKAGE_REQUIRES "hsa-rocr-dev, python") +set(CPACK_PACKAGE_NAME "${PROJECT_NAME}") + +if (NOT DEFINED CPACK_PACKAGE_VENDOR) + set(CPACK_PACKAGE_VENDOR "AMD") +endif () + +if (NOT DEFINED CPACK_PACKAGE_VERSION_MAJOR) + set(CPACK_PACKAGE_VERSION_MAJOR "1") +endif () + +if (NOT DEFINED CPACK_PACKAGE_VERSION_MINOR) + set(CPACK_PACKAGE_VERSION_MINOR "0") +endif () + +if (NOT DEFINED CPACK_PACKAGE_VERSION_PATCH) + set(CPACK_PACKAGE_VERSION_PATCH "0") +endif () + +if (NOT DEFINED CPACK_PACKAGE_CONTACT) + set(CPACK_PACKAGE_CONTACT "Advanced Micro Devices Inc.") +endif () + +if (NOT DEFINED CPACK_PACKAGE_DESCRIPTION_SUMMARY) + set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Radeon Open Compute (ROCm) Runtime rocminfo tool") +endif () ########################### # Debian package specific variables @@ -111,12 +240,11 @@ set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${CPACK_DEBIAN_PACKAGE_HOMEPAGE} CACHE STRING ########################### # RPM package specific variables ########################### -if (DEFINED CPACK_PACKAGING_INSTALL_PREFIX) - set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/bin") -endif( ) +if ( DEFINED CPACK_PACKAGING_INSTALL_PREFIX ) + set ( CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/bin" ) +endif ( ) -rocm_create_package( - NAME rocminfo - DESCRIPTION "Radeon Open Compute (ROCm) Runtime rocminfo tool" - MAINTAINER "Advanced Micro Devices Inc." -) +########################### +# Include packaging +########################### +include ( CPack ) From 141592e4f3a0fad57d47a084ab54e4258d3122cd Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Mon, 15 Jul 2019 14:02:12 -0500 Subject: [PATCH 023/162] Correct check for video group membership * Continue with rocminfo even if video and kfd check fail. * Color code informational lines (white) and warnings (red) Change-Id: I739034c932fffca0924abc93ae9a929664a3e182 --- rocminfo.cc | 118 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 76 insertions(+), 42 deletions(-) diff --git a/rocminfo.cc b/rocminfo.cc index ad946bcc5c..9fddcfb4f9 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -46,8 +46,9 @@ #include #include #include +#include +#include -#include #include #include #include @@ -55,27 +56,31 @@ #include "hsa/hsa.h" #include "hsa/hsa_ext_amd.h" -#define RET_IF_HSA_INIT_ERR(err) { \ - if ((err) != HSA_STATUS_SUCCESS) { \ - CheckInitError(err); \ - RET_IF_HSA_ERR(err); \ - } \ -} +#define COL_BLU "\x1B[34m" +#define COL_KCYN "\x1B[36m" +#define COL_GRN "\x1B[32m" +#define COL_NRM "\x1B[0m" +#define COL_RED "\x1B[31m" +#define COL_MAG "\x1B[35m" +#define COL_WHT "\x1B[37m" +#define COL_YEL "\x1B[33m" +#define COL_RESET "\033[0m" #define RET_IF_HSA_ERR(err) { \ if ((err) != HSA_STATUS_SUCCESS) { \ - char err_val[12]; \ - char* err_str = NULL; \ - if (hsa_status_string(err, \ - (const char**)&err_str) != HSA_STATUS_SUCCESS) { \ - sprintf(&(err_val[0]), "%#x", (uint32_t)err); \ - err_str = &(err_val[0]); \ - } \ - printf("hsa api call failure at: %s:%d\n", \ - __FILE__, __LINE__); \ - printf("Call returned %s\n", err_str); \ - return (err); \ - } \ + char err_val[12]; \ + char* err_str = NULL; \ + if (hsa_status_string(err, \ + (const char**)&err_str) != HSA_STATUS_SUCCESS) { \ + snprintf(&(err_val[0]), sizeof(err_val[12]), "%#x", (uint32_t)err); \ + err_str = &(err_val[0]); \ + } \ + printf("%shsa api call failure at: %s:%d\n", \ + COL_RED, __FILE__, __LINE__); \ + printf("%sCall returned %s\n", COL_RED, err_str); \ + printf("%s", COL_RESET); \ + return (err); \ + } \ } // This structure holds system information acquired through hsa info related @@ -1017,41 +1022,69 @@ AcquireAndDisplayAgentInfo(hsa_agent_t agent, void* data) { return HSA_STATUS_SUCCESS; } -void CheckInitError(hsa_status_t err) { - - printf("ROCm initialization failed\n"); - +void CheckInitialState(void) { // Check kernel module for ROCk is loaded FILE *fd = popen("lsmod | grep amdgpu", "r"); char buf[16]; if (fread (buf, 1, sizeof (buf), fd) <= 0) { - printf("ROCk module is NOT loaded, possibly no GPU devices\n"); - return; + printf("%sROCk module is NOT loaded, possibly no GPU devices%s\n", + COL_RED, COL_RESET); + } else { + printf("%sROCk module is loaded%s\n", COL_WHT, COL_RESET); } // Check if user belongs to group "video" // @note: User who are not members of "video" // group cannot access DRM services - int status = -1; + char u_name[32]; bool member = false; - char gr_name[] = "video"; - struct group* grp = NULL; - do { - grp = getgrent(); - if (grp == NULL) { - break; - } - status = memcmp(gr_name, grp->gr_name, sizeof(gr_name)); - if (status == 0) { - member = true; - break; - } - } while (grp != NULL); - if (member == false) { - printf("User is not member of \"video\" group\n"); + struct passwd *pw; + int num_groups = 0; + gid_t *groups; + + struct group *gr_s = getgrnam("video"); // NOLINT + if (gr_s == nullptr) { + printf("%sFailed to get group info to check" + " for video group membership%s\n", COL_RED, COL_RESET); return; } + if (getlogin_r(u_name, 32)) { + printf("%sFailed to get user name to check for" + " video group membership%s\n", COL_RED, COL_RESET); + return; + } + + pw = getpwnam(u_name); // NOLINT + if (pw == NULL) { + printf("%sFailed to find pwd entry for user %s%s\n", + COL_RED, u_name, COL_RESET); + return; + } + + (void)getgrouplist(u_name, pw->pw_gid, NULL, &num_groups); + groups = new gid_t[num_groups]; + if (getgrouplist(u_name, pw->pw_gid, groups, &num_groups) == -1) { + printf("%sFailed to get user group list%s\n", COL_RED, COL_RESET); + delete []groups; + return; + } + + for (int i = 0; i < num_groups; ++i) { + if (gr_s->gr_gid == groups[i]) { + printf("%s%s is member of video group%s\n", COL_WHT, u_name, COL_RESET); + member = true; + break; + } + } + if (member == false) { + printf("%s%s is not member of \"video\" group, the default DRM access " + "group. Users must be a member of the \"video\" group or another" + " DRM access group in order for ROCm applications to run " + "successfully%s.\n", COL_RED, u_name, COL_RESET); + } + + delete []groups; return; } @@ -1064,8 +1097,9 @@ void CheckInitError(hsa_status_t err) { int main(int argc, char* argv[]) { hsa_status_t err; + CheckInitialState(); err = hsa_init(); - RET_IF_HSA_INIT_ERR(err); + RET_IF_HSA_ERR(err) // Acquire and display system information system_info_t sys_info; From 6f140e5391235475a4571bf1a03845e8e88fe3b8 Mon Sep 17 00:00:00 2001 From: Wilfried Holzke Date: Fri, 16 Aug 2019 22:04:52 +0200 Subject: [PATCH 024/162] Fixed sizeof(err_val) to return the number of characters in the array Change-Id: I7e4f04d10b2f9cc9dbed2431e53b5ebc540acf56 --- rocminfo.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rocminfo.cc b/rocminfo.cc index 9fddcfb4f9..ee20da8bc6 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -72,7 +72,7 @@ char* err_str = NULL; \ if (hsa_status_string(err, \ (const char**)&err_str) != HSA_STATUS_SUCCESS) { \ - snprintf(&(err_val[0]), sizeof(err_val[12]), "%#x", (uint32_t)err); \ + snprintf(&(err_val[0]), sizeof(err_val), "%#x", (uint32_t)err); \ err_str = &(err_val[0]); \ } \ printf("%shsa api call failure at: %s:%d\n", \ From 9f5349806a958eaf8d9ae65323eb47e7000abe13 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Thu, 25 Jul 2019 17:33:49 -0400 Subject: [PATCH 025/162] Messages indicating fatal errors should be fatal Change-Id: Ib071d3f6ed216c817daa637fc784680ef9d123f8 --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b5fa9dd0de..8b90b7fe6f 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,7 +50,7 @@ set(ROCR_LIB_DIR ${ROCM_DIR}/lib) # Determine ROCR Header files are present # if(NOT EXISTS ${ROCR_INC_DIR}/hsa/hsa.h) - message("ERROR: ${ROCR_INC_DIR}/hsa/hsa.h does not exist. Check value of ROCM_DIR define") + message(FATAL_ERROR, "ERROR: ${ROCR_INC_DIR}/hsa/hsa.h does not exist. Check value of ROCM_DIR define") return() endif() @@ -66,12 +66,12 @@ endif() # if (${IS64BIT} EQUAL 0) if(NOT EXISTS ${ROCR_LIB_DIR}/libhsa-runtime.so) - message("ERROR: ${ROCR_LIB_DIR}/libhsa-runtime.so doesn't exist. Check value of ROCM_DIR define") + message(FATAL_ERROR, "ERROR: ${ROCR_LIB_DIR}/libhsa-runtime.so doesn't exist. Check value of ROCM_DIR define") return() endif() else() if(NOT EXISTS ${ROCR_LIB_DIR}/libhsa-runtime64.so) - message("ERROR: Define ROCR_LIB_DIR pointing to ROCR libraries is not set") + message(FATAL_ERROR, "ERROR: Define ROCR_LIB_DIR pointing to ROCR libraries is not set") return() endif() endif() From 04dc08664e2bb547dd3603393dd7519c372ac5d0 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Thu, 25 Jul 2019 17:59:51 -0400 Subject: [PATCH 026/162] Use CACHE variables, allow overriding ROCR_LIB_DIR/ROCR_INC_DIR CACHE variables allow for variables to be documented, and ROCR_LIB_DIR/ROCR_INC_DIR should be overridable as they'll have different values on different Linux distributions. Change-Id: I0bba633c184df2da55bdbe6aabbd53346d098b83 --- CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b90b7fe6f..eac5c31df0 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,9 +43,10 @@ endif() # # Required Defines first: - -set(ROCR_INC_DIR ${ROCM_DIR}/include) -set(ROCR_LIB_DIR ${ROCM_DIR}/lib) +set(ROCRTST_BLD_BITS CACHE "64" STRING "Either 32 or 64") +set(ROCM_DIR CACHE PATH "Root for RocM install") +set(ROCR_INC_DIR ${ROCM_DIR}/include CACHE PATH "Path for RocM includes") +set(ROCR_LIB_DIR ${ROCM_DIR}/lib CACHE PATH "Path for RocM libraries") # # Determine ROCR Header files are present # From 9842beb7703410bd03b31f66f4c2f4043648a56d Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Thu, 22 Aug 2019 12:01:49 -0500 Subject: [PATCH 027/162] Update versioning to new uniform standards Change-Id: I93eb3170fedeee98caf7b3fd8f63a8c0fef5fd78 --- CMakeLists.txt | 53 +++++++---- cmake_modules/utils.cmake | 162 ++++++++++++++++++++++++++++++++++ cmake_modules/version_util.sh | 40 +++++++++ 3 files changed, 238 insertions(+), 17 deletions(-) create mode 100755 cmake_modules/utils.cmake create mode 100755 cmake_modules/version_util.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index eac5c31df0..a733d8a2e4 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,14 @@ if(WIN32) message("This sample is not supported on Windows platform") return() endif() + +## Set default module path if not already set +if(NOT DEFINED CMAKE_MODULE_PATH) + set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/") +endif() +## Include common cmake modules +include(utils) + # # Process input variables # @@ -93,6 +101,27 @@ set(ROCMINFO_EXE "rocminfo") set(PROJECT_NAME ${ROCMINFO_EXE}) project (${PROJECT_NAME}) + + +# The following default version values should be updated as appropriate for +# ABI breaks (update MAJOR and MINOR), and ABI/API additions (update MINOR). +# Until ABI stabilizes VERSION_MAJOR will be 0. This should be over-ridden +# by git tags (through "git describe") when they are present. +set(PKG_VERSION_MAJOR 1) +set(PKG_VERSION_MINOR 0) +set(PKG_VERSION_PATCH 0) +set(PKG_VERSION_NUM_COMMIT 0) + +################# Determine the library version ######################### +## Setup the package version based on git tags. +set(PKG_VERSION_GIT_TAG_PREFIX "rocminfo_pkg_ver") + +find_program (GIT NAMES git) + +get_package_version_number("1.0.0" ${PKG_VERSION_GIT_TAG_PREFIX} GIT) +# VERSION_* variables should be set by get_version_from_tag +message("Package version: ${PKG_VERSION_STR}") + # # Print out the build configuration being used: # @@ -207,32 +236,22 @@ install ( ########################### # Packaging directives ########################### -set(CPACK_PACKAGE_NAME "${PROJECT_NAME}") +# set(CPACK_PACKAGE_NAME "${PROJECT_NAME}") +set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PKG_VERSION_STR}") if (NOT DEFINED CPACK_PACKAGE_VENDOR) set(CPACK_PACKAGE_VENDOR "AMD") endif () -if (NOT DEFINED CPACK_PACKAGE_VERSION_MAJOR) - set(CPACK_PACKAGE_VERSION_MAJOR "1") -endif () - -if (NOT DEFINED CPACK_PACKAGE_VERSION_MINOR) - set(CPACK_PACKAGE_VERSION_MINOR "0") -endif () - -if (NOT DEFINED CPACK_PACKAGE_VERSION_PATCH) - set(CPACK_PACKAGE_VERSION_PATCH "0") -endif () - -if (NOT DEFINED CPACK_PACKAGE_CONTACT) - set(CPACK_PACKAGE_CONTACT "Advanced Micro Devices Inc.") -endif () - if (NOT DEFINED CPACK_PACKAGE_DESCRIPTION_SUMMARY) set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Radeon Open Compute (ROCm) Runtime rocminfo tool") endif () + +if (NOT DEFINED CPACK_PACKAGE_CONTACT) + set(CPACK_PACKAGE_CONTACT "Advanced Micro Devices Inc.") +endif() + ########################### # Debian package specific variables ########################### diff --git a/cmake_modules/utils.cmake b/cmake_modules/utils.cmake new file mode 100755 index 0000000000..5e1c19bd3f --- /dev/null +++ b/cmake_modules/utils.cmake @@ -0,0 +1,162 @@ +################################################################################ +## +## The University of Illinois/NCSA +## Open Source License (NCSA) +## +## Copyright (c) 2014-2017, Advanced Micro Devices, Inc. All rights reserved. +## +## Developed by: +## +## AMD Research and AMD HSA Software Development +## +## Advanced Micro Devices, Inc. +## +## www.amd.com +## +## Permission is hereby granted, free of charge, to any person obtaining a copy +## of this software and associated documentation files (the "Software"), to +## deal with the Software without restriction, including without limitation +## the rights to use, copy, modify, merge, publish, distribute, sublicense, +## and#or sell copies of the Software, and to permit persons to whom the +## Software is furnished to do so, subject to the following conditions: +## +## - Redistributions of source code must retain the above copyright notice, +## this list of conditions and the following disclaimers. +## - Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimers in +## the documentation and#or other materials provided with the distribution. +## - Neither the names of Advanced Micro Devices, Inc, +## nor the names of its contributors may be used to endorse or promote +## products derived from this Software without specific prior written +## permission. +## +## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +## THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +## OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +## ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +## DEALINGS WITH THE SOFTWARE. +## +################################################################################ + +## Parses the VERSION_STRING variable and places +## the first, second and third number values in +## the major, minor and patch variables. +function( parse_version VERSION_STRING ) + + string ( FIND ${VERSION_STRING} "-" STRING_INDEX ) + + if ( ${STRING_INDEX} GREATER -1 ) + math ( EXPR STRING_INDEX "${STRING_INDEX} + 1" ) + string ( SUBSTRING ${VERSION_STRING} ${STRING_INDEX} -1 VERSION_BUILD ) + endif () + + string ( REGEX MATCHALL "[0123456789]+" VERSIONS ${VERSION_STRING} ) + list ( LENGTH VERSIONS VERSION_COUNT ) + + if ( ${VERSION_COUNT} GREATER 0) + list ( GET VERSIONS 0 MAJOR ) + set ( VERSION_MAJOR ${MAJOR} PARENT_SCOPE ) + set ( TEMP_VERSION_STRING "${MAJOR}" ) + endif () + + if ( ${VERSION_COUNT} GREATER 1 ) + list ( GET VERSIONS 1 MINOR ) + set ( VERSION_MINOR ${MINOR} PARENT_SCOPE ) + set ( TEMP_VERSION_STRING "${TEMP_VERSION_STRING}.${MINOR}" ) + endif () + + if ( ${VERSION_COUNT} GREATER 2 ) + list ( GET VERSIONS 2 PATCH ) + set ( VERSION_PATCH ${PATCH} PARENT_SCOPE ) + set ( TEMP_VERSION_STRING "${TEMP_VERSION_STRING}.${PATCH}" ) + endif () + + set ( VERSION_STRING "${TEMP_VERSION_STRING}" PARENT_SCOPE ) + +endfunction () + +## Gets the current version of the repository +## using versioning tags and git describe. +## Passes back a packaging version string +## and a library version string. +function(get_version_from_tag DEFAULT_VERSION_STRING VERSION_PREFIX GIT) + parse_version ( ${DEFAULT_VERSION_STRING} ) + + if ( GIT ) + execute_process ( COMMAND git describe --tags --dirty --long --match ${VERSION_PREFIX}-[0-9.]* + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_VARIABLE GIT_TAG_STRING + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE RESULT ) + if ( ${RESULT} EQUAL 0 ) + parse_version ( ${GIT_TAG_STRING} ) + endif () + + endif () + + set( VERSION_STRING "${VERSION_STRING}" PARENT_SCOPE ) + set( VERSION_MAJOR "${VERSION_MAJOR}" PARENT_SCOPE ) + set( VERSION_MINOR "${VERSION_MINOR}" PARENT_SCOPE ) +endfunction() + +function(num_change_since_prev_pkg VERSION_PREFIX) + find_program(get_commits NAMES version_util.sh + PATHS ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules) + if (get_commits) + execute_process( COMMAND ${get_commits} -c ${VERSION_PREFIX} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_VARIABLE NUM_COMMITS + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE RESULT ) + + set(NUM_COMMITS "${NUM_COMMITS}" PARENT_SCOPE ) + + if ( ${RESULT} EQUAL 0 ) + message("${NUM_COMMITS} were found since previous release") + else() + message("Unable to determine number of commits since previous release") + endif() + else() + message("WARNING: Didn't find version_util.sh") + set(NUM_COMMITS "unknown" PARENT_SCOPE ) + endif() +endfunction() + +function(get_package_version_number DEFAULT_VERSION_STRING VERSION_PREFIX GIT) + get_version_from_tag(${DEFAULT_VERSION_STRING} ${VERSION_PREFIX} GIT) + num_change_since_prev_pkg(${VERSION_PREFIX}) + + set(PKG_VERSION_STR "${VERSION_STRING}.${NUM_COMMITS}") + if (DEFINED ENV{ROCM_BUILD_ID}) + set(VERSION_ID $ENV{ROCM_BUILD_ID}) + else() + set(VERSION_ID "local_build-0") + endif() + + set(PKG_VERSION_STR "${PKG_VERSION_STR}.${VERSION_ID}") + + if (GIT) + execute_process(COMMAND git rev-parse --short HEAD + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_VARIABLE VERSION_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE RESULT ) + if( ${RESULT} EQUAL 0 ) + # Check for dirty workspace. + execute_process(COMMAND git diff --quiet + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + RESULT_VARIABLE RESULT ) + if(${RESULT} EQUAL 1) + set(VERSION_HASH "${VERSION_HASH}-dirty") + endif() + else() + set( VERSION_HASH "unknown" ) + endif() + else() + set( VERSION_HASH "unknown" ) + endif() + set(PKG_VERSION_STR "${PKG_VERSION_STR}-${VERSION_HASH}") + set(PKG_VERSION_STR ${PKG_VERSION_STR} PARENT_SCOPE) +endfunction() diff --git a/cmake_modules/version_util.sh b/cmake_modules/version_util.sh new file mode 100755 index 0000000000..5c1ded9631 --- /dev/null +++ b/cmake_modules/version_util.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# Handle commandline args +while [ "$1" != "" ]; do + case $1 in + -c ) # Commits since prevous tag + TARGET="count" ;; + * ) + TARGET="count" + break ;; + esac + shift 1 +done +TAG_PREFIX=$1 +reg_ex="${TAG_PREFIX}*" + +commits_since_last_tag() { + TAG_ARR=(`git tag --sort=committerdate -l ${reg_ex} | tail -2`) + PREVIOUS_TAG=${TAG_ARR[0]} + CURRENT_TAG=${TAG_ARR[1]} + + PREV_CMT_NUM=`git rev-list --count $PREVIOUS_TAG` + CURR_CMT_NUM=`git rev-list --count $CURRENT_TAG` + + # Commits since prevous tag: + if [[ -z $PREV_CMT_NUM || -z $CURR_CMT_NUM ]]; then + let NUM_COMMITS="0" + else + let NUM_COMMITS="${CURR_CMT_NUM}-${PREV_CMT_NUM}" + fi + echo $NUM_COMMITS +} + +case $TARGET in + count) commits_since_last_tag ;; + *) die "Invalid target $target" ;; +esac + +exit 0 + From f1181e05690a82dd0003b0b7264736b0e42ffcb8 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Fri, 9 Aug 2019 17:23:09 -0400 Subject: [PATCH 028/162] Install to standard locations using GNUInstallDirs Change-Id: I6bafae15d2a0dfb70389673e03b6f72737786501 --- CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a733d8a2e4..ce08409c3f 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,7 @@ # Minimum version of cmake required # cmake_minimum_required(VERSION 2.8.0) +include ( GNUInstallDirs ) # # GCC 4.8 or higher compiler required. # @@ -227,11 +228,11 @@ target_link_libraries(${ROCMINFO_EXE} ${ROCR_LIBS} c stdc++ dl pthread rt) install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/${ROCMINFO_EXE} PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - DESTINATION bin ) + 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 - DESTINATION bin ) + DESTINATION ${CMAKE_INSTALL_BINDIR} ) ########################### # Packaging directives @@ -261,7 +262,7 @@ set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${CPACK_DEBIAN_PACKAGE_HOMEPAGE} CACHE STRING # RPM package specific variables ########################### if ( DEFINED CPACK_PACKAGING_INSTALL_PREFIX ) - set ( CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/bin" ) + set ( CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}" ) endif ( ) ########################### From 2afaae2fbe61ea0bcd6735ba5ae3c9b42864f5f7 Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Mon, 9 Dec 2019 11:57:09 -0600 Subject: [PATCH 029/162] Require >= CMake3.5 instead of 2.8 Change-Id: I5e0045fad2ecc028c2dcb9fd78805dfb42a9e2ed --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ce08409c3f..23911c0f4a 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # # Minimum version of cmake required # -cmake_minimum_required(VERSION 2.8.0) +cmake_minimum_required(VERSION 3.5.0) include ( GNUInstallDirs ) # # GCC 4.8 or higher compiler required. From 831f3ab124233877087812384c56e19a0198f022 Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Mon, 9 Dec 2019 14:51:53 -0600 Subject: [PATCH 030/162] Update README to include instruction to fetch git tags Also, slight reformatting. Change-Id: I7c35343556e48cadccd266b41465fb5ea04ace29 --- README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7e6e12828b..74e840b51b 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,15 @@ ROCm Application for Reporting System Info ## To Build 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. Building -the package also requires the rocm-cmake helper files. +as a cmake argument using the standard CMAKE_PREFIX_PATH cmake variable. -For example, building from the CMakeLists.txt directory -might look like this: +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, + +$ git fetch --tags origin + +Building from the CMakeLists.txt directory might look like this: mkdir -p build @@ -20,6 +24,6 @@ make 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. From 9b0cd9e428705ce035b721497ea78af03fe66db5 Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Mon, 9 Dec 2019 14:59:57 -0600 Subject: [PATCH 031/162] Fix for running rocminfo on wider variety of CPUs Change-Id: I7acc46d2fec97ae1026643f79e59dd632444ce2e --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 23911c0f4a..88a1d283aa 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -181,7 +181,10 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") # Extend the compiler flags for 64-bit builds # if (IS64BIT) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -msse -msse2") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64") + if((${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64") OR (${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "AMD64")) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -msse2") + endif() else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") endif() From 12736c6fd8f44b65fc21d3ee3f6f700a3e2f623d Mon Sep 17 00:00:00 2001 From: Wilfried Holzke Date: Sun, 29 Sep 2019 09:22:00 +0200 Subject: [PATCH 032/162] Added env var to set target.lst Change-Id: Ie6aefba6ef79360e65d4a64a6be1ec50e59b5741 --- rocm_agent_enumerator | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index 7a733395e2..86cc0e005c 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -55,9 +55,11 @@ def getGCNISA(line, match_from_beginning = False): def readFromTargetLstFile(): target_list = [] - # locate target.lst which should be placed at the same directory with this - # script - target_lst_path = os.path.join(CWD, "target.lst") + # 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: From a1348470696a5c84cb3eb9a578bf53f4962be85e Mon Sep 17 00:00:00 2001 From: Wilfried Holzke Date: Mon, 21 Oct 2019 20:32:54 +0200 Subject: [PATCH 033/162] Added documentation for the new env var. Change-Id: I0407a5dd36e91a1ea205ce4dda9a7fca906e1266 --- README.md | 14 ++++++++++++++ rocm_agent_enumerator | 14 +++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 74e840b51b..a8b27fe07d 100644 --- a/README.md +++ b/README.md @@ -27,3 +27,17 @@ cd .. Upon a successful build the binary, rocminfo, and the python script, rocm_agent_enumerator, will be in the build folder. +## Execution + +"rocminfo" gives information about the HSA system attributes and agents. + +"rocm_agent_enumerator" prints the list of available AMD GCN ISA. There exist four different ways how it is generated: + +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. rocminfo : a tool shipped with this script to enumerate GPU agents available on a working ROCm stack. + +4. lspci : enumerate PCI bus and locate supported devices from a hard-coded lookup table. + diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index 86cc0e005c..7dc577f527 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -68,7 +68,7 @@ def readFromTargetLstFile(): target = getGCNISA(line, match_from_beginning = True) if target is not None: target_list.append(target) - + return target_list def readFromROCMINFO(): @@ -123,11 +123,15 @@ def main(): The program collects the list in 3 different ways, in the order of precendence: - 1. target.lst : user-supplied text file. This is used in a container setting + 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. - 2. rocminfo : a tool shipped with this script to enumerate GPU agents + 3. rocminfo : a tool shipped with this script to enumerate GPU agents available on a working ROCm stack. - 3. lspci : enumerate PCI bus and locate supported devices from a hard-coded + 4. lspci : enumerate PCI bus and locate supported devices from a hard-coded lookup table. """ target_list = readFromTargetLstFile() @@ -141,7 +145,7 @@ def main(): # workaround to cope with existing rocm_agent_enumerator behavior where gfx000 # would always be returned print("gfx000") - + for gfx in target_list: print(gfx) From 70ebe13a8932944bc8d369cc7a91d6e2c0c8e65f Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Fri, 6 Mar 2020 13:46:15 -0600 Subject: [PATCH 034/162] Fix ennumerator id parser. Fixes SWDEV-226018 Change-Id: I14144cdd316c19fe29dcd70b406a52aac8a741cd --- rocm_agent_enumerator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index 7dc577f527..5b1a9b75a8 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -41,7 +41,7 @@ def staticVars(**kwargs): return func return deco -@staticVars(search_term=re.compile("gfx\d+")) +@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) From a1b4a580fc898f98a84ba62184f270dd52a829a2 Mon Sep 17 00:00:00 2001 From: Ramesh Errabolu Date: Mon, 13 Apr 2020 20:42:43 -0500 Subject: [PATCH 035/162] Extend rocminfo to print UUID of ROCm devices Change-Id: I258962046e6d05dda91a8c48af646e50500b2d53 --- rocminfo.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rocminfo.cc b/rocminfo.cc index ee20da8bc6..5bb87f0c0b 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -97,6 +97,7 @@ typedef struct { // calls, and is later used for reference when displaying the information. typedef struct { char name[64]; + char uuid[24]; char vendor_name[64]; char device_mkt_name[64]; hsa_agent_feature_t agent_feature; @@ -304,6 +305,13 @@ AcquireAgentInfo(hsa_agent_t agent, agent_info_t *agent_i) { // Get agent name and vendor err = hsa_agent_get_info(agent, HSA_AGENT_INFO_NAME, agent_i->name); RET_IF_HSA_ERR(err); + + // Get UUID, an Ascii string, of a ROCm device + err = hsa_agent_get_info(agent, + (hsa_agent_info_t)HSA_AMD_AGENT_INFO_UUID, + &agent_i->uuid); + + // Get device's vendor name err = hsa_agent_get_info(agent, HSA_AGENT_INFO_VENDOR_NAME, &agent_i->vendor_name); RET_IF_HSA_ERR(err); @@ -482,6 +490,7 @@ 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); printLabelStr("Marketing Name:", agent_i->device_mkt_name, 1); printLabelStr("Vendor Name:", agent_i->vendor_name, 1); From 373d8abdec59772c518ee7065a3b8003976a1a91 Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Thu, 16 Apr 2020 16:39:51 -0500 Subject: [PATCH 036/162] Fix rocm_agent_enumerator on RHEL This fixes SWDEV-231760 Change-Id: If704c8ff76548e10ddbda1b5c1ad0c28df7ab6f0 --- rocm_agent_enumerator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index 5b1a9b75a8..565969d463 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python import os import re From cd4b7cea858bb1169f1aa3b8bcdeca1ad0022c2e Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Thu, 30 Apr 2020 19:34:35 -0400 Subject: [PATCH 037/162] Change check for /dev/kfd permissions On newer kernels, it seems the group was changed from "video" to "render". The check for video group misled me for quite some time, so relax this check. Rather than specifically checking for video group ownership, first see if /dev/kfd can be open as read-write. Then diagnose whether the user belongs to the group that owns it, rather than hardcoding the video group. Change-Id: I9e65427363e9a5cdba802e09cee2f40fb80520ed --- rocminfo.cc | 47 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/rocminfo.cc b/rocminfo.cc index 5bb87f0c0b..38bb55f93f 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -44,7 +44,9 @@ */ #include #include +#include #include +#include #include #include #include @@ -1042,7 +1044,8 @@ void CheckInitialState(void) { printf("%sROCk module is loaded%s\n", COL_WHT, COL_RESET); } - // Check if user belongs to group "video" + // Check if user belongs to the group for /dev/kfd (e.g. "video" or + // "render") // @note: User who are not members of "video" // group cannot access DRM services char u_name[32]; @@ -1051,16 +1054,44 @@ void CheckInitialState(void) { int num_groups = 0; gid_t *groups; - struct group *gr_s = getgrnam("video"); // NOLINT + // Check if we can open /dev/kfd as read-write. If not, try to + // diagnose common reasons why you can't. + int open_kfd = open("/dev/kfd", O_RDWR); + if (open_kfd >= 0) { + close(open_kfd); + printf("%sAble to open /dev/kfd read-write%s\n", + COL_WHT, COL_RESET); + return; + } + + printf("%sUnable to open /dev/kfd read-write: %s%s\n", + COL_RED, strerror(errno), COL_RESET); + + const char *kfd_gr_name = NULL; + + struct stat sb; + if (stat("/dev/kfd", &sb) == 0) { + // The owner of kfd was renamed, so avoid hard-coding the + // name. Check whatever group owns it. + if (struct group *kfd_gr = getgrgid(sb.st_gid)) + kfd_gr_name = kfd_gr->gr_name; + } + + if (!kfd_gr_name) + kfd_gr_name = "video"; + + struct group *gr_s = getgrnam(kfd_gr_name); // NOLINT if (gr_s == nullptr) { printf("%sFailed to get group info to check" - " for video group membership%s\n", COL_RED, COL_RESET); + " for %s group membership%s\n", COL_RED, kfd_gr_name, + COL_RESET); return; } if (getlogin_r(u_name, 32)) { printf("%sFailed to get user name to check for" - " video group membership%s\n", COL_RED, COL_RESET); + " %s group membership%s\n", COL_RED, kfd_gr_name, + COL_RESET); return; } @@ -1081,16 +1112,16 @@ void CheckInitialState(void) { for (int i = 0; i < num_groups; ++i) { if (gr_s->gr_gid == groups[i]) { - printf("%s%s is member of video group%s\n", COL_WHT, u_name, COL_RESET); + printf("%s%s is member of %s group%s\n", COL_WHT, u_name, kfd_gr_name, COL_RESET); member = true; break; } } if (member == false) { - printf("%s%s is not member of \"video\" group, the default DRM access " - "group. Users must be a member of the \"video\" group or another" + printf("%s%s is not member of \"%s\" group, the default DRM access " + "group. Users must be a member of the \"%s\" group or another" " DRM access group in order for ROCm applications to run " - "successfully%s.\n", COL_RED, u_name, COL_RESET); + "successfully%s.\n", COL_RED, u_name, kfd_gr_name, kfd_gr_name, COL_RESET); } delete []groups; From 7624cc10082536b9c6ae1bc187dc754e67709099 Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Thu, 30 Apr 2020 21:11:15 -0500 Subject: [PATCH 038/162] Correct spelling of output message Change-Id: Id7789e622ea76cc53c3be719798c3c1f90ede6e2 --- rocminfo.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rocminfo.cc b/rocminfo.cc index 38bb55f93f..205e430a1e 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -733,7 +733,7 @@ static void DisplayPoolInfo(pool_info_t *pool_i, uint32_t indent) { std::string al_str = std::to_string(pool_i->pool_alloc_alignment/1024)+"KB"; printLabelStr("Alloc Alignment:", al_str.c_str(), indent); - printLabelStr("Acessible by all:", (pool_i->pl_access ? "TRUE" : "FALSE"), + printLabelStr("Accessible by all:", (pool_i->pl_access ? "TRUE" : "FALSE"), indent); } From 5d6be5b80826f8098b2688f2cccbc2a7c4bbf8da Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Thu, 30 Apr 2020 19:09:11 -0400 Subject: [PATCH 039/162] Refer explicitly to python3 in shebang line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Ubuntu 20.04, there is no more python or python2. Currently I get this: /usr/bin/env: ‘python’: No such file or directory Change-Id: Ib310b8aa7c1bd62973ef3cc8bcaf571831ad4435 --- rocm_agent_enumerator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index 565969d463..f62daa4881 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os import re From 605b3a5105476aa8055e138aaa36ec28db5e0edf Mon Sep 17 00:00:00 2001 From: Ashutosh Mishra Date: Thu, 4 Jun 2020 19:25:31 +0530 Subject: [PATCH 040/162] Adapting to latest HSA changes JIRA : SWDEV-234471 With this change rocminfo exe shall be created using using hsa-runtime64::hsa-runtime64 which internally decides whether static or shared libs based on its cmake build options S. Keely: Update patch to use find_package for rocr dependency. Removed deadcode now supported by find_package. Removed "hsa/" prefix from include statements since find_package points to the target (ie rocr) include directory. Removed typedef on structs due to new clang-11 warning. Adapting to the comments : Removed PATHS for hsa find_package Change-Id: I1ec65cdbce3085e44f1839da196eb4ae5c9ff30d --- CMakeLists.txt | 88 +++++++++----------------------------------------- rocminfo.cc | 20 ++++++------ 2 files changed, 26 insertions(+), 82 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 88a1d283aa..6dd3762d2d 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,4 @@ # -# Minimum version of cmake required -# -cmake_minimum_required(VERSION 3.5.0) -include ( GNUInstallDirs ) -# # GCC 4.8 or higher compiler required. # # Required Defines on cmake command line @@ -35,6 +30,17 @@ include ( GNUInstallDirs ) # # Currently support for Windows platform is not present # + +# +# Minimum version of cmake required +# +cmake_minimum_required(VERSION 3.5.0) + +set(ROCMINFO_EXE "rocminfo") +set(PROJECT_NAME ${ROCMINFO_EXE}) +project (${PROJECT_NAME}) + +include ( GNUInstallDirs ) if(WIN32) message("This sample is not supported on Windows platform") return() @@ -51,40 +57,7 @@ include(utils) # Process input variables # -# Required Defines first: -set(ROCRTST_BLD_BITS CACHE "64" STRING "Either 32 or 64") -set(ROCM_DIR CACHE PATH "Root for RocM install") -set(ROCR_INC_DIR ${ROCM_DIR}/include CACHE PATH "Path for RocM includes") -set(ROCR_LIB_DIR ${ROCM_DIR}/lib CACHE PATH "Path for RocM libraries") -# -# Determine ROCR Header files are present -# -if(NOT EXISTS ${ROCR_INC_DIR}/hsa/hsa.h) - message(FATAL_ERROR, "ERROR: ${ROCR_INC_DIR}/hsa/hsa.h does not exist. Check value of ROCM_DIR define") - return() -endif() - -# Determine ROCR Library files are present -# -if("${ROCRTST_BLD_BITS}" STREQUAL 32) - set (ONLY64STR "") - set (IS64BIT 0) -else() - set (ONLY64STR "64") - set (IS64BIT 1) -endif() -# -if (${IS64BIT} EQUAL 0) - if(NOT EXISTS ${ROCR_LIB_DIR}/libhsa-runtime.so) - message(FATAL_ERROR, "ERROR: ${ROCR_LIB_DIR}/libhsa-runtime.so doesn't exist. Check value of ROCM_DIR define") - return() - endif() -else() - if(NOT EXISTS ${ROCR_LIB_DIR}/libhsa-runtime64.so) - message(FATAL_ERROR, "ERROR: Define ROCR_LIB_DIR pointing to ROCR libraries is not set") - return() - endif() -endif() +find_package(hsa-runtime64 1.0 REQUIRED ) string(TOLOWER "${ROCRTST_BLD_TYPE}" tmp) if("${tmp}" STREQUAL release) @@ -95,15 +68,6 @@ else() set(ISDEBUG 1) endif() -# Set Name for Samples Project -# - -set(ROCMINFO_EXE "rocminfo") -set(PROJECT_NAME ${ROCMINFO_EXE}) -project (${PROJECT_NAME}) - - - # The following default version values should be updated as appropriate for # ABI breaks (update MAJOR and MINOR), and ABI/API additions (update MINOR). # Until ABI stabilizes VERSION_MAJOR will be 0. This should be over-ridden @@ -133,7 +97,6 @@ message("Package version: ${PKG_VERSION_STR}") # message("") message("Build Configuration:") -message("-------------IS64BIT: " ${IS64BIT}) message("-----------BuildType: " ${BUILD_TYPE}) message("------------Compiler: " ${CMAKE_CXX_COMPILER}) message("-------------Version: " ${CMAKE_CXX_COMPILER_VERSION}) @@ -176,17 +139,13 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmerge-all-constants") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fms-extensions") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64") # # Extend the compiler flags for 64-bit builds # -if (IS64BIT) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64") - if((${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64") OR (${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "AMD64")) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -msse2") - endif() -else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") +if((${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64") OR (${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "AMD64")) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -msse2") endif() # @@ -196,21 +155,6 @@ if(ISDEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb -O0") endif() -# -# Linux Linker options -## -# Specify the directory containing various libraries of ROCR -# to be linked against for building ROC Perf applications -# -link_directories(${ROCR_LIB_DIR}) - -# -# Extend the list of libraries to be used for linking ROC Perf Apps -# -set(ROCR_LIBS ${ROCR_LIBS} hsa-runtime${ONLY64STR}) - -include_directories(${ROCR_INC_DIR} ${OPENCL_INC_DIR}) - ########################### # rocm_agent_enumerator ########################### @@ -223,7 +167,7 @@ configure_file(rocm_agent_enumerator rocm_agent_enumerator COPYONLY) ########################### aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} ROCMINFO_SOURCES) add_executable(${ROCMINFO_EXE} ${ROCMINFO_SOURCES}) -target_link_libraries(${ROCMINFO_EXE} ${ROCR_LIBS} c stdc++ dl pthread rt) +target_link_libraries(${ROCMINFO_EXE} hsa-runtime64::hsa-runtime64) ########################### # Install directives diff --git a/rocminfo.cc b/rocminfo.cc index 205e430a1e..7cc117e46a 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -55,8 +55,8 @@ #include #include -#include "hsa/hsa.h" -#include "hsa/hsa_ext_amd.h" +#include "hsa.h" +#include "hsa_ext_amd.h" #define COL_BLU "\x1B[34m" #define COL_KCYN "\x1B[36m" @@ -87,17 +87,17 @@ // This structure holds system information acquired through hsa info related // calls, and is later used for reference when displaying the information. -typedef struct { +struct system_info_t { uint16_t major, minor; uint64_t timestamp_frequency = 0; uint64_t max_wait = 0; hsa_endianness_t endianness; hsa_machine_model_t machine_model; -} system_info_t; +}; // This structure holds agent information acquired through hsa info related // calls, and is later used for reference when displaying the information. -typedef struct { +struct agent_info_t { char name[64]; char uuid[24]; char vendor_name[64]; @@ -133,7 +133,7 @@ typedef struct { uint16_t workgroup_max_dim[3]; uint16_t bdf_id; bool fast_f16; -} agent_info_t; +}; // This structure holds memory pool information acquired through hsa info // related calls, and is later used for reference when displaying the @@ -151,7 +151,7 @@ typedef struct { // This structure holds ISA information acquired through hsa info // related calls, and is later used for reference when displaying the // information. -typedef struct { +struct isa_info_t { char *name_str; uint32_t workgroup_max_size; hsa_dim3_t grid_max_dim; @@ -163,16 +163,16 @@ typedef struct { bool mach_models[2]; bool profiles[2]; bool fast_f16; -} isa_info_t; +}; // This structure holds cache information acquired through hsa info // related calls, and is later used for reference when displaying the // information. -typedef struct { +struct cache_info_t { char *name_str; uint8_t level; uint32_t size; -} cache_info_t; +}; static const uint32_t kLabelFieldSize = 25; static const uint32_t kValueFieldSize = 35; From e7b43b970f26e82c236c25c9a087caeb53448bd5 Mon Sep 17 00:00:00 2001 From: Ashutosh Mishra Date: Mon, 21 Sep 2020 14:45:58 +0530 Subject: [PATCH 041/162] Standardizing Package name Enables standards compliant package naming for debian and rpm Signed-off-by: Ashutosh Mishra Change-Id: I38af7b31f0c17d0c38ea7c2eb143770e7f1d74b2 --- CMakeLists.txt | 67 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 26 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6dd3762d2d..57983f2e70 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,7 +34,7 @@ # # Minimum version of cmake required # -cmake_minimum_required(VERSION 3.5.0) +cmake_minimum_required(VERSION 3.6.3) set(ROCMINFO_EXE "rocminfo") set(PROJECT_NAME ${ROCMINFO_EXE}) @@ -184,35 +184,50 @@ install ( ########################### # Packaging directives ########################### -# set(CPACK_PACKAGE_NAME "${PROJECT_NAME}") -set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PKG_VERSION_STR}") +set(CPACK_PACKAGE_NAME "${PROJECT_NAME}") +set(CPACK_PACKAGE_VENDOR "Advanced Micro Devices, Inc.") +set(CPACK_PACKAGE_VERSION_MAJOR "${PKG_VERSION_MAJOR}") +set(CPACK_PACKAGE_VERSION_MINOR "${PKG_VERSION_MINOR}") +set(CPACK_PACKAGE_VERSION_PATCH "${PKG_VERSION_PATCH}") +set(CPACK_PACKAGE_CONTACT "AMD Rocminfo Support ") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Radeon Open Compute (ROCm) Runtime rocminfo tool") -if (NOT DEFINED CPACK_PACKAGE_VENDOR) - set(CPACK_PACKAGE_VENDOR "AMD") -endif () - -if (NOT DEFINED CPACK_PACKAGE_DESCRIPTION_SUMMARY) - set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Radeon Open Compute (ROCm) Runtime rocminfo tool") -endif () - - -if (NOT DEFINED CPACK_PACKAGE_CONTACT) - set(CPACK_PACKAGE_CONTACT "Advanced Micro Devices Inc.") +#Make proper version for appending +#Default Value is 99999, setting it first +set(ROCM_VERSION_FOR_PACKAGE "99999") +if(DEFINED ENV{ROCM_LIBPATCH_VERSION}) + set(ROCM_VERSION_FOR_PACKAGE $ENV{ROCM_LIBPATCH_VERSION}) endif() -########################### -# Debian package specific variables -########################### +#Debian package specific variables 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}) +else() + set(CPACK_DEBIAN_PACKAGE_RELEASE "local") +endif() -########################### -# RPM package specific variables -########################### -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 ( ) +#RPM package specific variables +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() +if(DEFINED ENV{CPACK_RPM_PACKAGE_RELEASE}) + set(CPACK_RPM_PACKAGE_RELEASE $ENV{CPACK_RPM_PACKAGE_RELEASE}) +else() + set(CPACK_RPM_PACKAGE_RELEASE "local") +endif() + +#Set rpm distro +if(CPACK_RPM_PACKAGE_RELEASE) + set(CPACK_RPM_PACKAGE_RELEASE_DIST ON) +endif() + +#Prepare final version for the CAPACK use +set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}.${ROCM_VERSION_FOR_PACKAGE}") + +#Set the names now using CPACK utility +set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") +set(CPACK_RPM_FILE_NAME "RPM-DEFAULT") -########################### -# Include packaging -########################### include ( CPack ) From 10da0a71da6700c91e8cd204927cca0d9461b586 Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Tue, 27 Oct 2020 19:55:00 -0500 Subject: [PATCH 042/162] Exit earlier if prerquisites are not met Change-Id: I1c861234986013742ce606ecffb5d9a7db697d05 --- rocminfo.cc | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/rocminfo.cc b/rocminfo.cc index 7cc117e46a..ee01f60970 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -1033,13 +1033,14 @@ AcquireAndDisplayAgentInfo(hsa_agent_t agent, void* data) { return HSA_STATUS_SUCCESS; } -void CheckInitialState(void) { +int CheckInitialState(void) { // Check kernel module for ROCk is loaded FILE *fd = popen("lsmod | grep amdgpu", "r"); char buf[16]; if (fread (buf, 1, sizeof (buf), fd) <= 0) { printf("%sROCk module is NOT loaded, possibly no GPU devices%s\n", COL_RED, COL_RESET); + return -1; } else { printf("%sROCk module is loaded%s\n", COL_WHT, COL_RESET); } @@ -1059,9 +1060,7 @@ void CheckInitialState(void) { int open_kfd = open("/dev/kfd", O_RDWR); if (open_kfd >= 0) { close(open_kfd); - printf("%sAble to open /dev/kfd read-write%s\n", - COL_WHT, COL_RESET); - return; + return 0; } printf("%sUnable to open /dev/kfd read-write: %s%s\n", @@ -1085,21 +1084,21 @@ void CheckInitialState(void) { printf("%sFailed to get group info to check" " for %s group membership%s\n", COL_RED, kfd_gr_name, COL_RESET); - return; + return -1; } if (getlogin_r(u_name, 32)) { printf("%sFailed to get user name to check for" " %s group membership%s\n", COL_RED, kfd_gr_name, COL_RESET); - return; + return -1; } pw = getpwnam(u_name); // NOLINT if (pw == NULL) { printf("%sFailed to find pwd entry for user %s%s\n", COL_RED, u_name, COL_RESET); - return; + return -1; } (void)getgrouplist(u_name, pw->pw_gid, NULL, &num_groups); @@ -1107,7 +1106,7 @@ void CheckInitialState(void) { if (getgrouplist(u_name, pw->pw_gid, groups, &num_groups) == -1) { printf("%sFailed to get user group list%s\n", COL_RED, COL_RESET); delete []groups; - return; + return -1; } for (int i = 0; i < num_groups; ++i) { @@ -1125,7 +1124,7 @@ void CheckInitialState(void) { } delete []groups; - return; + return -1; } // Print out all static information known to HSA about the target system. @@ -1137,7 +1136,9 @@ void CheckInitialState(void) { int main(int argc, char* argv[]) { hsa_status_t err; - CheckInitialState(); + if (CheckInitialState()) { + return 1; + } err = hsa_init(); RET_IF_HSA_ERR(err) @@ -1166,6 +1167,7 @@ int main(int argc, char* argv[]) { err = hsa_shut_down(); RET_IF_HSA_ERR(err); + return 0; } #undef RET_IF_HSA_ERR From 1452f8fa24b2a33051c326dc7b21bff0450b4c66 Mon Sep 17 00:00:00 2001 From: Icarus Sparry Date: Mon, 5 Jul 2021 18:28:42 +0000 Subject: [PATCH 043/162] Add dependency on rocm-core Signed-off-by: Icarus Sparry Change-Id: I2b0e330698ed19a2474734e33a1215644ec6f1cc --- CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 57983f2e70..112d1d7734 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -207,6 +207,7 @@ if (DEFINED ENV{CPACK_DEBIAN_PACKAGE_RELEASE}) else() set(CPACK_DEBIAN_PACKAGE_RELEASE "local") endif() +set(CPACK_DEBIAN_PACKAGE_DEPENDS "rocm-core") #RPM package specific variables if(DEFINED CPACK_PACKAGING_INSTALL_PREFIX) @@ -217,17 +218,23 @@ if(DEFINED ENV{CPACK_RPM_PACKAGE_RELEASE}) else() set(CPACK_RPM_PACKAGE_RELEASE "local") endif() +set(CPACK_RPM_PACKAGE_REQUIRES "rocm-core") #Set rpm distro if(CPACK_RPM_PACKAGE_RELEASE) set(CPACK_RPM_PACKAGE_RELEASE_DIST ON) endif() -#Prepare final version for the CAPACK use +#Prepare final version for the CPACK use set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}.${ROCM_VERSION_FOR_PACKAGE}") #Set the names now using CPACK utility set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") set(CPACK_RPM_FILE_NAME "RPM-DEFAULT") +# Remove dependency on rocm-core if -DROCM_DEP_ROCMCORE=ON not given to cmake +if(NOT ROCM_DEP_ROCMCORE) + string(REGEX REPLACE ",? ?rocm-core" "" CPACK_RPM_PACKAGE_REQUIRES ${CPACK_RPM_PACKAGE_REQUIRES}) + string(REGEX REPLACE ",? ?rocm-core" "" CPACK_DEBIAN_PACKAGE_DEPENDS ${CPACK_DEBIAN_PACKAGE_DEPENDS}) +endif() include ( CPack ) From 102f22f974c1476150523e7f3f4d15dcb9948e7b Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Mon, 15 Mar 2021 15:52:42 -0500 Subject: [PATCH 044/162] Append CXXFLAGS env. variable to CMAKE_CXX_FLAGS This facilitates address sanitizer builds via env. variable. Change-Id: I69fc9a5782ca80d7bdbf2b1ec0c89cccc4a5ca11 --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 112d1d7734..d8052a9aa9 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,8 +129,9 @@ add_definitions(-DLITTLEENDIAN_CPU=1) # # Linux Compiler options # -set(CMAKE_CXX_FLAGS "-std=c++11 ") +set(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-math-errno") From 2bd7657503e28cd9fc6fe5bf5d3c3f3c0667554a Mon Sep 17 00:00:00 2001 From: Ashutosh Misra Date: Sun, 13 Jun 2021 15:21:22 +0530 Subject: [PATCH 045/162] Adding package dependency SWDEV-260294:Rocminfo shall explicitly depend on hsa-rocr for package installation Signed-off-by: Ashutosh Mishra Change-Id: I9a6d1691cd5a821f135a1d1cff599e9a2c40d06f --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d8052a9aa9..5f894133e1 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,6 +202,7 @@ if(DEFINED ENV{ROCM_LIBPATCH_VERSION}) endif() #Debian package specific variables +set(CPACK_DEBIAN_PACKAGE_DEPENDS "hsa-rocr-dev") 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}) @@ -211,6 +212,7 @@ endif() set(CPACK_DEBIAN_PACKAGE_DEPENDS "rocm-core") #RPM package specific variables +set(CPACK_RPM_PACKAGE_DEPENDS "hsa-rocr-dev") 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 e1df81cb8f924bf4fdd56ef1fa5ed6ddbbfe6c89 Mon Sep 17 00:00:00 2001 From: Yi Qian Date: Tue, 14 Sep 2021 20:41:39 +0000 Subject: [PATCH 046/162] Add a new rocm_agent_enumerator option '-name' which lists target names obtained from the output of rocminfo. Change-Id: Iea366c744e2f03a46fd5c902ae4faa94b96f6942 --- README.md | 2 +- rocm_agent_enumerator | 54 ++++++++++++++++++++++++++++--------------- 2 files changed, 37 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index a8b27fe07d..a039d06404 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ rocm_agent_enumerator, will be in the build folder. "rocminfo" gives information about the HSA system attributes and agents. -"rocm_agent_enumerator" prints the list of available AMD GCN ISA. There exist four different ways how it is generated: +"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 four 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. diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index f62daa4881..5295873097 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -52,6 +52,14 @@ def getGCNISA(line, match_from_beginning = False): 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 = [] @@ -71,9 +79,8 @@ def readFromTargetLstFile(): return target_list -def readFromROCMINFO(): +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") @@ -85,10 +92,16 @@ def readFromROCMINFO(): rocminfo_output = [] # search AMDGCN gfx ISA - line_search_term = re.compile("\A\s+Name:\s+(gfx\d+)") + 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: - target = getGCNISA(line) + if search_arch_name is True: + target = getGCNArchName(line) + else: + target = getGCNISA(line) if target is not None: target_list.append(target) @@ -118,33 +131,38 @@ def readFromLSPCI(): return target_list def main(): - """Prints the list of available AMD GCN ISA + 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: + 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 + 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 + 2. target.lst : user-supplied text file. This is used in a container setting where ROCm stack may usually not available. - 3. rocminfo : a tool shipped with this script to enumerate GPU agents + 3. rocminfo : a tool shipped with this script to enumerate GPU agents available on a working ROCm stack. - 4. lspci : enumerate PCI bus and locate supported devices from a hard-coded + 4. lspci : enumerate PCI bus and locate supported devices from a hard-coded lookup table. - """ - target_list = readFromTargetLstFile() + """ + target_list = readFromTargetLstFile() - if len(target_list) == 0: - target_list = readFromROCMINFO() + if len(target_list) == 0: + target_list = readFromROCMINFO() - if len(target_list) == 0: - target_list = readFromLSPCI() + if len(target_list) == 0: + target_list = readFromLSPCI() # workaround to cope with existing rocm_agent_enumerator behavior where gfx000 # would always be returned - print("gfx000") + print("gfx000") for gfx in target_list: print(gfx) From e32a4d9bed45041b09fbc9fada536e2a59ed38cf Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Mon, 20 Sep 2021 20:56:47 -0500 Subject: [PATCH 047/162] Don't touch CMAKE_CXX_FLAGS. Cmake manages CMAKE_CXX_FLAGS in standard ways from user inputs, env vars, and target properties. Use target properties for our options and let cmake handle the rest. Change-Id: I20ef738e4df7880258d770f4ec13c09d8b323fba --- CMakeLists.txt | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f894133e1..98fbd8ef70 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,31 +129,29 @@ add_definitions(-DLITTLEENDIAN_CPU=1) # # Linux Compiler options # -set(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS}") - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-math-errno") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-threadsafe-statics") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmerge-all-constants") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fms-extensions") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64") +set(ROCMINFO_CXX_FLAGS -std=c++11) +set(ROCMINFO_CXX_FLAGS ${ROCMINFO_CXX_FLAGS} -fexceptions) +set(ROCMINFO_CXX_FLAGS ${ROCMINFO_CXX_FLAGS} -fno-rtti) +set(ROCMINFO_CXX_FLAGS ${ROCMINFO_CXX_FLAGS} -fno-math-errno) +set(ROCMINFO_CXX_FLAGS ${ROCMINFO_CXX_FLAGS} -fno-threadsafe-statics) +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(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -msse2") + set(ROCMINFO_CXX_FLAGS ${ROCMINFO_CXX_FLAGS} -msse -msse2) endif() # # Add compiler flags to include symbol information for debug builds # if(ISDEBUG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb -O0") + set(ROCMINFO_CXX_FLAGS ${ROCMINFO_CXX_FLAGS} -ggdb -O0) endif() ########################### @@ -170,6 +168,8 @@ aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} ROCMINFO_SOURCES) add_executable(${ROCMINFO_EXE} ${ROCMINFO_SOURCES}) target_link_libraries(${ROCMINFO_EXE} hsa-runtime64::hsa-runtime64) +target_compile_options(${ROCMINFO_EXE} PRIVATE ${ROCMINFO_CXX_FLAGS}) + ########################### # Install directives ########################### From 86560046de79611f45065262918746acfa061d74 Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Mon, 20 Sep 2021 21:05:59 -0500 Subject: [PATCH 048/162] Correct and simplify package dependencies. Package should depend on hsa-rocr, not hsa-rocr-dev. Also Remove negative path for dependency rocm-core (unconditional add + conditional remove simplified to conditional add). Change-Id: I6ead202f4f3f2f77b1da2ffed77feee956caf2e9 --- CMakeLists.txt | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 98fbd8ef70..1dafe573da 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,17 +202,19 @@ if(DEFINED ENV{ROCM_LIBPATCH_VERSION}) endif() #Debian package specific variables -set(CPACK_DEBIAN_PACKAGE_DEPENDS "hsa-rocr-dev") +set(CPACK_DEBIAN_PACKAGE_DEPENDS "hsa-rocr") 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}) else() set(CPACK_DEBIAN_PACKAGE_RELEASE "local") endif() -set(CPACK_DEBIAN_PACKAGE_DEPENDS "rocm-core") +if ( ROCM_DEP_ROCMCORE ) + string ( APPEND CPACK_DEBIAN_PACKAGE_DEPENDS ", rocm-core" ) +endif() #RPM package specific variables -set(CPACK_RPM_PACKAGE_DEPENDS "hsa-rocr-dev") +set(CPACK_RPM_PACKAGE_REQUIRES "hsa-rocr") 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() @@ -221,7 +223,9 @@ if(DEFINED ENV{CPACK_RPM_PACKAGE_RELEASE}) else() set(CPACK_RPM_PACKAGE_RELEASE "local") endif() -set(CPACK_RPM_PACKAGE_REQUIRES "rocm-core") +if ( ROCM_DEP_ROCMCORE ) + string ( APPEND CPACK_RPM_PACKAGE_REQUIRES " rocm-core" ) +endif() #Set rpm distro if(CPACK_RPM_PACKAGE_RELEASE) @@ -234,10 +238,5 @@ set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSIO #Set the names now using CPACK utility set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") set(CPACK_RPM_FILE_NAME "RPM-DEFAULT") -# Remove dependency on rocm-core if -DROCM_DEP_ROCMCORE=ON not given to cmake -if(NOT ROCM_DEP_ROCMCORE) - string(REGEX REPLACE ",? ?rocm-core" "" CPACK_RPM_PACKAGE_REQUIRES ${CPACK_RPM_PACKAGE_REQUIRES}) - string(REGEX REPLACE ",? ?rocm-core" "" CPACK_DEBIAN_PACKAGE_DEPENDS ${CPACK_DEBIAN_PACKAGE_DEPENDS}) -endif() include ( CPack ) From 2b4b0c8862eb607edb07f6699df36553b7985707 Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Mon, 20 Sep 2021 21:30:10 -0500 Subject: [PATCH 049/162] Add dependency on kmod. rocminfo uses lsmod to check for loaded drivers. Use of sysfs is possible but sysfs' stable interface does not allow for easy parsing. Use of lsmod avoids needing to walk the sysfs tree and avoids issues of permissions to examine sysfs. Both Debian and Fedora list lsmod under kmod. Presumption is that CentOS and RHEL also follow this. Change-Id: Ic5033e0b780100c54d2fe0b4f501c40acbc237fb --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1dafe573da..6d142bc6dd 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,7 +202,7 @@ if(DEFINED ENV{ROCM_LIBPATCH_VERSION}) endif() #Debian package specific variables -set(CPACK_DEBIAN_PACKAGE_DEPENDS "hsa-rocr") +set(CPACK_DEBIAN_PACKAGE_DEPENDS "hsa-rocr, kmod") 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}) @@ -214,7 +214,7 @@ if ( ROCM_DEP_ROCMCORE ) endif() #RPM package specific variables -set(CPACK_RPM_PACKAGE_REQUIRES "hsa-rocr") +set(CPACK_RPM_PACKAGE_REQUIRES "hsa-rocr kmod") 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 ea5ce46fb4e5f285f049ac7a02ce42a97aeb028f Mon Sep 17 00:00:00 2001 From: Joseph Greathouse Date: Fri, 29 Oct 2021 09:24:05 -0500 Subject: [PATCH 050/162] Add better PCI ID backup in rocm_agent_enumerator The PCI ID backup method in rocm_agent_enumerator, where the tool uses lspci to find all AMD GPU devices in the system and manaully match them to gfx version, is extremely outdated. The PCI ID list did not include anything after Vega 10, and the actual call to lspci no longer returned anything due to some missing conversions. The patch adds all GPUs that might be needed by ROCr up through Navy Flounder. The PCI ID to gfx matching pulls from the amdgpu driver and libhsakmt. Change-Id: I58b77bb6aa631f575352fc444d2542f265909706 --- rocm_agent_enumerator | 55 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 8 deletions(-) diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index 5295873097..3d8028a9e5 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -10,7 +10,9 @@ CWD = os.path.dirname(os.path.realpath(__file__)) ISA_TO_ID = { # Kaveri - Temporary - "gfx700" : [0x130f], + "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], @@ -23,15 +25,52 @@ ISA_TO_ID = { "gfx803" : [0x7300, 0x730f, # Polaris10 0x67c0, 0x67c1, 0x67c2, 0x67c4, 0x67c7, 0x67c8, 0x67c9, 0x67ca, - 0x67cc, 0x67cf, + 0x67cc, 0x67cf, 0x6fdf, # Polaris11 0x67d0, 0x67df, 0x67e0, 0x67e1, 0x67e3, 0x67e7, 0x67e8, 0x67e9, 0x67eb, 0x67ef, 0x67ff, # Polaris12 - 0x6980, 0x6981, 0x6985, 0x6986, 0x6987, 0x6995, 0x6997, 0x699f], + 0x6980, 0x6981, 0x6985, 0x6986, 0x6987, 0x6995, 0x6997, 0x699f, + # VegaM + 0x694c, 0x694e, 0x694f], # Vega10 - "gfx900" : [0x6860, 0x6861, 0x6862, 0x6863, 0x6864, 0x6867, 0x6868, 0x686c, - 0x687f] + "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): @@ -112,7 +151,7 @@ def readFromLSPCI(): try: # run lspci - lspci_output = subprocess.Popen(["/usr/bin/lspci", "-n", "-d", "1002:"], stdout=subprocess.PIPE).communicate()[0].split('\n') + lspci_output = subprocess.Popen(["/usr/bin/lspci", "-n", "-d", "1002:"], stdout=subprocess.PIPE).communicate()[0].decode("utf-8").split('\n') except: lspci_output = [] @@ -160,8 +199,8 @@ def main(): if len(target_list) == 0: target_list = readFromLSPCI() - # workaround to cope with existing rocm_agent_enumerator behavior where gfx000 - # would always be returned + # workaround to cope with existing rocm_agent_enumerator behavior where gfx000 + # would always be returned print("gfx000") for gfx in target_list: From 0e1807c72dd572b389af84d4df11303c2324ab09 Mon Sep 17 00:00:00 2001 From: Joseph Greathouse Date: Fri, 29 Oct 2021 10:34:47 -0500 Subject: [PATCH 051/162] Update cmake to include pciutils dependencies When building packages, add in pciutils as a dependency because rocm_agent_enumerator uses this as a mechanism for looking up what GPUs exist on the system. Change-Id: I10ac088c461c6d0bca435b61fbc90b685556fdf4 --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d142bc6dd..d53da30465 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,7 +202,7 @@ if(DEFINED ENV{ROCM_LIBPATCH_VERSION}) endif() #Debian package specific variables -set(CPACK_DEBIAN_PACKAGE_DEPENDS "hsa-rocr, kmod") +set(CPACK_DEBIAN_PACKAGE_DEPENDS "hsa-rocr, kmod, pciutils") 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}) @@ -214,7 +214,7 @@ if ( ROCM_DEP_ROCMCORE ) endif() #RPM package specific variables -set(CPACK_RPM_PACKAGE_REQUIRES "hsa-rocr kmod") +set(CPACK_RPM_PACKAGE_REQUIRES "hsa-rocr kmod pciutils") 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 e9b7de43beb7438d0828f1fd429c6d3712837620 Mon Sep 17 00:00:00 2001 From: Joseph Greathouse Date: Fri, 29 Oct 2021 10:35:35 -0500 Subject: [PATCH 052/162] Switch order of lspci and rocminfo for gfx arch query rocminfo is a very heavyweight mechanism for learning a lot of information about the GPUs that are attached to the system. It opens up the limited /dev/kfd resource to gather lots of information about each device, while rocm_agent_enumerator really only wants the gfx number of AMD devices attached to the system. To avoid this heavyweight lookup in most cases, this patch switches the order of tests. Rather than starting with rocminfo and then falling back to a poorly-maintained PCI ID list, this patch changes the agent enumerator to start by checking in the PCI ID list (fast case) and then falling back to rocminfo (slow case) if the PCI ID list is out of date. Change-Id: If24b8bc3baeeb6adad362abbb288ef3728383bce --- rocm_agent_enumerator | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index 3d8028a9e5..3698f8c2b6 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -186,18 +186,18 @@ def main(): 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. rocminfo : a tool shipped with this script to enumerate GPU agents + 3. lspci : enumerate PCI bus and locate supported devices from a hard-coded + lookup table. + 4. rocminfo : a tool shipped with this script to enumerate GPU agents available on a working ROCm stack. - 4. lspci : enumerate PCI bus and locate supported devices from a hard-coded - lookup table. """ target_list = readFromTargetLstFile() if len(target_list) == 0: - target_list = readFromROCMINFO() + target_list = readFromLSPCI() if len(target_list) == 0: - target_list = readFromLSPCI() + target_list = readFromROCMINFO() # workaround to cope with existing rocm_agent_enumerator behavior where gfx000 # would always be returned From f419b81bdfcde0bc30e7bf8084efefa65a7c8960 Mon Sep 17 00:00:00 2001 From: Joseph Greathouse Date: Fri, 29 Oct 2021 16:25:10 -0500 Subject: [PATCH 053/162] Add capability to pull gfx architecture from KFD topology New versions of amdkfd include the gfx architecture version number for all GPUs surfaced in the HSA topology. This patch adds this as the preferred way for rocm_agent_enumerator to check for supported gfx architecture numbers. Kernels that are missing this feature will not have the value in the topology. rocm_agent_enumerator will fall back to checking against the PCI IDs in this case. If PCI IDs fail, we fall back to the heavyweight rocminfo method. Change-Id: I5cf22e1069114675092e97ae52331b829cfafb04 --- rocm_agent_enumerator | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index 3698f8c2b6..4ed6a3c17a 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -169,6 +169,31 @@ def readFromLSPCI(): return target_list +def readFromKFD(): + target_list = [] + + topology_dir = '/sys/class/kfd/kfd/topology/nodes/' + 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): + target_search_term = re.compile("gfx_target_version.+") + with open(prop_path) as f: + line = f.readline() + 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, 'x') + 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 @@ -186,13 +211,18 @@ def main(): 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. lspci : enumerate PCI bus and locate supported devices from a hard-coded + 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. - 4. rocminfo : a tool shipped with this script to enumerate GPU agents + 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() From b57c02d131966b0b503a76e70d5f0331ee522cf7 Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Thu, 15 Apr 2021 21:04:21 +0800 Subject: [PATCH 054/162] Handle high levels of concurrency in rocm_agent_enumerator. rocm_agent_enumerator may invoke rocminfo. Rocminfo opens the GPU device which allocates limited resource. Beyond 254 concurrent processes this resource will be exhausted and rocminfo will return an error. This patch loops rocm_agent_enumerator when recieving a failure message from rocminfo indicating KFD is out of memory. Change-Id: I8637e214f5fa012642975c28578ae6bf9200eda8 --- rocm_agent_enumerator | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index 4ed6a3c17a..a93694d008 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -4,6 +4,7 @@ import os import re import subprocess import sys +import time # get current working directory CWD = os.path.dirname(os.path.realpath(__file__)) @@ -125,8 +126,24 @@ def readFromROCMINFO(search_arch_name = False): rocminfo_executable = os.path.join(CWD, "rocminfo") try: - # run rocminfo - rocminfo_output = subprocess.Popen(rocminfo_executable, stdout=subprocess.PIPE).communicate()[0].decode("utf-8").split('\n') + 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 = [] From 7766360dd64cb30d68c87543d0d9d2baba0ae968 Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Fri, 29 Oct 2021 20:23:32 -0500 Subject: [PATCH 055/162] Close /dev/kfd after access check. Cleanup dangling file handle. Change-Id: I37bc42a2ffb7122f441cbf8a09c141d4396db928 --- rocminfo.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/rocminfo.cc b/rocminfo.cc index ee01f60970..3fc46e7706 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -1044,6 +1044,7 @@ int CheckInitialState(void) { } else { printf("%sROCk module is loaded%s\n", COL_WHT, COL_RESET); } + pclose(fd); // Check if user belongs to the group for /dev/kfd (e.g. "video" or // "render") From b83efe00a4e016b7c88b8c935f793e81b9c62310 Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Fri, 29 Oct 2021 18:48:46 -0500 Subject: [PATCH 056/162] Update README. Document use of sysfs for gfx arch lookup. Change-Id: Ic326769be3e23d627e16fb1aae56c0d16ce99d78 --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a039d06404..e49dd58565 100644 --- a/README.md +++ b/README.md @@ -31,13 +31,14 @@ rocm_agent_enumerator, will be in the build folder. "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 four 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. 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. rocminfo : a tool shipped with this script to enumerate GPU agents available on a working ROCm stack. +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 31e6575e9f4711d2ab1ec1308daed993ec4f91c8 Mon Sep 17 00:00:00 2001 From: Nirmal Unnikrishnan Date: Fri, 21 Jan 2022 16:28:07 +0000 Subject: [PATCH 057/162] Adding license file to rocminfo package Change-Id: Ibc3b53922c366944a404982ed977ede50c6f36c7 --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d53da30465..b422f72226 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -192,8 +192,12 @@ set(CPACK_PACKAGE_VERSION_MINOR "${PKG_VERSION_MINOR}") set(CPACK_PACKAGE_VERSION_PATCH "${PKG_VERSION_PATCH}") set(CPACK_PACKAGE_CONTACT "AMD Rocminfo Support ") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt") +set( CPACK_RPM_PACKAGE_LICENSE "NCSA" ) set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Radeon Open Compute (ROCm) Runtime rocminfo tool") +#Install license file +install(FILES ${CPACK_RESOURCE_FILE_LICENSE} DESTINATION share/doc/${CPACK_PACKAGE_NAME}) + #Make proper version for appending #Default Value is 99999, setting it first set(ROCM_VERSION_FOR_PACKAGE "99999") From 6b4d69d01135b2e715d6dd1e60162af7ab5f4996 Mon Sep 17 00:00:00 2001 From: Ashutosh Mishra Date: Thu, 3 Feb 2022 23:38:24 +0530 Subject: [PATCH 058/162] changeing major_ver of targetlist to decimal Change-Id: Iada6cf9d2ba3bce4c042dffbf97f1588ffe10a8a --- rocm_agent_enumerator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index a93694d008..7bc0dc4357 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -206,7 +206,7 @@ def readFromKFD(): 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, 'x') + format(minor_ver, 'x') + format(stepping_ver, 'x')) + target_list.append("gfx" + format(major_ver, 'd') + format(minor_ver, 'x') + format(stepping_ver, 'x')) line = f.readline() return target_list From cf92f649ab0db4084fc8b2b6e891670f60edc314 Mon Sep 17 00:00:00 2001 From: Shweta Khatri Date: Tue, 15 Feb 2022 19:00:11 -0500 Subject: [PATCH 059/162] Fixed some errors in rocminfo reported by lint tool Change-Id: Ie7852c2003c10847226a5df23c4e85fbe89dad43 --- rocminfo.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/rocminfo.cc b/rocminfo.cc index 3fc46e7706..871f4066e2 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -187,7 +187,6 @@ enum rocmi_int_format { std::string int_to_string(uint32_t i, uint32_t fmt = ROCMI_INT_FORMAT_DEC|ROCMI_INT_FORMAT_HEX) { std::stringstream sd; - std::string ret = ""; bool need_parens = false; if (fmt & ROCMI_INT_FORMAT_DEC) { @@ -209,7 +208,6 @@ std::string int_to_string(uint32_t i, if (need_parens) { sd << ") "; } - need_parens = true; } return sd.str(); @@ -218,7 +216,7 @@ std::string int_to_string(uint32_t i, static void printLabelInt(char const *l, int d, uint32_t indent_lvl = 0) { std::string ind(kIndentSize * indent_lvl, ' '); - printf("%s%-*s%-*u\n", ind.c_str(), kLabelFieldSize, l, kValueFieldSize, d); + printf("%s%-*s%-*d\n", ind.c_str(), kLabelFieldSize, l, kValueFieldSize, d); } static void printLabelStr(char const *l, char const *s, uint32_t indent_lvl = 0) { @@ -997,8 +995,6 @@ AcquireAndDisplayAgentInfo(hsa_agent_t agent, void* data) { err = AcquireAgentInfo(agent, &agent_i); RET_IF_HSA_ERR(err); - std::string ind(kIndentSize, ' '); - printLabel("*******", true); std::string agent_ind("Agent "); agent_ind += std::to_string(*agent_number).c_str(); @@ -1037,7 +1033,7 @@ int CheckInitialState(void) { // Check kernel module for ROCk is loaded FILE *fd = popen("lsmod | grep amdgpu", "r"); char buf[16]; - if (fread (buf, 1, sizeof (buf), fd) <= 0) { + if (fread (buf, 1, sizeof (buf), fd) == 0) { printf("%sROCk module is NOT loaded, possibly no GPU devices%s\n", COL_RED, COL_RESET); return -1; From b6dc27f0b35f986dc206f3d7e94b47d0d89d242b Mon Sep 17 00:00:00 2001 From: Mike Li Date: Tue, 8 Mar 2022 15:48:57 -0500 Subject: [PATCH 060/162] Add ASIC revision Signed-off-by: Mike Li Change-Id: I8f6bbf39e4cf85bb03fd6c0de7afe5f9e6666ba5 --- rocminfo.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rocminfo.cc b/rocminfo.cc index 871f4066e2..d172819cc9 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -113,6 +113,7 @@ struct agent_info_t { hsa_device_type_t device_type; uint32_t cache_size[4]; uint32_t chip_id; + uint32_t asic_revision; uint32_t cacheline_size; uint32_t max_clock_freq; uint32_t internal_node_id; @@ -382,6 +383,12 @@ AcquireAgentInfo(hsa_agent_t agent, agent_info_t *agent_i) { &agent_i->chip_id); RET_IF_HSA_ERR(err); + // Get asic revision + err = hsa_agent_get_info(agent, + (hsa_agent_info_t) HSA_AMD_AGENT_INFO_ASIC_REVISION, + &agent_i->asic_revision); + RET_IF_HSA_ERR(err); + // Get cacheline size err = hsa_agent_get_info(agent, (hsa_agent_info_t) HSA_AMD_AGENT_INFO_CACHELINE_SIZE, @@ -567,6 +574,7 @@ 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); 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); From 4f1b5ed4b80c1538b1f54b2c4d23b63316d9f0fc Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Thu, 24 Jun 2021 00:11:25 -0500 Subject: [PATCH 061/162] Correct include paths for new directory layout. Depends-On: I5e11e72848633dcc749d1e92705a8e3be67f793d Change-Id: If743d015bb9c7c6fb179e259e2d4eb69be60e383 --- rocminfo.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rocminfo.cc b/rocminfo.cc index d172819cc9..0842d57d37 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -55,8 +55,8 @@ #include #include -#include "hsa.h" -#include "hsa_ext_amd.h" +#include "hsa/hsa.h" +#include "hsa/hsa_ext_amd.h" #define COL_BLU "\x1B[34m" #define COL_KCYN "\x1B[36m" From 0b270afafc54314a46786332d2563b12e794a657 Mon Sep 17 00:00:00 2001 From: Ranjith Ramakrishnan Date: Tue, 24 May 2022 23:23:40 -0700 Subject: [PATCH 062/162] SWDEV-321112: Use GNUInstallDir variable DOCDIR Replaced install path 'share/doc/project_name' with gnuinstalldir variable CMAKE_INSTALL_DOCDIR Change-Id: Id9fc7599e6893a604f9d965b952ab27413e1c0d6 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b422f72226..cbcf9d096e 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -196,7 +196,7 @@ set( CPACK_RPM_PACKAGE_LICENSE "NCSA" ) set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Radeon Open Compute (ROCm) Runtime rocminfo tool") #Install license file -install(FILES ${CPACK_RESOURCE_FILE_LICENSE} DESTINATION share/doc/${CPACK_PACKAGE_NAME}) +install(FILES ${CPACK_RESOURCE_FILE_LICENSE} DESTINATION ${CMAKE_INSTALL_DOCDIR}) #Make proper version for appending #Default Value is 99999, setting it first From d8f236cd8180ee0f1fc1da497d0f576a446b86ab Mon Sep 17 00:00:00 2001 From: David Salinas Date: Wed, 1 Jun 2022 19:06:12 +0000 Subject: [PATCH 063/162] Handle case with no GPUs Change-Id: I35b8d4d0c0b6e63d9851d56163686794c7bb8c1e --- rocm_agent_enumerator | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index 7bc0dc4357..6264a5fbe9 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -190,24 +190,25 @@ def readFromKFD(): target_list = [] topology_dir = '/sys/class/kfd/kfd/topology/nodes/' - 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): - target_search_term = re.compile("gfx_target_version.+") - with open(prop_path) as f: - line = f.readline() - 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')) + 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): + target_search_term = re.compile("gfx_target_version.+") + with open(prop_path) as f: line = f.readline() + 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 From 3a4d533a1e2a179ad873c480dc4a42ea23681263 Mon Sep 17 00:00:00 2001 From: Mike Li Date: Wed, 17 Aug 2022 11:44:09 -0400 Subject: [PATCH 064/162] Check permission and handle PermissionError exception Signed-off-by: Mike Li Change-Id: If7cb8464d0b761e4be45c85eb7147ceed609da61 --- rocm_agent_enumerator | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index 6264a5fbe9..ceb9e11165 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -195,10 +195,15 @@ def readFromKFD(): 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): + 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: - line = f.readline() + 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: From 94b4b3f0a66eb70912177ca7076b4267f8b5449b Mon Sep 17 00:00:00 2001 From: Johannes Dieterich Date: Mon, 21 Nov 2022 18:09:55 +0000 Subject: [PATCH 065/162] Fix rocminfo when run within docker environments Currently, rocminfo will fail when executed inside a docker container due to being unable to lsmod inside docker. This has impacts on rocprofiler use. Fix this behavior by querying initstate of the amdgpu module from /sys/module/amdgpu instead. If initstate is marked "live" everything if fine - error out with either "not loaded" (initstate file does not exist) or "not live" (initstate file does not contain "live" string). Change-Id: I6f2e9655942fd4cf840fd3f56b7d69e893fa84d7 --- rocminfo.cc | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/rocminfo.cc b/rocminfo.cc index 0842d57d37..8ed9111178 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -51,6 +51,7 @@ #include #include +#include #include #include #include @@ -1039,16 +1040,33 @@ AcquireAndDisplayAgentInfo(hsa_agent_t agent, void* data) { int CheckInitialState(void) { // Check kernel module for ROCk is loaded - FILE *fd = popen("lsmod | grep amdgpu", "r"); - char buf[16]; - if (fread (buf, 1, sizeof (buf), fd) == 0) { + + std::ifstream amdgpu_initstate("/sys/module/amdgpu/initstate"); + if (amdgpu_initstate){ + std::stringstream buffer; + buffer << amdgpu_initstate.rdbuf(); + amdgpu_initstate.close(); + + std::string line; + bool is_live = false; + while (std::getline(buffer, line)){ + if (line.find( "live" ) != std::string::npos){ + is_live = true; + break; + } + } + if (is_live){ + 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); + return -1; + } + } else { printf("%sROCk module is NOT loaded, possibly no GPU devices%s\n", COL_RED, COL_RESET); return -1; - } else { - printf("%sROCk module is loaded%s\n", COL_WHT, COL_RESET); } - pclose(fd); // Check if user belongs to the group for /dev/kfd (e.g. "video" or // "render") From c6b1707d0eea8c94b2d9f2e8697c5e56c846c2b6 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Wed, 7 Dec 2022 03:17:11 +0000 Subject: [PATCH 066/162] 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 8ed9111178..a6b4663b0b 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 067/162] 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 a6b4663b0b..c7bcba4dab 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 068/162] 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 ceb9e11165..b901e47012 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 069/162] 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 c7bcba4dab..c5a45b6287 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 070/162] 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 c5a45b6287..42f6cfd399 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 071/162] 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 cbcf9d096e..ce135316d7 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 072/162] 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 42f6cfd399..cdf8fd02ef 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 073/162] 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 cdf8fd02ef..1d6cfbfcfb 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 074/162] 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 b901e47012..33538df4d3 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 075/162] Add recommended granule query Change-Id: I7eb10e267d0272759321ee30feddf2d6464d9443 --- rocminfo.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rocminfo.cc b/rocminfo.cc index 1d6cfbfcfb..f3c8e89d64 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 076/162] 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 f3c8e89d64..4b7b287978 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 077/162] 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 ce135316d7..7ef71be8f1 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 078/162] 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 33538df4d3..6d44bd475d 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 079/162] 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 4b7b287978..9e88cd32b4 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 080/162] 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 7ef71be8f1..71ccee34ba 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 081/162] 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 082/162] 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 9e88cd32b4..f5cf867a11 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 083/162] 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 0000000000..afd8276c51 --- /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 084/162] 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 afd8276c51..597df29bf4 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 085/162] 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 f5cf867a11..d5b0989943 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 086/162] 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 71ccee34ba..a55c8164ee 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 087/162] 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 a55c8164ee..ff240bf387 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 088/162] 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 597df29bf4..a045d391a7 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 089/162] 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 d5b0989943..868615382a 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 090/162] 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 0000000000..0086358db1 --- /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 091/162] 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 0086358db1..0000000000 --- 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 092/162] 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 0000000000..0086358db1 --- /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 093/162] 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 0000000000..a05f61be74 --- /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 094/162] 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 a05f61be74..f55a286d39 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 095/162] 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 0000000000..e091329ec2 --- /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 096/162] 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 0000000000..fbbc470f73 --- /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 097/162] 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 0000000000..69fa449dd9 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1 @@ +_build/ diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000000..274742dc4e --- /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 0000000000..732e9711d2 --- /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 0000000000..0c4fb3328c --- /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 0000000000..17703b4076 --- /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 0000000000..757de61423 --- /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 098/162] 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 0000000000..ad1e828c13 --- /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 0000000000..6082363663 --- /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 099/162] 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 0000000000..d24c82f8f3 --- /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 100/162] Add doc team to CODEOWNERS --- .github/CODEOWNERS | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e091329ec2..17a6867dc4 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 101/162] 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 0000000000..fe5141c49b --- /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 102/162] 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 0000000000..d23d17dd10 --- /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 103/162] 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 fe5141c49b..a251722513 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 104/162] 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 ad1e828c13..d44f8bb0ae 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 105/162] 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 0c4fb3328c..edc11be08e 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 106/162] 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 edc11be08e..8cee3759c8 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 107/162] 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 8cee3759c8..c783847a1f 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 108/162] 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 a251722513..ca096598fb 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 109/162] 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 d23d17dd10..a9078754d2 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 110/162] 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 d44f8bb0ae..b30de2e6c1 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 111/162] 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 b30de2e6c1..bdde73e90b 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 112/162] 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 c783847a1f..d6b2fb1b48 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 113/162] 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 a9078754d2..ae1f6333b8 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 114/162] 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 ae1f6333b8..95b7248915 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 115/162] 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 95b7248915..9f3d68200b 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 116/162] 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 ca096598fb..b42e32a5fa 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 117/162] 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 bdde73e90b..fd641836c7 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 118/162] 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 9f3d68200b..59b65d195d 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 119/162] 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 17703b4076..1ba9717bbf 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 757de61423..3aafdde50d 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 120/162] 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 b42e32a5fa..96e2195332 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 121/162] 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 fd641836c7..db6ce3aeb0 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 122/162] 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 59b65d195d..104635a8d2 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 123/162] 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 104635a8d2..debfa081e2 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 124/162] 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 96e2195332..03c9a17b89 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 125/162] 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 03c9a17b89..e0bf8d1726 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 126/162] 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 debfa081e2..ae74e66003 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 127/162] 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 db6ce3aeb0..9f33d6cf4a 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 128/162] 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 1ba9717bbf..3f2ef3d650 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 3aafdde50d..c62f5753cf 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 129/162] 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 0000000000..102b05bf88 --- /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 130/162] Update use-rocm-agent-enumerator.rst --- docs/how-to/use-rocm-agent-enumerator.rst | 279 +--------------------- 1 file changed, 9 insertions(+), 270 deletions(-) diff --git a/docs/how-to/use-rocm-agent-enumerator.rst b/docs/how-to/use-rocm-agent-enumerator.rst index ae74e66003..a009697975 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: - -- gfx000 -- gfx941 -- gfx1036 - -You can use ROCmInfo with the following commands: +This is an example output of the rocm_agent_enumerator command on a system with an MI-300X installation, .. code-block:: - #!/usr/bin/env python3 + gfx000 + gfx941 + + +.. 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 131/162] 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 a009697975..2ce84950b8 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 132/162] 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 d6b2fb1b48..2cde262d8a 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 133/162] Update index.rst --- docs/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/index.rst b/docs/index.rst index 9f33d6cf4a..3b6b80428f 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 134/162] 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 3b6b80428f..5aaa420c7c 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 135/162] 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 a045d391a7..06d6e2466d 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 136/162] 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 3f2ef3d650..987734c5cd 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 c62f5753cf..14560b0a01 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 137/162] 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 987734c5cd..189f044916 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 14560b0a01..c31d293f89 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 138/162] 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 189f044916..c7df173680 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 c31d293f89..a21583b597 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 139/162] 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 ff240bf387..426657d9c8 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 63ff6a4b302f68fdf2d95551c1d7a6d48d4fa752 Mon Sep 17 00:00:00 2001 From: Ranjith Ramakrishnan Date: Tue, 13 Aug 2024 11:15:38 -0700 Subject: [PATCH 140/162] Removed kmod dependency from rocminfo kmod dependency is not at all required for rocminfo. Removing the same from the package dependency list Change-Id: I58f9c4305585c5dd770ea3c6a6298c30c89c31b5 --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 426657d9c8..df6755a228 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, python3, libc6, libgcc-s1, libstdc++6") +set(CPACK_DEBIAN_PACKAGE_DEPENDS "hsa-rocr, 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}) @@ -231,9 +231,9 @@ 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++") + set(CPACK_RPM_PACKAGE_REQUIRES "hsa-rocr, 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)") + set(CPACK_RPM_PACKAGE_REQUIRES "hsa-rocr, pciutils, python3, glibc, (libgcc or libgcc_s1), (libstdc++ or libstdc++6)") endif() # End EVAL_RESULT if(DEFINED CPACK_PACKAGING_INSTALL_PREFIX) From 08693587d603d7441efc56d7b14f9cf2a6a45c38 Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Fri, 28 Jun 2024 16:55:58 -0500 Subject: [PATCH 141/162] Add CONTRIBUTING.md file Change-Id: I8f31240d485aa1cfc259e5882de5d73d55c95409 --- CONTRIBUTING.md | 106 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..e811da79ec --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,106 @@ + + + + + + +# Contributing to `rocminfo` +We welcome contributions to `rocminfo`. Please follow these guidelines to help ensure your contributions will be successfully accepted. + +## Issue Discussion +Please use the GitHub Issues tab to notify us of issues. + +* Use your best judgement for issue creation. If your issue is already listed, upvote the issue and + comment or post to provide additional details, such as how you reproduced this issue. +* If you're not sure if your issue is the same, err on the side of caution and file your issue. + You can add a comment to include the issue number (and link) for the similar issue. If we evaluate + your issue as being the same as the existing issue, we'll close the duplicate. +* If your issue doesn't exist, use the issue template to file a new issue. + * When filing an issue, be sure to provide as much information as possible, including script output so + we can collect information about your configuration. This helps reduce the time required to + reproduce your issue. + * Check your issue regularly, as we may require additional information to successfully reproduce the + issue. +* You may also open an issue to ask questions to the maintainers about whether a proposed change + meets the acceptance criteria, or to discuss an idea pertaining to the library. + +## Acceptance Criteria for Contributions +The goal of `rocminfo` is to provide the user with all the system information that is known to and provided by the HSA/ROCr API. Anybody writing a ROCr application could use rocminfo to see the values the API would provide to their application. The included `rocm_agent_enumerator` prints the list of available AMD GCN ISA devices on the host. Keep these goals in mind when considering the suitability of any new changes; that is, do your changes improve the reliability or capability toward these goals. + +## Coding Style +C++ code changes should conform to the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html). + +## Pull Request Guidelines +When you create a pull request, you should target the `TODO ADD THIS` branch. + +By creating a pull request, you agree to the statements made in the [code license](#code-license) section. Your pull request should target the default branch. Our current default branch is the `TODO ADD THIS` branch, which serves as our integration branch. + +### Deliverables +For each new file in repository,  +please include the licensing header (replace "current year" with the actual current year). +``` +/* + * ============================================================================= + * ROC Runtime Conformance Release License + * ============================================================================= + * The University of Illinois/NCSA + * Open Source License (NCSA) + * + * Copyright (c) , Advanced Micro Devices, Inc. + * All rights reserved. + * + * Developed by: + * + * AMD Research and AMD ROC Software Development + * + * Advanced Micro Devices, Inc. + * + * www.amd.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal with the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimers. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimers in + * the documentation and/or other materials provided with the distribution. + * - Neither the names of , + * nor the names of its contributors may be used to endorse or promote + * products derived from this Software without specific prior written + * permission. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS WITH THE SOFTWARE. + * + */ + ``` + +### Process +Use the following process when creating a PR. + +* Identify the issue you want to fix +* Target the `TODO ADD THIS` branch for integration +* Ensure your code builds successfully +* Verify the output of `rocminfo` and `rocm_agent_enumerator` + * Verify your change is what was intended + * Existing, working functionality is still intact +* Submit your PR and work with the reviewer or maintainer to get your PR approved +* Once approved, the PR is brought onto internal CI systems and may be merged into the component + during our release cycle, as coordinated by the maintainer +* We'll inform you once your change is committed + +## Code License +All code contributed to this project will be licensed under the license identified in the [License.txt](./License.txt). Your contribution will be accepted under the same license. + +## References +* [License.txt](./License.txt) \ No newline at end of file From 9f6d7cdf6b3fe5ffef7417a35b4af206d35cd9fd Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 23 Aug 2024 18:18:00 +0000 Subject: [PATCH 142/162] Remove extra print for gfx000 Removing extra print that was added for backward compatibility. Change-Id: I12a5346708886861a6e3cd6440830e6425e647d9 --- rocm_agent_enumerator | 4 ---- 1 file changed, 4 deletions(-) diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index 43cdd0349b..08a0596e99 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -271,10 +271,6 @@ def main(): 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) From 9537420254727a16aed9ef3ae415b2d0ebe644af Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Wed, 4 Sep 2024 17:03:38 +0000 Subject: [PATCH 143/162] Add queries for xnack_enabled and vmm support Change-Id: I7200fdc4c3086e92d60fbf785be89fb5d441409c --- rocminfo.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/rocminfo.cc b/rocminfo.cc index 868615382a..da18935529 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -101,7 +101,9 @@ struct system_info_t { hsa_endianness_t endianness; hsa_machine_model_t machine_model; bool mwaitx_enabled; + bool xnack_enabled; bool dmabuf_support; + bool vmm_support; }; // This structure holds agent information acquired through hsa info related @@ -331,11 +333,22 @@ static hsa_status_t AcquireSystemInfo(system_info_t *sys_info) { 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); RET_IF_HSA_ERR(err); + // Get Xnack Enabled + err = hsa_system_get_info(HSA_AMD_SYSTEM_INFO_XNACK_ENABLED, + &sys_info->xnack_enabled); + RET_IF_HSA_ERR(err); + + // Get VMM supported + err = hsa_system_get_info(HSA_AMD_SYSTEM_INFO_VIRTUAL_MEM_API_SUPPORTED, + &sys_info->vmm_support); + RET_IF_HSA_ERR(err); + return err; } @@ -367,9 +380,15 @@ static void DisplaySystemInfo(system_info_t const *sys_info) { printLabel("Mwaitx:"); printf("%s\n", sys_info->mwaitx_enabled ? "ENABLED" : "DISABLED"); + printLabel("XNACK enabled:"); + printf("%s\n", sys_info->xnack_enabled ? "YES" : "NO"); + printLabel("DMAbuf Support:"); printf("%s\n", sys_info->dmabuf_support ? "YES" : "NO"); + printLabel("VMM Support:"); + printf("%s\n", sys_info->vmm_support ? "YES" : "NO"); + printf("\n"); } From c6f7a17c85e0cdd75bf062e7a3490e831c87eb94 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Tue, 24 Sep 2024 10:39:23 -0400 Subject: [PATCH 144/162] rocminfo fails when amdgpu is built into the kernel When amdgpu is built into the kernel, /sys/module/amdgpu/initstate will not be created even when the driver is functional. However, test shows /sys/module/amdgpu will be present. Adding an additional check for /sys/module/amdgpu when /sys/module/amdgpu/instate is not present. Change-Id: Ie5c67c7e1eff8ac1683b211aaec802d0d342aeeb --- rocminfo.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/rocminfo.cc b/rocminfo.cc index da18935529..6d7329ad6c 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -1220,9 +1220,14 @@ int CheckInitialState(void) { return -1; } } else { - printf("%sROCk module is NOT loaded, possibly no GPU devices%s\n", - COL_RED, COL_RESET); - return -1; + 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; + } + close(module_dir); } // Check if user belongs to the group for /dev/kfd (e.g. "video" or From 22ed708c39d38ea20d082f72ace1233900a4fb61 Mon Sep 17 00:00:00 2001 From: Longlong Yao Date: Mon, 16 Dec 2024 18:46:18 -0800 Subject: [PATCH 145/162] Use /dev/dxg to detect wsl environment Since wslinfo does not exist in docker running on wsl, change the way to detect wsl environment. Change-Id: I215eb985a227caeef47483cd51818c84bf1d8a4c Signed-off-by: Longlong Yao --- rocminfo.cc | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/rocminfo.cc b/rocminfo.cc index 6d7329ad6c..af495e5d92 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -56,14 +56,9 @@ #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" @@ -233,31 +228,12 @@ 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 > /dev/null 2>&1"); - 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) { + const char *filePath = "/dev/dxg"; + FILE *file = fopen(filePath, "r"); + if (file) { printf("WSL environment detected.\n"); + fclose(file); wsl_env = true; } } From 7f417dc598268c85ea60bc7383d8a27ddd224ff4 Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Tue, 3 Dec 2024 14:01:50 -0600 Subject: [PATCH 146/162] Support for generic ISAs in rocm_agent_enumerator Change-Id: Ie6cf2f1930e27afd6564250e108af1f10864946e --- rocm_agent_enumerator | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index 08a0596e99..2e77c2cd57 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -81,7 +81,7 @@ def staticVars(**kwargs): return func return deco -@staticVars(search_term=re.compile(r"gfx[0-9a-fA-F]+")) +@staticVars(search_term=re.compile(r"gfx[0-9a-fA-F]+(-[0-9a-fA-F]+)?(-generic)?")) def getGCNISA(line, match_from_beginning = False): if match_from_beginning is True: result = getGCNISA.search_term.match(line) @@ -92,7 +92,7 @@ def getGCNISA(line, match_from_beginning = False): return result.group(0) return None -@staticVars(search_name=re.compile(r"gfx[0-9a-fA-F]+(:[-+:\w]+)?")) +@staticVars(search_name=re.compile(r"gfx[0-9a-fA-F]+(-[0-9a-fA-F]+)?(-generic)?(:[-+:\w]+)?")) def getGCNArchName(line): result = getGCNArchName.search_name.search(line) From e07320467cda57c9435c1540f3a0a64ae0215cae Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Tue, 21 Jan 2025 12:08:37 -0600 Subject: [PATCH 147/162] rocminfo: Update Debian depends to use libgcc1 Change-Id: I49e8f534393abe6b93f52a545e4baec720b6edde --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index df6755a228..f24e26cb42 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, pciutils, python3, libc6, libgcc-s1, libstdc++6") +set(CPACK_DEBIAN_PACKAGE_DEPENDS "hsa-rocr, pciutils, python3, libc6, libgcc-s1 | libgcc1, 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}) From 0f7c9495f4ae9a90c74cbe0fd4ab04e93c27bad3 Mon Sep 17 00:00:00 2001 From: "Choudhary, Rahul" Date: Fri, 31 Jan 2025 15:42:44 -0800 Subject: [PATCH 148/162] Create kws_caller.yml and rocm_ci_caller.yml Enabling ROCM CI workflow --- .github/workflows/kws_caller.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/kws_caller.yml diff --git a/.github/workflows/kws_caller.yml b/.github/workflows/kws_caller.yml new file mode 100644 index 0000000000..ffcbff7b1e --- /dev/null +++ b/.github/workflows/kws_caller.yml @@ -0,0 +1,15 @@ +name: Rocm Validation Suite KWS +on: + push: + branches: [amd-staging] + pull_request: + types: [opened, synchronize, reopened] + workflow_dispatch: +jobs: + kws: + if: ${{ github.event_name == 'pull_request' }} + uses: AMD-ROCm-Internal/rocm_ci_infra/.github/workflows/kws.yml@mainline + secrets: inherit + with: + pr_number: ${{github.event.pull_request.number}} + base_branch: ${{github.base_ref}} From 0e1d6396cc24710bc8b343f40af264cbb2aa7f1f Mon Sep 17 00:00:00 2001 From: "Choudhary, Rahul" Date: Fri, 31 Jan 2025 15:43:24 -0800 Subject: [PATCH 149/162] Create rocm_ci_caller.yml --- .github/rocm_ci_caller.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/rocm_ci_caller.yml diff --git a/.github/rocm_ci_caller.yml b/.github/rocm_ci_caller.yml new file mode 100644 index 0000000000..7e85fe7730 --- /dev/null +++ b/.github/rocm_ci_caller.yml @@ -0,0 +1,25 @@ +name: ROCm CI Caller +on: + # Commenting below to avoid re-runs of amd smi for trivial rebases + pull_request: + branches: [amd-staging, amd-mainline] + types: [opened, reopened, synchronize] + push: + branches: [amd-mainline] + workflow_dispatch: + issue_comment: + types: [created] + +jobs: + call-workflow: + if: ${{ github.event_name != 'issue_comment' || github.event.comment.body == '!verify' }} + uses: AMD-ROCm-Internal/rocm_ci_infra/.github/workflows/rocm_ci.yml@mainline + secrets: inherit + with: + input_sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} + input_pr_num: ${{ github.event_name == 'pull_request' && github.event.pull_request.number || 0 }} + input_pr_url: ${{ github.event_name == 'pull_request' && github.event.pull_request.html_url || '' }} + input_pr_title: ${{ github.event_name == 'pull_request' && github.event.pull_request.title || '' }} + repository_name: ${{ github.repository }} + base_ref: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref }} + trigger_event_type: ${{ github.event_name }} From 6bd1718fd1229dc868be9bf8ecd1ff565a27fc12 Mon Sep 17 00:00:00 2001 From: "Choudhary, Rahul" Date: Fri, 31 Jan 2025 16:05:53 -0800 Subject: [PATCH 150/162] Create rocm_ci_caller.yml --- .github/workflows/rocm_ci_caller.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/rocm_ci_caller.yml diff --git a/.github/workflows/rocm_ci_caller.yml b/.github/workflows/rocm_ci_caller.yml new file mode 100644 index 0000000000..7e85fe7730 --- /dev/null +++ b/.github/workflows/rocm_ci_caller.yml @@ -0,0 +1,25 @@ +name: ROCm CI Caller +on: + # Commenting below to avoid re-runs of amd smi for trivial rebases + pull_request: + branches: [amd-staging, amd-mainline] + types: [opened, reopened, synchronize] + push: + branches: [amd-mainline] + workflow_dispatch: + issue_comment: + types: [created] + +jobs: + call-workflow: + if: ${{ github.event_name != 'issue_comment' || github.event.comment.body == '!verify' }} + uses: AMD-ROCm-Internal/rocm_ci_infra/.github/workflows/rocm_ci.yml@mainline + secrets: inherit + with: + input_sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} + input_pr_num: ${{ github.event_name == 'pull_request' && github.event.pull_request.number || 0 }} + input_pr_url: ${{ github.event_name == 'pull_request' && github.event.pull_request.html_url || '' }} + input_pr_title: ${{ github.event_name == 'pull_request' && github.event.pull_request.title || '' }} + repository_name: ${{ github.repository }} + base_ref: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref }} + trigger_event_type: ${{ github.event_name }} From 33ac6534118785334b6c27220d47bf812b26724d Mon Sep 17 00:00:00 2001 From: "Choudhary, Rahul" Date: Fri, 31 Jan 2025 16:06:10 -0800 Subject: [PATCH 151/162] Delete .github/rocm_ci_caller.yml --- .github/rocm_ci_caller.yml | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 .github/rocm_ci_caller.yml diff --git a/.github/rocm_ci_caller.yml b/.github/rocm_ci_caller.yml deleted file mode 100644 index 7e85fe7730..0000000000 --- a/.github/rocm_ci_caller.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: ROCm CI Caller -on: - # Commenting below to avoid re-runs of amd smi for trivial rebases - pull_request: - branches: [amd-staging, amd-mainline] - types: [opened, reopened, synchronize] - push: - branches: [amd-mainline] - workflow_dispatch: - issue_comment: - types: [created] - -jobs: - call-workflow: - if: ${{ github.event_name != 'issue_comment' || github.event.comment.body == '!verify' }} - uses: AMD-ROCm-Internal/rocm_ci_infra/.github/workflows/rocm_ci.yml@mainline - secrets: inherit - with: - input_sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} - input_pr_num: ${{ github.event_name == 'pull_request' && github.event.pull_request.number || 0 }} - input_pr_url: ${{ github.event_name == 'pull_request' && github.event.pull_request.html_url || '' }} - input_pr_title: ${{ github.event_name == 'pull_request' && github.event.pull_request.title || '' }} - repository_name: ${{ github.repository }} - base_ref: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref }} - trigger_event_type: ${{ github.event_name }} From 060726826026730a9e2cefc5920f397da484953c Mon Sep 17 00:00:00 2001 From: benrichard-amd Date: Fri, 7 Feb 2025 08:43:47 -0800 Subject: [PATCH 152/162] Obey CMAKE_BUILD_TYPE Obey CMAKE_BUILD_TYPE when it is passed on the command line. Previous behavior remains: Debug by default ROCRTST_BLD_TYPE can set build type --- CMakeLists.txt | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f24e26cb42..212ca0e463 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,11 @@ if(WIN32) return() endif() +# Debug by default +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Debug") +endif() + # Generate static package, when BUILD_SHARED_LIBS is set to OFF. # Default to ON option(BUILD_SHARED_LIBS "Build using shared libraries" ON) @@ -62,13 +67,15 @@ include(utils) find_package(hsa-runtime64 1.0 REQUIRED ) -string(TOLOWER "${ROCRTST_BLD_TYPE}" tmp) -if("${tmp}" STREQUAL release) - set(BUILD_TYPE "Release") - set(ISDEBUG 0) -else() - set(BUILD_TYPE "Debug") - set(ISDEBUG 1) +if(DEFINED ROCRTST_BLD_TYPE) + string(TOLOWER "${ROCRTST_BLD_TYPE}" tmp) + if("${tmp}" STREQUAL release) + set(CMAKE_BUILD_TYPE "Release") + set(ISDEBUG 0) + else() + set(CMAKE_BUILD_TYPE "Debug") + set(ISDEBUG 1) + endif() endif() # The following default version values should be updated as appropriate for @@ -100,7 +107,7 @@ message("Package version: ${PKG_VERSION_STR}") # message("") message("Build Configuration:") -message("-----------BuildType: " ${BUILD_TYPE}) +message("-----------BuildType: " ${CMAKE_BUILD_TYPE}) message("------------Compiler: " ${CMAKE_CXX_COMPILER}) message("-------------Version: " ${CMAKE_CXX_COMPILER_VERSION}) message("--------Proj Src Dir: " ${PROJECT_SOURCE_DIR}) @@ -110,10 +117,6 @@ message("--------Proj Exe Dir: " ${PROJECT_BINARY_DIR}/bin) message("") -# -# Set the build type based on user input -# -set(CMAKE_BUILD_TYPE ${BUILD_TYPE}) # # Flag to enable / disable verbose output. # @@ -122,7 +125,7 @@ SET( CMAKE_VERBOSE_MAKEFILE on ) # Compiler pre-processor definitions. # # Define MACRO "DEBUG" if build type is "Debug" -if(${BUILD_TYPE} STREQUAL "Debug") +if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") add_definitions(-DDEBUG) endif() From 11823451e6da829826859407bc22ae4341ee7031 Mon Sep 17 00:00:00 2001 From: "Su, Daniel" Date: Mon, 3 Mar 2025 10:29:44 -0500 Subject: [PATCH 153/162] External CI: change trigger from amd-master to amd-mainline --- .azuredevops/rocm-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azuredevops/rocm-ci.yml b/.azuredevops/rocm-ci.yml index 06d6e2466d..3cf03ac7b8 100644 --- a/.azuredevops/rocm-ci.yml +++ b/.azuredevops/rocm-ci.yml @@ -21,7 +21,7 @@ trigger: branches: include: - amd-staging - - amd-master + - amd-mainline paths: exclude: - .github @@ -33,7 +33,7 @@ pr: branches: include: - amd-staging - - amd-master + - amd-mainline paths: exclude: - .github From 9638da746714ea25d482b891dc8e10feaf2b7346 Mon Sep 17 00:00:00 2001 From: "Khatri, Shweta" Date: Fri, 7 Mar 2025 13:56:43 -0500 Subject: [PATCH 154/162] Added gfx94x and gfx11xx IDs to enumerator (#5) --- rocm_agent_enumerator | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index 2e77c2cd57..e56b3f7c1e 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -49,6 +49,10 @@ ISA_TO_ID = { "gfx90a" : [0x7408, 0x740c, 0x740f, 0x7410], # Renoir "gfx90c" : [0x15e7, 0x1636, 0x1638, 0x164c], + + # Instinct MI300 series + "gfx942" : [0x74a1, 0x74a2, 0x74a5, 0x74a9, 0x74b5, 0x74b6, 0x74bd], + # Navi10 "gfx1010" : [0x7310, 0x7312, 0x7318, 0x7319, 0x731a, 0x731b, 0x731e, 0x731f], # Navi12 @@ -72,6 +76,13 @@ ISA_TO_ID = { "gfx1034" : [0x7420, 0x7421, 0x7422, 0x7423, 0x743f], # Yellow_Carp "gfx1035" : [0x164d, 0x1681] + + # Navi31 + "gfx1100": [0x7448, 0x7449, 0x744a, 0x744c, 0x745e], + # Navi32 + "gfx1101": [0x7470, 0x747e], + # Navi33 + "gfx1102": [0x7480, 0x7483, 0x7489, 0x7499], } def staticVars(**kwargs): From 8503ec36ca4c4e01da7c708534f23df22657fb1d Mon Sep 17 00:00:00 2001 From: "Khatri, Shweta" Date: Fri, 14 Mar 2025 11:16:56 -0400 Subject: [PATCH 155/162] Use idomatic approach to extending CMAKE_MODULE_PATH. (#7) There are many reasons why there may already be a CMAKE_MODULE_PATH defined. The idiomatic way to extend it in a project is via list(APPEND). https://github.com/ROCm/rocminfo/pull/97 submitted by @stellaraccident Co-authored-by: Stella Laurenzo --- CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 212ca0e463..c8f0c6cd5c 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,9 +55,7 @@ endif() # 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/") -endif() +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/") ## Include common cmake modules include(utils) From 7caeb3292fbb6aa1dbc0eb9548bccad1a614ecb9 Mon Sep 17 00:00:00 2001 From: "Mallya, Ameya Keshava" Date: Fri, 14 Mar 2025 14:00:09 -0700 Subject: [PATCH 156/162] Added release trigger for further releases --- .github/workflows/rocm_ci_caller.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rocm_ci_caller.yml b/.github/workflows/rocm_ci_caller.yml index 7e85fe7730..384b405d37 100644 --- a/.github/workflows/rocm_ci_caller.yml +++ b/.github/workflows/rocm_ci_caller.yml @@ -2,7 +2,7 @@ name: ROCm CI Caller on: # Commenting below to avoid re-runs of amd smi for trivial rebases pull_request: - branches: [amd-staging, amd-mainline] + branches: [amd-staging, amd-mainline, release/rocm-rel-*] types: [opened, reopened, synchronize] push: branches: [amd-mainline] From ac6000dc4702a85ab0eb611bb6d46b7ffc89d5a5 Mon Sep 17 00:00:00 2001 From: "Yat Sin, David" Date: Tue, 25 Mar 2025 10:30:04 -0400 Subject: [PATCH 157/162] Fix for typo in ISA_TO_ID table (#6) Change-Id: Id0720988fb01079a3ca6f3287dc743d93db4fd0f --- rocm_agent_enumerator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rocm_agent_enumerator b/rocm_agent_enumerator index e56b3f7c1e..8116304d8e 100755 --- a/rocm_agent_enumerator +++ b/rocm_agent_enumerator @@ -75,7 +75,7 @@ ISA_TO_ID = { # Beige_Goby "gfx1034" : [0x7420, 0x7421, 0x7422, 0x7423, 0x743f], # Yellow_Carp - "gfx1035" : [0x164d, 0x1681] + "gfx1035" : [0x164d, 0x1681], # Navi31 "gfx1100": [0x7448, 0x7449, 0x744a, 0x744c, 0x745e], From 38e9f399a2f061dc49fb97e9e92079155824c25c Mon Sep 17 00:00:00 2001 From: lyndonli Date: Mon, 24 Mar 2025 18:10:17 +0800 Subject: [PATCH 158/162] Remove WSL checks for displaying UUID and BDFID Signed-off-by: lyndonli --- rocminfo.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/rocminfo.cc b/rocminfo.cc index af495e5d92..b472377a33 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -590,8 +590,7 @@ AcquireAgentInfo(hsa_agent_t agent, agent_info_t *agent_i) { static void DisplayAgentInfo(agent_info_t *agent_i) { printLabelStr("Name:", agent_i->name, 1); - if (!wsl_env || HSA_DEVICE_TYPE_CPU == agent_i->device_type) - printLabelStr("Uuid:", agent_i->uuid, 1); + printLabelStr("Uuid:", agent_i->uuid, 1); printLabelStr("Marketing Name:", agent_i->device_mkt_name, 1); printLabelStr("Vendor Name:", agent_i->vendor_name, 1); @@ -673,8 +672,7 @@ static void DisplayAgentInfo(agent_info_t *agent_i) { printLabelStr("Cacheline Size:", int_to_string(agent_i->cacheline_size), 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("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); From 5c8c974e710913fdd8dbec1740998f638eec8b84 Mon Sep 17 00:00:00 2001 From: "Mallya, Ameya Keshava" Date: Fri, 28 Mar 2025 09:19:43 -0700 Subject: [PATCH 159/162] Added KWS check for amd-mainline (#9) --- .github/workflows/kws_caller.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/kws_caller.yml b/.github/workflows/kws_caller.yml index ffcbff7b1e..1765b15800 100644 --- a/.github/workflows/kws_caller.yml +++ b/.github/workflows/kws_caller.yml @@ -1,7 +1,7 @@ name: Rocm Validation Suite KWS on: push: - branches: [amd-staging] + branches: [amd-staging , amd-mainline] pull_request: types: [opened, synchronize, reopened] workflow_dispatch: From 61eb6895dc91b742c78e5449baa59e01e768ec6a Mon Sep 17 00:00:00 2001 From: "Hila, Nino" Date: Tue, 22 Apr 2025 18:55:03 -0400 Subject: [PATCH 160/162] Add palamida.yml (#11) --- .github/palamida.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .github/palamida.yml diff --git a/.github/palamida.yml b/.github/palamida.yml new file mode 100644 index 0000000000..c34f60c67f --- /dev/null +++ b/.github/palamida.yml @@ -0,0 +1,6 @@ +disabled: false +scmId: gh-emu-rocm +branchesToScan: + - amd-staging + - amd-mainline +jenkinsUrl: https://palamidajenkinsvm.amd.com/job/palamida/job/pci/job/ScanInitiatorGitHub \ No newline at end of file From eb62039faca93658b66f1749f5ad027bcb72e3e1 Mon Sep 17 00:00:00 2001 From: "Hila, Nino" Date: Tue, 13 May 2025 00:50:26 -0400 Subject: [PATCH 161/162] Update palamida.yml (#12) * Add palamida.yml - removing url --- .github/palamida.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/palamida.yml b/.github/palamida.yml index c34f60c67f..2a54378973 100644 --- a/.github/palamida.yml +++ b/.github/palamida.yml @@ -3,4 +3,3 @@ scmId: gh-emu-rocm branchesToScan: - amd-staging - amd-mainline -jenkinsUrl: https://palamidajenkinsvm.amd.com/job/palamida/job/pci/job/ScanInitiatorGitHub \ No newline at end of file From cd0f8c6173acb803c3d871fe2bcc795bd7768c34 Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Wed, 26 Mar 2025 22:12:30 +0800 Subject: [PATCH 162/162] Add ROC-DTIF backend support for rocminfo Signed-off-by: Aaron Liu --- rocminfo.cc | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/rocminfo.cc b/rocminfo.cc index b472377a33..c1cd332044 100755 --- a/rocminfo.cc +++ b/rocminfo.cc @@ -192,6 +192,7 @@ static const uint32_t kValueFieldSize = 35; static const uint32_t kIndentSize = 2; static bool wsl_env = false; +static bool dtif_env = false; enum rocmi_int_format { ROCMI_INT_FORMAT_DEC = 1, @@ -238,6 +239,17 @@ static void DetectWSLEnvironment() { } } +static void DetectDTIFEnvironment() { + char *var = getenv("HSA_ENABLE_DTIF"); + if (var == NULL) + return; + + if (0 == strncmp(var, "1", 1)) { + printf("HSA-DTIF environment detected.\n"); + dtif_env = true; + } +} + static void printLabelInt(char const *l, int d, uint32_t indent_lvl = 0) { std::string ind(kIndentSize * indent_lvl, ' '); @@ -667,10 +679,10 @@ static void DisplayAgentInfo(agent_info_t *agent_i) { } printLabelStr("Chip ID:", int_to_string(agent_i->chip_id), 1); - if (!wsl_env) + if (!(wsl_env || dtif_env)) printLabelStr("ASIC Revision:", int_to_string(agent_i->asic_revision), 1); printLabelStr("Cacheline Size:", int_to_string(agent_i->cacheline_size), 1); - if (!wsl_env || HSA_DEVICE_TYPE_GPU == agent_i->device_type) + if (!(wsl_env || dtif_env) || HSA_DEVICE_TYPE_GPU == agent_i->device_type) printLabelInt("Max Clock Freq. (MHz):", agent_i->max_clock_freq, 1); printLabelInt("BDFID:", agent_i->bdf_id, 1); printLabelInt("Internal Node ID:", agent_i->internal_node_id, 1); @@ -678,7 +690,7 @@ static void DisplayAgentInfo(agent_info_t *agent_i) { 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); - if (!wsl_env) + if (!(wsl_env || dtif_env)) printLabelInt("WatchPts on Addr. Ranges:", agent_i->max_addr_watch_pts, 1); if (agent_i->device_type == HSA_DEVICE_TYPE_GPU) @@ -1296,8 +1308,9 @@ int main(int argc, char* argv[]) { hsa_status_t err; DetectWSLEnvironment(); + DetectDTIFEnvironment(); - if (!wsl_env && CheckInitialState()) { + if (!(wsl_env || dtif_env) && CheckInitialState()) { return 1; } err = hsa_init();