Skip to content

00-Environment

AMD

🛠️ ROCm Environment Setup

Unified environment baseline · ROCm 7.12.0 · Prerequisite for all subsequent chapters

Back to Home | 中文

Introduction

  This chapter serves as the environment baseline for the entire hello-rocm project. It targets ROCm 7.12.0 (Technology Preview, released 2026-03-26) and covers installation, verification, and uninstallation on both Windows and Ubuntu.

  All subsequent chapters (01-Deploy, 02-Fine-tune, etc.) depend on this setup. To use a different ROCm version or GPU architecture, refer to the GPU Architecture Reference Table for substitutions.

💡 Platform recommendation: Windows supports ROCm for quick inference and experimentation, but the full ROCm toolchain (rocminfo, amd-smi, multi-GPU, containerized deployment, etc.) is best supported on Ubuntu. We recommend Ubuntu 24.04 as the primary development environment; Windows works well for lightweight inference and quick testing.

⚠️ ROCm 7.12.0 is a Technology Preview release — not suitable for production. For production use, see ROCm 7.2 production stream.

⚠️ Windows users must read: Before installation, verify that your Adrenalin Driver version and Windows version meet the requirements (see version table below), or ROCm will not function.


Version Requirements

ItemRequirementDownload
ROCm7.12.0 (Technology Preview)Official install page
PyTorch2.10.0 / 2.9.1Via uv (see below)
Python3.11 / 3.12 / 3.13Managed by uv
Windows Version11 25H2
Adrenalin Driver (Windows)26.3.1⬇️ Download Adrenalin 26.3.1
Visual Studio 2022 (Windows)Community, select "Desktop development with C++"⬇️ Download VS 2022
Ubuntu24.04.3 (HWE kernel 6.14 for Ryzen APU)Ubuntu Downloads

Table of Contents


1. Windows 11 Installation

Example: Ryzen AI Max+ 395 (gfx1151)

📖 Official docs: Install ROCm on Windows | Install PyTorch

1.1 Prerequisites Check

✅ CheckRequirement
Windows VersionMust be Windows 11 25H2 (Settings → System → About)
Adrenalin DriverMust be 26.3.1 (⬇️ Download)
Visual Studio 2022 (Optional)Community edition, select "Desktop development with C++" (⬇️ Download). Required for AMD Quark or custom op compilation
Visual Studio installer — select Desktop development with C++

1.2 Remove Conflicting Software

  • Control Panel → Programs → Uninstall a program → Remove all HIP SDK entries

1.3 Disable Windows Security Features

The following features interfere with ROCm and must be disabled:

  • WDAG: Control Panel → Programs and Features → Turn Windows features on or off → Uncheck "Microsoft Defender Application Guard"
  • SAC: Settings → Privacy & Security → Windows Security → App & browser control → Smart App Control settings → Off

1.4 Install uv (Python Package Manager)

This project uses uv to manage Python environments and dependencies, replacing the traditional pip + venv workflow. uv is written in Rust and is 10-100x faster.

powershell
# Windows install (PowerShell)
irm https://astral.sh/uv/install.ps1 | iex

# Or via winget
# winget install astral-sh.uv

# Verify
uv --version

📖 More install methods: uv documentation

1.5 Install ROCm + PyTorch

powershell
# Install Python 3.12 (uv has built-in version management)
uv python install 3.12

# Create virtual environment
uv venv --python 3.12
.venv\Scripts\activate

# Install ROCm runtime + libraries (gfx1151 = Ryzen AI Max+ 395/390/385)
uv pip install --index-url https://repo.amd.com/rocm/whl/gfx1151/ "rocm[libraries,devel]"

# Install PyTorch
uv pip install --index-url https://repo.amd.com/rocm/whl/gfx1151/ torch torchvision torchaudio

# Install other project dependencies (if requirements.txt exists)
uv pip install -r requirements.txt

⚠️ Do NOT copy ROCm DLLs to System32 — this causes conflicts.

💡 The gfx1151 above corresponds to Ryzen AI Max series (395/390/385). For other GPUs, replace --index-url:

Your GPUReplace with
Ryzen AI PRO 400 series (AI 9 HX PRO 475 etc.)https://repo.amd.com/rocm/whl/gfx1150/
Radeon RX 9070 XT / 9060 XThttps://repo.amd.com/rocm/whl/gfx120X-all/
Radeon RX 7900 XTX / 7800 XThttps://repo.amd.com/rocm/whl/gfx110X-all/
Instinct MI300X / MI325Xhttps://repo.amd.com/rocm/whl/gfx94X-dcgpu/

Full reference: GPU Architecture Table or Official Compatibility Matrix.


2. Ubuntu 24.04 Installation

Example: Ryzen AI Max+ PRO 395 (gfx1151)

📖 Official docs: Install ROCm on Ubuntu | Install PyTorch

2.1 Install uv and Dependencies

bash
sudo apt install -y libatomic1 libquadmath0

# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh

# Verify
uv --version
bash
# Install Python 3.12
uv python install 3.12

# Create virtual environment
uv venv --python 3.12
source .venv/bin/activate

# Install ROCm (gfx1151 = Ryzen AI Max+ 395/390/385)
uv pip install --index-url https://repo.amd.com/rocm/whl/gfx1151/ "rocm[libraries,devel]"

# Install PyTorch
uv pip install --index-url https://repo.amd.com/rocm/whl/gfx1151/ torch torchvision torchaudio

# Install other project dependencies (if requirements.txt exists)
uv pip install -r requirements.txt

💡 For other GPUs, replace --index-url — see Section 1.5 or GPU Architecture Table.

2.3 Alternative: One-Click Install Script

For a fully automated installation (kernel, driver, ROCm), use the project's install script:

bash
git clone -b unified-installer https://github.com/amdjiahangpan/rocm-install-script.git
cd rocm-install-script
chmod +x install.sh
sudo ./install.sh

📖 Script details and options: rocm-install-script (unified-installer branch)

2.4 Configure GPU Access Permissions (Linux)

💡 This step can be done anytime after installation; takes effect after reboot.

bash
sudo usermod -a -G render,video "$LOGNAME"
# Log out and back in, or reboot

3. Verify Installation

3.1 PyTorch Check (Windows / Linux)

bash
python -c "import torch; print('PyTorch:', torch.__version__); print('ROCm available:', torch.cuda.is_available()); print('Device:', torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'N/A')"

Expected output:

PyTorch: 2.10.0+rocm7.12.0
ROCm available: True
Device: AMD Radeon Graphics

💡 ROCm uses HIP to provide CUDA API compatibility, so torch.cuda.is_available() returning True is expected behavior.

3.2 Simple Computation Test

python
import torch
x = torch.randn(3, 3, device='cuda')
y = torch.randn(3, 3, device='cuda')
print(x @ y)

3.3 Linux-only Tools

bash
rocminfo | grep -E "Name:|Marketing Name:"
rocm-smi          # or: amd-smi monitor
hipinfo           # available with pip installation

3.4 Troubleshooting

SymptomCauseSolution
torch.cuda.is_available() = FalseDriver version mismatchWindows: confirm Adrenalin 26.3.1; Linux: confirm inbox kernel
No GPU detected (Linux)Not in render/video groupsudo usermod -a -G render,video $LOGNAME + reboot
DLL load error (Windows)SAC/WDAG not disabledSee Section 1.3

4. Uninstall ROCm

Windows

Simply delete the .venv folder (via File Explorer, or in CMD):

cmd
rmdir /s /q .venv

To uninstall Adrenalin driver: Control Panel → Programs → Uninstall a program → AMD Software

Ubuntu

bash
rm -rf .venv

5. Switching GPU Architectures

Simply replace the --index-url or apt package name with the corresponding value:

GPU ExampleLLVM Targetpip index URL
MI355X / MI350Xgfx950https://repo.amd.com/rocm/whl/gfx950-dcgpu/
MI300X / MI325Xgfx942https://repo.amd.com/rocm/whl/gfx94X-dcgpu/
RX 9070 XTgfx1201https://repo.amd.com/rocm/whl/gfx120X-all/
RX 7900 XTXgfx1100https://repo.amd.com/rocm/whl/gfx110X-all/
Ryzen AI Max 395gfx1151https://repo.amd.com/rocm/whl/gfx1151/
Ryzen AI PRO 400gfx1150https://repo.amd.com/rocm/whl/gfx1150/

Full reference: GPU Architecture Table


📖 Official documentation: