Repository navigation
Model L frame on native D3D12: Model M's native frame with Model L's encoder and decoder - #140
Merged
Merged
Conversation
phantoslayer21
force-pushed
the
model-l/frame-d3d12
branch
2 times, most recently
from
November 14, 2026 05:37
6e55c45 to
4ec8fab
Compare
…encoder and decoder Model L on backend 3 (native D3D12) runs Model M's native frame with Model L's encoder (step 2) and decoder (step 4). Its coefficients go through the pack12 store l_coef_pack12 (lossless, #131 / #134) into Model M's pack12 post path, the only post path ported to D3D12. dec1 runs its own block (Model M fuses it into its pack12 decoder there; Model L's decoder reads dec1's map), so the xe / xo / xd fusions, which need that fused decoder, are off for Model L; pm, mb and rv apply as for Model M. - clean/runtime/runtime.cpp: - Model L is accepted on backend 3 (builds with WG_MODEL_L); - at create, every D3D12 port Model L needs that <build>/dx12/manifest.json lacks is refused by name, "not yet ported to D3D12": its encoder (the _direct form on the direct-resource route), linears, clamp-free blocks, projections, l_coef_pack12, and dec1's own block swin_block_c64_add_ex_nc. Weights that need a clamped block are refused too (only the _nc forms are ported); - pack12 is Model L's default on backend 3 and required there; on HIP it stays refused (l_coef, base format); - the encoder launches lev/input_encoder_direct on the direct-resource route; the decoder launches l_coef_pack12 on pack12 frames; - the direct-resource checks accept Model L without the fused pack12 decoder. - clean/tests/runtime_frame_trace.cpp: --backend=<n>; l_coef_pack12's arguments decoded. - test_l_runtime_frame.py, class D3D12: the manifest is built from the repository's own @wg-kernel declarations. The missing ports are named, and each one alone is named; with every port present, the frame passes #111's checks on backend 3 (map chain, extents, offsets, parameters, every argument against named buffers and blobs, history, sizes, resets, a failed launch), with the pack12 images' extents, dec1's own block and Model M's pack12 post after the store. Model M on backend 3 traces the same with and without Model L in the build. Refs #89 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
--run --backend d3d12 runs the frame sequence on native D3D12 (runtime backend 3, default kernels: Model L's ports, the pack12 store l_coef_pack12, Model M's pack12 post path; Model M's native frame as the control) and keeps the raw pack12 images. --compare-d3d12 compares every stage output both backends write with the HIP run's, byte for byte, the pack12 images unpacked against the HIP run's A, B and C (the layout of clean/FORMATS.md, dec0 "pack12"). Not compared: b0 ... b4 (the bottleneck megakernels write only b5), the display image (the fused pack12 post writes none), and on the first frame the previous frame's state. Refs #89 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
…well The direct-resource route required the "original" output-filter build of the wave64 fused post (post_w64__orig.co) with the model file's filter weights. With the analytic-filter ports on main (#145, #146; keyed by name and code object, #143) it also takes post_w64.co, the build a model file without those weights uses, as Model L's: the check now refuses only quality5 / quality9, a post outside wave64, or the original filter without weights. test_l_runtime_frame.py: the D3D12 tests use the declared ports as they are (both filter builds of Model M's fused post are declared now); a test that the analytic build of the fused pack12 post is among them. Refs #89 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
…, reported apart An output that is all zero on D3D12 and not on HIP is reported as not written there, not as differing: the D3D12 fusions keep enc1's merged map (pm) and, for Model M, dec2's and dec1's outputs (xe, the fused pack12 decoder) on chip, so those debug buffers stay as allocated. The outputs compared are listed in the result. Refs #89 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
Since #135, the HIP Model L frame reconstructs with l_post_recon while the native D3D12 frame runs Model M's fused pack12 post. Each frame's encoder reads the previous frame's reconstruction, so the two runs part after the first frame, and a byte comparison with HIP holds only where their inputs agree. For Model L, --compare-d3d12 therefore checks the D3D12 frame on its own: - --run --backend d3d12-stages: the frames with the D3D12 fusions off (WG_D3D12_FUSION=none, set before the runtime library loads: one configuration per process), so every stage output is written except b0 ... b4 (the bottleneck megakernel; the plain C = 128 block has no D3D12 port); - every stage of that run against the reference on the run's own inputs, as --compare (compare_model: post_ref "M", the bottleneck as one unit chained from enc2.merged, A / B / C from the unpacked pack12 images, no display for the fused post); - the default kernels (--backend d3d12) against that run, byte for byte; - the default run's post against Model M's post reference. Model M's D3D12 frame stays compared with its HIP frame, byte for byte. test_l_runtime_frame.py: check_frame / check_roles take l_post (False for the native D3D12 frame, which launches Model M's post, not l_post_recon). Refs #89 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21
force-pushed
the
model-l/frame-d3d12
branch
from
November 14, 2026 05:41
4ec8fab to
9b70595
Compare
phantoslayer21
marked this pull request as ready for review
November 14, 2026 05:48
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 on native D3D12 (backend 3): Model M's native frame with Model L's encoder (step 2) and decoder (step 4).
The coefficients go through the pack12 store
l_coef_pack12(#131, #134) into Model M's fused pack12 post, which usesthe analytic-filter ports (#143, #145, #146). This is the reconstruction for the first game run; switching to Model
L's own
l_post_recon_p12(#141) and the analytic filter (#147) follows.What changes
clean/runtime/runtime.cpp:Model L is accepted on backend 3, in builds with
WG_MODEL_L. On HIP (backend 0), Model L frame on HIP: its own reconstruction l_post_recon in place of Model M's post #135's route is unchanged;backends 1 and 2 still refuse Model L.
At create, every D3D12 port Model L needs that
<build>/dx12/manifest.jsonlacks is refused by name ("not yetported to D3D12: ..."); nothing stands in for a missing port. The list:
lev/input_encoder, orlev/input_encoder_directon the game's direct-resource route;l_swin_block_c32_enc_nc/_dec_nc, the two projections,l_coef_pack12;swin_block_c64_add_ex_nc.Weights that need the clamped blocks are refused (only the
_ncforms are ported).Off HIP, Model L does not take Model L frame on HIP: its own reconstruction l_post_recon in place of Model M's post #135's post-route override: pack12 is its default and required on backend 3, and
LDR is not refused there, since Model M's post takes both. Frames the pack12 post does not take (render size too
close to D) run
l_post_reconand the analytic filter, both ported.The fusions pm, mb and rv apply as for Model M. xe, xo and xd need Model M's fused pack12 decoder, so they are
off; dec1 runs its own block.
Direct-resource route:
post_w64.co, a model file without output-filter weights, as Model L's) is acceptednext to the original filter build;
clean/tests/runtime_frame_trace.cpp:--backend=<n>;l_coef_pack12's arguments are decoded.clean/l/runtime/tests/test_l_runtime_frame.py: classD3D12,Ports;check_frame/check_rolestakel_post.clean/l/runner/l_frame_check.py:--run --backend d3d12 | d3d12-stagesand--compare-d3d12(see "GPUrecord").
Refs #89
GPU record (native D3D12,
clean/l/runner/l_frame_check.py, on 4ec8fab)Build:
clean/dx12/build_dx12.pyon this branch: 60 in the manifest, with the analyticw64/post_tf_f32_p12_diet_vsit/post_tf4_dl_f32_p12_diet_vsitandw64/post_filter_c1_s4(post_w64.co);build.pyand--prepare.Frames: #111's 11 per model (96 x 64, 80 x 48, 77 x 45; resets on frames 0, 2, 5, 8, 9; both parities), synthetic
models. Each run was its own locked GPU slot (
gpu_slot.py --cap-s 170): HIP 2.0 s, D3D12 default 2.0 s, D3D12 withthe fusions off 3.0 s.
On D3D12, Model L ran
lev/input_encoder, the linears,l_swin_block_c32_enc_nc,l_project_gather, Model M'snative stages, dec1's
swin_block_c64_add_ex_nc,l_dec_project,l_swin_block_c32_dec_nc,l_coef_pack12andw64/post_tf_f32_p12_diet_vsit(post_pack p12, bottleneckbmegahg,d1d0_p120).every Swin stage written, dec0's coefficients, latent, history, reduced history, final output.
l_post_recon(Model L frame on HIP: its own reconstruction l_post_recon in place of Model M's post #135) and D3D12 with Model M's fused pack12 post. Each frame'sencoder reads the previous frame's reconstruction, so the two runs part after the first frame. Where their inputs
agree (frames 0 and 9), the D3D12 frame is byte-identical to the HIP frame. The D3D12 frame is checked on its own:
Per stage against the CPU reference, on the run with the fusions off (
--backend d3d12-stages): every stagepasses on all 11 frames, under the same rules as Model L runtime frame on the HIP backend (confirmed FORMATS.md interface) #111's HIP check.
State (counter, parity, reset, offsets, latent / motion history / history hand-over) and exposure: 11 of 11.
Default kernels (the game's route) against that run: byte-identical on all 11 frames, across 22 outputs.
enc1.mergedis not written by the default kernels: the pm fusion keeps it on chip.The default run's post against Model M's post reference: 11 of 11 frames pass; history 387 / 641520 differ,
at most 13 FP16 ulps; reduced 8 / 160380.
The D3D12 fusions leave enc1's merged map and Model M's dec2 / dec1 outputs unwritten; these are reported apart, as
all zero on D3D12.
Tested (CPU, the recording device)
clean/l/runtime/tests: 31 tests OK.D3D12class's manifest is built from the repository's own@wg-kerneldeclarations.l_coef_pack12failure.clean.tests.test_runtime_frame_trace,test_model_select,test_model_filter,test_model_pack_cpp: 31 OK(on 4ec8fab).
WG_MODEL_L(before the rebase onto Model L frame on HIP: its own reconstruction l_post_recon in place of Model M's post #135; the runtime's HIP paths for Model M are untouched since).Not tested
lev/input_encoder_direct(kern2). Until then, createrefuses it by name.
l_post_recon_p12+ filter): the follow-up switch.