Repository navigation
Frame generation: probe of the gfx12 matrix instructions against net1's chunk arithmetic - #193
Merged
Merged
Conversation
…'s chunk arithmetic (evidence) - kernels/fg_probe.hip: the exact chunk reference (fg_exact16.h, plus RN32), v_wmma_f16_16x16x16_f16 and v_wmma_f32_16x16x16_f16 chained like net1's chunks; fg_probe_mid.h: the float16-midpoint test - clean/dx12/kernels/fg_probe.hlsl: both forms on D3D12 through the driver channel, byte-identical to HIP - runner/fg_wmma_probe.py: random, adversarial and per-layer chain classes, counts, step distances, examples, a CPU re-check of the GPU reference - records/wmma-probe-2026-11-14.json: neither form equals the exact chunk (tier C by the probe) - No runtime change; fg_ kernels still built only through --only Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #96 (frame generation). Step 1 of the net1 fast path: a probe of gfx12's 16 x 16 x 16 matrix instructions against net1's chunk arithmetic. This PR is the tool and its record only; nothing in any runtime changes.
Question
In net1's convolutions, the float16 accumulator takes 16-term chunks:
acc = RN16(acc + sum of 16 products), with one rounding. One WMMA has K = 16 and adds C in the same instruction, so each of its 256 outputs is one chunk when C is the accumulator. Does either matrix form compute that sum exactly and round it once?What's in it
clean/fg/kernels/fg_probe.hip:fg_exact16.h, plus an RN32 rounding of the same exact sum;v_wmma_f16_16x16x16_f16(float16 accumulate), chained like net1's chunks (D fed back as C);v_wmma_f32_16x16x16_f16(float32 accumulate), with the float16 accumulator in between: each chunk's float32 result is rounded to float16. The kernel also flags results that land exactly on a float16 midpoint (fg_probe_mid.h), the only place where RN16 of an exactly rounded float32 sum could differ from RN16 of the exact sum.clean/dx12/kernels/fg_probe.hlsl: both forms on D3D12 through the driver channel, with the same fragments and outputs. The final stores read their pointers throughwg_uniform(): on this driver, two stores at one per-lane offset through two pointers were merged, the documented driver exception, and the sentinel check showed it here.clean/fg/runner/fg_wmma_probe.pyruns these case classes:For each form and class it counts equal / mismatching outputs, the distance in float16 steps (max, over 1, over 4), and up to three mismatching examples (inputs, expected, got). It re-checks a sample of the GPU reference on the CPU (
fp16acc.acc_dot16, Python integers). The D3D12 outputs are compared byte for byte with HIP, with sentinels 0xA5 / 0x5A and slack bytes.clean/fg/records/wmma-probe-2026-11-14.json: the record.Result (record above)
Neither form equals the exact chunk, so by the probe this is tier C. In detail, on HIP (150.5 million chunk evaluations):
D3D12 gives the same bytes as HIP in every class (60 cases).
Tested
python -m unittest discover -s clean/fg/tests -t .: 81 OK, including 4 new tests: the midpoint test against brute force over float16 neighbours, RN32 against exact fractions, the case classes.clean/dx12/tests/test_kernel_sets.py: 4 OK (fg_ kernels in no set).public_gates.py: must-pass gates pass; the LOOK lines are at main's baseline.Not tested