Skip to content

Model K: streamline narrow stages and compact head - #288

Merged
phantoslayer21 merged 2 commits into
mainfrom
kl-K/l1-narrow
Nov 19, 2026
Merged

phantoslayer21 merged 2 commits into
mainfrom
kl-K/l1-narrow

Conversation

@phantoslayer21

@phantoslayer21 phantoslayer21 commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

What changed

Prewiden the FP16 bias planes and fold weight offsets for Model K's narrow e0, e1, d1, and compact d0 stages. Pack the 32 live d0 head rows into two WMMA tiles and preserve the logical row mapping for the compact and hidden epilogues. Rebind the softmax source digest after the native report gate passed.

Initial timing against eff8ed7

Four alternating ABBA/BAAB blocks per shape, 1,500 frames per leg. A and B used the same runtime build flags and loaded DXIL from disk. A's reviewed phi-fast shaders were verified against the eff8ed7 source tree.

Shape Median B - A (us) Paired block deltas (us) Max A/A (us) Floor (us) Direct FNV
1080p Q -14.500 -13.750, -14.500, -14.500, -14.750 1.500 5.000 1b975fbba17891e3
1440p Q -22.500 -22.500, -22.750, -22.500, -22.000 2.000 5.000 5fb3d1ab49ad8f90

Gates

  • Direct D3D12 route matched both REFS FNVs on all 32 timing legs with zero nonfinite values.
  • Native D3D12 matched all 600 frame hashes and six saved RGBA16F frames at odd, 1080p Q, and 1440p Q against eff8ed7 and REFS. Forced round-to-odd also matched all 600 odd frames and six saved frames. The odd raw state and output comparison matched 516,093,680 bytes, including compact and full head and recurrent state.
  • The CPU and kernel-set run passed all 43 tests, with the GPU-only fixture skipped during that run. The compact pack probe recovered 1,024 weights and 32 biases byte for byte. The native half-widening probe matched 65,536 of 65,536 codes. The exhaustive phi proof covered 1,073,741,824 finite inputs and caught 146 guard-removal errors.
  • The backend-3 k_smx_test=report reproduced 133 of 133 stored HIP hashes in each of mix and round-to-odd, with zero hash or probe mismatches.
  • All 162 DXIL file hashes and provenance entries verified on A and B. The five intended L1 entries changed, with the original gfx1201 ISA and allocation tiers reproduced, 16,384 bytes LDS each, and zero scratch or spills.
  • All four GPU mutants were caught. The e0 bias-next, d0 hidden-swap, e0 W2 weight-next, and uniform-input phi mutants first differed at odd frames 0, 1, 0, and 1, respectively.
  • The leak scan reported zero hits in the eight changed files.

Review fixes

Head 731ba36 passes the compact d0 head and FP32 bias plane as separate D3D12 arguments and preserves the original 48-row head in the shared stage parameters. The hybrid runtime refuses missing or incompatible narrow ports and rejects null argument storage before packing.

The replay passes the original arguments to HIP and supplies the packed weights and bias planes to D3D12. The head row test covers every pixel and hidden channel, and DXC rejects a full-head shader built with the compact bias plane.

Four alternating ABBA/BAAB blocks per shape used 1,500 frames per leg against eff8ed7. The noise floor is max(5 us, twice max A/A).

Shape Median B - A (us) Paired block deltas (us) Max A/A (us) Floor (us) Direct FNV
1080p Q -13.375 -12.500, -13.500, -13.750, -13.250 2.000 5.000 1b975fbba17891e3
1440p Q -23.625 -23.500, -23.750, -23.750, -23.000 3.500 7.000 5fb3d1ab49ad8f90
  • All 32 direct runs matched the reference FNVs with zero nonfinite values. Native D3D12 matched 600 hashes and six saved frames at odd, 1080p Q, and 1440p Q, plus the forced round-to-odd odd run. The raw comparison matched 516,093,680 bytes across 72 buffers and outputs.
  • The backend-3 softmax report matched 133/133 stored HIP hashes in each rounding form with zero hash and probe mismatches.
  • The narrow port check passed 132/132 cases across 11 kernels, including both d1 forms. 13 cases differed only in NaN sign (27 elements). Both controls passed.
  • The D3D12 runtime fixture passed all 38 tests with zero skips. It exercised backends 2 and 3 against HIP, the missing compact port refusal, the corrupt e0 refusal, and round-to-odd at 1440p Q and 4K Performance.
  • The CPU and kernel-set suite passed 54 tests. Its separate tiled-input GPU fixture was skipped in that CPU run. The head pack recovered 1,024 weights and 32 biases. The native widening probe passed all 65,536 half encodings. The exhaustive phi proof covered 1,073,741,824 finite inputs and detected 146 guard-removal errors.
  • All 162 DXIL files and their provenance verified on both builds. RGA/ISA passed for the five changed entries with the same allocation tiers, 16,384 bytes LDS and zero scratch or spills. All four GPU mutants were caught at frames 0, 1, 0 and 1. The commit leak scan reported zero hits.

Use prewidened FP32 bias planes and folded weight offsets in the two-window narrow kernels. Pack the 32 live compact-head rows into two WMMA tiles.

Rebind the K softmax source digest after native D3D12 backend 3 k_smx_test=report reproduced all 133 stored hashes in each of the mix and round-to-odd forms with zero mismatches.

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
Keep the original 48-row head in KBlkParams and pass the compact
head and bias plane as separate D3D12 arguments. Require the narrow
ports and their argument signatures for hybrid and native contexts.
Refuse missing argument values before hybrid argument packing.

Replay both d1 forms and the compact head against the original HIP
arguments. Check the packed row permutation on the host and reject a
compact-bias full-head shader at compile time.

Rebind the softmax source digest to a47546460b78b46b3ae0775661c6c4160ad20af09b6106c16322f8d164136264.
The native backend-3 k_smx_test=report reproduced 133/133 stored HIP
hashes for each of mix and round-to-odd, with zero hash or probe
mismatches.

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
@phantoslayer21
phantoslayer21 marked this pull request as ready for review November 19, 2026 01:20
@phantoslayer21
phantoslayer21 merged commit 11d3bbc into main Nov 19, 2026
10 checks passed
@phantoslayer21
phantoslayer21 deleted the kl-K/l1-narrow branch November 19, 2026 01:20
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.

1 participant