Skip to content

Model K: exact speedup, input kernel at 72 VGPRs (-28 us at 1080p Q, -48 us at 1440p Q) - #285

Merged
phantoslayer21 merged 1 commit into
mainfrom
kl-K/kx-vgpr72
Nov 18, 2026
Merged

phantoslayer21 merged 1 commit into
mainfrom
kl-K/kx-vgpr72

Conversation

@phantoslayer21

Copy link
Copy Markdown
Owner

What changed

The tiled direct input kernel (kx/k_in_tiled_direct) computed the frame-wide
uniforms (KiHost and the direct motion factors sp and offset) per lane.
Those values are wave-uniform, so they now pass through v_readfirstlane once
and live in scalar registers. The same operations run in the same order, so
the output bytes do not change.

  • RGA gfx1201: 83 -> 64 VGPR (84 -> 72 allocated, at the 72 bound), 100 SGPR,
    11520 B LDS (unchanged), no scratch.
  • Workgroups per CU for this kernel rise from 4 to 5 under the occupancy model.
  • Only kx/k_in_tiled_direct changes. Of the 159 DXIL files, the other 158 are
    byte-identical to the previous build, and the runtime DLL is identical.
  • Rebased onto origin/main (e1f4679, Model L). The K input sources do not
    include any file that changed on main, so the K DXIL is unaffected by the
    rebase.

Byte checks

  • Timed runs (32, hipbench final-frame output): every run hashes to the
    reference values, 1b975fbba17891e3 (1080p Q) and 5fb3d1ab49ad8f90
    (1440p Q).
  • Native gate (600 frames per shape, input uniforms from host, RGBA16F output):
    per-frame results equal the reference, totals equal the reference, 6 saved
    frames byte-identical, no non-finite values.
  • Mutant check: a deliberately wrong base blob at 1080p produces
    66240e73d13ed096 and is caught by the reference comparison.
  • Coverage note: the timed configuration (input_uniforms=gpu, out=f32) is
    checked at the final-frame level only. Per-frame equality on that exact
    configuration is not separately shown; the native gate uses the host-uniform
    and RGBA16F path.

Timing

Block means of (B - A), where A is the previous kernel and B is this change.
Negative is faster. 16 raw runs per shape.

Shape Block means (us) Median (us) Wall-clock median (us) A/A max (us)
1080p Q -28.75, -28.25, -27.5, -28.0 -28.1 about -26.5 1.5
1440p Q -47.5, -48.25, -48.0, -45.25 -47.75 about -47.5 4.5

Stage attribution is not clean. The input stage drops by about 34 us (1080p)
and 55 us (1440p), as expected. Network and output stages read a few us slower
in the timed runs (about 4.75 us and 2 us at 1080p) even though their DXIL is
unchanged. The total still favors this change at both shapes.

Evidence records (raw run logs, comparisons, and occupancy reports) are kept
off-repo by the maintainer.

…n_tiled_direct 83 -> 64 VGPR)

The exact tiled direct input kernel computed KiHost and the direct motion
factors (sp, offset) per lane; the values are wave-uniform, so they now go
through v_readfirstlane once and live in scalar registers. Same operations in
the same order, output bytes unchanged. RGA gfx1201: 83 -> 64 VGPR, 11520 B
LDS, 100 SGPR, no scratch. Only kx/k_in_tiled_direct changes (every other
K input / output DXIL is byte-identical).
@phantoslayer21
phantoslayer21 marked this pull request as ready for review November 18, 2026 21:12
@phantoslayer21
phantoslayer21 merged commit 841aac1 into main Nov 18, 2026
10 checks passed
@phantoslayer21
phantoslayer21 deleted the kl-K/kx-vgpr72 branch November 18, 2026 21:16
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