ROCm软件栈以及TheRock输出对应关系
参考ROCm官方文档(AMD ROCm documentation — ROCm Documentation)以及相关资料梳理ROCm软件栈,并结合TheRock编译输出,给出对应关系。进而了解整个软件栈各模块的作用。
1 ROCm软件栈
1.2 应用层 (Applications)
-
AI/ML应用:PyTorch、TensorFlow、JAX等深度学习框架。
-
HPC应用:GROMACS、OpenFOAM、LAMMPS等科学计算软件。
-
媒体处理:Blender、FFmpeg、DaVinci Resolve等创作工具。
-
科学计算:MATLAB、Julia、RAPIDS等数据分析平台。
1.2 框架层 (Frameworks)
-
PyTorch:动态图深度学习框架,支持自动微分和GPU加速。
-
TensorFlow:静态图机器学习平台,提供完整的生态系统。
-
JAX(Just After eXecution):函数式变换库,支持JIT编译和自动微分。ROCm/jax: Composable transformations of Python+NumPy programs: differentiate, vectorize, JIT to GPU/TPU, and more
-
Kokkos:C++性能可移植编程模型,抽象硬件差异。
-
OpenMP:指令级并行编程标准,支持目标卸载到GPU。
1.3 库层 (Libraries)
机器学习库
-
MIOpen(Open Machine Intelligence Library):深度学习算子库,优化卷积、池化等操作。ROCm/MIOpen: [DEPRECATED] Moved to ROCm/rocm-libraries repo
-
MIGraphX(Machine Intelligence Graph Execution):图优化和推理引擎,支持模型部署优化。ROCm/AMDMIGraphX: AMD's graph optimization engine.
-
MIVisionX( Machine Intelligence Vision Library):计算机视觉库,提供OpenVX实现。ROCm/MIVisionX: MIVisionX toolkit is a set of comprehensive computer vision and machine intelligence libraries, utilities, and applications bundled into a single toolkit.
-
Composable Kernel:跨架构高性能内核编程模型,适用于机器学习关键计算。
-
ROCm Performance Primitives (RPP)(RPP):高性能计算机视觉库,支持 HIP/OpenCL/CPU 后端。
-
rocAL:图像和视频增强、解码与处理库。
-
rocDecode:高性能视频解码 SDK,访问 AMD GPU 视频解码功能。
-
rocJPEG:AMD GPU 上的 JPG 图像解码库。
-
rocPyDecode:提供 Python 和 C/C++ 接口访问 rocDecode 功能。
数学计算库
-
half:C++ header-only 库,提供 IEEE 754 标准 16-bit 半精度浮点类型及算术运算、类型转换和常用数学函数;文档:half;仓库:half
-
hipBLAS:BLAS 封装库,支持 rocBLAS 和 cuBLAS 后端,实现矩阵运算接口;文档:hipBLAS;仓库:hipBLAS
-
hipBLASLt:通用矩阵-矩阵运算库,提供更灵活 API 并扩展传统 BLAS 功能;文档:hipBLASLt;仓库:hipBLASLt
-
hipFFT:快速傅里叶变换(FFT)封装库,支持 rocFFT 或 cuFFT 后端;文档:hipFFT;仓库:hipFFT
-
hipSOLVER:LAPACK 封装库,支持 rocSOLVER 和 cuSOLVER 后端;文档:hipSOLVER;仓库:hipSOLVER
-
hipSPARSE:稀疏矩阵封装库,支持 rocSPARSE 和 cuSPARSE 后端;文档:hipSPARSE;仓库:hipSPARSE
-
hipSPARSELt:稀疏矩阵封装库,支持多种后端;文档:hipSPARSELt;仓库:hipSPARSELt
-
rocALUTION:稀疏线性代数库,探索 ROCm 运行时的细粒度并行性;文档:rocALUTION;仓库:rocALUTION
-
rocSOLVER:在 ROCm 上实现 LAPACK 算法,优化 AMD GPU 性能;文档:rocSOLVER;仓库:rocSOLVER
-
rocSPARSE:稀疏矩阵计算接口库,基于 HIP 实现 BLAS 风格运算;文档:rocSPARSE;仓库:rocSPARSE
-
Tensile:基于基准测试的后端库生成器,用于 GEMM、GEMM-like 问题和 N 维张量运算;文档:Tensile;仓库:Tensile
通信库
-
RCCL(ROCm Communication Collectives Library):多GPU通信集合库,实现AllReduce等集合操作。ROCm/rccl: ROCm Communication Collectives Library (RCCL)
- rocSHMEM:内核级 GPU 通信库,提供类似 OpenSHMEM 的接口,实现 GPU 间高效数据交换。
原语库
-
rocPRIM(ROCm Parallel Primitives):并行算法原语库,提供排序、归约等基础操作。ROCm/rocPRIM: [DEPRECATED] Moved to ROCm/rocm-libraries repo
-
rocThrust:类似STL的并行算法库,简化GPU编程。ROCm/rocThrust: [DEPRECATED] Moved to ROCm/rocm-libraries repo
-
hipCUB:基于 rocPRIM 或 CUB 的轻量级 header-only 封装库,方便将使用 CUB 的项目迁移到 HIP 层。
-
hipTensor:AMD 的 C++ 库,基于 Composable Kernel 加速张量运算原语,用于高性能 ML/深度学习计算。
1.4 编译器层 (Compilers)
-
hipcc(HIPCC):HIP编译器驱动,处理HIP代码编译和链接。
-
LLVM-ROC(ROCm compilers):基于LLVM的AMD GPU后端,生成优化代码。ROCm/llvm-project: This is the AMD-maintained fork of the LLVM git repository.
-
amdclang:支持OpenMP目标卸载的Clang编译器。
-
ROCm Device Libs:设备端数学函数库,提供基础运算。ROCm/llvm-project: This is the AMD-maintained fork of the LLVM git repository.
1.5 编程模型层 (Programming Models)
-
HIP(Heterogeneous-compute Interface for Portability):异构计算可移植接口,提供CUDA类似编程体验。rocm-systems/projects/hip at develop · ROCm/rocm-systems
-
OpenCL(Open Computing Language):开放计算语言标准,支持跨平台异构计算。
-
OpenMP(Open Multi-Processing):指令级并行编程模型,简化GPU代码移植。
1.6 运行时层 (Runtimes)
-
ROCr(ROCR-Runtime):ROCm 底层运行时,基于 HSA 模型,管理 GPU 资源、执行上下文、调度队列和内存。rocm-systems/projects/rocr-runtime at develop · ROCm/rocm-systems
-
HIP Runtime(HIP):HIP 程序运行时,实现 HIP API,提供内存管理、流和事件、内核加载与执行等功能。rocm-systems/projects/hip at develop · ROCm/rocm-systems
-
CLR(AMD Compute Language Runtime (CLR)):HIP 和 OpenCL 的公共运行时支撑层,负责内核编译、执行模型、多 GPU 管理等,不是单独的库,而是 HIP 与 OpenCL runtime 的共享组件。rocm-systems/projects/clr at develop · ROCm/rocm-systems
1.7 工具层 (Tools)
性能分析工具
-
rocprofiler(OCm Compute Profiler、ROCm Systems Profiler、ROCProfiler、ROCprofiler-SDK):性能分析工具,收集硬件性能计数器。rocm-systems/projects/rocprofiler-systems at develop · ROCm/rocm-systems、rocm-systems/projects/rocprofiler-sdk at develop · ROCm/rocm-systems、rocm-systems/projects/rocprofiler-register at develop · ROCm/rocm-systems、rocm-systems/projects/rocprofiler-compute at develop · ROCm/rocm-systems。
-
Omniperf:全面性能分析器,提供优化建议。
- ROCm Bandwidth Test:显存带宽和数据拷贝性能测试。
- ROCTracer:拦截 ROCm Runtime API 调用并追踪 GPU 异步活动。
开发调试工具
-
rocgdb(ROCgdb)):GPU调试器,支持内核级调试和断点设置。ROCm/ROCgdb: This is ROCgdb, the ROCm source-level debugger for Linux, based on GDB, the GNU source-level debugger.
-
HIPIFY(HIPIFY):代码转换工具,自动将CUDA代码转为HIP。ROCm/HIPIFY: HIPIFY: Convert CUDA to Portable C++ Code
- ROCdbgapi:提供 GPU 程序调试的底层接口。
- ROCr Debug Agent:运行时捕获 GPU 错误并打印 wavefront 状态。
系统管理
-
ROCm SMI(ROCm System Management Interface):GPU系统管理接口,监控状态和性能指标。rocm-systems/projects/rocm-smi-lib at develop · ROCm/rocm-systems
-
rocminfo(ROCm System Information)/AMD SMI:系统信息查询工具,显示GPU拓扑和特性。rocm-systems/projects/rocminfo at develop · ROCm/rocm-systems
- ROCm Data Center Tool:集群 GPU 管理工具。
- ROCm Validation Suite:GPU 问题检测与排错工具。
1.8 驱动层 (Drivers)
-
AMDGPU:Linux内核显示驱动,管理GPU硬件资源。
-
HSAKMT(Heterogeneous System Architecture Kernel Mode Driver):HSA内核模式驱动,处理用户态-内核态通信。
-
ROCt(ROCm Thunk):用户态驱动接口,提供系统调用封装。
1.9 硬件层 (Hardware)
-
CDNA(Compute DNA)架构:计算优化架构(Instinct MI系列),专注HPC和AI。
-
RDNA(Radeon DNA)架构:图形计算架构(Radeon RX系列),平衡图形和计算。
-
Infinity Fabric:高速互连技术,实现多GPU直接通信。
2 ROCm软件栈架构图

3 TheRock输出与ROCm软件栈
TheRock编译后生成的输出文件在:
build/dist/rocm/ ├── bin ├── include ├── lib ├── libexec ├── llvm -> lib/llvm └── share
bin中主要包含编译、Tools、Test等可执行文件;lib中包含Math Libraries、Communication Libraries、ROCm Runtime等。比如:
Libraries ├─ ML & CV: libMIOpen.so ├─ Communication: librccl.so ├─ Math: │ ├─ libhipblas.so, librocblas.so │ ├─ libhipblaslt.so │ ├─ libhipfft.so, librocfft.so │ ├─ libhiprand.so, librocrand.so │ ├─ libhipsolver.so, librocsolver.so │ └─ libhipsparse.so, librocsparse.so └─ Primitives: (未出现) Compilers ├─ libamd_comgr.so └─ llvm/Runtimes ├─ HIP: libamdhip64.so, libhiprtc.so, libhiprtc-builtins.so └─ HSA: libhsa-runtime64.so Tools ├─ System: librocm_smi64.so ├─ Performance: librocprofiler-sdk.so, librocprofiler-sdk-roctx.so, librocprofiler-register.so └─ Development: rocprofiler-sdk/ Drivers ├─ liboam.so ├─ librocm-core.so ├─ rocmmod └─ rocm_sysdeps/
4 ROCm架构图参考
以下是一些不同视角的架构图。
ROCm(6.3.2) Software Stack

Architecture and Components | ROCm/ROCm | DeepWiki

《Accelerate Your Applications with ROCm | Inside HPC & AI News》

Exploring AMD’s Ambitious ROCm Initiative » ADMIN Magazine

Welcome to AMD ROCm™ Platform — ROCm 4.5.0 documentation

A Nice Overview Of The ROCm Linux Compute Stack - Phoronix



浙公网安备 33010602011771号