Skip to content

Model L frame on HIP: its own reconstruction l_post_recon in place of Model M's post - #135

Merged
phantoslayer21 merged 7 commits into
mainfrom
model-l/hip-recon
Nov 14, 2026
Merged

phantoslayer21 merged 7 commits into
mainfrom
model-l/hip-recon

Conversation

@phantoslayer21

@phantoslayer21 phantoslayer21 commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Model L's HIP frame with its own reconstruction: step 5 runs l_post_recon (l_post.co, #128) in place of Model
M's post kernel. It takes Model M's unbanded post_recon route, with post_recon's arguments and buffers
(clean/l/FORMATS.md step 5), 8-byte history and the base coefficient format, then Model M's unbanded output filter.

This branch has #137 merged in (the oracle's steps 4-6 in float32, the cause of the earlier gap), main, and Model L's
post acceptance (below). On the GPU record every stage of all 11 Model L frames passes, and so does Model M's control.

Model L's post acceptance (PROVISIONAL until a kernel-order model of the reconstruction exists; approved by the
coordinator).
Model L only: clean/l/runner/l_post_check.py (l_post_rule, l_post_run) and Model L's post in
clean/l/runner/l_frame_check.py. Model M's checks are unchanged.

  • FP16 values more than 1 ulp off: at most 0.01 % over the whole run, and at most 0.05 % in any one frame or case (was
    0.01 % per frame or case).
  • Unchanged: no non-finite value; at most 1 % of values differ; mean error at most 0.1 % of the reference RMS;
    reduced codes within 1.
  • Why: the kernel's hardware log2 (v_log_f32, not correctly rounded) can put one input feature h(E_in(e c)) on the
    other side of an FP16 rounding boundary than the oracle's correctly rounded log. The gather's half accumulators
    carry that flip forward, to several FP16 steps where a window mixes a clamped negative colour with positive ones.
    With about 5 such values per frame, a per-frame 0.01 % turns on one flip.
  • Evidence: forcing that one feature to the kernel's value in the oracle leaves 0 values more than 1 ulp off on
    frames 8 and 9 of this record (at most 1 step), and on the one case of Model L reconstruction oracle: steps 4-6 in float32 (the gap #135 found) #137's record that failed the old rule.
  • The log2 question itself is part of the Model M fidelity decision, which oversight holds.

What changes

  • clean/l/runner/l_post_check.py, clean/l/runner/l_frame_check.py: Model L's post acceptance (above).
  • clean/runtime/runtime.cpp, for model=L:
    • l_post.co is loaded; the reconstruction launches l_post_recon;
    • refused: Model M's post kernels (post_kernel / WG_POST_KERNEL) and post_pack=p12;
    • refused: LDR colour (WgRtConfig.hdr = 0). l_post_recon is HDR, and Model L's LDR kernel is not written yet.
      Model M's post is never used in its place.
    • the kernel summary adds l_post=l_post_recon.
  • clean/tests/runtime_frame_trace.cpp: --hdr=<0|1>; l_post_recon's arguments are decoded, WgPostParams as
    P{rw,rh,dw,dh,reset}.
  • clean/l/runtime/tests/test_l_runtime_frame.py, test_l_runtime_abi.py: see "Tested".
  • clean/l/runner/l_frame_check.py: Model L runs with HDR colour; its post and filter are compared with
    clean/l/reference/recon.py; --plain runs frames without random_inputs' special values.

Refs #89

GPU record (HIP, clean/l/runner/l_frame_check.py --run and --compare, on 8a3a429: main with #139 and #137
merged in, Model L's post acceptance; the head ea1e4f1 only adds main's #144, D3D12 files only, so the HIP record stands)

RX 9070 XT, locked GPU slots (model-l-frame-1, -2, -3: the same counts on 9278b9a, e217712 and 8a3a429), 2.0 s
in the slot each. The same harness as before: 11 frames per model (96 x 64, 80 x 48, 77 x 45; resets on frames 0, 2,
5, 8, 9; both parities), with random_inputs' special values (NaN, huge and negative colours, NaN depths, motion
leaving the frame). Every stage is checked on the runtime's own inputs. Model M's frame on the same harness is the
control.

  • All stages pass on all 11 frames for both models. Filter: 0 of 285,120 values outside tolerance for each model.
    The default kernels are byte-identical to the six-launch bottleneck run on all 11 frames for both models.
  • Model L's post (against recon.reconstruct with the float32 blend):
    • history: 146 of 641,520 values differ. 24 differ by more than 1 FP16 step, 3.7e-5 over the run (limit 1e-4). At
      most 12 steps.
    • display: 160 differ, 24 by more than 1 step (3.7e-5).
    • reduced codes: 5 of 160,380 differ, by 1.
    • The worst frames (8 and 9, resets) have 6 of 58,320 values more than 1 step off (1.03e-4, per-frame limit 5e-4).
    • Before Model L reconstruction oracle: steps 4-6 in float32 (the gap #135 found) #137 (the float64 blend): 1456 history values differed, at most 238 steps, every frame failed.
  • Model M's post (its unchanged rule): 520 of 641,520 differ, 3 by more than 1 step, at most 4.
  • l_post_check.py (locked slot model-l-post-4, 2 seeds, on 8a3a429): 20 of 20 cases pass. Over the run, 4 of
    143,928 history values are more than 1 step off (2.8e-5). Negative control: fails, as required.

What the frames' over-1-step values are. All 12 over-1-step values on frames 8 and 9 are explained by one input feature per
frame. A render pixel's green feature h(E_in(e c)) lies within 1 float32 ulp of log2 of an FP16 rounding boundary. The
kernel's hardware log2 (v_log_f32, not correctly rounded) rounds it to the other FP16 value than the oracle does.
Forcing that one feature to the kernel's side in the oracle gives 0 values over 1 step on both frames (at most 1 step).
The step grows because the half accumulators of the 4 x 4 gather carry the flip, more so where the window mixes a
clamped negative colour with positive ones. The same mechanism explains l_post_check.py's one failing case on #137.
This is the open kernel-order point (hardware log2 / exp2 / reciprocal), not a wiring or special-value fault.

Tested

  • CPU: clean/l/runtime/tests: 24 tests OK; clean/l/tests: 49 tests OK (on 8a3a429).
    • Model L's frame equals Model M's on the post_recon route (WG_POST_KERNEL=post_recon), launch for launch,
      with steps 2, 4 and 5 replaced; Model M's unbanded filter follows l_post_recon.
    • l_post_recon's 14 arguments match the named buffers and the post blob (found by its bytes' hash): colour, A, B,
      C, the previous history, this frame's motion surfaces, the new history, the reduced history, the display image,
      the exposure pair. Its parameters (render size, D = 180 x 108, reset) and grid are checked too.
    • Three more mix-ups fail: history read / written, post blob / dec0.coef, A / C.
    • Refusals: LDR, a Model M post kernel, post_pack=p12.
    • ABI (compile only): l_post.co exports l_post_recon with 12 addresses, WgPostParams (64 bytes) and an
      address, as the recorder decodes it.
  • clean.tests.test_runtime_frame_trace, test_model_select, test_model_filter, test_model_pack_cpp: 31 OK.
  • Model M unchanged: the 14-case frame trace set is identical to main's. With WG_MODEL_L, one line differs: the
    set's model=L case now stops at the LDR refusal (the set runs without HDR).

Not tested

  • Model L in LDR (the kernel does not exist yet).
  • The banded, fused or true-fusion post routes for Model L: Model L runs only the unbanded route.
  • A real converted Model L file (lane g).

… Model M's post

Step 5 of Model L's frame runs l_post_recon (l_post.co, #128; clean/l/FORMATS.md
step 5) on Model M's unbanded post_recon route: post_recon's arguments and
buffers, 8-byte history, the base coefficient format, then Model M's unbanded
output filter.

- clean/runtime/runtime.cpp: for model=L, l_post.co is loaded and the post kernel
  is l_post_recon. Model M's post kernels (post_kernel / WG_POST_KERNEL) and
  post_pack=p12 are refused for Model L. LDR colour (WgRtConfig.hdr = 0) is
  refused: l_post_recon is HDR and Model L's LDR kernel is not written yet.
- clean/tests/runtime_frame_trace.cpp: --hdr=<0|1>; l_post_recon's arguments
  decoded (P{rw,rh,dw,dh,reset} for WgPostParams).
- test_l_runtime_frame.py: Model L's frame equals Model M's on the post_recon
  route with steps 2, 4 and 5 replaced; l_post_recon's arguments against the
  named buffers and the post blob; its parameters and grid; Model M's filter
  follows; three more mix-ups fail; the LDR and post-kernel refusals.
- test_l_runtime_abi.py: l_post.co's l_post_recon against the recorder's kinds
  (WgPostParams 64 bytes).
- clean/l/runner/l_frame_check.py: Model L runs with HDR colour; its post and
  filter against clean/l/reference/recon.py; --plain runs frames without
  random_inputs' special values.

Refs #89

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
…del-l/hip-recon

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>

# Conflicts:
#	clean/l/runner/l_frame_check.py
Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
…most 0.01 % per run, 0.05 % per case

Model L only (l_post_check.py, and l_frame_check.py for Model L); Model M's checks keep
their per-case 0.01 %. The kernel's hardware log2 (v_log_f32, not correctly rounded) can
flip one input feature across an FP16 rounding boundary; the gather's half accumulators
carry it forward. Forcing that feature in the oracle leaves 0 values over 1 ulp on the
cases that failed. Approved by the coordinator; provisional until a kernel-order model.

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
@phantoslayer21
phantoslayer21 marked this pull request as ready for review November 14, 2026 04:13
@phantoslayer21
phantoslayer21 merged commit 07dd03c into main Nov 14, 2026
9 checks passed
@phantoslayer21
phantoslayer21 deleted the model-l/hip-recon branch November 14, 2026 04:50
phantoslayer21 added a commit that referenced this pull request Nov 14, 2026
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 added a commit that referenced this pull request Nov 14, 2026
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>
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