mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #292] [CLOSED] NVFP4 routed experts: converter, pack, decode, prompt path (W4A8, W4A4 on Blackwell), AVX-512 CPU rows #2558
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2558
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/292
Author: @sergqwer
Created: 9/30/2026
Status: ❌ Closed
Base:
main← Head:pr/nvfp4📝 Commits (1)
0902837NVFP4 routed experts: converter, pack, decode, prompt path, AVX-512 CPU rows📊 Changes
23 files changed (+2035 additions, -54 deletions)
View changed files
📝
CMakeLists.txt(+20 -5)➕
docs/NVFP4.md(+145 -0)📝
include/strata/artifact/gguf_reader.hpp(+4 -0)📝
include/strata/kernels/cpu/native_expert.hpp(+7 -0)➕
include/strata/kernels/cpu/nvfp4_avx512.hpp(+28 -0)📝
include/strata/kernels/iq_kernels.hpp(+8 -4)📝
include/strata/prefill/kernels.hpp(+1 -1)📝
include/strata/prefill/moe_mmq.hpp(+29 -3)📝
src/kernels/cpu/native_expert.cpp(+38 -3)➕
src/kernels/cpu/nvfp4_avx512.cpp(+186 -0)➕
src/kernels/cpu/nvfp4_avx512_parity.cpp(+320 -0)📝
src/kernels/cuda/iq_kernels.cu(+109 -11)➕
src/kernels/nvfp4_expert_gpu_parity.cpp(+107 -0)📝
src/prefill/kernels.cu(+9 -4)➕
src/prefill/mmq_nvfp4_parity.cpp(+350 -0)➕
src/prefill/mmq_nvfp4_w4a8.cu(+24 -0)📝
src/prefill/moe_mmq.cu(+151 -11)📝
src/prefill/prefill.cpp(+51 -10)📝
src/program/generate.cpp(+6 -1)📝
tools/iq_pack.py(+32 -1)...and 3 more files
📄 Description
Summary
A ModelOpt NVFP4 checkpoint of Qwen3.8-Flash-Next runs on the native path: routed experts in NVFP4 (group 16), the
rest in the formats the native path already reads.
docs/NVFP4.mdhas the whole design and every measurement.These changes come from an NVFP4 fork of Strata (sergqwer/strata-nvfp4), ported onto current main one topic per PR.
Pipeline.
tools/nvfp4_convert.py): llama.cpp's own converter (the pinned commit) with the engine's typepolicy. The experts are repacked without loss;
tools/nvfp4_verify.pyandnvfp4_verify_gguf.pycompare them withthe checkpoint bit for bit.
tools/iq_pack.py): each NVFP4 blob gets a 16-byte tail{s_gate, s_up, s_down, 0}, the per-expertweight_scale_2. Every consumer that already moves whole blobs (arena, device cache, prefill staging, a secondGPU) then moves the scales with the weights.
experts.binis written by itself, because it is the only source withthe tails.
ggml). Each global scale multiplies its own projection's FP32 output: folding
s_downinto up put the hidden intoFP16's subnormals (2-12% expert error instead of 1.1%).
ggml-cpu without AVX-512.
hidden (
mmq_nvfp4_w4a8.cu). W4A4 (FP4 MMA, sm_120a) and FP16 are opt-in throughSTRATA_PREFILL_NVFP4.kernel was 40% of GPU time.
and guards the CUDA-only parts for HIP.
Measured
RTX 5090, Ryzen 9 9950X3D, 128 GB, Windows 11; this branch on main, 64K context, int8 K/V,
--vram-reserve-mib 1500:Precision of the prompt path, first-token KL against FP16, 8 prompts:
W4A8 reads prompts at 2,503 tok/s, W4A4 at 2,904 and FP16 at 1,905 (4-8K prompts, 262K context).
Tests
nvfp4_expert_gpu_parity: the decode kernels against ggml's reference.nvfp4_avx512_parity: the CPU rows against ggml-cpu.mmq_nvfp4_parity: the prompt path's products against FP64.Tested with, and what is not in this PR
jpezzulli/OrcaRouter-Qwen3.8-Flash-Next-Uncensored-ModelOpt-NVFP4.nvidia/Qwen3.8-Flash-Next-NVFP4quantizes its routed experts the same way (by itshf_quant_config.json), so ittakes the same path. I have not run it.
🤖 Generated with Claude Code
https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.