Repository navigation
Model L on D3D12: the decoder block with l_coef_pack12 as its epilogue - #159
Merged
Merged
Conversation
l_swin_block_c32_dec_coef12_nc (D3D12 only): the decoder block's lane that holds a pixel's channels 0..15 runs l_coef_pack12's per-pixel functions on the FP16 values the map would hold, so A, C and the latent come out of the block and y2 is neither stored nor read back. Byte for byte the pair l_swin_block_c32_dec_nc -> l_coef_pack12. - hlsl/l_coef_px.hlsli: l_coef's per-pixel functions, shared by l_ops_coef.hlsl and the block (swin_block.hlsl SW_OUT_COEF12); fused_swin_gen.py's anchor follows, and it writes LF on every OS. - runtime: native D3D12 fusion "lc" (default on; Model L pack12 frames). Without lc, or without the kernel in the manifest, the pair runs (the fallback route). - clean/l/runner/l_fold_check.py: the folded kernel against the pair on D3D12 and on HIP, raw bytes, per-run sentinels in the slack, negative control, Model M control. - tests: the recorder's signature; the frame and role checks take either decoder form. Refs #89 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21
marked this pull request as ready for review
November 14, 2026 09:02
phantoslayer21
added a commit
that referenced
this pull request
Nov 14, 2026
…he Model L set l_linear_32_32_fused (#160) and l_swin_block_c32_dec_coef12_nc (#159) have no HIP code object, so the co test alone put them in Model M's set. Model M's set is unchanged (46); Model L's set is 16. kernel_sets.json regenerated; the profile tool's docstring names --model-l. Refs #89 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.
Model L speed on D3D12, second change: the decoder block with
l_coef_pack12as its epilogue. The new D3D12-onlykernel
l_swin_block_c32_dec_coef12_ncgives the same bytes in A, C and the latent as the pairl_swin_block_c32_dec_nc->l_coef_pack12. The block's FP16 map (y2, 64 bytes per pixel) is neither stored norread back. Nothing is approximated, and the pair stays as the fallback route.
What changes
clean/dx12/hlsl/l_coef_px.hlsli(new):l_coef's per-pixel functions, moved out ofl_ops_coef.hlsland sharedwith the block. The
l_coef/l_coef_pack12DXILs change from the move; they were checked again on the GPU (below).clean/dx12/kernels/swin_block.hlsl, newSW_OUT_COEF12mode for the C = 32 decoder block. The lane that holds apixel's channels 0..15 (
hh = 0; Model L's 13 values are all among them) runs the shared functions on the FP16values the map would hold, for the pixels inside the render rectangle.
clean/dx12/kernels/l_swin.hlsl: declares the kernel (co=-); VGPR bound 96, uses 95.fused_swin_gen.py: its argument anchor takes the new lines, so the generated Model M kernels are unchanged (everyDXIL but the two above is byte-identical to main's). It now writes LF on every OS (it wrote CRLF on Windows).
clean/runtime/runtime.cpp: new native D3D12 fusionlc, on by default, used by Model L's pack12 frames.WG_D3D12_FUSIONwithoutlc, or when the build's manifest lacks thekernel.
l_dec_fold=on|off.compare.py's copy of the default fusion list is updated.clean/l/runner/l_fold_check.py(new): the identity check below.and the D3D12 frame test runs the fold, the pair without
lcand the pair without the kernel.Refs #89
Byte identity (
clean/l/runner/l_fold_check.py, one GPU slot; recordrecords/fold-identity.jsonin therr-plugin build folder)
kernel_replaypasses: theblock writes y2, then
l_coef_pack12reads it), and the pair on HIP.0x5A, the fold 0x3C).
of it, and about half of it; 2 seeds.
sentinel.
swin_block_c96_nccontrol through the same replay: 8 of 8.l_coef/l_coef_pack12after the move to the shared include: 12 of 12 each against HIP, negative control caught,M control 12 of 12 (
clean/l/runner/l_d3d12_ops_check.py; recordrecords/coef-include-identity.json).Frame check (
clean/l/runner/l_frame_check.py --compare-d3d12, synthetic models; recordrecords/fold-frame-check.json)l_dec_fold=on); the all-outputs run (fusions off) uses the pair.for byte 11 of 11; its post against Model M's post reference 11 of 11.
Timing (
l_d3d12_profile.py, 1080p Quality, synthetic models). Build A is main's build; build B is this change.Interleaved, 3 rounds each, every run in its own GPU slot; medians; record
records/fold-ab.json.l_swin_block_c32_dec_nc0.3092 +l_coef_pack120.1634 = 0.4726 ms. The fold: 0.3516 ms (-121 us).Tested
clean/l/runtime/tests/test_l_runtime_frame.py(18 tests); public gates.Not tested
saturation). The shared functions' branches are covered by the
l_coef_pack12check, whose map inputs are builtto reach them.