Skip to content

fix(rocm): make TVM-FFI index and store JIT kernels portable to HIP - #133

Draft
zihaomu wants to merge 9 commits into
FlashML-org:mainfrom
zihaomu:feat/rocm-rdna4-jit
Draft

fix(rocm): make TVM-FFI index and store JIT kernels portable to HIP#133
zihaomu wants to merge 9 commits into
FlashML-org:mainfrom
zihaomu:feat/rocm-rdna4-jit

Conversation

@zihaomu

@zihaomu zihaomu commented Aug 24, 2026

Copy link
Copy Markdown

Draft follow-up to #132. This branch is based on the #132 head. Until #132 merges, GitHub Files changed also includes the foundation diff; the incremental review scope of this PR is the four files listed below.

Summary

  • disable NVIDIA programmatic-dependent-launch instructions and launch attributes on ROCm while preserving the CUDA path;
  • accept kDLROCM tensors in the generic index and store TVM-FFI kernels;
  • keep the CUDA PTX implementation unchanged and use the HIP-compatible common launch path;
  • add cold/warm numerical tests for both index and store JIT modules.

Incremental review scope

Relative to zihaomu:feat/rocm-rdna3-rdna4-foundation:

  • python/freetoken/kernel/csrc/include/freetoken/utils.cuh
  • python/freetoken/kernel/csrc/jit/index.cu
  • python/freetoken/kernel/csrc/jit/store.cu
  • tests/kernels/test_jit_index_store.py

Diff size: 54 additions, 8 deletions.

Dependency

Validation

  • GPU: AMD Radeon AI PRO R9700 (gfx1201)
  • PyTorch 2.11.0+rocm7.14.0, HIP 7.14.60850
  • index/store cold and warm JIT numerical comparisons: PASS
  • focused JIT + pinned regression: PASS
  • final combined follow-up test set: 54 passed

Compatibility

CUDA branches remain behind the non-ROCm preprocessor path. Physical NVIDIA regression testing is not claimed; this PR remains Draft until #132 and CUDA CI establish the final base.

bouclem and others added 9 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
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