Add 'projects/rocminfo/' from commit 'cd0f8c6173acb803c3d871fe2bcc795bd7768c34'

git-subtree-dir: projects/rocminfo
git-subtree-mainline: ae5decac0f
git-subtree-split: cd0f8c6173
This commit is contained in:
systems-assistant[bot]
2025-07-22 22:52:39 +00:00
28 changed files with 3105 additions and 0 deletions
@@ -0,0 +1,45 @@
resources:
repositories:
- repository: pipelines_repo
type: github
endpoint: ROCm
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:
- amd-staging
- amd-mainline
paths:
exclude:
- .github
- License.txt
- README.md
pr:
autoCancel: true
branches:
include:
- amd-staging
- amd-mainline
paths:
exclude:
- .github
- License.txt
- README.md
drafts: false
jobs:
- template: ${{ variables.CI_COMPONENT_PATH }}/rocminfo.yml@pipelines_repo
+6
View File
@@ -0,0 +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
+1
View File
@@ -0,0 +1 @@
blank_issues_enabled: true
@@ -0,0 +1,179 @@
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 MI300
- AMD Instinct MI300A
- AMD Instinct MI300X
- 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 6.0.0
- 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
+17
View File
@@ -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"
+5
View File
@@ -0,0 +1,5 @@
disabled: false
scmId: gh-emu-rocm
branchesToScan:
- amd-staging
- amd-mainline
+15
View File
@@ -0,0 +1,15 @@
name: Rocm Validation Suite KWS
on:
push:
branches: [amd-staging , amd-mainline]
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}}
+25
View File
@@ -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, release/rocm-rel-*]
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 }}
+18
View File
@@ -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"
+271
View File
@@ -0,0 +1,271 @@
#
# 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=<path to rocm root> <other defines if needed> .."
# 4) Run "make"
#
# Upon a successful build, the executable "rocminfo" will be in the
# build directory.
#
# Currently support for Windows platform is not present
#
#
# Minimum version of cmake required
#
cmake_minimum_required(VERSION 3.6.3)
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()
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)
## Set default module path if not already set
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/")
## Include common cmake modules
include(utils)
#
# Process input variables
#
find_package(hsa-runtime64 1.0 REQUIRED )
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
# 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:
#
# Build Src directory
# Build Binary directory
# Build Type: Debug Vs Release, 32 Vs 64
# Compiler Version, etc
#
message("")
message("Build Configuration:")
message("-----------BuildType: " ${CMAKE_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("")
#
# Flag to enable / disable verbose output.
#
SET( CMAKE_VERBOSE_MAKEFILE on )
#
# Compiler pre-processor definitions.
#
# Define MACRO "DEBUG" if build type is "Debug"
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
add_definitions(-DDEBUG)
endif()
add_definitions(-DLITTLEENDIAN_CPU=1)
#
# Linux Compiler options
#
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)
#
# 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} -m64 -msse -msse2)
endif()
#
# Add compiler flags to include symbol information for debug builds
#
if(ISDEBUG)
set(ROCMINFO_CXX_FLAGS ${ROCMINFO_CXX_FLAGS} -ggdb -O0)
endif()
###########################
# rocm_agent_enumerator
###########################
configure_file(rocm_agent_enumerator rocm_agent_enumerator COPYONLY)
###########################
# RocR Info
###########################
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
###########################
install (
TARGETS ${ROCMINFO_EXE}
DESTINATION ${CMAKE_INSTALL_BINDIR} )
install (
PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/rocm_agent_enumerator
DESTINATION ${CMAKE_INSTALL_BINDIR} )
###########################
# Packaging directives
###########################
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}")
set(CPACK_PACKAGE_VERSION_PATCH "${PKG_VERSION_PATCH}")
set(CPACK_PACKAGE_CONTACT "AMD Rocminfo Support <rocminfo.support@amd.com>")
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 ${CMAKE_INSTALL_DOCDIR})
#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
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})
else()
set(CPACK_DEBIAN_PACKAGE_RELEASE "local")
endif()
if ( ROCM_DEP_ROCMCORE )
string ( APPEND CPACK_DEBIAN_PACKAGE_DEPENDS ", rocm-core" )
endif()
#RPM package specific variables
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, pciutils, python3, glibc, libgcc, libstdc++")
else()
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)
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()
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)
set(CPACK_RPM_PACKAGE_RELEASE_DIST ON)
endif()
#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")
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 )
+106
View File
@@ -0,0 +1,106 @@
<head>
<meta charset="UTF-8">
<meta name="description" content="Contributing to rocminfo">
<meta name="keywords" content="ROCm, contributing, rocminfo">
</head>
# 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) <current year>, 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 <Name of Development Group, Name of Institution>,
* 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)
+38
View File
@@ -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.
+44
View File
@@ -0,0 +1,44 @@
# 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 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,
$ 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.
## 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.
+162
View File
@@ -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()
+40
View File
@@ -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
+1
View File
@@ -0,0 +1 @@
_build/
+29
View File
@@ -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."
)
@@ -0,0 +1,22 @@
.. meta::
:description: agent, enumerator ROCmInfo
:keywords: install, rocminfo, AMD, ROCm, ROCmInfo
Using ROCm agent enumerator
-----------------------------
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.
See the following example output of the rocm_agent_enumerator command on a system with an MI-300X installation,
.. code-block::
gfx000
gfx941
.. Note::
The gfx000 represents the CPU agent.
@@ -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 ***
+33
View File
@@ -0,0 +1,33 @@
.. meta::
:description: Install ROCmInfo
:keywords: install, rocminfo, AMD, ROCm
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.
You can access ROCmInfo code at `GitHub. <https://github.com/ROCm/rocminfo>`_
.. grid:: 2
:gutter: 3
.. grid-item-card:: Build
* :doc:`ROCmInfo installation <./install/build>`
.. grid-item-card:: How to
* :doc:`Use ROCmInfo <how-to/use-rocminfo>`
* :doc:`Use ROCm agent enumerator <how-to/use-rocm-agent-enumerator>`
To contribute to the documentation, refer to
`Contributing to ROCm <https://rocm.docs.amd.com/en/latest/contribute/contributing.html>`_.
You can find licensing information on the
`Licensing <https://rocm.docs.amd.com/en/latest/about/license.html>`_ page.
+49
View File
@@ -0,0 +1,49 @@
.. meta::
:description: Install ROCmInfo
:keywords: install, rocminfo, AMD, ROCm
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.
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,
.. 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.
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.
+5
View File
@@ -0,0 +1,5 @@
=======
License
=======
.. include:: ../License.txt
+1
View File
@@ -0,0 +1 @@
_toc.yml
+19
View File
@@ -0,0 +1,19 @@
defaults:
numbered: False
root: index
subtrees:
- caption: Install
entries:
- file: install/build.rst
title: ROCmInfo installation
- 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
- caption: About
entries:
- file: license.md
@@ -0,0 +1 @@
rocm-docs-core==1.5.0
@@ -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.5.0
# 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
+289
View File
@@ -0,0 +1,289 @@
#!/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],
# Instinct MI300 series
"gfx942" : [0x74a1, 0x74a2, 0x74a5, 0x74a9, 0x74b5, 0x74b6, 0x74bd],
# 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],
# Navi31
"gfx1100": [0x7448, 0x7449, 0x744a, 0x744c, 0x745e],
# Navi32
"gfx1101": [0x7470, 0x747e],
# Navi33
"gfx1102": [0x7480, 0x7483, 0x7489, 0x7499],
}
def staticVars(**kwargs):
def deco(func):
for k in kwargs:
setattr(func, k, kwargs[k])
return func
return deco
@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)
else:
result = getGCNISA.search_term.search(line)
if result is not None:
return result.group(0)
return None
@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)
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(r"Cannot allocate memory")
term2 = re.compile(r"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(r"\A\s+Name:\s+(amdgcn-amd-amdhsa--gfx\d+)")
else:
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:
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(r"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(r"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:
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()
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()
for gfx in target_list:
print(gfx)
if __name__ == "__main__":
main()
+1347
View File
File diff suppressed because it is too large Load Diff