Repository navigation
gpu: the GDN prompt delta seeds only its high parts' term, so the smaller terms keep their own alignment - #1145
Conversation
…ller terms keep their own alignment The prompt delta's o and state products start from the chunk's D_t*S^T q_t and D*S, which keeps a sum the one-token rule holds finite finite near f32's limit. Seeding all six split terms with them made every smaller term's MMA align to the seed, and the tensor cores' accumulator truncates the aligned sum, so the keys near one direction clause of gate_linear read 3.2e-6 for o on an RTX 5090 and 4.2e-6 on an RTX 3090, above its 2e-6 band on both. split_mma now sums the five smaller terms from a zero accumulator, adds the seed in one f32 rounding and runs the high parts' term on that, so only the high term's sum aligns to the seed. On the RTX 5090 the clause reads 1.14e-6 for o and 6.9e-7 for the lane, the other prompt clauses 5.6e-7 to 7.2e-7, and the clause with updates cancelling a state near f32's limit stays finite. The RTX 3090 read 1.3x the RTX 5090 on the seeded form, about 1.5e-6 here, so the band stays at 2e-6, about 2x the worst measured, with its pin updated.
There was a problem hiding this comment.
Verdict: CLEAN: No must-fix defect found in the changed accumulation or gate pins.
Non-blocking
⚠ Complete the numeric-order evidence: crates/gpu/src/linear/delta.rs:717.
For each full 16-token chunk that commits state, the two output calls and sixteen state calls add 18 × 4 scalar f32 additions per thread [derived]; MMA and device-launch counts stay unchanged.
AGENTS.md classifies this as “float sum order or precision.” The supplied evidence lacks the required gate-gpu-e2e count-pin result and timed A/B. Attach these for the current head on the contributor's card, timing prefill and naming the card, model file, commit hashes, commands and output.
Checked
Duplicates: 0 new functions, types or constants; dryer reported 0 pairs. Grep found no second owner of the seeded split product; chunk_product has a different operand shape and no seed.
Complexity: crapper flagged none; split_mma adds one fixed-size loop.
Silent failure: 2 consumers followed, output and state; non-finite results still raise LinearDelta.
Tests: no assertions changed. Mutant: restore low-term accumulation onto the seed at split_mma. The PR reports 3.215e-6 on RTX 5090 at m=4096 before the fix, exceeding the existing near-direction check's 2e-6 band. No local CUDA run.
Gates: PROMPT_BAND remains 2e-6; its measurement comment and the unsafe-block ratchet carry dated PIN reasons.
Escape catalog: no C1–C4 patterns match.
Notes
The supplied GPU run names head dd67f5b; this review's head is 4f8fca6. Hardware results above come from the PR body.
Dryer did not search crates/gpu-gates; its changed hunk only updates the band comment.
Card check: gpu-evidence. This pull request changes crates/gpu-gates/src/bin/gate_linear.rs, crates/gpu/src/linear/delta.rs and carries a gate run on the author's card, which counts as verified.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
The review is done and the contribution check passed, so I'm merging this. |
GDN prompt 곱에서 큰 seed에 정렬되던 작은 항들을 따로 누적하도록 고쳐, RTX 5090에서 near-direction 절의 오차를 3.2e-6에서 1.1e-6으로 낮췄습니다.
What and why
The GDN prompt delta added the chunk's state term and its in-chunk query term as the accumulator seed of all six split terms of each product. The five smaller terms then aligned to the large seed in the tensor cores' truncating accumulator, which tripled the truncation error. On an RTX 5090 the
gate_linearprompt clause with keys near one direction readoat 3.215e-6 and the lane at 2.732e-6 on the kernel before this change, over the 2e-6PROMPT_BAND.Refs #1140
split_mmanow accumulates the five smaller terms from zero, adds the seed in one f32 rounding, and runs only the high parts' term on top of the seed. The seed still keeps a sum that the one-token rule keeps finite from overflowing.PROMPT_BANDstays 2e-6 and its PIN comment carries the new measurements. Thegpuunsafe ratchet goes from 2992 to 2993 blocks for the extra MMA launch, which has its SAFETY line. The change reaches every model that runs the GDN prompt form, on any tensor-parallel size, becausesplit_mmais a per-card kernel.Release notes: Fixed: the GDN prompt delta's tensor-core accumulation error on keys near one direction is about a third of what it was, back under its 2e-6 band.
Code shape
copying it (
AGENTS.md"Common code first",docs/rust-quality.mdR14). Where I found an existing copy, Inamed it below.
(tensor shapes, the attention kind, the quant). A common owner gained no per-model branch, flag or trait method.
tools/check-comments.sh).PIN(YYYY-MM-DD):and its reason.
cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up.Duplication found or removed (
path:line), or "none": none.chunk_product(crates/gpu/src/linear/delta.rs:646) multiplies two shared-memory tiles from a zero accumulator and takes no seed, whilesplit_mma(:707) is one 16-key step with A in registers onto a seed that must join after the smaller terms.SPLIT_TERMSstays the one owner of the term order.What I ran
Base
0d6f89cb8e7b874047142a0e2555f174cc5f4566, headdd67f5bc9a785908287e5f558c6e3b7064f57d3a.orelative L2 error of the prompt clause against the one-lane rule (Base is the kernel before the change, Head the kernel after it):PROMPT_BANDis 2e-6, so the near-direction row before the change is over it and the row after is under it. After the change, the f32-limit edge clause and the whole gate read:The
generate_ds41line of the same run lists its pinned spill entries and reports no violations.tools/check-unsafe.shaccepts thegpuratchet at 2993 blocks.Hardware (if the change is for a machine)
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.