Skip to content

Model L on native D3D12: its own reconstruction by default (default-post check: M's post fails Model L's oracle) - #170

Merged
phantoslayer21 merged 2 commits into
mainfrom
model-l/default-own-post
Nov 14, 2026
Merged

phantoslayer21 merged 2 commits into
mainfrom
model-l/default-own-post

Conversation

@phantoslayer21

Copy link
Copy Markdown
Owner

Refs #89

Default-post correctness check: today's default (A) fails, so this PR makes l_post=own Model L's default on
native D3D12.
The default flip is oversight's call.

The check (offline: HIP, D3D12 runtime and CPU; no game)

  • Setup:
    • clean/l/runner/l_default_post_check.py (new) runs l_frame_check's 11 frames for Model L on D3D12 in two
      configurations and checks each post per frame against Model L's post oracle (clean/l/reference/recon.py).
    • Each frame is checked on its own inputs: the unpacked pack12 coefficients and the run's own previous history.
  • Model: the converter's real-weight Model L model.wgcm, read by the tools only (as in Model L frame check on real weights: --model for the converter's model.wgcm; record #133):
    • model SHA-256 d3c040191ec7ab0164efc03ee76413277e7fb54e6e6d2b168f2c0202aa1ad806;
    • map SHA-256 58e6d0e7cd6926817cfea28a0b4a65c056e9bfa5ca62aa05b968b62590c9e857.
  • Frames: synthetic (96 x 64 x 5, 80 x 48 x 3, 77 x 45 x 3; resets on frames 0, 2, 5, 8, 9; special colour
    values), D = 180 x 108.
  • Rule: the spec's L post acceptance. FP16 values more than 1 ulp off: at most 0.05 % per frame and at most 0.01 %
    over the run. Plus the rest of l_post_rule, and the reduced codes within 1 and 99 % exact.
  • Record: clean/l/records/l_default_post_real_weights.json (counts and digests only).

(A) Today's default, Model M's fused pack12 post (l_post=m): FAIL.

  • 0 of 11 frames pass. Run: 486912 of 641520 full-history FP16 values more than 1 ulp off (75.9 %).
  • Worst frame: frame 1, 86.6 %. Per frame 62.4 % … 86.6 %. Reduced codes up to 894 codes off.
  • The fused post writes no display image, so A is judged on the full history and the reduced codes.
  • Why: this is not rounding. Model M's post is another algorithm (3 x 3 gather, encoded-domain history mix); Model L's
    is a 4 x 4 gather with a linear-colour history mix (item 4).

(B) Model L's own post (l_post=own): PASS.

  • 11 of 11 frames pass.
  • Run: history 2 of 641520 values more than 1 ulp off (0.00031 %), display 4 of 641520 (0.00062 %).
  • Worst frame: frame 1, history 0.0034 %, display 0.0017 %. Reduced codes at most 1 off.
Frame A history > 1 ulp B history > 1 ulp B display > 1 ulp
0 43220 / 58320 (74.1 %) 0 0
1 50526 (86.6 %) 2 (0.0034 %) 1 (0.0017 %)
2 42833 (73.4 %) 0 0
3 50408 (86.4 %) 0 0
4 44834 (76.9 %) 0 0
5 39216 (67.2 %) 0 0
6 48013 (82.3 %) 0 1 (0.0017 %)
7 45918 (78.7 %) 0 0
8 36373 (62.4 %) 0 1 (0.0017 %)
9 38555 (66.1 %) 0 0
10 47017 (80.6 %) 0 1 (0.0017 %)

Oracle fix found on the way (in this PR).

  • With the oracle as it was, B passed the FP16 limits on all 11 frames but failed frame 6's reduced codes: one pixel
    was 4 codes off.
  • Cause: the same edge case Post reference: motion candidate positions in float32, as the kernel computes them #142 fixed in Model M's reference. A motion candidate position on the bottom edge is
    qy = 108 exactly in the kernels' float32 arithmetic (valid), but just past 108 in the oracle's float64 (invalid),
    and the two samples differ widely.
  • recon.py now computes the candidate positions in float32 as the kernels do (m_center's bilinear and q = X + m,
    Model M's bilinear_f32). With Model M's recon entry it stays byte-identical to Model M's reference
    (test_l_recon).

What changes

  • clean/runtime/runtime.cpp: without the l_post option, Model L on native D3D12 takes l_post=own where its
    route applies (l_own_post_fits: HDR colour, the default pack12 post route, its D3D12 ports present). Otherwise it
    keeps Model M's post. LDR keeps M's post: l_post_recon's LDR form is not written yet.
    • l_post=m and l_post=own keep their meaning; own still refuses what it cannot run. HIP is unchanged (Model L
      runs its own post there already).
  • clean/l/reference/recon.py: the float32 candidate positions above.
  • clean/l/runner/l_frame_check.py --compare-d3d12: follows the D3D12 run's reconstruction. With Model L's own post
    by default, the post outputs are compared with HIP's byte for byte and the display image counts as written.
  • clean/l/runner/l_default_post_check.py (new) and the record.
  • Tests: test_l_runtime_frame — the D3D12 traces of Model M's post route pass l_post=m. The default's rule is
    tested: own with its ports; M with l_post=m, with HDR off, or with any own port missing.

Records with the new default (GPU, gfx1201)

  • D3D12 Model L frame against the HIP frame (l_frame_check --run --backend d3d12, --compare-d3d12; raw
    defined bytes, sentinels; the default now runs l_post_recon_p12):

    Model Real weights Synthetic
    L 11 of 11 frames identical, 28 outputs, 0 differing 11 of 11, 28 outputs, 0 differing
    M (control) 11 of 11 identical 11 of 11 identical

    Negative controls (dropped history write, dropped reduced write, whole reduced write, missing output): all caught.

  • HIP against the references (l_frame_check --compare, every stage):

  • Synthetic oracle check (l_post_check.py --seeds 6, new oracle): pass, 6 of 431784 values more than 1 ulp off,
    negative control caught.

  • CPU tests: test_l_runtime_frame 20 OK, test_l_recon 15 OK, test_l_reference 18 OK, test_l_pack 13 OK,
    test_l_map 3 OK.

  • Gates: leak scan 0 hits; public gates at the baseline (31 / 18 / 108).

Tested / Not tested

  • Tested: everything above.
  • Not tested: a game run with the new default (this check gates it); LDR (keeps M's post, its own LDR kernel is
    not written).

…n where its route applies)

Model M's fused pack12 post, the default so far, is another algorithm than Model L's (3 x 3 gather, encoded-domain
history). Against Model L's post oracle on the 11 frames with the converter's real-weight Model L it fails every
frame (about 76 % of the full history's FP16 values more than one ulp off); Model L's own post passes Model L's post
acceptance on every frame. Record: clean/l/records/l_default_post_real_weights.json, from the new
clean/l/runner/l_default_post_check.py.

- runtime.cpp: without the l_post option, Model L on native D3D12 takes l_post=own where its route applies (HDR
  colour, the default pack12 post route, its D3D12 ports present: l_own_post_fits), else Model M's post; l_post=m and
  l_post=own keep their meaning (own still refuses what it cannot run).
- recon.py (Model L's post oracle): motion candidate positions in float32 as the kernels compute them, as Model M's
  reference does since #142. In float64 one real-weight candidate position fell just past the bottom edge that the
  kernels' float32 arithmetic puts exactly on it (valid), which failed frame 6's reduced codes.
- l_frame_check.py --compare-d3d12: follows the D3D12 run's reconstruction (Model L's own by default now: post
  outputs compared with HIP's byte for byte, the display image written).
- Tests: the D3D12 traces of Model M's post route pass l_post=m; the default's rule is tested.

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
@phantoslayer21
phantoslayer21 merged commit 8ed26e8 into main Nov 14, 2026
9 checks passed
@phantoslayer21
phantoslayer21 deleted the model-l/default-own-post branch November 14, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant