Repository navigation
hy4_flash: fused iHC and HC CUDA kernels, contracts, controls, and 5-SM limits - #5100
Conversation
|
Thank you, @GrgaPalcic. All 18 production entries are reachable and recorded, and the four HC outputs have separate cases. The fixture-pin update matches the loader source; kernel/test code is unchanged from the reported run. The head merges cleanly and serving still uses the existing path. Four fixes remain:
Keep the reported passes within their tested scope. Synthetic GB10 inputs are enough for these operator repairs; no checkpoint is needed.
|
|
Updated
Verification receipts
|
|
Thank you for the four focused repairs. The HC kernel now matches the serial IHC arithmetic, including explicit FMA operations, and the contracts compare every collapsed, post-gate, merge, primary-output, updated-X and solo-row output byte. The fused-mode, aliasing and Your current-head synthetic contract and resource results cover the requested cells. I found no remaining correctness issue. This merges cleanly on current main and goes into our next landing train. No additional device or checkpoint run is needed for this kernel-only slice.
|
…ound_in, update head smem
c08cf5f to
2f6d9a5
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 the Hy4-flash fused iHC (
hy4_ihc_fused) and HC (hy4_hc) CUDA kernels, host-compilable launchers, contract gates, 13 planted controls, and 5-SM launch limits insidezig/src/families/hy4_flash/andzig/kernels/cuda/hy4_flash/(distincthy4_hcandhy4_ihc_fusedfatbins, zero collision withhy4_ihc):zig/kernels/cuda/hy4_flash/hc.cuh+hc.cu(hy4_hc): 3 production kernels (hy4_hc_pre,hy4_hc_head,hy4_hc_merge) in IEEE FP32 (--fmad=false --ftz=false --prec-div=true --prec-sqrt=true) reusing../common/reduce.cuhand../common/glue_math.cuh. Zero planted control symbols in the production fatbin.zig/kernels/cuda/hy4_flash/ihc_fused.cuh,ihc_fused_coop_prefill.cuh, andihc_fused.cu(hy4_ihc_fused): 15 production kernels covering 1-launch ticket, cooperative, tiled, and batched prefill iHC boundaries (boundary,entry,epilogue_head,head_only,post_only,post_vec,pre_tiled_rb2/rb4,head_tiled,prefill_m8/m4), reusing../common/cp_async.cuh,../common/reduce.cuh, and../common/vec.cuh.zig/kernels/cuda/contract_hy4_hc_controls.cuh(included fromcontract_controls_set.cu): 13 planted control kernels infatbin_contract_controlscovering non-finite drops, repeat drift, tail skips, and reduced-precision (bf16) sums.zig/src/families/hy4_flash/hc_cuda.zigandihc_fused_cuda.zig: host-compilable CUDA launchers with shared-memory budget unit tests, registered inzig/src/families/hy4_flash/host_tests.zigandzig/build/cuda.zig.zig/tests/cuda/contract_hy4_hc.zigandcontract_hy4_ihc_fused.zig(registered incontract_family_sets.zigandcontract_limits.zig): full 5-gate CUDA contract coverage across all 4hy4_hcoutputs, all 5hy4_ihc_fusedboundary modes (0-bit row invariance across launch arms), and all 13 planted controls.zig/src/core/contract/hy4_ihc_hc_records.zig(registered inregistry_joins.zig):nvcc 13.05-SM (sm_80, 86, 89, 120, 121) register/shared-memory/bound records (90 active SM records across 18 kernels).No served path, model load, or default is changed in this slice. Remaining work for #4795: paged absorbed MLA CUDA kernel slice, served W8A16
TP=2/TP=4+DFly2CUDA Graphs with serial token-equality receipts (BF16 KV only), and CUDA SigLIP2--vision+ 3D M-RoPE.main(f36acccdd, independent of hy4_flash: FP8 Engram CUDA kernels, contract gates, controls, and 5-SM limits (slice 2b of #4795) #5087, hy4_flash: paged sparse indexer CUDA kernels, contracts, controls, and 5-SM limits #5095, and hy4_flash: router, BF16 row helpers, and DFly2 glue CUDA kernels, contracts, and 5-SM limits #5099); adds 1 commit (625a0e4ac)atc overlap --json: shared CUDA kernel/contract registration files (cuda_kernels.zig,kernels.zig,cuda.zig,contract_controls_set.cu,contract_limits.zig,contract_family_sets.zig,registry_joins.zig) have expected list-append overlaps with open CUDA kernel PRs (hy4_flash: FP8 Engram CUDA kernels, contract gates, controls, and 5-SM limits (slice 2b of #4795) #5087, hy4_flash: paged sparse indexer CUDA kernels, contracts, controls, and 5-SM limits #5095, hy4_flash: router, BF16 row helpers, and DFly2 glue CUDA kernels, contracts, and 5-SM limits #5099); zero overlap on anyhy4_flashimplementation file.Checks on this head
625a0e4ace487af8610e8028242a55022517fffd(basef36acccdd9bd0200080a1d143be01ea83eaa2438)python3 tools/zig/lean_check.py, on the base and on this head:164on base (f36acccdd, inherited),164on head (625a0e4ac),0new (python3 tools/pr_check.py --base origin/main:0 error(s))python3 tools/zig/cuda_common_check.py:55 local copies, 0 violationspython3 tools/zig/cuda_fragment_check.py:2 fragments, 17 includes, 0 misses0.17.0,-Dfixed-cpu, Linux x86_64):zig build -Dfixed-cpu test-hy4-flash-host --summary all:50pass,0fail,0skip (exit0)zig build -Dfixed-cpu test-contract-images-host --summary all:6pass,0fail,0skip (exit0)zig build -Dfixed-cpu test-kernel-contract --summary all:328pass,0fail,0skip (exit0)zig build -Dfixed-cpu compile-cuda-tests: exit0zig fmt --check build.zig zig && git diff --check: exit0sm_121, CUDA13.0.88,nvcc 13.0, Zig0.17.0,-Dsm=80,86,89,120,121):zig build fatbins -Dnvcc=/usr/local/cuda/bin/nvcc -Dsm=80,86,89,120,121andzig build -Dnvcc=/usr/local/cuda/bin/nvcc -Dsm=80,86,89,120,121: exit0./zig-out/bin/tf-cuda-test kernel-contract hy4_hc(exit0):(filtered) SUMMARY 4 kernels: 4 pass gates 1-4, 0 fail, 0 known findings; 11 controls: 11 red as planted, 0 missed; 0 limit problems./zig-out/bin/tf-cuda-test kernel-contract hy4_ihc_fused(exit0):(filtered) SUMMARY 5 kernels: 5 pass gates 1-4, 0 fail, 0 known findings; 2 controls: 2 red as planted, 0 missed; 0 limit problems./zig-out/bin/tf-cuda-test kernel-contract-limits zig-out/fatbin: all90(18 × 5)hy4_hc/hy4_ihc_fused5-SM records reportedPASS ... (record current),0limit problemsReceipt
n/a — kernel-only CUDA slice with full 5-gate device contract and 5-SM launch-limit qualification; does not reach serving or change any model load/default.
sm_121, CUDA13.0.88) device contract & 5-SM fatbin limits (sm_80,86,89,120,121); macOS/Windows host builds covered by CIf36acccdd, head625a0e4ac, Zig0.17.0, CUDA13.0.88(nvcc 13.0), NVIDIA GB10 (sm_121, Linux aarch64); targets officialtencent/Hy4-flash-FP8@003107fa248f5892064ab1c43af0a7003dd68c9bsm_121) CUDA contract + 5-SM (80,86,89,120,121) fatbin limit checks; did not run physical SM 80/86/89/120 GPUs (compiled and checked againstnvcc 13.0limits)tools/bench_concurrent.py --alone --serialortoken_shaagainst"draft": false: n/a (kernel-only slice; float64 contract exactness, 0-bit row invariance across launch arms, non-finite class preservation, 5-run byte-identical repeatability, shape bounds, FP32 sum discrimination, and 13/13 red planted controls verified live onsm_121)tools/bench_openai.py: n/a (kernel-only slice)Checklist