Skip to content

feat(rocm): add RDNA3 and RDNA4 runtime foundation - #132

Open
zihaomu wants to merge 8 commits into
FlashML-org:mainfrom
zihaomu:feat/rocm-rdna3-rdna4-foundation
Open

feat(rocm): add RDNA3 and RDNA4 runtime foundation#132
zihaomu wants to merge 8 commits into
FlashML-org:mainfrom
zihaomu:feat/rocm-rdna3-rdna4-foundation

Conversation

@zihaomu

@zihaomu zihaomu commented Aug 24, 2026

Copy link
Copy Markdown

Summary

  • add an independent ROCm source-build foundation for RDNA3 (gfx1100-gfx1103) and RDNA4 (gfx1200, gfx1201);
  • support both traditional /opt/rocm layouts and the modular ROCm SDK shipped by the official ROCm 7.14 PyTorch image;
  • build and load the pinned-memory and CPU-MoE extensions on HIP;
  • make the pinned-host fast-index-copy and Triton activation/norm paths work on ROCm;
  • detect the visible gcnArchName, with explicit environment overrides for cross compilation.

Why this targets main directly

This PR is a standalone, current-main integration. It incorporates the useful work from #23 and the RDNA3 runtime follow-up at bouclem#1, then adds the RDNA4 and ROCm 7.14 changes. It therefore does not require either external feature branch to merge first.

This intentionally overlaps those open PRs so maintainers can review and merge a complete, hardware-tested ROCm foundation without being blocked by a cross-fork base chain.

Attribution

Thank you to both contributors for establishing and validating the earlier ROCm paths.

Validation

Hardware and software:

  • AMD Radeon AI PRO R9700 (gfx1201)
  • PyTorch 2.11.0+rocm7.14.0
  • HIP 7.14.60850
  • AMD Triton 3.7.1

Results:

  • clean python -m pip install -e . --no-build-isolation --no-deps: PASS; both native extensions compiled and loaded;
  • cold TVM-FFI fast-index-copy JIT build: PASS;
  • architecture, pinned/copy, Triton attention, Gemma norm, SwiGLU, and CPU-MoE graph replay tests: 48 passed;
  • python -m pip check: PASS;
  • git diff --check: PASS.

Compatibility

ROCm-specific code is guarded by HIP/ROCm detection and existing CUDA paths are retained. Physical NVIDIA regression testing is not claimed; upstream CUDA CI is requested before merge.

Follow-ups

Kept out of this foundation PR for separate review:

  1. generic TVM-FFI index/store HIP portability;
  2. CUDA-only optional-backend gating;
  3. RCCL tensor-parallel routing;
  4. native GGUF kernels on ROCm/RDNA4;
  5. RDNA-specific performance tuning and full model-serving validation.

bouclem and others added 8 commits August 24, 2026 13:53
- Add hip_compat.h shim mapping CUDA runtime API to HIP equivalents
- Update pinned_tensor.cpp to compile under both nvcc and hipcc
- Add ROCm detection in arch.py (is_rocm, get_rocm_gfx_arch, is_gfx11xx_family)
- Guard NVIDIA arch checks to return None on ROCm
- Skip nvcc version check in _toolchain.py when on ROCm
- Add ROCm build path in setup.py (ROCM_HOME, amdhip64, --offload-arch)
- Add _hip_cflags() in kernel/utils.py for JIT compilation on ROCm
- Add is_rocm() and driver_hip_version() in backend.py
- Add rocm-smi fallback in __main__.py for clangd generation
- Add TODO(ROCm) for NCCL->RCCL, flashinfer/sgl_kernel ROCm builds,
  Triton autotune RDNA3 tuning, PDL equivalent, hiprtc JIT cache
- Add AMD ROCm classifier in pyproject.toml
@zihaomu

zihaomu commented Aug 24, 2026

Copy link
Copy Markdown
Author

Draft follow-ups are now available:

All four are opened as Draft PRs against main. Until this foundation PR merges, their GitHub “Files changed” views temporarily include the #132 foundation commits; each PR body lists its intended incremental review scope. They will remain drafts and be rebased/refreshed as their dependencies land.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants