Skip to content

cuda ernie5_5: the HCA compressor, a block's softmax pool, RMSNorm and RoPE, under the kernel contract - #5326

Closed
Bizuayeu wants to merge 10 commits into
ashhart:mainfrom
Bizuayeu:pr/ernie55-hca-compress
Closed

Bizuayeu wants to merge 10 commits into
ashhart:mainfrom
Bizuayeu:pr/ernie55-hca-compress

Conversation

@Bizuayeu

@Bizuayeu Bizuayeu commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

tf_ernie55_hca_compress, in a new ernie5_5_hca image: the compressor of ERNIE 5.5's HCA layers (37 of its 43, every layer but the six DSA ones), as vLLM's C128 compressor forms each compressed row from its block of 128 tokens, one row a block of 256 threads (two channels a thread). From the tokens' fp32 kv and score (the projection's output, kv_score), for each of the 512 channels alone: s_i = score_i + ape_i (ape indexed by the token's offset in the block, one fp32 add as vLLM's state stores it), M = max_i s_i, then e_i = expf(s_i - M) summed and kv_i e_i accumulated in fma with the tokens in order, and one division; the row's RMSNorm 1 / sqrt(mean + eps) (a thread's two squares, the warp's butterfly, the 8 warps in order) times the norm's weight; and GPT-J's pairs (448 + 2l, 449 + 2l) turned at the block's first position 128j with YaRN's frequencies at compress_rope_theta, the angle the fp32 product of the frequency and the position, as vLLM's cos_sin_cache holds it. The row is rounded to bf16 once, at the end. Nothing launches it yet, so served output is unchanged.

One choice differs from the vendor's kernels: vLLM's pool takes each warp's max of 16 tokens and rescales the warps' sums by exp2((m_w - M) log2e) with fast-math exp2, and its norm and rope run in a second kernel; here one kernel takes the block's max first and one expf a token, so the bits are this kernel's own order, written above.

Checks on this head

  • On your rebase (370ac14616, on cuda ernie5_5: the mHC broadcast, the first layer's pre from one row, under the kernel contract #5324's 7f36b770a8), on a GB10 (sm_121): the tree cleaned (git clean -xdf) with an empty global cache, zig build compile-cuda-tests fatbins kernel-contract-fatbins -Dnvcc=... -Dsm=80,86,89,120,121 (nvcc 13.0.88): 0 errors. On the GPU, tf-cuda-test ernie5_5-hca: SUMMARY ernie5_5 hca: 1 kernels, 1 pass gates 1-4, 0 fail, 0 known findings; 2 controls: 2 red as planted, 0 missed; tf-cuda-test ernie5_5-mhc: SUMMARY ernie5_5 mhc: 9 kernels, 9 pass gates 1-4, 0 fail, 0 known findings; 8 controls: 8 red as planted, 0 missed; tf-cuda-test kernel-contract ernie5_5: SUMMARY 13 kernels: 13 pass gates 1-4, 0 fail, 0 known findings; 17 controls: 17 red as planted, 0 missed; 0 limit problems. Against cuda ernie5_5: the mHC broadcast, the first layer's pre from one row, under the kernel contract #5324's head 7f36b770a8, built and run the same way: kernel-contract-limits gives both the same 205 stale records and the same RED and FAIL lines, apart from this tree's 5 tf_ernie55_hca_compress lines (PASS ... (record current)); the one fatbin change is the added image ernie5_5_hca; the other 204 are the parent's to the byte. Host (zig build -Dfixed-cpu): test-ernie5_5-host 42/44 tests passed (2 skipped), test-gradient-serving 1/1 tests passed, test-kernel-contract 368/368 tests passed. The items below are from before your rebase.
  • On top of your restack (3bf38677c2): 9e4765a41d cuda ernie5_5: the HCA compressor's contract empties extra between freeing and reallocating it, as asked (cuda ernie5_5: the HCA compressor, a block's softmax pool, RMSNorm and RoPE, under the kernel contract #5326 (comment)); test code only, compile-cuda-tests 12 of 12 steps on Windows, tools/pr_check.py against the branch's base on main (043ee2bf60) 0 new, 0 errors.
  • Head commit, before your restack: 9d7cbf5ec8 cuda ernie5_5: the HCA compressor, a block's softmax pool, RMSNorm and RoPE, under the kernel contract. It is e2b9fb5d63 with the stride bounds in hca.check and their test (cuda ernie5_5: the HCA compressor, a block's softmax pool, RMSNorm and RoPE, under the kernel contract #5326 (comment)); the kernel and its image are unchanged, and the contract's shapes are far inside the new bounds, so the GPU runs below stand. The GB10 gate below ran on 9f75f66fb5 and the WSL runs on 8b8b10c459, this commit on the stack's earlier heads on main 77eae824e4 with gate 4's first fill; the GB10 contract ran again on aef4c9954d, this commit with the fill fixed on main 469f1f7fd8. The kernel and host source is the same in all of them. Since, it was rebased onto cuda ernie5_5: the mHC broadcast, the first layer's pre from one row, under the kernel contract #5324 and its CHANGELOG line took this pull request's number, and then took the stride bounds; on this head, the Windows checks.
  • Lean checker (tools/pr_check.py --base 9d16097ee1 --pr 5326, this commit against cuda ernie5_5: the mHC broadcast, the first layer's pre from one row, under the kernel contract #5324's): 123 problems on both, 0 new; 0 errors. The 123 are inherited from main.
  • Tests run, with the command and pass, fail and skip counts (Zig 0.17.0, nvcc 13.0.88):
    • GB10 (sm_121): 9f75f66fb5 checked out with an empty global cache and the tree's own cache and zig-out removed, zig build compile-cuda-tests fatbins kernel-contract-fatbins -Dnvcc=... -Dsm=80,86,89,120,121: 0 errors. On the GPU, tf-cuda-test kernel-contract-limits zig-out/fatbin gives the five tf_ernie55_hca_compress lines PASS ... (record current) (32 registers at sm_80, 40 at the others, 32 static shared bytes, bound 256), and its other lines are cuda ernie5_5: the mHC broadcast, the first layer's pre from one row, under the kernel contract #5324's commit's (the same 186 stale records and RED and FAIL lines); the image ernie5_5_hca is added and every other fatbin equals cuda ernie5_5: the mHC broadcast, the first layer's pre from one row, under the kernel contract #5324's commit's. hca.cu's PTX: 33 compiles at each of compute_80, 86, 120 and 121 with address randomization on and off, one form at each. That run's gate 4 was red: its first fill (kv to 8,191, a rest of 1 to 7) left bf16 33.8x outside a bound that adds the kernel's own roundings, short of the 100x the gate asks. With the fill above, on aef4c9954d, tf-cuda-test ernie5_5-hca passes gates 1-4: gate 1, 1,026 non-finite and 1,534 finite outputs in their float64 classes; gate 2, five runs byte-identical; gate 3, 4 shapes within the FP64 bound, the worst at 0.985 of it; gate 4, exact sums at k 128, where fp16 sums overflow and bf16 sums miss by 307x. Both controls are red (below). kernel-contract ernie5_5 passes the thirteen ERNIE kernels with all 17 controls red, and that build's 191 stale records are main 91dbadce65's, line for line.
    • Windows: on this head, zig fmt --check and zig ast-check on the two Zig files the bounds touch (on e2b9fb5d63, on the 13 changed Zig files); zig build test-ernie5_5-host 40 of 42 passed, 2 skipped, and with e2b9fb5d63's hca.zig the new test fails (39 of 42); zig build compile-cuda-tests 12 of 12 steps, test-kernel-contract 46 of 46 steps, 353 of 353 tests, test-gradient-serving 1 of 1; pr_check: 0 errors.
    • WSL 2 (x86-64): 8b8b10c459 in a clone of the stack, after cuda ernie5_5: the mHC broadcast, the first layer's pre from one row, under the kernel contract #5324's commit (so unchanged test modules are not run again): git diff --check clean; zig build compile-cuda-tests 12 of 12 steps; test-gradient-serving 1 of 1; test-ernie5_5-host 39 of 41, 2 skipped; test-kernel-contract 46 of 46 steps, 338 of 338 tests; tools/zig/check_cuda_sources.py on hca.cu with clang++ 6 of 6; host_tests_test OK; CI's pytest from the root (-q -rs) 856 passed, 116 skipped, 827 subtests passed, the same skips as main's. The same steps on aef4c9954d, this commit's code on main 469f1f7fd8: git diff --check clean; compile-cuda-tests 12 of 12 steps; test-gradient-serving 1 of 1; test-ernie5_5-host 39 of 41, 2 skipped; test-kernel-contract 46 of 46 steps, 341 of 341 tests; clang++ 6 of 6; host_tests_test OK; pytest 861 passed, 116 skipped, 827 subtests passed, the same skips as main's.
  • CI: none reported on this branch; it conflicts with main (in zig/build/cuda.zig, zig/build/cuda_kernels.zig and gradient-serving.tsv).
  • Not run, and why: the contract on GPUs other than the GB10 (sm_121); the other four SMs are covered by their limits records only. No served path, since nothing launches the kernel.

Receipt

  • Main against branch: n/a. Nothing launches tf_ernie55_hca_compress, so no served token or byte can change. On the GB10, against cuda ernie5_5: the mHC broadcast, the first layer's pre from one row, under the kernel contract #5324's commit's tree built the same way, the image ernie5_5_hca is added and every other fatbin is byte-identical.
  • Boxes it reaches: none served yet; it is written for ERNIE 5.5's HCA layers (refs ERNIE-5.5-Flash-Preview on two DGX Sparks: a native CUDA family #4926).
  • New switch? None.
  • Environment, with the TensorFold commit, Zig and backend toolchain, machine and GPU, checkpoint and revision: 9f75f66fb5 (the GB10 gate) and 8b8b10c459 (WSL) on the stack's earlier heads on main 77eae824e4, and aef4c9954d (the GB10 contract) on main 469f1f7fd8; this head is the same change on cuda ernie5_5: the mHC broadcast, the first layer's pre from one row, under the kernel contract #5324's 9d16097ee1; Zig 0.17.0, nvcc 13.0.88; one GB10 (sm_121); no checkpoint (synthetic blocks; compress_rope_theta, rope_scaling and rms_norm_eps from the released config).
  • Paths and platforms the change reaches, which I ran and which I could not: the kernel on sm_121 through the contract; sm_80, 86, 89 and 120 by their limits records only.
  • Exactness, from tools/bench_concurrent.py --alone --serial or token_sha against "draft": false: n/a (no served path).
  • Main against this branch, same machine and checkpoint, posted before asking for a run on our machines (or why you can't): n/a (no served path).
  • Decode speed before and after, from tools/bench_openai.py: n/a (no served path).
  • Prompt speed before and after: n/a (no served path).
  • Licence of any new weights or drafter, or "n/a": 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_ernie55_hca_compress (new; replaces none), records for sm_80, 86, 89, 120 and 121 in zig/src/core/contract/ernie5_5_records.zig (32 registers at sm_80 and 40 at the others, 32 static shared bytes, bound 256; a 40-byte stack frame, sincosf's large-angle reduction, as the DSA indexer keys' kernel has).
  • A planted control for each new kernel, and each one fails as planted: tf_ctl_ernie55_hca_compress_no_ape (the pool without ape), red at shapes ("at 4x3x128 output 0 is 2.480469e-1 where float64 gives -1.455253e-1: 660.00 of its bound"); tf_ctl_ernie55_hca_compress_last_position (the rope at the block's last position, 128j + 127), red at shapes (74.69 of its bound).
  • Each backend's SUMMARY line and exit status: on aef4c9954d, SUMMARY ernie5_5 hca: 1 kernels, 1 pass gates 1-4, 0 fail, 0 known findings; 2 controls: 2 red as planted, 0 missed, exit 0; kernel-contract ernie5_5: (filtered) SUMMARY 13 kernels: 13 pass gates 1-4, 0 fail, 0 known findings; 17 controls: 17 red as planted, 0 missed; 0 limit problems, exit 0. CUDA only (no HIP, Metal or XPU image).
  • Chips I could not run: sm_80, 86, 89 and 120 GPUs (their limits records come from the fatbins).

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 host tests need only Zig; the contract's controls go red as planted; without a GPU or -Dnvcc the CUDA steps are not built, as for every image).
  • 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.
  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off (nothing launches the kernel yet).
  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo (no served path changes).
  • No precision traded for speed. If the bits change, the description says which sums change and why (no served bits change; the pool is fp32 with one expf a token, the vendor's two-stage fast-math exp2 aside).
  • Decode and prompt processing are no slower than main at one stream and the widest admitted; with --drafter, no slower than without it, greedy and sampled (no served path changes).

@ashhart

ashhart commented Nov 27, 2026

Copy link
Copy Markdown
Owner

Thanks, @Bizuayeu, for the clear implementation and the detailed contract coverage. The pooling, RMSNorm, RoPE placement, final BF16 rounding and planted controls are easy to follow. Nothing invokes this compressor in serving yet, so the existing served-token path is unchanged.

One item remains before landing. (Current main also conflicts with this in zig/build/cuda.zig, zig/build/cuda_kernels.zig and zig/tests/fixtures/gradient-serving.tsv; we will rebase it for you once the fix below is in, so nothing is needed from you there.)

There is also a small stride-validation gap. hca.check accepts even ts or os values above the signed 64-bit kernel ABI, after which cuda_hca.launch can trap in its integer cast. Please bound both strides in hca.check and add refusal tests beside the existing shape checks. This affects direct launcher callers; the compressor is not connected to serving yet.

The rest of the read-only HCA review found no pooling, norm, RoPE or rounding defect.

  • Synthena

@Bizuayeu
Bizuayeu force-pushed the pr/ernie55-hca-compress branch from e2b9fb5 to 9d7cbf5 Compare November 27, 2026 19:50
@Bizuayeu

Copy link
Copy Markdown
Contributor Author

Please bound both strides in hca.check and add refusal tests beside the existing shape checks.

(#5326 (comment))

Done on 9d7cbf5ec8. hca.check now refuses strides whose furthest offsets, (128 rows - 1) ts + 1023 and (rows - 1) os + 511 floats, would pass the kernel's i64, so cuda_hca.launch's casts cannot trap. Besides a stride above i64, this also refuses one inside it whose offsets at the given row count would wrap the kernel's row * 128 * ts or row * os.

The new test beside the shape checks: ts and os past i64 are refused (at 0 rows too); the largest even strides one row allows pass; one step more at one row, or the same strides at two rows, are refused. It fails against the old check. On Windows, test-ernie5_5-host 40 of 42 passed, 2 skipped, and pr_check has 0 errors. The kernel and its image are unchanged, so the GPU runs in the description stand; the description has the rest.

I've left the rebase to you, as you offered.

@ashhart

ashhart commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Thanks, @Bizuayeu. The HCA increment shows no additional static blocker: score-plus-APE pooling, the 512-channel RMSNorm, GPT-J rotation at each block's first position, stride guards and planted controls are internally consistent.

Two inherited blockers remain. Host and CUDA window merging still clamp picked without stopping at a short nonnegative prefix. With picks [5, -1], k=2, picked=7, seq=10, and window 3, -1 enters the live list and sparse MLA uses it as a cache row. Please stop at the first negative pick in both implementations and add malformed-prefix host and CUDA regressions with structural checks.

The mHC mix also still substitutes unrounded FP32 coefficients and a custom reduction for the pinned TF32/DeepGEMM arithmetic. Please reproduce the pinned rounding and reduction exactly in kernel and oracle, or provide byte-exact same-engine evidence for the alternative without tolerance. Add a planted 1 + 2^-11 coefficient case that fails when input rounding is omitted.

The inherited hardening fixes also remain: guard window-shape multiplication with division, clear the contract's extra slice before its fallible reallocation, and add errdefer cleanup for tok before allocating cnt.

No rebase is requested, and no device run is promised here.

  • Synthena

@Bizuayeu

Copy link
Copy Markdown
Contributor Author

Please reproduce the pinned rounding and reduction exactly in kernel and oracle, or provide byte-exact same-engine evidence for the alternative without tolerance.

(#5326 (comment))

Thanks. The mixes stay fp32 products on purpose: your reviews of #5301 found that the right choice, "Keeping the mHC mixes as fp32 products, rather than rounding inputs to TF32 the way the vendor's GEMM does, is the right choice here" (#5301 (comment)) and "no change is needed to the FP32-product choice" (#5301 (comment)), and the kernel and the oracle here are that choice. Should I keep it, or move the kernel and the oracle to the vendor's TF32 inputs and DeepGEMM's reduction order, with the planted 1 + 2^-11 coefficient?

The -1 padding and the hardening fixes are as on #5243 (#5243 (comment)): the merge's fix is #5211's, and this branch's copy of #5211's commit predates it; the two test fixes are ready as commits for #5211 and #5243.

On this branch two more are mine: its compressor contract's extra has the same gap as #5243's index contract, and its YaRN test does not compile (-40.0 / hh.rope, a comptime float over a comptime int), unseen because no build step compiles the contract files' tests. I have them as two commits on 3bf38677c2 (compile-cuda-tests 12 of 12 steps on Windows, and the contract file's three tests passing from a temporary test root over the runner's modules). Shall I push them here?

@ashhart

ashhart commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Thank you, Bizuayeu. The HCA compressor retains the requested score-plus-APE pool, RMSNorm, block-first-position RoPE, stride guards, and planted controls. The stride-validation request is met.

The inherited window and mHC blockers remain: both window implementations still admit an internal -1 under an oversized picked count, and the mHC mix still lacks either the pinned TF32/DeepGEMM arithmetic or byte-exact same-engine evidence for its FP32 alternative, including the 1 + 2^-11 planted coefficient. The window-overflow, extra-reallocation, and tok-cleanup hardening requests also remain.

One HCA-specific cleanup issue you identified remains: the compressor contract frees extra and immediately reallocates it without first clearing the slice. An allocation failure leaves a dangling slice for later cleanup. Clear it before the fallible allocation, as you proposed.

Please push that HCA allocation fix and stop both window merges at the first negative pick with malformed-prefix structural regressions. No rebase or device run is requested until these source fixes are in.

  • Synthena

@Bizuayeu

Copy link
Copy Markdown
Contributor Author

Please push that HCA allocation fix and stop both window merges at the first negative pick with malformed-prefix structural regressions.

(#5326 (comment))

Thanks. Pushed 9e4765a41d on 3bf38677c2: the compressor contract empties extra between freeing and reallocating it (compile-cuda-tests 12 of 12 steps on Windows, the lean checker 0 errors). The YaRN test's compile fix I had beside it is in #5508 with the contract-test root, as you asked on #4926 (#4926 (comment)), so only the extra commit is pushed here.

The window merges' stop at the first negative pick is #5211's, on main, with its host and CUDA malformed-prefix regressions and the window-shape division guard; as you wrote on #5243 (#5243 (comment)), your restack carries it here. The tok cleanup is #5535, and the mHC mix stays FP32, as you settled on #5311 (#5311 (comment)).

@ashhart

ashhart commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Thanks, @Bizuayeu. The compressor contract clears extra before its fallible replacement allocation in 9e4765a41d, so that requested fix is met. The stride guards remain present. The YaRN test correction and contract-test root are also visible in the stack above #5508; they should be carried from there rather than duplicated here.

The TF32 rewrite request is withdrawn. Keep the agreed FP32 products. Before qualification, the planned restack still needs main's window-prefix and overflow corrections, the index cleanup from #5243, the token-buffer follow-up #5535, and this HCA cleanup commit preserved together.

No duplicate fix or rebase is requested from you here. Current-tree CUDA qualification remains pending.

  • Synthena

@ashhart
ashhart force-pushed the pr/ernie55-hca-compress branch 3 times, most recently from 386508a to de75602 Compare November 29, 2026 13:18
Bizuayeu and others added 9 commits November 29, 2026 19:16
…under the kernel contract

ERNIE 5.5's indexer scores each query against keys made from wk's k: LayerNorm(128, eps=1e-6) with k_norm's weight
and bias, then RoPE on the first 64 dims in NeoX's halves, pairs i and i + 32, at the config's rope_theta (the DSA
layers' plain RoPE; YaRN is the HCA layers'). tf_ernie55_index_key (in the ernie5_5_index image) makes a key a warp:
the LayerNorm in fp32, the mean then the squares about it, y = fma(xc / sqrt(var + eps), w, b), then the turn at the
fp32 angle inv[i] times the position with sincosf, and one rounding to bf16 (vLLM rounds to bf16 after the LayerNorm
and again after the rope). The vendor's Hadamard on q and k before its FP8 quantization is left out: with bf16 keys it
changes no score in exact arithmetic. key.zig is the host's float64 key; its tests hold it to vLLM's F.layer_norm and
NeoX halves.

The contract (ernie5_5-index, also in kernel-contract) asks each key within its float64 bound, from prompt chunks and
a decode row at the first position to decode rows past sincosf's fast range and at the 1M context's end; gate 4's rows
of 254 to 260 in steps of 2 keep fp32 sums exact while fp16 and bf16 sums lose the steps. The k rows sit 192 apart
with NaN past 128, so a read past the key shows. Three controls go red: GPT-J's pairs, the LayerNorm without its
bias, and the next position's angle. Nothing launches it yet.
…eing and reallocating it

reference freed extra and allocated it again; had that allocation failed, extra would still have held the freed
slice, freed a second time by the next reference or by deinit. It is now empty between the two.
…, under the kernel contract

tf_ernie55_mhc_post, in the ernie5_5_mhc image, adds a layer's bf16 output to its row's 4 residual streams as
vLLM's mhc_post does for ERNIE 5.5: stream o = post[o] x + sum_i comb[i][o] res[i], with post and comb from the pre
side, from the product, then the input streams in order in fma, rounded to bf16 once. GLM's post body sits in its
own glue, so ERNIE's is a family kernel.

The streams are checked against float64 (ernie5_5/mhc.zig), with gate 4 on integer terms that fp32 holds in any
order, cancelling to +-1/2, whose fp16 and bf16 roundings do not; two controls: comb read transposed, and the layer
output added without post.
…r the kernel contract

tf_ernie55_hc_head, in the ernie5_5_mhc image, folds ERNIE 5.5's 4 residual streams into the one row the final
RMSNorm takes, as vLLM's hc_head does: its 4 mixes against fn's float32 rows and the streams' squares, summed as the
pre side sums them, the plain RMS 1 / sqrt(mean + eps) (vLLM's hc_head keeps it, where ERNIE's pre side takes
1 / (sqrt(mean) + eps)), pre = sigmoid(m r scale + base) + hc_eps, then sum_s pre_s x_s rounded to bf16 once.

The row is checked against float64 (ernie5_5/mhc.zig), from the pre side's rows; gate 4 runs pre at 1/2 on one
stream. Two controls: ERNIE's pre-side mix RMS, and the mixes without hc_head's scale.
… under the kernel contract

tf_ernie55_mhc_pre_broadcast, in the ernie5_5_mhc image, is ERNIE 5.5's first-layer mHC pre as vLLM-ERNIE's
broadcast forms it: the embedding row e as each of the 4 streams, its 24 mixes against fnb (fn's 4 column blocks
summed at load, float32), the mix RMS 1 / (sqrt(mean) + eps) over e's own 4096 squares, then the pre side's pre,
post, comb (Sinkhorn) and normed collapse, and e written into the 4 residual streams.

The pre side's sums, its mixes' outputs and its norm become three inline functions the two kernels share; the pre
side's usage is unchanged at the five SMs.

Each output is checked alone against float64 (ernie5_5/mhc.zig, whose host test holds the broadcast to the pre side
of e's 4 copies, bit for bit); gate 4 runs pre at 1/2 on half-integer rows. Two controls: the mix RMS's mean over
pre's 4 x 4096 values, and e written into stream 0 alone.
…d RoPE, under the kernel contract

tf_ernie55_hca_compress, in a new ernie5_5_hca image, forms each compressed row of ERNIE 5.5's HCA layers from its
block of 128 tokens as vLLM's C128 compressor does: for each of the 512 channels, the softmax over the tokens of
score + ape pooling the fp32 kv (the block's max, then expf of each difference summed and kv e accumulated in fma, the
tokens in order, one division); the row's RMSNorm 1 / sqrt(mean + eps) times its weight; and GPT-J's pairs on the last
64 dims turned at the block's first position with YaRN's frequencies at compress_rope_theta; rounded to bf16 once.

The rows are checked against float64 (ernie5_5/hca.zig, whose host test holds it to the vendor's two-stage pool); gate
4 sets every exponent to 0, with odd kv whose second half cancels the first. Two controls: the pool without ape, and
the rope at the block's last position.

hca.check also refuses strides whose furthest offsets, (128 rows - 1) ts + 1023 and (rows - 1) os + 511 floats, would
pass the kernel's i64, so the launch's casts to its i64 arguments cannot trap.
…eeing and reallocating it

reference freed extra and allocated it again; had that allocation failed, extra would still have held the freed
slice, freed a second time by the next reference or by deinit. It is now empty between the two.
@Bizuayeu

Bizuayeu commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor Author

land #5538 and close #5508 and #5536 as included in it

(#4926 (comment))

#5538's head 6b16a9441a carries this pull request's work too, so it can close as included in the same way: the HCA compressor as 0a3a1c1690 and its contract's extra reset as ae1c44d1fa. CI passes on that head, and the GB10 run of the whole ERNIE contract on it, 17 kernels through gates 1-4 with their controls red as planted and 0 limit problems, is the first item of #5538's Checks.

@ashhart

ashhart commented Nov 30, 2026

Copy link
Copy Markdown
Owner

Thank you, @Bizuayeu.

Confirmed: the compressor contract clears extra before reallocating it, the stride guards and planted controls are in place, and the FP32 products stay as agreed. #5538 carries the HCA compressor kernel unchanged, together with that cleanup and the newer key-stride bound.

So we'll land #5538 and close this one as included. Nothing more is needed from you here.

  • Synthena

@ashhart

ashhart commented Nov 30, 2026

Copy link
Copy Markdown
Owner

This landed as part of #5538, so I am closing it as included. Thank you, @Bizuayeu.

  • Synthena

@ashhart ashhart closed this Nov 30, 2026
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