feat(rocm): enable native GGUF kernels on ROCm (validated on RDNA4) - #136
Draft
zihaomu wants to merge 13 commits into
Draft
feat(rocm): enable native GGUF kernels on ROCm (validated on RDNA4)#136zihaomu wants to merge 13 commits into
zihaomu wants to merge 13 commits into
Conversation
- 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
This was referenced Aug 24, 2026
nekomario28
added a commit
to nekomario28/FreeToken
that referenced
this pull request
Aug 25, 2026
nekomario28
added a commit
to nekomario28/FreeToken
that referenced
this pull request
Aug 25, 2026
Integrate exact upstream FlashML-org#135 semantics onto the current-main corrected ROCm composition while preserving FlashML-org#136. Temporary PR used only as a 3-way merge carrier.
Collaborator
|
@zihaomu Thanks for your support! Can you DM me through email or through slack/discord/wechat? We can discuss more about FreeToken-AMD support. |
zihaomu
force-pushed
the
feat/rocm-rdna4-gguf
branch
from
August 31, 2026 08:11
4959197 to
7b3acf2
Compare
|
I have an AMD XTX 7900 24GB to test it on RDNA 3 if you want ping me |
samuelishida
pushed a commit
to samuelishida/FreeToken
that referenced
this pull request
Sep 5, 2026
What: - Remove .agents/learnings and .plans/rocm-consolidation files from the branch. - Remove internal increment and plan-path references from source comments and public installation docs. - Keep implementation comments that explain correctness, ownership, profiler intent, source attribution, or ROCm safety behavior. - Clarify public ROCm documentation: gfx1100 has recorded serving smoke on ROCm 7.2.1; the ROCm 7.14.x container is a reference environment, and other target cells remain compile-only until physical serving evidence exists. Why: - Keep merge surface focused on code, tests, reproducibility tooling, and user-facing documentation. - Prevent private planning history, review workflow language, stale plan paths, and local process notes from entering the upstream repository. - Avoid presenting compile success or a reference container as cross-target serving or performance proof. Related upstream work informing this branch: - PR FlashML-org#132: portable ROCm/HIP foundation. - PR FlashML-org#133: TVM-FFI index/store portability. - PR FlashML-org#135: RCCL tensor-parallel communication. - PR FlashML-org#136: native GGUF ROCm build and Q4_0 kernels. - PR FlashML-org#137: earlier AMD serving bring-up. - PR FlashML-org#217: source-fork ROCm, Qwen3.5 GGUF, and performance experiments. - PR FlashML-org#241: gfx1150 build, JIT, Triton, and attention hardening. - PR FlashML-org#260: gfx1151 validation and fallback/build evidence. - PR FlashML-org#316: HIP graph-capture-safe expert copies. - PR FlashML-org#378: CPU/Hybrid MoE graph replay safety. - Local branch milestones: 436263f, 926c1e8, e1d1856, 8a70c7e, and e5fd30f. Evidence: - 170 focused tests passed after cleanup. - gfx1100 is the only target with end-to-end Qwen3.5 GGUF serving smoke recorded here. - Remaining matrix targets are compile-only; no new throughput claim is published without a matching A/B manifest.
Hekapo
pushed a commit
to Hekapo/FreeTokenROCm
that referenced
this pull request
Sep 6, 2026
Adapt the portable JIT and wave32 GGUF safeguards from upstream PRs FlashML-org#132, FlashML-org#133, and FlashML-org#136 while preserving the Windows ROCm build path and row-aware Triton fallback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FREETOKEN_ROCM_ARCHinto PyTorch's internalPYTORCH_ROCM_ARCHbuild path so PyTorch does not inject its full default architecture list;-mno-wavefrontsize64, with an additional header-level fail-fast for toolchains exposing the wavefront macro;ggml_mul_mat_vec_a8, and routedggml_moe_a8_vecagainst PyTorch references.Incremental review scope
Relative to
zihaomu:feat/rocm-rdna4-jit:python/freetoken/kernel/gguf.pypython/freetoken/kernel/utils.pypython/freetoken/kernel/csrc/gguf/dispatch.htests/kernels/test_gguf_rocm.pytests/utils/test_rocm_arch.pydocs/install.mdREADME.mdDiff size: 284 additions, 19 deletions.
Dependency
Validation
Hardware and software:
gfx1201)2.11.0+rocm7.14.0, HIP7.14.60850Fresh extension-cache result with only
FREETOKEN_ROCM_ARCH=gfx1201set:hipcccommand contained only--offload-arch=gfx1201plus-mno-wavefrontsize64;hipcccompilation and shared-library link: PASS;6 passedin 118.71 seconds;10 passed.Support scope and known limitations
Native GGUF is source/build enabled for FreeToken's declared wave32 RDNA3/RDNA4 target set (
gfx1100-gfx1103,gfx1200,gfx1201). The numerical validation in this PR was performed ongfx1201; RDNA3 GGUF hardware validation is not claimed yet. Non-RDNA/wave64 targets fail fast instead of risking silent reduction errors.Q4_0 production paths are validated. Other GGUF quant formats and full model serving remain out of scope. This PR remains Draft until #132 and #133 establish the final base.