Repository navigation
Model L D3D12: the q map in a 20-byte form on the le route (byte-identical; enc0 -10/-27/-11 us) - #203
Merged
Conversation
…bytes out) lev/input_encoder_q20 and lev/input_encoder_direct_q20 (encoder.hlsl WG_ENC_Q20) write each halo pixel's 20 value bytes without the 12 zero bytes, in two planes (bytes 0..15 of every pixel, then bytes 16..19), and the encoder block with the linears as its prologue (l_swin_block_c32_enc_lin_nc, SW_SRC 3) reads that form: lane half 1 takes bytes 16..19 from the second plane and zeros for 20..31, the fragments it read from the 32-byte map. 12 of q's 32 bytes per halo pixel are neither written nor read; every load and store stays aligned. Fusion le now needs the q20 input encoder too; without it the 32-byte route (input encoder, linears, plain block) runs. The 32-byte input encoders and every other existing DXIL are unchanged. Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21
force-pushed
the
model-l/q20
branch
from
November 14, 2026 21:18
9a46871 to
d5b0648
Compare
phantoslayer21
marked this pull request as ready for review
November 14, 2026 21:25
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 #89
On Model L's D3D12
leroute, the q map loses its 12 always-zero bytes per halo pixel. The input encoder now writes only the 20 value bytes and the encoder block reads only those; the network's outputs are byte-identical.What changes
encoder.hlsl: newWG_ENC_Q20formslev/input_encoder_q20andlev/input_encoder_direct_q20. They compute the same values as the input encoder, but write each halo pixel's 20 value bytes in two planes: bytes 0..15 of every pixel, then bytes 16..19 of every pixel. Every store stays aligned.swin_block.hlsl,SW_SRC 3:l_swin_block_c32_enc_lin_ncreads that form.lenow also needs the q20 input encoder of the route (buffer or direct). Without it, the 32-byte route runs: input encoder, linears, plain block.l.narrowis an internal map, not a checked output.build_dx12.py: the two kernels go inMODEL_L_ONLY.kernel_sets.json.runtime_frame_trace.cpp: the q20 kernel's argument kinds.test_l_runtime_frame.py: argument roles for the q20 form, plus a fallback subtest without the q20 kernel.l_enclin_check.py: q's bytes 20..31 are zero, as the map format says, and the fused kernel reads the 20-byte form.Timing
Synthetic models; main (ae3cf4e kernels and runtime) against this branch, interleaved, 5 rounds, each run in its own GPU slot. Values are medians in ms. Records:
q20c-timing.jsonand its per-run recordsq20c-{skrt,q20rtc}-<shape>-r1..5.json.Every PR run's enc0 was below every main run's at all three shapes.
Tested
l_enclin_check.py --seeds 2on the 20-byte input. Recordq20-enclin-identity.json.l_linear_32_32_fused→l_swin_block_c32_enc_nc) and the HIP sequence.l_frame_check.py --run --backend d3d12 / d3d12-stages, then--compare-d3d12), both models, pass, with all negative controls caught. This also coverslev/input_encoder_q20end to end. Recordq20-framecheck-raw-d3d12.json.q20-frames-vs-main.json.build_dx12.py --model-lbuild against main's DXIL set. Onlyl_swin_block_c32_enc_lin_ncdiffers, and two kernels are new (the q20 encoders). Every other DXIL, Model M's and the 32-byte encoders' included, is unchanged. The three changed or new DXILs are the ones tested and timed.test_l_runtime_frame.py(21 tests),test_kernel_sets.py,fused_swin_gen.py --check.public_gates.pypasses. The LOOK lines carry no hit in this branch's files.Not tested
lev/input_encoder_direct_q20on the GPU: no harness runs the direct-resource route. It's the same code as the buffer form with the direct texture loads, and it compiles (117 VGPRs, as the 32-byte direct form).