Skip to content

Model L: D3D12 direct form of the halo input encoder (lev/input_encoder_direct), byte for byte against its HIP twin - #144

Merged
phantoslayer21 merged 2 commits into
mainfrom
model-l/l-halo-enc-direct-d3d12-pr
Nov 14, 2026
Merged

phantoslayer21 merged 2 commits into
mainfrom
model-l/l-halo-enc-direct-d3d12-pr

Conversation

@phantoslayer21

Copy link
Copy Markdown
Owner

Model L (#89): the D3D12 direct form of Model L's halo input encoder, lev/input_encoder_direct, byte for byte against
its HIP twin. The native D3D12 route with the game's own resources (Cyberpunk 2077's route) runs Model M's
input_encoder_direct; #127 ported only the buffer form of Model L's encoder.

Like Model M's input_encoder_direct, this kernel has no HIP kernel of its own. It is the buffer kernel reading the
game's textures. Its HIP twin is input_encoder of l_enc_values.co (encoder.hip with WG_ENC_VALUES_OUT=1).

Targets main. CI needs no GPU: nothing here runs without one.

  • clean/dx12/kernels/encoder.hlsl: the @wg-kernel line of lev/input_encoder_direct, which is
    WG_DIRECT_TEXTURES=1 with WG_ENC_VALUES_OUT=1, rs=direct. Model M's direct-texture loads stay unchanged and
    the halo switch of Model L: D3D12 port of the halo input encoder (lev/input_encoder), byte for byte against its HIP kernel #127 applies on top. The #error now refuses only the combination with motion at output
    resolution.
  • clean/dx12/tests/kernel_replay.cpp: a direct-resource mode, so a direct kernel can be checked byte for byte.
    • New case lines: direct <slot> <format> <w> <h> <file> (slots color, depth, motion, output) and
      direct_params <rx> <ry> <rw> <rh>.
    • The case creates the textures, fills them in one recorded pass, and leaves the inputs NON_PIXEL_SHADER_RESOURCE
      and the output UNORDERED_ACCESS.
    • It binds them with NativeD3D12Ext::bind_direct_frame (motion scale 1, offset 0, color_pi 1, no exposure
      texture) around the launch, then ends the frame. All through the device's own API.
  • clean/l/runner/l_d3d12_ops_check.py: lev/input_encoder_direct cases.
    • The frames and random draws of the buffer form's cases (Model L: D3D12 port of the halo input encoder (lev/input_encoder), byte for byte against its HIP kernel #127, including the width-17 frames).
    • HIP runs input_encoder on the frame's buffers. The D3D12 port reads the same FP32 values from textures:
      color RGBA32F, depth R32F, motion RG32F, so every texel load is exact.
    • The D3D12 color argument is a zeroed colour-table buffer (no table), and the depth and motion arguments are null:
      the direct form does not read them. The same four outputs are compared.

Refs #89

Tested

Local, Windows, Radeon RX 9000 series card, against main's l_enc_values.co:

  • GPU (one GPU slot), l_d3d12_ops_check.py --run --seeds 6 --kernels lev/input_encoder_direct,lev/input_encoder:
    • lev/input_encoder_direct: 36 of 36 cases identical (6 seeds x 6 frames; halo map + 3 motion surfaces,
      3,854,688 output bytes);
    • lev/input_encoder (Model L: D3D12 port of the halo input encoder (lev/input_encoder), byte for byte against its HIP kernel #127): still 36 of 36 identical (3,854,688 bytes);
    • the Model M control swin_block_c96_nc: 36 of 36 identical (3,167,424 bytes);
    • 0 differing bytes in every output. The negative control (a direct case at half grid) was caught: 50,495 bytes
      differed;
    • compared as raw downloaded bytes. Each output was first filled with its back end's own non-zero sentinel
      (HIP 0xA5, D3D12 0x5A).
  • Model M's 4 encoder DXILs (input_encoder, input_encoder_direct, emo/input_encoder_mo,
    emo/input_encoder_mo_direct): 4 of 4 byte-identical, main against this branch (DXIL SHA-256).
    lev/input_encoder's DXIL is also unchanged.
  • python tools/ci/check_line_endings.py: 0 problems. Public gates (secrets, personal data, licence, chunks) pass.

Not tested

  • In a whole Model L frame on D3D12 (waits for param's D3D12 frame).
  • Game texture formats other than the FP32 ones used here (RGBA16F colour, RG16F motion): those reads are the same
    typed loads as Model M's direct encoder, and the values they deliver are what both forms consume.
  • A pre-exposure other than 1 and the colour-table path: the same code as Model M's direct encoder, not exercised here.

…er_direct), byte for byte against its HIP twin

kernel_replay gets a direct-resource mode (textures bound as one direct frame) so the
direct form is checked against HIP's input_encoder of l_enc_values.co on the same values.

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 03:53
Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>

# Conflicts:
#	clean/l/runner/l_d3d12_ops_check.py
@phantoslayer21
phantoslayer21 merged commit 03f80c8 into main Nov 14, 2026
9 checks passed
@phantoslayer21
phantoslayer21 deleted the model-l/l-halo-enc-direct-d3d12-pr branch November 14, 2026 04:03
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