Repository navigation
Frame generation: net1 fast path, tier B on the matrix instructions (HIP and D3D12 byte-identical) - #199
Merged
Conversation
…HIP and D3D12 byte-identical) - kernels/fg_net1_mma.hip, clean/dx12/kernels/fg_mconv.hlsl: fg_mconv1/2/4, one v_wmma_f32_16x16x16_f16 per spec chunk in the layer's chunk order, the float16 accumulator from the bias as C, rounded to float16 after every chunk; exact leaky ReLU and fused 2 x 2 pool in the epilogue; NHWC float16 - fg_upscale_hwc_f16 (HIP and fg_upscale_hwc.hlsl): the exact upscale on NHWC tensors - runner/fg_net1_mma.py: net1 in 27 launches; HIP == D3D12 for every buffer (sentinels, slack, half-grid negative control per kernel, special values); report against the CPU reference; timing (information only) - records/net1-tierb-2026-11-14.json: gate results, report (counts only) and timing - Exact kernels unchanged (validation mode); fg_ kernels still built only through --only 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). The net1 fast path, tier B as decided after the probe (#193):
v_wmma_f32_16x16x16_f16with float16 rounding per chunk. This first piece covers every convolution on the matrix instructions, with the encoders' pools fused; the decoder and bottleneck fusion comes in the next PR. The exact kernels are unchanged and stay as the validation mode.What changes
clean/fg/kernels/fg_net1_mma.hip(code objectfg_net1_mma.co) andclean/dx12/kernels/fg_mconv.hlsladdfg_mconv1/2/4, one per number of 16-channel output tiles per wave:v_wmma_f32_16x16x16_f16. Its C is the float16 accumulator; its result is rounded to float16 (nearest even) before the next chunk.fg_exact16.h.wg_uniform().fg_upscale_hwc_f16(HIP, plusfg_upscale_hwc.hlsl): the exact upscale's arithmetic on NHWC tensors. The adds reusefg_add_f16.clean/fg/runner/fg_net1_mma.pyruns net1 in 27 launches on both back ends, then:--timing(information only) runs a launch-length probe first, then 1080p- and 1440p-sized inputs.clean/fg/records/net1-tierb-2026-11-14.json: gate results, the report (counts only) and the timing.Report against the exact CPU reference (record above; not a gate)
On the converted real weights, with the fixed 64 x 64 input (execute-only: converter pass, 42/42 stage digests, converted file deleted, no output digest kept in public):
Network output: 16,384 values; 7,410 more than 1 step off, 2,881 more than 4; max 14,732 steps.
Per output value (4,096 each):
The first layer is at the probe's per-chunk level: 15 of 32,768 values more than 1 step off. The difference then grows roughly 6–10× per encoder level. So the probe's per-chunk figure (about 0.002 % of chunks more than 1 step off) does not carry over to net1's output.
For comparison, float16 accumulate on the same input put 13,965 values more than 1 step off and 10,129 more than 4.
Timing (information only; synthetic weights, mean of 10 runs after a warm-up; HIP device events, D3D12 wall time per synchronised run)
The longest single launch was 1.72 ms. For reference, the exact kernels took 169 ms on D3D12 at 1080p (#191). D3D12 is slower than HIP here; the next PR (fused decoders and bottleneck, D3D12 code inspection) targets that.
Tested
python -m unittest discover -s clean/fg/tests -t .: 83 OK, including 2 new plan tests: every weight fragment element against weights, chunk order and tap; the fused plan's buffers and launches.clean/dx12/tests/test_kernel_sets.py: 4 OK.public_gates.py: must-pass gates pass; the LOOK lines are at main's baseline.Not tested