Repository navigation
L post recon (D3D12): fewer VALU in the tap, history and encode paths, byte-identical, with a guarded conversion fold (draft) - #231
Merged
Conversation
…LDS index without per-tap multiplies, history encode through the conversion fold Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
…loads, same texels and sums) Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
…the driver's conversion fold with a start-up probe and a no-fold port, an ISA check in the build, mixed-lane frames in the L frame check 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>
…/ no-fold post ports, history fast path guarded for images under 4 x 4, edge-size check - device_d3d12: after l_fold_probe, the native device runs l_post_recon_p12's fold port and no-fold port on one crafted frame (clean/runtime/fold_selftest.h from gen_fold_selftest.py: FP32-product ties of both sides on each of the six encode sites, zero and FP16-subnormal products, the floor) and compares the raw output bytes; the fold ports run only when both steps pass (fail closed, also for a fold port without a self-test) - build_dx12: isa= terms <op>@<literal> count only the x * literal + 0 sites; the fold port's rule is the six kEncK sites; --define for test variants - l_post.hlsl: the interior predicate requires P_dw >= 4 and P_dh >= 4 before its unsigned tests; LP_MUT 8 / 9 mutants and the LP_HSCOUNT test counter - l_post_edge_check.py: the four post kernels and the no-fold port at 14 sizes (1 x 1 ... 97 x 35) and 12 motion kinds, D3D12 against HIP raw bytes with per-edge bands, the counter, the mutants and the oracle - kernel_replay prints the device note Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
…o-fold port is the only port; edge check legs must be complete The fold, its start-up probe and self-test, the needs= / isa= port selection and their tests move to a follow-up branch. l_post_recon_p12 is one port again: the round-to-odd history encode, exact on any driver. The edge check drops its fold legs, empties each leg's output folder before the run, and counts a leg (mutants included) only when kernel_replay exits 0 and every case wrote every output at full size. 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.
Draft. Speed change to Model L's reconstruction kernels (D3D12 port, wave32), byte-identical to HIP on any driver: no step depends on a driver fold. The history-encode fold that an earlier revision of this PR carried, with its start-up probe and self-test, moved to a follow-up PR.
What changes
clean/dx12/kernels/l_post.hlsl, shared by the four post kernels (l_post_recon,l_post_recon_p12, and their LDR forms):opqh(a * b)becomesmulh(a, b) = fma(a, b, -0)with an opaque -0: one instruction instead of a multiply plusv_xor_b16, and the driver cannot fuse it into the following add. RN16(a b + -0) = RN16(a b) for every non-NaN pair, zeros included.madorder), as Model M'shistory_cr_span. It is taken only when every sampling lane's 4 x 4 footprint is inside the history, and only for a history of at least 4 x 4. Below that size the unsigned bounds would wrap, so smaller images take the clamped path.and()/or()in place of short-circuit&&/||, andopq(x) * kasfma(x, k, opaque -0)(as Model M's post).The history encode is unchanged: the round-to-odd product into the driver's conversion, exact without any fold.
Tests:
l_frame_check.pyadds two frames whose colour alternates dark and bright blocks of 8 columns, so one wave holds lanes on both sides of a per-lane branch. Without them, a wrong wave-level test in item 6 went undetected.clean/l/runner/l_post_edge_check.py(new) runs the four post kernels at 14 history sizes (1 x 1 to 97 x 35: sides below 4, odd sizes, a tile's interior boundary in the middle of a wave) and 12 motion kinds (random; every lane at the centre or just inside each edge; the fast path's footprint boundary from inside and outside; waves that mix inside and edge lanes). It compares D3D12 with HIP raw bytes, reports the full history per edge band, checks HIP against Model L's reference, and counts the waves taking the fast path in a test build (LP_HSCOUNT) against expectations simulated from the kernel's grid. Every leg starts from an emptied output folder and counts only when the replay exits 0 and every case wrote every output at full size, so a failed mutant run is never taken as caught.clean/dx12/tests/test_post_edge_cases.py(CPU): the guarded predicate equals the footprint test at every size from 1 x 1, the old one reads outside images with a side below 4, and each edge-check kind samples where it says.build_dx12.py --definebuilds such test variants.LP_MUT 1, 2, 4 ... 9are negative-control mutants (never shipped; 8: the fast path's predicate always false, 9: the predicate without its size guard).Results
Frame check (
l_d3d12_own_post_check.py, 13 frames incl. the mixed ones; raw bytes against the HIP frame, sentinels, record-level negative controls):LDR leg (
l_frame_check --ldr, D3D12 vs HIP): 13/13.Edge check:
Mutants of the frame check (earlier revision, same code for these items):
Timing on the direct route (test_interop_d3d12 hipbench, executor dx12, runtime timing log), 1440p Quality, synthetic L model, 5 interleaved rounds. The base is the same runtime library (built from this branch; no runtime code changes) with main's kernels:
Paired rounds: -79.5 to -123 us, median -110 us.
Tested
clean/dx12/tests/test_post_edge_cases.pyandtest_kernel_sets.py.Not tested