Skip to content

cuda mla: 256-wide v heads and a per-head sink merge, the merge's body moved from hy4_flash to common/mla.cuh - #5084

Merged
ashhart merged 3 commits into
ashhart:mainfrom
Bizuayeu:pr/mla-v256-sink
Nov 26, 2026
Merged

ashhart merged 3 commits into
ashhart:mainfrom
Bizuayeu:pr/mla-v256-sink

Conversation

@Bizuayeu

@Bizuayeu Bizuayeu commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Core's CUDA MLA image (mla.cu, cuda.mla) gains the two pieces ERNIE 5.5's DSA layers need beyond what it has (latent 512, q_nope 192, 64 roped columns, v 256, and a per-head sink), both with hy4_flash's arithmetic:

  • tf_mla_expand_v_256: tf_mla::expand_v at 256-wide v heads. The body is already in common/mla.cuh, and hy4_flash instantiates it as tf_hy4_expand_v in its own image. Mla.expandV takes 128 or 256.
  • tf_mla_merge_sink: the chunk tiles' partials merged with each head's fp32 sink counted once as a zero-value key, a block of 128 per (row, head), bf16 out. Its body is hy4_flash's tf_hy4_attend_merge, moved to common/mla.cuh as tf_mla::merge_sink, with one change: each entry passes its thread's column (threadIdx.x * 4) in, so that tf_hy4_attend_merge's SASS stays main's (below). tf_hy4_attend_merge now calls it, in its own image, with its entry name and --fmad=false. Mla.mergeSink launches the new entry.
  • geometry() takes the widths the kernels take: q_nope 128 or 192 (both absorbs exist) and v 128 or 256. Nothing outside mla.zig calls it today.

GLM's path uses neither entry. GLM expands with its own tf_glm_expand_v and merges with tf_glm_merge, and the mla image's existing entries are unchanged (SASS below). hy4_flash's latent experts stay as they are: they are only core calls, which ERNIE can make too (agreed in the comment below).

Checks on this head

  • The GB10 run's identities and results (the lines themselves, the contract's gate lines for each kernel among them, are in "The GB10 run's lines", after the kernel contract):
    • The runner that ran mla-sink and kernel-contract mla, from this tree's second build (below): sha256 2b69a44ff145022dee383cb6182ae319f12bcc19e93156e788593ea6b744406a, 519,188,712 bytes. It embeds mla.fatbin, sha256 5f1ceaf89db7380d0476deb1208fddfe02d038eb0f2e6293986d247d2cacef28, hy4_mla_attention.fatbin, a779939acc8f33b36c68e7b1f87e95e3cab00bc9412c1f27df51fa70f6a97858, and glm_glue.fatbin, 7b8ead2250df343be0e8a2898b743d680aa2e595902229a5d1f777c054d1b868: each file in zig-out/fatbin, which the limits and the SASS comparison read, is found byte for byte once inside the runner.
    • tf-cuda-test kernel-contract mla, exit 0: (filtered) SUMMARY 10 kernels: 10 pass gates 1-4, 0 fail, 0 known findings; 11 controls: 11 red as planted, 0 missed; 0 limit problems; gates 32619 ms, limits 2 ms
    • tf-cuda-test kernel-contract-limits zig-out/fatbin: the two new launches' 10 records (sm_80, 86, 89, 120 and 121) are current; exit 1 with 154 problems, the same 154 as on main, none of them this pull request's.
    • Main 8e0548f715's images: hy4_mla_attention.fatbin, which mla-sink loads from its path, has the same sha256 as this tree's; mla.fatbin is 620ec31e3299374eacdf653e23e029f001ce46ed691e32cd4bb3c13f5a1a0925 and glm_glue.fatbin fddc0e248769be4bdde544c779102d2dea4319423463b0e8e4df03ff355b037f (other bytes than this tree's, with the same SASS function by function, under Receipt).
  • Head commit: b3fca7fcf3 on main 8e0548f715. The GB10's runs below are on 5e47d70a19, which differs from this head only in text: its CHANGELOG.md line reads #TBD where this head names this pull request. The runs in WSL 2, CI's pytest command among them, are on 33f5a3c9fa, a form I did not push, which also has the two new launch records at zero.
  • Lean checker, python3 tools/zig/lean_check.py, on the base and on this head: 164 problems on main 8e0548f715 and 164 on this head, 0 new (tools/zig/lean_new.py). The 164 are inherited from main. common/mla.cuh grows from 342 to 365 lines and mla.zig from 188 to 210; the new test has 131.
  • Tests run, with the command and pass, fail and skip counts (Zig 0.17.0, nvcc 13.0.88, one GB10, sm_121):
    • On the GB10, this tree and main 8e0548f715, each built from an empty global cache with zig build compile-cuda-tests fatbins kernel-contract-fatbins -Dnvcc="$NVCC" -Dsm=80,86,89,120,121 ($NVCC is nvcc 13.0.88) (exit 0 both); this tree was built once more in the same cache after its two new launch records were filled from the first build's limits, and the runs below use that build. tf-cuda-test mla-sink "$MAIN/zig-out/fatbin/hy4_mla_attention.fatbin" ($MAIN is main's tree): exit 0, PASS sink merge: 18 shapes, tf_mla_merge_sink gives tf_hy4_attend_merge's bytes; at most 9.958750745463797e-1 of the float64 bound and PASS sink merge: tf_hy4_attend_merge gives the other build's bytes at all 18 shapes. The 18 shapes are hy4_flash's (64 heads of one chunk, 32 and 16 of one, 32, 16 and 8 of four) at 1, 17 and 64 rows, on synthetic partials and sinks; the bound is bf16's rounding of the float64 result, |want| * 2^-8, plus 2^-20 of the summed magnitude over the denominator. tf-cuda-test kernel-contract mla: exit 0 (its SUMMARY is in the first item).
    • On the GB10, this tree: zig build -Dfixed-cpu test-cuda-host --summary all failed one test the first time, 501 of 503 steps succeeded, 9,527 of 9,572 tests passed, 44 skipped, 1 failed: start_cli_test's "start CLI: Ctrl-C during a deferred download has its normal process effect" (expect(W.IFSIGNALED(status))); run again at once in the same tree, 503 of 503 steps succeeded (3,617 of 3,628 tests passed, 11 skipped, in the steps that ran again). That test reads none of the files this changes; on this branch's first form (3c7185694f, not pushed, with the same two records filled), whose Zig files are this head's, the same command passed 503 of 503 steps, 9,528 of 9,572 tests, 44 skipped. test-kernel-contract: 43 of 43 steps, 323 of 323 tests passed; test-gradient-serving: 4 of 4 steps, 1 of 1 test passed. In WSL 2 (x86-64 Ubuntu 24.04), 33f5a3c9fa: zig fmt --check and zig ast-check on the 8 Zig files, and git diff --check, clean; zig build -Dfixed-cpu compile-cuda-tests without nvcc, 12 of 12 steps; tools/zig/check_cuda_sources.py with a clang++ on the four CUDA sources that this changes or that include common/mla.cuh, 18 of 24 checks passed, as on 8e0548f715 (the 6 that fail stop at glm_index_rope.cuh's memcpy, the same on both); python3 -m unittest discover -s tools/zig -p host_tests_test.py, 14 tests OK; python -m pytest -q -rs -p no:cacheprovider from the root, with pytest 9.2.0 and PyYAML 6.0.4 and a clang++ on PATH: 821 passed, 106 skipped, 826 subtests passed, the same counts and skip reasons as 8e0548f715.
  • CI: green on b3fca7fcf3: fmt, zig, zig-b, zig-windows, zig-macos-dev-tools, pytest (822 passed, 105 skipped, 826 subtests passed; the run in WSL 2 above has 821 and 106, and the CI log does not print skip reasons), release-paths (ubuntu-24.04), comfyui-moss-installer and both benchmark-clients jobs passed; host-nightly-linux and host-nightly-macos were skipped. The annotations are GitHub's Node.js 20 deprecation warnings and a macOS runner queue notice.
  • Not run, and why: other GPUs than the GB10 (sm_121) for the gates; the new launch records are nvcc 13.0's for sm_80, 86, 89, 120 and 121 (13.3's are pending, as for the image's other entries); Metal and HIP (no change there); a served model (no checkpoint calls the new entries yet, and hy4_flash's attention has no served CUDA path on main).

Receipt

n/a for serving: no served checkpoint's tokens or speed change. The receipt is hy4_flash's bytes, the SASS and the contract below.

  • Main against branch: cuobjdump -sass of each tree's hy4_mla_attention, mla and glm_glue fatbins above, compared function by function at all five SMs (tools/zig/sass_compare.sh counts the two added entries as a difference): hy4_mla_attention, 10 of 10 (SM, function) pairs equal, tf_hy4_attend_merge's among them; mla, all 40 of main's pairs equal, and tf_mla_expand_v_256 and tf_mla_merge_sink added at each SM; glm_glue, 250 of 250 equal. With the column read inside the moved body instead (the first form, 3c7185694f, not pushed), nvcc 13.0.88 gave tf_hy4_attend_merge other SASS at sm_120 and sm_121 (the same at sm_80, 86 and 89, and the same bytes on the GB10 at the 18 shapes); with each entry passing it, as here, the SASS is main's at all five.
  • Boxes it reaches: CUDA MLA, when a family calls the new entries; hy4_flash's CUDA attention merge.
  • New switch? None.
  • Environment: TensorFold main 8e0548f715 and this head, Zig 0.17.0, nvcc 13.0.88, one GB10 (sm_121).
  • Exactness: tf_hy4_attend_merge gives main's bytes and tf_mla_merge_sink gives tf_hy4_attend_merge's, at hy4_flash's shapes, as above.
  • Decode and prompt speed: n/a, no served path changes.
  • Licence of any new weights or drafter: n/a.
Kernel contract, only when a GPU kernel is new or changed
  • Kernels registered with the contract, and the kernel each one replaces: tf_mla_expand_v_256 (contract_mla_proj.zig, rows 1, 8 and 70 at 32 and 64 heads) and tf_mla_merge_sink (contract_mla_chunks.zig, through tf_mla_chunks_r16 at four chunks of 32 heads, one of 64 and two of 32), new, against float64. Rounding points and sum order: the expand is the 128-wide entry's chain at 256 columns; the merge rescales each chunk by expf(m - top) and sums mass and output in chunk order with explicit fmas, starting from the sink's expf(sink - top), and rounds once to bf16.
  • A planted control for each new kernel, and each one fails as planted: tf_mla_expand_v_256 reading each head's weights from the next head, and tf_mla_merge_sink with every sink left out (each head's sink drawn from -2 to 8, so it holds from a few percent to most of the merge's mass).
  • Each backend's SUMMARY line and exit status, and the limits: under "Checks on this head", first, with the images tested (the contract exits 0; the limits exit 1 with the same 154 stale records of other images as main 8e0548f715; the 10 RED lines are the limits tool's own planted controls, the same on main). The two new controls go red at the shapes gate, tf_mla_expand_v_256's at 616 times its bound and tf_mla_merge_sink's at 1.26 times; the new records hold tf_mla_expand_v_256 at 96 or 95 registers and 128 static shared bytes, tf_mla_merge_sink at 31 to 40 registers.
  • Chips I could not run: every CUDA GPU but the GB10.
The GB10 run's lines

From the runs and the images named under "Checks on this head", as the runner printed them; the FAIL lines are the planted controls' own.

tf-cuda-test mla-sink "$MAIN/zig-out/fatbin/hy4_mla_attention.fatbin", exit 0:

PASS sink merge: 18 shapes, tf_mla_merge_sink gives tf_hy4_attend_merge's bytes; at most 9.958750745463797e-1 of the float64 bound
PASS sink merge: tf_hy4_attend_merge gives the other build's bytes at all 18 shapes

tf-cuda-test kernel-contract mla, exit 0:

N/A  cuda affine4 MLP128 replacement bits: cluster path needs sm_90 or newer, this GPU is sm_121
N/A  cuda affine4 MLP128 FP64: cluster path needs sm_90 or newer, this GPU is sm_121
PASS nonfinite cuda mla tf_mla_gate (head-wise sigmoid gate, in place): 130 non-finite and 20350 finite outputs match the float64 classes
PASS repeat cuda mla tf_mla_gate (head-wise sigmoid gate, in place): five runs byte-identical (8192 bytes), inputs and guards untouched, no overlap
PASS shapes cuda mla tf_mla_gate (head-wise sigmoid gate, in place): 2 shapes within the float64 bound (worst 0.962 of the bound), 0 edges refused by the kernel
N/A  sums cuda mla tf_mla_gate (head-wise sigmoid gate, in place): declares none sums
PASS nonfinite cuda mla tf_mla_rope (plain, positions from 1,000): 4 non-finite and 10236 finite outputs match the float64 classes
PASS repeat cuda mla tf_mla_rope (plain, positions from 1,000): five runs byte-identical (4096 bytes), inputs and guards untouched, no overlap
PASS shapes cuda mla tf_mla_rope (plain, positions from 1,000): 2 shapes within the float64 bound (worst 0.996 of the bound), 0 edges refused by the kernel
N/A  sums cuda mla tf_mla_rope (plain, positions from 1,000): declares none sums
PASS nonfinite cuda mla tf_mla_rope (YaRN's attention factor, positions from 900,000): 4 non-finite and 10236 finite outputs match the float64 classes
PASS repeat cuda mla tf_mla_rope (YaRN's attention factor, positions from 900,000): five runs byte-identical (4096 bytes), inputs and guards untouched, no overlap
PASS shapes cuda mla tf_mla_rope (YaRN's attention factor, positions from 900,000): 2 shapes within the float64 bound (worst 0.995 of the bound), 0 edges refused by the kernel
N/A  sums cuda mla tf_mla_rope (YaRN's attention factor, positions from 900,000): declares none sums
FAIL shapes control: mla tf_mla_gate gates each head by the next head's column: at 1x32x128 output 0 is 9.570313e-2 where float64 gives 1.597394e-1: 51.21 of its bound
CONTROL control: mla tf_mla_gate gates each head by the next head's column: red at shapes, as planted
FAIL shapes control: mla tf_mla_rope (plain) turns each row by the next position's angle: at 1x32x64 output 0 is -5.000000e0 where float64 gives -9.867009e-1: 1040.57 of its bound
CONTROL control: mla tf_mla_rope (plain) turns each row by the next position's angle: red at shapes, as planted
FAIL shapes control: mla tf_mla_rope (YaRN) leaves the attention factor out: at 1x32x64 output 0 is -1.093750e0 where float64 gives -1.248834e0: 31.78 of its bound
CONTROL control: mla tf_mla_rope (YaRN) leaves the attention factor out: red at shapes, as planted
PASS nonfinite cuda mla tf_mla_absorb_q_128 (q_nope . wk into the latent): 1536 non-finite and 90624 finite outputs match the float64 classes
PASS repeat cuda mla tf_mla_absorb_q_128 (q_nope . wk into the latent): five runs byte-identical (36864 bytes), inputs and guards untouched, no overlap
PASS shapes cuda mla tf_mla_absorb_q_128 (q_nope . wk into the latent): 6 shapes within the float64 bound (worst 0.995 of the bound), 0 edges refused by the kernel
PASS sums cuda mla tf_mla_absorb_q_128 (q_nope . wk into the latent): exact sums at k 128, where fp16 sums would miss by infx and bf16 by 224x
PASS nonfinite cuda mla tf_mla_expand_v_128 (latent . wv into 128-wide v heads): 384 non-finite and 20096 finite outputs match the float64 classes
PASS repeat cuda mla tf_mla_expand_v_128 (latent . wv into 128-wide v heads): five runs byte-identical (8192 bytes), inputs and guards untouched, no overlap
PASS shapes cuda mla tf_mla_expand_v_128 (latent . wv into 128-wide v heads): 6 shapes within the float64 bound (worst 0.994 of the bound), 0 edges refused by the kernel
PASS sums cuda mla tf_mla_expand_v_128 (latent . wv into 128-wide v heads): exact sums at k 512, where fp16 sums would miss by infx and bf16 by 177x
FAIL shapes control: mla tf_mla_absorb_q_128 reads each head's wk from the next head: at 1x32x128 output 0 is 6.757813e-1 where float64 gives 6.710047e-1: 1.82 of its bound
CONTROL control: mla tf_mla_absorb_q_128 reads each head's wk from the next head: red at shapes, as planted
FAIL shapes control: mla tf_mla_expand_v_128 reads each head's wv from the next head: at 1x32x512 output 0 is 1.109375e0 where float64 gives 9.096877e-1: 55.71 of its bound
CONTROL control: mla tf_mla_expand_v_128 reads each head's wv from the next head: red at shapes, as planted
PASS nonfinite cuda mla tf_mla_absorb_q_192 (full GLM-5.3's q_nope . wk into the latent): 1536 non-finite and 61824 finite outputs match the float64 classes
PASS repeat cuda mla tf_mla_absorb_q_192 (full GLM-5.3's q_nope . wk into the latent): five runs byte-identical (25344 bytes), inputs and guards untouched, no overlap
PASS shapes cuda mla tf_mla_absorb_q_192 (full GLM-5.3's q_nope . wk into the latent): 6 shapes within the float64 bound (worst 0.995 of the bound), 0 edges refused by the kernel
PASS sums cuda mla tf_mla_absorb_q_192 (full GLM-5.3's q_nope . wk into the latent): exact sums at k 192, where fp16 sums would miss by infx and bf16 by 186x
FAIL shapes control: mla tf_mla_absorb_q_192 reads each head's wk from the next head: at 1x22x192 output 0 is -2.390625e0 where float64 gives 9.810516e-1: 877.44 of its bound
CONTROL control: mla tf_mla_absorb_q_192 reads each head's wk from the next head: red at shapes, as planted
PASS nonfinite cuda mla tf_mla_expand_v_256 (latent . wv into 256-wide v heads): 768 non-finite and 40192 finite outputs match the float64 classes
PASS repeat cuda mla tf_mla_expand_v_256 (latent . wv into 256-wide v heads): five runs byte-identical (16384 bytes), inputs and guards untouched, no overlap
PASS shapes cuda mla tf_mla_expand_v_256 (latent . wv into 256-wide v heads): 6 shapes within the float64 bound (worst 0.994 of the bound), 0 edges refused by the kernel
PASS sums cuda mla tf_mla_expand_v_256 (latent . wv into 256-wide v heads): exact sums at k 512, where fp16 sums would miss by infx and bf16 by 233x
FAIL shapes control: mla tf_mla_expand_v_256 reads each head's wv from the next head: at 1x32x512 output 0 is 1.453125e0 where float64 gives -1.019910e0: 616.05 of its bound
CONTROL control: mla tf_mla_expand_v_256 reads each head's wv from the next head: red at shapes, as planted
PASS nonfinite cuda mla tf_mla_chunks_r16 (576-wide q and keys, dense over a linear cache), with tf_glm_merge: 96324 non-finite and 34748 finite outputs match the float64 classes
PASS repeat cuda mla tf_mla_chunks_r16 (576-wide q and keys, dense over a linear cache), with tf_glm_merge: five runs byte-identical (262144 bytes), inputs and guards untouched, no overlap
PASS shapes cuda mla tf_mla_chunks_r16 (576-wide q and keys, dense over a linear cache), with tf_glm_merge: 3 shapes within the float64 bound (worst 0.209 of the bound), 0 edges refused by the kernel
PASS sums cuda mla tf_mla_chunks_r16 (576-wide q and keys, dense over a linear cache), with tf_glm_merge: within its bound at k 1024; fp16 sums would miss 0x, bf16 0.4x (online softmax over 512-key chunks, then the chunk merge: no input makes its sums exact in fp32)
PASS nonfinite cuda mla tf_mla_chunks_split_r16 and tf_mla_merge_part (a split cache's two halves), with tf_glm_merge: 103478 non-finite and 27594 finite outputs match the float64 classes
PASS repeat cuda mla tf_mla_chunks_split_r16 and tf_mla_merge_part (a split cache's two halves), with tf_glm_merge: five runs byte-identical (262144 bytes), inputs and guards untouched, no overlap
PASS shapes cuda mla tf_mla_chunks_split_r16 and tf_mla_merge_part (a split cache's two halves), with tf_glm_merge: 3 shapes within the float64 bound (worst 0.203 of the bound), 0 edges refused by the kernel
PASS sums cuda mla tf_mla_chunks_split_r16 and tf_mla_merge_part (a split cache's two halves), with tf_glm_merge: within its bound at k 1024; fp16 sums would miss 0x, bf16 0.4x (online softmax over 512-key chunks, then the chunk merge: no input makes its sums exact in fp32)
FAIL shapes control: mla tf_mla_chunks_r16 reads each head's queries from the next head: at 8x16384x1024 output 0 is -1.391602e-2 where float64 gives -1.691224e-2: 1.40 of its bound
CONTROL control: mla tf_mla_chunks_r16 reads each head's queries from the next head: red at shapes, as planted
FAIL shapes control: mla tf_mla_chunks_split_r16 reads a rank's page z as chunk z: at 8x16384x1024 output 0 is -1.391602e-2 where float64 gives -1.647722e-2: 1.15 of its bound
CONTROL control: mla tf_mla_chunks_split_r16 reads a rank's page z as chunk z: red at shapes, as planted
FAIL shapes control: mla tf_mla_merge_part merges one chunk short of the rank's: at 8x16384x1024 output 0 is -4.028320e-2 where float64 gives -2.636678e-2: 5.99 of its bound
CONTROL control: mla tf_mla_merge_part merges one chunk short of the rank's: red at shapes, as planted
PASS nonfinite cuda mla tf_mla_chunks_r16 and tf_mla_merge_sink (each head's sink, a zero-value key, counted once): 99390 non-finite and 31682 finite outputs match the float64 classes
PASS repeat cuda mla tf_mla_chunks_r16 and tf_mla_merge_sink (each head's sink, a zero-value key, counted once): five runs byte-identical (262144 bytes), inputs and guards untouched, no overlap
PASS shapes cuda mla tf_mla_chunks_r16 and tf_mla_merge_sink (each head's sink, a zero-value key, counted once): 3 shapes within the float64 bound (worst 0.177 of the bound), 0 edges refused by the kernel
PASS sums cuda mla tf_mla_chunks_r16 and tf_mla_merge_sink (each head's sink, a zero-value key, counted once): within its bound at k 2048; fp16 sums would miss 0x, bf16 0.4x (online softmax over 512-key chunks, then the chunk merge: no input makes its sums exact in fp32)
FAIL shapes control: mla tf_mla_merge_sink leaves every head's sink out: at 8x16384x2048 output 1024 is -3.759766e-2 where float64 gives -3.491098e-2: 1.26 of its bound
CONTROL control: mla tf_mla_merge_sink leaves every head's sink out: red at shapes, as planted
PASS limits live sm_121 most shared bytes a block (opt-in): the driver says 101376, the table 101376
PASS limits live sm_121 threads a block: the driver says 1024, the table 1024
INFO limits live: images built by nvcc 13.0, checked against nvcc 13.0's records
PASS limits live mla tf_mla_chunks_r16: 256 threads launched, the driver allows 256; 126 registers, 0 + 93568 shared bytes (recorded 126, 0)
PASS limits live mla tf_mla_chunks_split_r16: 256 threads launched, the driver allows 256; 119 registers, 0 + 93568 shared bytes (recorded 119, 0)
PASS limits live mla tf_mla_merge_part: 128 threads launched, the driver allows 128; 32 registers, 0 + 0 shared bytes (recorded 32, 0)
PASS limits live mla tf_mla_absorb_q_128: 128 threads launched, the driver allows 128; 56 registers, 512 + 0 shared bytes (recorded 56, 512)
PASS limits live mla tf_mla_absorb_q_192: 128 threads launched, the driver allows 128; 72 registers, 512 + 0 shared bytes (recorded 72, 512)
PASS limits live mla tf_mla_expand_v_128: 128 threads launched, the driver allows 128; 95 registers, 128 + 0 shared bytes (recorded 95, 128)
PASS limits live mla tf_mla_rope: 32 threads launched, the driver allows 32; 22 registers, 0 + 0 shared bytes (recorded 22, 0)
PASS limits live mla tf_mla_gate: 128 threads launched, the driver allows 1024; 12 registers, 0 + 0 shared bytes (recorded 12, 0)
PASS limits live mla tf_mla_expand_v_256: 128 threads launched, the driver allows 128; 95 registers, 128 + 0 shared bytes (recorded 95, 128)
PASS limits live mla tf_mla_merge_sink: 128 threads launched, the driver allows 128; 40 registers, 0 + 0 shared bytes (recorded 40, 0)
(filtered) SUMMARY 10 kernels: 10 pass gates 1-4, 0 fail, 0 known findings; 11 controls: 11 red as planted, 0 missed; 0 limit problems; gates 32619 ms, limits 2 ms

tf-cuda-test kernel-contract-limits zig-out/fatbin, the two new launches' 10 lines (exit 1 with 154 problems, as on main):

PASS limits sm_80 mla tf_mla_expand_v_256: 96 registers, 128 static shared bytes, bound 128 (record current)
PASS limits sm_86 mla tf_mla_expand_v_256: 96 registers, 128 static shared bytes, bound 128 (record current)
PASS limits sm_89 mla tf_mla_expand_v_256: 96 registers, 128 static shared bytes, bound 128 (record current)
PASS limits sm_120 mla tf_mla_expand_v_256: 95 registers, 128 static shared bytes, bound 128 (record current)
PASS limits sm_121 mla tf_mla_expand_v_256: 95 registers, 128 static shared bytes, bound 128 (record current)
PASS limits sm_80 mla tf_mla_merge_sink: 31 registers, 0 static shared bytes, bound 128 (record current)
PASS limits sm_86 mla tf_mla_merge_sink: 39 registers, 0 static shared bytes, bound 128 (record current)
PASS limits sm_89 mla tf_mla_merge_sink: 39 registers, 0 static shared bytes, bound 128 (record current)
PASS limits sm_120 mla tf_mla_merge_sink: 40 registers, 0 static shared bytes, bound 128 (record current)
PASS limits sm_121 mla tf_mla_merge_sink: 40 registers, 0 static shared bytes, bound 128 (record current)

Checklist

  • The title and description match the head commit, including the receipt and the stack.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency (the GPU test and the contract need the new entries; the host test needs the new widths).
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.

@Bizuayeu
Bizuayeu marked this pull request as ready for review November 25, 2026 22:04
@ashhart

ashhart commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Thank you, @Bizuayeu.

The 256-wide expansion keeps the existing reduction and BF16 rounding sequence. The sink contributes once per row and head, empty chunks have zero mass, and Hy4-flash's entry, launch shape and disabled-FMA behavior are preserved. GLM remains on its own kernels.

The supplied contract evidence covers exact new/old merge comparisons, planted sink omission and unchanged existing-kernel SASS. The branch merges cleanly on today's main, and no new serving dispatch requires another checkpoint run. SAFE TO LAND.

  • Synthena

ashhart and others added 3 commits November 26, 2026 04:23
…y moved from hy4_flash to common/mla.cuh

The mla image gains tf_mla_expand_v_256 (tf_mla::expand_v at 256-wide v heads, which hy4_flash already instantiates as
tf_hy4_expand_v) and tf_mla_merge_sink, which merges the chunk tiles' partials with each head's fp32 sink counted once
as a zero-value key. The merge's body is hy4_flash's tf_hy4_attend_merge, moved to common/mla.cuh as
tf_mla::merge_sink, which takes each thread's column from its entry: with the column read inside the moved body, nvcc
13.0 gave tf_hy4_attend_merge other SASS at sm_120 and sm_121. hy4_flash keeps its image, entry name and --fmad=false
and calls it there, so its outputs are unchanged. Mla.expandV takes 128- or 256-wide heads, Mla.mergeSink launches the
merge, and geometry() takes the widths the kernels take (q_nope 128 or 192, v 128 or 256). Both entries are under the
kernel contract against float64, with a planted control each, and tf-cuda-test mla-sink checks that the mla merge
gives tf_hy4_attend_merge's bytes at hy4_flash's shapes, and that tf_hy4_attend_merge gives another build's bytes when
given its hy4_mla_attention fatbin. GLM's path uses neither entry.
@ashhart
ashhart merged commit de763e8 into ashhart:main Nov 26, 2026
2 of 12 checks passed
@ashhart

ashhart commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Thank you @Bizuayeu. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants