Skip to content

Model K: exact speedup, certified fast log2 in the input stage (-17.25 us at 1080p Q, -31 us at 1440p Q) - #287

Merged
phantoslayer21 merged 5 commits into
mainfrom
kl-K/phi-fast
Nov 19, 2026
Merged

phantoslayer21 merged 5 commits into
mainfrom
kl-K/phi-fast

Conversation

@phantoslayer21

@phantoslayer21 phantoslayer21 commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

Model K's tiled HDR input uses a shorter compensated FP32 log2 polynomial. It accepts the result only when the error bound certifies the rounded FP32 value. Ambiguous inputs and positive infinity use the existing log2 fallback.

  • The exhaustive CPU proof checked 1,073,741,824 finite FP32 inputs. The guard sent 715,486 inputs to the fallback. Removing the guard produced 141 incorrect results. All 42 CPU and kernel-set tests passed, and the SMX self-check digest is current.
  • All 32 direct-route captures matched the reference FNVs 1b975fbba17891e3 at 1080p Q and 5fb3d1ab49ad8f90 at 1440p Q. Native D3D12 matched 600 frames each at odd dimensions, 1080p Q, and 1440p Q, including six saved RGBA16F frames per shape compared byte for byte. The GPU mutant changed odd frame 1.
  • Only the three intended tiled-input DXIL entries changed. RGA reported unchanged VGPR counts and LDS usage, with zero scratch or spills.

Against c4b9b0de, one session used four paired ABBA/BAAB blocks per shape and 1,500 frames per leg. The median paired change was -17.25 us at 1080p Q and -31 us at 1440p Q. Maximum A/A differences were 0.5 us and 4.5 us, respectively.

The evidence records are kept off-repo by the maintainer.

Review fixes

  • The polynomial square uses kf_opq. The gfx1201 ISA shows v_mul_f32 feeding the correction FMA through v_xor_b32 in all three tiled-input variants. RGA reports 72, 64, and 64 VGPRs with 11,520 B LDS, zero scratch, and zero spills. All 162 DXIL manifest entries passed provenance and file-hash checks.
  • The new CPU test generates the tables, pins their log entries and the shader by SHA-256, and checks 65,536 mantissas by default. WG_K_PHI_LOG2_FULL=1 enables the exhaustive path. Both modes passed, and the CPU and kernel-set suite passed all 43 tests.
  • The exhaustive proof covered 1,073,741,824 inputs and checked the binary64 enclosure on 727,755 lanes. That includes all 715,486 guard misses and 12,269 baseline fallback lanes accepted by phi-fast. The FMA cross-check covered 4,099 samples. The updated proof detected 146 wrong results in the guard-removal mutant.
  • All 16 direct-route FNVs matched REFS (1b975fbba17891e3 at 1080p Q, 5fb3d1ab49ad8f90 at 1440p Q). All 600 native frames per shape matched the recorded baseline and REFS at odd dimensions, 1080p Q, and 1440p Q.

The ABBA/BAAB re-check against c4b9b0de used two blocks per shape and 1,500 frames per leg. Median B minus A was -18.125 us at 1080p Q (blocks -18, -18.25 us) and -30.875 us at 1440p Q (blocks -30.25, -31.5 us). Maximum A/A differences were 0 and 2 us, respectively.

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