[PR #5299] [Engine] Enable generic NVFP4 W4A8 prefill and parity tools on HIP #5375

Open
opened 2026-11-07 16:34:44 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/5299
Author: @Tsury
Created: 11/5/2026
Status: 🔄 Open

Base: main ← Head: hip-nvfp4-parity


📝 Commits (4)

  • 0f07ce3 test: expose NVFP4 parity tools on HIP
  • 7c64648 feat: enable NVFP4 W4A8 prefill on HIP
  • 464a1c7 docs: record HIP NVFP4 parity and manual build support
  • 652904b fix: keep HIP NVFP4 W4A8 explicitly opt-in

📊 Changes

3 files changed (+39 additions, -12 deletions)

View changed files

📝 CMakeLists.txt (+9 -3)
📝 docs/NVFP4.md (+22 -5)
📝 src/prefill/moe_mmq.cu (+8 -4)

📄 Description

HIP builds already instantiate the native NVFP4 decode kernels, but the prompt path compiles out NVFP4 MMQ support. Compile the existing generic W4A8 unit for HIP and route NVFP4 products to it only with explicit STRATA_PREFILL_NVFP4=w4a8. HIP keeps its FP16 default. W4A4 stays CUDA-only.

The change also exposes the existing NVFP4 GPU parity/bandwidth executables on HIP and adds the prompt parity executable to its build. The numerical kernels and pack format are unchanged. Setup continues to offer NVFP4 packs on NVIDIA only; the documented HIP route uses an existing pack manually.

Passed

The executions below used engine commit 7c6464855a83142607f05555b9eebf23896fb922, before the later opt-in-only host gate. The numerical kernels and explicit-W4A8 active path are unchanged in the latest head.

Strix Halo gfx1151, ROCm 7.14.1, AMD clang 23, v0.2.10 base ffa80d73133ea5c548aefe57889a16e8085a938f, pinned GGML 3cf03257f219afbe7334045ff7c6a06ac68c627d:

  • Built strata, nvfp4_expert_gpu_parity, mmq_nvfp4_parity, nvfp4_decode_bench, nvfp4_avx512_parity, and native_arithmetic_parity with HIP gfx1151, portable CPU baseline, MMQ and tests enabled.
  • CPU NVFP4 parity: AVX2 bit-exact; AVX512 worst normalized deviation 3.31e-7 synthetic and 3.22e-7 on the real expert. All 4,866,048 finite bitwise arithmetic comparisons passed.
  • nvfp4_expert_gpu_parity pack/experts.bin: all six default experts passed; worst relative output error against FP64 1.165% (the two activation quantizations remain).
  • STRATA_PREFILL_NVFP4=w4a8 mmq_nvfp4_parity pack/experts.bin: all default gate/up and down products passed at 1/7/37/128/300 rows, relative error 0.5243–0.5569%.
  • The same program with --group: all three grouped products passed, relative error 0.5361–0.5374%.

The public pack used was OrcaRouter NVFP4 GPTQ, revision 2692e6abba95729fd60094099a773a20b9fca228; all files matched its SHA256SUMS. Decode parity and prompt parity use their existing independent FP64 references. These results establish numerical checks on gfx1151, not model quality or other HIP architectures.

Failed

None in the numerical checks above.

Not run / targeted help

This PR is a draft under CONTRIBUTING.md until the current head is built on every affected backend. The current-head HIP build passed (strata, mmq_nvfp4_parity). A CPU-only host-gate probe with HIP_VISIBLE_DEVICES=-1 returned supported=0 with the variable unset or fp16, supported=1 with explicit w4a8, and supported=0 with w4a4. CUDA compilation and execution are not available in this environment. SYCL uses its separate CMake project and does not compile these sources.

Targeted help requested: build the current head with STRATA_ENABLE_CUDA=ON, a supported CUDA architecture and the pinned GGML source, including strata, nvfp4_expert_gpu_parity, and mmq_nvfp4_parity. Please report compiler/version/architecture and the result here. CUDA compatibility is not claimed without that check.

Default and limits

HIP W4A8 is explicit opt-in; an unset STRATA_PREFILL_NVFP4 retains the existing FP16 fallback. Source inspection establishes that guard; a before/after default-path byte comparison remains pending. The installer choices are unchanged. No performance gain or model-quality equivalence is claimed.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/5299 **Author:** [@Tsury](https://github.com/Tsury) **Created:** 11/5/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `hip-nvfp4-parity` --- ### 📝 Commits (4) - [`0f07ce3`](https://github.com/Niko1221/Strata/commit/0f07ce389ce376dc5e60818eb049992a744a57b8) test: expose NVFP4 parity tools on HIP - [`7c64648`](https://github.com/Niko1221/Strata/commit/7c6464855a83142607f05555b9eebf23896fb922) feat: enable NVFP4 W4A8 prefill on HIP - [`464a1c7`](https://github.com/Niko1221/Strata/commit/464a1c7022ad0e6df1e11a9a06ccd8035ccabf9d) docs: record HIP NVFP4 parity and manual build support - [`652904b`](https://github.com/Niko1221/Strata/commit/652904b6826cb0a61110053a4fb3181072ee2a7c) fix: keep HIP NVFP4 W4A8 explicitly opt-in ### 📊 Changes **3 files changed** (+39 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+9 -3) 📝 `docs/NVFP4.md` (+22 -5) 📝 `src/prefill/moe_mmq.cu` (+8 -4) </details> ### 📄 Description HIP builds already instantiate the native NVFP4 decode kernels, but the prompt path compiles out NVFP4 MMQ support. Compile the existing generic W4A8 unit for HIP and route NVFP4 products to it only with explicit `STRATA_PREFILL_NVFP4=w4a8`. HIP keeps its FP16 default. W4A4 stays CUDA-only. The change also exposes the existing NVFP4 GPU parity/bandwidth executables on HIP and adds the prompt parity executable to its build. The numerical kernels and pack format are unchanged. Setup continues to offer NVFP4 packs on NVIDIA only; the documented HIP route uses an existing pack manually. ## Passed The executions below used engine commit `7c6464855a83142607f05555b9eebf23896fb922`, before the later opt-in-only host gate. The numerical kernels and explicit-W4A8 active path are unchanged in the latest head. Strix Halo gfx1151, ROCm 7.14.1, AMD clang 23, v0.2.10 base `ffa80d73133ea5c548aefe57889a16e8085a938f`, pinned GGML `3cf03257f219afbe7334045ff7c6a06ac68c627d`: - Built `strata`, `nvfp4_expert_gpu_parity`, `mmq_nvfp4_parity`, `nvfp4_decode_bench`, `nvfp4_avx512_parity`, and `native_arithmetic_parity` with HIP gfx1151, portable CPU baseline, MMQ and tests enabled. - CPU NVFP4 parity: AVX2 bit-exact; AVX512 worst normalized deviation 3.31e-7 synthetic and 3.22e-7 on the real expert. All 4,866,048 finite bitwise arithmetic comparisons passed. - `nvfp4_expert_gpu_parity pack/experts.bin`: all six default experts passed; worst relative output error against FP64 1.165% (the two activation quantizations remain). - `STRATA_PREFILL_NVFP4=w4a8 mmq_nvfp4_parity pack/experts.bin`: all default gate/up and down products passed at 1/7/37/128/300 rows, relative error 0.5243–0.5569%. - The same program with `--group`: all three grouped products passed, relative error 0.5361–0.5374%. The public pack used was [OrcaRouter NVFP4 GPTQ](https://huggingface.co/Maximilian228/OrcaRouter-Qwen3.8-Flash-Next-Uncensored-NVFP4-GPTQ-Strata/tree/2692e6abba95729fd60094099a773a20b9fca228), revision `2692e6abba95729fd60094099a773a20b9fca228`; all files matched its SHA256SUMS. Decode parity and prompt parity use their existing independent FP64 references. These results establish numerical checks on gfx1151, not model quality or other HIP architectures. ## Failed None in the numerical checks above. ## Not run / targeted help This PR is a draft under CONTRIBUTING.md until the current head is built on every affected backend. The current-head HIP build passed (`strata`, `mmq_nvfp4_parity`). A CPU-only host-gate probe with `HIP_VISIBLE_DEVICES=-1` returned supported=0 with the variable unset or `fp16`, supported=1 with explicit `w4a8`, and supported=0 with `w4a4`. CUDA compilation and execution are not available in this environment. SYCL uses its separate CMake project and does not compile these sources. Targeted help requested: build the current head with `STRATA_ENABLE_CUDA=ON`, a supported CUDA architecture and the pinned GGML source, including `strata`, `nvfp4_expert_gpu_parity`, and `mmq_nvfp4_parity`. Please report compiler/version/architecture and the result here. CUDA compatibility is not claimed without that check. ## Default and limits HIP W4A8 is explicit opt-in; an unset `STRATA_PREFILL_NVFP4` retains the existing FP16 fallback. Source inspection establishes that guard; a before/after default-path byte comparison remains pending. The installer choices are unchanged. No performance gain or model-quality equivalence is claimed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#5375
No description provided.