ROCm (also called AMD ROCm) is the open-source software stack from AMD for general-purpose GPU computing, combining a kernel driver, a runtime, an LLVM-based compiler, the HIP programming interface and a family of tuned math and communication libraries. Among AI frameworks & tools, it plays the role that the CUDA platform plays on NVIDIA hardware: it is the layer beneath PyTorch, JAX, TensorFlow and inference engines that turns tensor operations into work on AMD Instinct accelerators and selected Radeon GPUs.
For teams in artificial intelligence, ROCm matters because it determines whether an existing model pipeline can move to AMD hardware without a rewrite. Most users never call ROCm directly; they install a ROCm build of their framework, and the quality of that build, the supported GPU list and the maturity of the kernels decide real-world performance and stability.
How the ROCm stack is organized
ROCm is organized as layers that each hide the one below: a Linux kernel driver manages the device, a user-space runtime schedules work, a compiler produces GPU machine code, and libraries expose fast routines for linear algebra, convolutions and collective communication. Frameworks sit at the top and call those libraries through backends that mirror their CUDA counterparts.
The runtime follows the Heterogeneous System Architecture (HSA) model, in which the host places work packets into user-mode queues that the GPU consumes directly. Code is compiled ahead of time for a specific GPU architecture target, named with identifiers such as gfx90a for the MI200 series, gfx942 for the MI300 series and gfx1100 for the Radeon RX 7900 family. A binary built without the right target simply fails to load on that GPU.
The table below maps the main ROCm components to their function and to the closest equivalent in the NVIDIA ecosystem, which helps engineers who already know CUDA.
| Component | Function | Closest CUDA equivalent |
|---|---|---|
| amdgpu driver and ROCr | Device management and HSA runtime | NVIDIA driver and CUDA driver API |
| HIP runtime and hipcc | Programming interface and compiler wrapper | CUDA runtime and nvcc |
| rocBLAS and hipBLASLt | Dense matrix multiplication | cuBLAS and cuBLASLt |
| MIOpen | Convolutions, normalization, attention primitives | cuDNN |
| RCCL | Multi-GPU collective communication | NCCL |
| rocprof and amd-smi | Profiling and device monitoring | Nsight tools and nvidia-smi |
HIP and the path from CUDA code
HIP (Heterogeneous-computing Interface for Portability) is a C++ dialect whose API is deliberately close to CUDA, so that calls such as cudaMalloc correspond to hipMalloc almost one to one. AMD provides hipify tools that translate CUDA source automatically, and the translated code can still be compiled for NVIDIA GPUs through a thin HIP layer.
Source compatibility is not the same as performance portability. AMD data center GPUs of the CDNA family execute threads in wavefronts of 64, while NVIDIA warps contain 32 threads, so kernels that hard-code warp size, rely on warp-level intrinsics or assume a particular shared-memory layout need manual review after translation. Inline PTX assembly has no automatic translation at all.
The following table summarizes the usual porting routes and what each one costs in effort.
| Starting point | Typical route | Main remaining effort |
|---|---|---|
| Framework-level Python code | Install the ROCm build of the framework | Usually none beyond testing |
| Custom CUDA C++ kernels | Run hipify, then compile with hipcc | Warp-size and intrinsic fixes |
| Triton kernels | Use the AMD backend of Triton | Retuning block sizes |
| Inline PTX or vendor binaries | Rewrite the affected parts | Full reimplementation |
How AI frameworks run on ROCm
In practice, PyTorch is the most mature entry point to ROCm. Its ROCm wheels reuse the familiar torch.cuda interface and the cuda device string, so most training scripts run without code changes; the framework routes calls to rocBLAS, hipBLASLt, MIOpen and RCCL behind the scenes. JAX and TensorFlow also ship ROCm builds, generally with a narrower set of tested configurations.
For large language model serving, inference engines such as vLLM and SGLang support ROCm, and AMD contributes kernels for attention and quantized matrix multiplication through its Composable Kernel library and AITER project. The large high-bandwidth memory on Instinct accelerators, such as 192 GB of HBM3 on the MI300X, is a key reason teams choose ROCm for serving models that would otherwise need to be split across more GPUs.
The next table compares ROCm with neighboring layers in the AI toolchain so that its position is clear.
| Layer | Scope | Relationship to ROCm |
|---|---|---|
| CUDA | NVIDIA GPU platform | Direct counterpart on other hardware |
| PyTorch | Model definition and training framework | Runs on top of ROCm as a backend |
| Triton | Python language for GPU kernels | Compiles to AMD GPUs through ROCm |
| ONNX Runtime | Cross-platform inference engine | Uses ROCm or MIGraphX as an execution provider |
| OpenVINO | Intel inference toolkit | Alternative stack for different hardware |
Choosing hardware and a ROCm configuration
A working setup depends on matching four versions that must agree: the GPU architecture, the Linux distribution and kernel, the ROCm release and the framework build. AMD publishes a compatibility matrix for each release, and staying inside it is the single most effective way to avoid obscure runtime errors. Container images with a preinstalled ROCm and framework remove much of this risk.
Support is strongest for Instinct data center accelerators and narrower for consumer Radeon cards, while Windows support through the HIP SDK covers fewer libraries than Linux. The decision table below gives sensible defaults.
| Situation | Recommended choice | Reason |
|---|---|---|
| Production training cluster | Instinct GPUs with official ROCm containers | Full library and RCCL support |
| Single-node LLM inference | Instinct GPU with vLLM ROCm image | Large memory, tuned kernels |
| Developer workstation | Officially listed Radeon GPU on Linux | Lower cost with supported target |
| Unlisted consumer GPU | Avoid for production work | Unsupported targets may break silently |
Limitations and common mistakes
The main limitation of ROCm is ecosystem depth rather than raw hardware capability. Many third-party libraries, research repositories and custom kernels are written for CUDA first, and some arrive on ROCm later or not at all. Teams should budget time for validation instead of assuming parity.
- Forcing an unsupported architecture: overriding the reported GPU target may run, but can produce crashes or wrong results.
- Mixing package sources: combining distribution packages with AMD repositories often causes library version conflicts.
- Ignoring kernel tuning: default GEMM and attention kernels may underperform until tuned for the specific model shapes.
- Assuming warp size 32: translated kernels with hard-coded assumptions can silently compute incorrect reductions.
- Benchmarking too early: performance changes noticeably between ROCm releases, so comparisons should name the exact versions.
A final caution concerns multi-node scaling: RCCL performance depends on the network fabric, its drivers and topology settings, so collective bandwidth should be measured before a long training run is scheduled.
A plain-language summary
A graphics card is a powerful engine. It still needs software that tells it what to do. ROCm is that software for AMD graphics cards. It sits between AI programs and the chip.
Think of it as a translator and a toolbox. AI programs like PyTorch speak in big math tasks. ROCm turns those tasks into instructions the AMD chip understands. It also supplies ready-made tools for the most common calculations.
The main point is simple. With ROCm, many AI programs can run on AMD hardware instead of only on NVIDIA hardware. The result depends on picking supported parts and matching versions.
An example from practice
A research group at a university wants to serve a 70-billion-parameter language model for internal use. On their previous hardware, the model in 16-bit precision needed several GPUs because each card had too little memory. They rent a server with eight AMD Instinct MI300X accelerators and use the official vLLM container built on ROCm.
The engineers keep their existing Python serving code, since the ROCm build of PyTorch exposes the same device interface. They spend two days on validation and kernel tuning: they confirm that outputs match their reference results, enable the tuned attention kernels and run a tuning pass for the matrix shapes of their model.
The outcome is a working service in which the full model fits on a single GPU, while the remaining accelerators serve additional replicas. The group notes one lesson for the future: pinning exact ROCm and framework versions in the container made later upgrades predictable and easy to test.