Skip to content

D3D12: analytic-filter direct forms of the fused output kernels, checked against HIP through a direct frame - #146

Merged
phantoslayer21 merged 8 commits into
mainfrom
dx12/post-analytic-direct
Nov 14, 2026
Merged

phantoslayer21 merged 8 commits into
mainfrom
dx12/post-analytic-direct

Conversation

@phantoslayer21

@phantoslayer21 phantoslayer21 commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Refs #89

Stacked on #145 (analytic-filter buffer forms; #143 has merged); this PR adds its own commit on top.

The game route on native D3D12 runs the _direct forms of the fused output kernels: the colour is read from the game's texture and the output is written into its texture. This PR adds the analytic-filter (post_w64.co) direct forms and a way to check them against HIP.

What

  • clean/dx12/kernels/post.hlsl: w64/post_tf_f32_p12_diet_vsit_direct and w64/post_tf4_dl_f32_p12_diet_vsit_direct with co=post_w64.co (WG_LZ_ANALYTIC with POST_OUT = 3).
    • The analytic filter runs in the direct form's vertical item: the lane's phase selects the FP32 constant weights.
    • The FP16-indexed output table is not used; it needs the original's FP16 filter result.
    • The original's DXILs are unchanged.
  • clean/dx12/tests/kernel_replay.cpp: a direct_out <file> case line next to Model L: D3D12 direct form of the halo input encoder (lev/input_encoder_direct), byte for byte against its HIP twin #144's direct / direct_params lines. After the launch, the output texture is read back (rows packed). The harness gives an RGBA32F colour texture with the colour buffer's values, depth and motion of zeros, and an RGBA32F output filled with a sentinel word, at color_pi 1 with no exposure texture.
  • clean/dx12/tests/post_tf_d3d12_check.py --direct: the direct forms have no HIP kernel of their own; post.hlsl defines form 3 as form 0 followed by the output store. With color_pi 1 and RGBA32F textures, a direct port's output must match HIP's form 0 (post_w64.co) as follows:
    • output texels: the RGB words equal HIP's FP32 output, and alpha is 1.0;
    • history and reduced codes: as in l_d3d12_ops_check.py (raw bytes, sentinels, slack);
    • its out_p buffer stays untouched.

GPU record

post_tf_d3d12_check.py --run --direct --seeds 3, one GPU slot, this branch's DXILs and kernel_replay.exe.

cases identical texture RGB bytes history + reduced bytes
w64/post_tf_f32_p12_diet_vsit_direct (analytic) vs HIP post_tf_f32_p12_diet_vsit (post_w64.co) 15 15 26,611,776 44,914,704
w64/post_tf4_dl_f32_p12_diet_vsit_direct (analytic) vs HIP post_tf_f32_p12_diet_vsit / post_tf_dl_f32_p12 15 15 731,808 1,240,800
control: Model M w64/post_tf_f32_p12_diet_vsit_direct (original) vs post_w64__orig.co form 0 12 12 806,976 1,368,720
  • Totals: 0 differing words or bytes; 0 bad slack bytes; out_p untouched in every case; alpha 1.0 everywhere.
  • Frames: as D3D12: analytic-filter ports of the fused output kernels (post_w64.co), byte for byte against HIP #145 (Quality, Performance, odd sizes, reset, exposure pair given or not, a 2560 x 280 output with two chunk sizes; tf4 also at native AA).
  • Negative control: w64_post_tf_f32_p12_diet_vsit_direct_s0_4 again with half its workgroups. Caught: 829,440 texture words differ.
  • Model M unchanged: all 10 original-filter kernels of post.hlsl, built from main and from this branch: SHA-256 identical, 10 of 10 (w64/post_tf_* incl. _tex, _direct, tf4; pmo/post_tf*_mo*). A manifest of this branch holds them unchanged plus four analytic entries.

Tested

Not tested

  • A colour pre-exposure other than 1 (the direct form's division) and a render rectangle offset inside the colour texture: the buffer form gets its colour after the staged division, so comparing these needs that division reproduced. The direct paths for them are the original's and are unchanged.
  • RGBA16F outputs (output_rne16); typed output formats other than RGBA32F.
  • A whole frame through the runtime: runtime.cpp still refuses the native direct route without the original's filter weights (the D3D12 frame work).

…), byte for byte against HIP

post.hlsl WG_LZ_ANALYTIC: w64/post_tf_f32_p12_diet_vsit and w64/post_tf4_dl_f32_p12_diet_vsit of
post_w64.co (the build the runtime loads when the model file has no output-filter weights, e.g.
Model L): FP32 Lanczos constants, FP32 values between the passes, no weight arguments. The
original's DXILs are unchanged. post_tf_d3d12_check.py: these ports against HIP post_w64.co with
l_d3d12_ops_check.py's engine (raw bytes, sentinels, slack, negative control), the original port
against post_w64__orig.co as the Model M control; the harness takes a kinds table and a HIP block.

Refs #89

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
…ked against HIP through a direct frame

post.hlsl: w64/post_tf_f32_p12_diet_vsit_direct and w64/post_tf4_dl_f32_p12_diet_vsit_direct of
post_w64.co (WG_LZ_ANALYTIC with POST_OUT 3): the analytic filter in the direct form's vertical item,
without the FP16-indexed output table. The original's DXILs are unchanged. kernel_replay.cpp: a
direct line (bind_direct_frame with RGBA32F colour and output textures, the output read back).
post_tf_d3d12_check.py --direct: the direct ports' output texels, history and reduced codes against
HIP's form 0 (post_w64.co), the original's direct port against post_w64__orig.co as the control.

Refs #89

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

# Conflicts:
#	clean/dx12/tests/kernel_replay.cpp
…ed build)

The analytic-filter ports declare the same kernel names as the original filter's with co=post_w64.co;
every declaration line is still checked for the 256 lanes and the cap.

Refs #89

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
@phantoslayer21
phantoslayer21 marked this pull request as ready for review November 14, 2026 04:44
@phantoslayer21
phantoslayer21 merged commit 668aab5 into main Nov 14, 2026
9 checks passed
@phantoslayer21
phantoslayer21 deleted the dx12/post-analytic-direct branch November 14, 2026 04:45
phantoslayer21 added a commit that referenced this pull request Nov 14, 2026
…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>
phantoslayer21 added a commit that referenced this pull request Nov 14, 2026
…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>
phantoslayer21 added a commit that referenced this pull request Nov 14, 2026
…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>
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