Repository navigation
hy4_flash: W8A16 CUDA weight packing for qmmf projections and TP=1/2/4 FP8 experts (slice 2a of #4795) - #4895
Conversation
d9a0d2c to
6bd6b95
Compare
|
The clean trial merge of I added a host fixture for two stacked 64-row slices starting at rows 100 and 127, with 128 columns starting at 64. Those slices cross the checkpoint's 128×128 scale blocks in both dimensions. Hard-coded expectations check the four transitions in the packed scale array, and all 32 tests pass. In a scratch control that rounds only stacked source row offsets down to 128, the original 31 tests still pass and the new fixture fails. This would protect the nonaligned slice behavior if the helper is reused for another share layout. Igor Lessio - AIFLOW LABS |
|
Thanks for testing the trial merge on M5 Max and for the suggestion, @AIFlowML! I added that host fixture in
|
|
Thanks, @GrgaPalcic. The new stacked-slice fixture covers the requested scale-block transitions. The packing preserves stored codes and BF16 words, widens scales exactly and keeps the slice/refusal checks. Safe to land as the host-only packing slice. CUDA kernels, distributed serving and token-equality qualification remain for the later integrations.
|
|
I checked the boundary fixture on the exact #5010 landing train, As a negative control in scratch, rounding the source row offset down to a 128-row boundary made the new test fail at its first transition (expected 3, found 1). The other 31 host tests passed. Restoring the exact row offset brought it back to 32/32. Thanks for adding that case. Igor Lessio - AIFLOW LABS |
30e31ad to
d9f900a
Compare
|
Thank you @GrgaPalcic. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
What this changes
Adds host-side W8A16 CUDA weight packing for
tencent/Hy4-flash-FP8insidezig/src/families/hy4_flash/(fp8_pack.zigandfp8_pack_test.zig), building directly on #4827 (fp8_weights.zig,fp8_partition.zig) andcuda.qmmf/cuda.fp8/cuda.experts.Fp8Experts:pack: stacks one or more BF16 or block-128 E4M3 projections by rows and slices 64-element input groups intocuda.qmmflayouts (qmmf.packBf16orcuda.fp8.packCodes+cuda.fp8.packScalesAtwith exact BF16→FP32 scale widening viacore.quant.fp8.widen), refusing empty parts, mixed formats, unaligned slices, out-of-range slices, and non-finite scales without requantizing.packHConcat: horizontally concatenates two BF16 column slices intoqmmfBF16 layout with bounds and 64-element group checks.hostExperts: slices stacked[E, 2w, L]gate_up_projand[E, L, w]down_projFP8 routed experts and their BF16weight_scale_invtensors on 128-row blocks acrossTP=1/2/4intocuda.experts.Fp8Experts(packGateUp/packOne) + widened FP32 scale buffers, refusing unaligned shares, malformed shapes, and non-finite scales.cuda(host runtime, no GPU images) intozig/build/hy4_flash.zigand addsfp8_pack_test.zigtohost_tests.zig(42/42pass intest-hy4-flash-host).No served path, model load, default, or GPU kernel is changed in this slice. Remaining work for #4795: CUDA kernels + kernel contract gates/controls/limits, served W8A16
TP=2/TP=4+DFly2CUDA Graphs with serial token-equality receipts, and SigLIP2--vision+ 3D M-RoPE on CUDA.main(9a38b1f7b, rebased cleanly after hy4_flash: the NVFP4 build's quantization block and weight map, with recipe and receipts (slice 1 of #3801) #4110 landed inhost_tests.zig); adds 2 commits (6bd6b9590,30e31ad24)atc overlap --json: run on30e31ad24againstorigin/main(9a38b1f7b) —changedFiles: 4,overlaps: [],worktreeOverlaps: [](complete: false,limitations: ["otherPullRequestsLimit", "pullFilesUnavailable", "pullRequestsLimit", "timeLimit"]).Checks on this head
30e31ad248b8eb3b76b1cc6c32b8c5c5e22491ca(base9a38b1f7b33863507cdea47e88207d8b3bea3f22)python3 tools/zig/lean_check.py, on the base and on this head:165on base (9a38b1f7b, inherited),165on head (30e31ad24),0new (python3 tools/pr_check.py --base origin/main:0 error(s))zig build -Dfixed-cpu test-hy4-flash-host --summary allon30e31ad24(Zig0.17.0, Linux x86_64):42pass,0fail,0skip (34baseline +8new; exit0)zig fmt --check build.zig zig && git diff --check: exit030e31ad24(fmt,zig,zig-b,zig-windows,zig-macos-dev-tools,pytest,release-paths (ubuntu-24.04),benchmark-clients (ubuntu-latest),benchmark-clients (windows-latest),comfyui-moss-installer).Receipt
n/a — host-only weight-packing module and unit tests; does not reach inference, model load, serving, or any GPU kernel.
9a38b1f7b, head30e31ad24, Zig0.17.0(-Dfixed-cpu), Linux x86_64 host (no GPU); targets officialtencent/Hy4-flash-FP8@003107fa248f5892064ab1c43af0a7003dd68c9btools/bench_concurrent.py --alone --serialortoken_shaagainst"draft": false: n/a (does not reach inference; exactness againstcuda.qmmf.packBf16,cuda.fp8.packCodes/packScalesAt, andcuda.experts.Fp8Experts.packGateUp/packOneplus refusal controls is verified infp8_pack_test.zig)tools/bench_openai.py: n/a (host-only slice)Checklist