Repository navigation
Model L: D3D12 ports of the encoder and decoder blocks, byte for byte against their HIP kernels - #132
Merged
Merged
Conversation
… against their HIP kernels swin_block.hlsl gets the HLSL side of the gather-source hook (SW_SRC: FP16 halo map, token-grid mirror) and the FP16 output (SW_OUT_F16); both default to Model M's code. Refs #89 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
marked this pull request as ready for review
November 14, 2026 03:03
This was referenced Nov 14, 2026
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 (#89): the D3D12 ports of Model L's encoder and decoder blocks,
l_swin_block_c32_enc_ncandl_swin_block_c32_dec_ncofl_swin.co(clean/l/kernels/l_swin.hip, merged in #115), byte for byte against their HIPkernels.
Targets main (it extends #117's harness). CI needs no GPU: nothing here runs without one.
clean/dx12/kernels/swin_block.hlsl: the HLSL side of Model L kernels: encoder and decoder blocks, input linears, projections, coefficient step (HIP) #115's gather-source hook and FP16 epilogue, as twodefines. Both default to Model M's code.
SW_SRC1 (LHaloF16Src): the block input is the FP16 halo map [H + 4][W + 4][32]. A window member reads itsown pixel (pr + 2, pc + 2), inside the grid or in the halo, with no mirror.
SW_SRC2 (LCoarseFp8Src): the FP8 map. A member outside the grid takes the mirrored 2 x 2 group (mirror of thegroup index) and keeps its sub-pixel.
SW_OUT_F16(LStoreF16Epi): the output is RN16(x2) as an FP16 map, real members only.#errorotherwise), as HIP's static_assert. The RMS norm needs no change: the HLSLtemplate already sums the squares from the FP32 values, which is what Model L kernels: encoder and decoder blocks, input linears, projections, coefficient step (HIP) #115's custom sources do.
fused_swin_gen.pyneeds.clean/dx12/kernels/fused_swin.hlsl: regenerated (fused_swin_gen.py, LF). It only gains the same text.clean/dx12/kernels/l_swin.hlsl: the two kernels'@wg-kernellines.clean/dx12/vgpr_limits.json: their entries, 96 likel_swin_block_c32_nc. They use 95 (enc) and 93 (dec).clean/l/runner/l_d3d12_check.py: the two kernels' cases, from one case generator per kernel.--kernelspicks the kernels. The existing kernels draw their random inputs in the same order as before.
l_c32_checkgridsplus two with fewer windows than a workgroup.
(
table.block_offset).Refs #89
Tested
Local, Windows, Radeon RX 9000 series card, against main's
l_swin.co(#115 merged):l_d3d12_check.py --run --seeds 6(all Model L kernels of the harness + the control):l_swin_block_c32_enc_nc: 84 of 84 cases identical (6 seeds x 7 grids x 2 offsets; 7,391,232 output bytes);l_swin_block_c32_dec_nc: 84 of 84 identical (14,782,464 bytes);l_swin_block_c32_nc(Model L: D3D12 port of the C = 32 Swin block, byte for byte against its HIP kernel #117): still 48 of 48 identical (23,911,488 bytes);swin_block_c96_nc: 48 of 48 identical (71,734,464 bytes);(HIP 0xA5, D3D12 0x5A).
build_dx12.py --isa(RGA): the same 46 FP8 and 2 FP16v_wmmaasl_swin_block_c32_nc. The encoder has one more128-bit load per lane (the FP16 input row is 32 bytes) and the decoder two 128-bit stores (FP16 out). VGPRs 95 / 93
of 96.
swin_block.hlsl,swin_c64w2.hlsl,fused_swin.hlsl): 9 of 9 byte-identical, main against thisbranch (DXIL SHA-256;
fused_swin.hlslregenerated from the changed template).fused_swin_gen.py --check: up to date.python tools/ci/check_line_endings.py: 0 problems. Public gates (secrets,personal data, licence, chunks) pass.
Not tested
_nc) forms: as for Model M's and Model L: D3D12 port of the C = 32 Swin block, byte for byte against its HIP kernel #117's ports, only the_ncforms are ported.