Skip to content

L post filter (D3D12 direct): each lane finishes its own channel before the lane gather - #240

Merged
phantoslayer21 merged 1 commit into
mainfrom
kspeed/l-filter-fo
Nov 15, 2026
Merged

phantoslayer21 merged 1 commit into
mainfrom
kspeed/l-filter-fo

Conversation

@phantoslayer21

Copy link
Copy Markdown
Owner

Draft. Speed change to Model L's output filter on the direct route (clean/dx12/kernels/post_filter.hlsl, kernels l_post_filter_direct and l_post_filter_direct_ldr). It is byte-identical to HIP, and no rounding changes.

What changes

Before this change, the lane of channel 0 gathered channels 1 and 2 from the next two lanes, then applied the pre-exposure scale and the FP16 rounding to all three values. Now each lane finishes its own channel value first (native_direct_scale when the pre-exposure is not 1, fd_half when output_rne16 is set), and channel 0's lane gathers the finished values. It is the same function on the same values, computed once per lane instead of three times on one lane. PF_MUT 1 is a negative control (never shipped): only channel 0 is rounded.

Idea and first measurement: S-FABLE-GPU-RESULTS ("fo").

Results

  • Store check (clean/dx12/tests/post_tf_d3d12_check.py --store): the direct filter's RGBA16F texture (pre-filled with 0x5A, so every texel must be written) and its RGBA32F texture, against HIP's output-copy rows and FP32 output, raw bytes:

    • HDR: 26/26 cases identical. The stored values include 432 rounding ties, 34068 NaN, 57618 values past 65504, 7680 infinities and 107121 values in the FP16 subnormal range, with pre-exposure 1 and other than 1.
    • LDR (--store --ldr): 20/20 identical, incl. 1098 ties, 28176 values past 65504 and 44042 in the FP16 subnormal range.
    • Half-grid negative control caught in both.
    • Mutant PF_MUT 1: caught, 8/26 (HDR) and 4/20 (LDR) cases identical.
  • 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 with main's kernels:

    base this PR
    TOTAL 3.852 ms 3.837 ms
    post part 1.132 ms 1.1085 ms

    Paired rounds: -11.5 to -29.5 us, median -16.5 us.

Tested

  • The store check (HDR and LDR) with its mutant and controls, and the timing above. The HIP filter itself is unchanged, so its checks against the reference stand.

Not tested

  • An in-game run, other resolutions in the timing.

…-exposure scale, FP16 rounding) before the lane gather; PF_MUT 1 negative control

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
@phantoslayer21
phantoslayer21 marked this pull request as ready for review November 15, 2026 08:40
@phantoslayer21
phantoslayer21 merged commit 856e353 into main Nov 15, 2026
10 checks passed
@phantoslayer21
phantoslayer21 deleted the kspeed/l-filter-fo branch November 15, 2026 08:40
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