Repository navigation
Model L: D3D12 ports of the input linears, byte for byte against their HIP kernels - #122
Merged
Merged
Conversation
…r HIP kernels l_ops_linear.hlsl ports l_linear_32_32_relu and l_linear_32_32_f16 of l_ops.co (clean/l/kernels/l_ops.hip, #115). No branch around the matrix instructions: a lane past the end of the map stores its clamped pixel's bytes to that pixel (a branch around the store let the compiler sink the WMMAs into it; wrong values in a partly filled wave). l_d3d12_ops_check.py compares any l_ops.co kernel's D3D12 port with its HIP kernel: raw bytes, each back end's output filled with its own sentinel, a negative control. l_d3d12_check.py gains prepare_replay (the ports and kernel_replay.exe), shared by both harnesses. Refs #89 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
The control (swin.co, its D3D12 port already proven on whole frames) runs through the same engine as the l_ops.co ports (raw bytes, sentinels, negative control) in every run unless --no-control; cases name their code object. Refs #89 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 01:40
phantoslayer21
added a commit
that referenced
this pull request
Nov 14, 2026
Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21
added a commit
that referenced
this pull request
Nov 14, 2026
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 (#89): the D3D12 ports of Model L's two input linears, byte for byte against their HIP kernels:
l_linear_32_32_reluandl_linear_32_32_f16ofl_ops.co(clean/l/kernels/l_ops.hip).Stacked on #117 (it uses
kernel_replayand the shared harness rules from there); it targets main once #117merges. Depends on #115 for the HIP kernels it is checked against (checked at #115's head 0ec574e). CI needs
neither: nothing here runs without a GPU.
clean/dx12/kernels/l_ops_linear.hlsl(new): both kernels from one source (LIN_RELU).clean/l/FORMATS.md); every load before the first matrix instruction.continue, no store) computespixel npix - 1, since its input is clamped there as in HIP, and stores it to pixel npix - 1. Those are the same bytes
that pixel's own lane stores. The first version guarded the store with
if (pix < npix), as HIP does. The D3D12compiler then sank the WMMAs into that branch, where they ran with part of the wave masked off: wrong values in a
partly filled wave (a 35-pixel map, pixels 32..34). A test padding the same map to a full wave showed HIP right and
D3D12 wrong. The fixed ISA has 0 branches, 2 stores and 4 WMMAs per kernel (
build_dx12.py --isa).clean/l/runner/l_d3d12_ops_check.py(new): anyl_ops.cokernel's D3D12 port against its HIP kernel, with therules of Model L: D3D12 port of the C = 32 Swin block, byte for byte against its HIP kernel #117's review:
left unwritten by either path differs;
swin_block_c96_nc(swin.co, its D3D12 port already proven on whole frames) runs throughthe same engine in every run, so the harness itself is proven too;
The projections and
l_coefjoin it in their own pull requests.clean/l/runner/l_d3d12_check.py:prepare_replay(build the ports andkernel_replay.exe), shared by bothharnesses.
Refs #89
Tested
Local, Windows, Radeon RX 9000 series card, with #115's HIP kernels:
l_d3d12_ops_check.py --run --seeds 6 --kernels l_linear_32_32_relu,l_linear_32_32_f16:l_linear_32_32_relu: 30 of 30 cases identical (6 seeds x 5 maps: 16 x 24, 36 x 68, 8 x 8, 68 x 100 and5 x 7 pixels, the last a partly filled wave; 1,868,352 output bytes);
l_linear_32_32_f16: 30 of 30 identical (3,736,704 bytes);swin_block_c96_nc: 36 of 36 identical (3,167,424 bytes);build_dx12.py --isa: 2buffer_store, 4v_wmma, 0 branches per kernel (the stores the kernel must issue).python tools/ci/check_line_endings.py: 0 problems. Public gates (secrets, personal data, licence, chunks) pass.Not tested