Skip to content

Recompiler: simplify direct DXIL typed-buffer component decoding - #1739

Open
coolpersonnn wants to merge 1 commit into
xcl-dev:mainfrom
coolpersonnn:dxil/format-load-decode
Open

coolpersonnn wants to merge 1 commit into
xcl-dev:mainfrom
coolpersonnn:dxil/format-load-decode

Conversation

@coolpersonnn

@coolpersonnn coolpersonnn commented Nov 24, 2026 •

Copy link
Copy Markdown

Part of #1269. This rebase keeps the narrow-load selection, descriptor caching and packed-float conversion already in main from 0b64aa0. It carries forward the original patch's single-dword extraction, shared normalization and fixed-format specialization.

What is in it

  • Extract each component of an aligned raw load from one dword and share the divide between signed and unsigned normalization in lower_mem.rs.
  • Emit only the relevant float conversion for fixed formats, bump the translator cache version, and retain the original layout, DXIL shape and GPU correctness tests.

Tested

  • Rebased head b488696 on Ryzen 9 9950X3D, RTX 5090 (621.01), Windows 11 build 26300, rustc 1.100.0 and DXC 1.8.2502.11. .\scripts\test.ps1 with XCL_ADAPTER=nvidia reported 962 passed, 0 failed and 43 ignored. The harness reported 23 GPU skips.
  • Optional XCL_SAMPLE_* fixtures were unset for the rebased suite.
GPU coverage skips on the rebased head
SKIPPED gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))
SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 arithmetic, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))
SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 compares, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu: f64, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer arithmetic, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer carries, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 rounding, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 transcendentals, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 three-source, wave64: no wave64
SKIPPED gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64
SKIPPED gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64
SKIPPED shaders::tests::pso_measurement_compiles_an_exact_synthetic_record: cannot disable the driver cache (Windows Developer Mode is required): The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D)
SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows
  • The DXIL tests verify one division per decoded dynamic component and constant-format folding. GPU readback covers unaligned, swizzled and fixed-format loads.

Regression run

Main

xcl-smoke v1
commit: c4d37bec1bb4286eb373aea963404a23f13401fa
gpu: NVIDIA GeForce RTX 5090
title: a93b40d7
seconds: 60
exit: 0x0
frames shown: 1082 (PresentX 1082)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15601 MB

PR head

xcl-smoke v1
commit: b488696e62a41cef17f98f15d65135be2432a851
gpu: NVIDIA GeForce RTX 5090
title: a93b40d7
seconds: 60
exit: 0x0
frames shown: 1065 (PresentX 1065)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15582 MB

Not tested

  • The title smoke run used the default HLSL path. Direct-DXIL coverage comes from GPU and DXIL shape tests. Retail shader performance was measured on the earlier proposal, before the overlapping improvements landed, and has not been remeasured on this head.

AI use

  • T3 Code / Antigravity (gemini-pro-orchestrator-neon) wrote and tested the original implementation. Codex (GPT-6 family, exact model variant unavailable) resolved the rebase, adapted the decoder to main, and ran the checks for this head.

Keep main's descriptor caching, narrow-load selection and packed-float
decoder. Each format component fits in one aligned dword, so extract it
without combining neighboring words. Choose the normalized numerator and
denominator before dividing. Skip unrelated float conversions for fixed
MTBUF formats.

The DXIL shape test checks one divide per decoded dynamic component and
constant-format folding. The GPU test checks dynamic, swizzled and
constant-format loads, including unaligned reads.

Part of xcl-dev#1269
Assisted-by: T3 Code / Antigravity (gemini-pro-orchestrator-neon)
Assisted-by: Codex (GPT-6 family, exact model variant unavailable)
@ivall ivall added the goal:world-load Bears on the retail title getting past world loading label Nov 24, 2026
@coolpersonnn coolpersonnn changed the title Recompiler: direct DXIL decodes only requested buffer format components Recompiler: simplify direct DXIL typed-buffer component decoding Nov 24, 2026
@coolpersonnn
coolpersonnn force-pushed the dxil/format-load-decode branch from c163d86 to b488696 Compare November 24, 2026 21:39
@futurepro62

Copy link
Copy Markdown

Full-suite run, since this PR has no test report yet. Tested exact head b488696 (on its base 266b845).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip pso_measurement_compiles_an_exact_synthetic_record --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu: 956 passed, 0 failed, 43 ignored. SKIPPED (no wave64): a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, a_per_lane_2d_or_3d_group_runs_on_the_gpu, coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu, cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu, gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.
  • The new tests ran and passed: buffer_format_components_fit_in_one_dword, buffer_load_format_decodes_only_requested_components_and_folds_constants, buffer_load_format_direct_gpu.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 962 passed, 0 failed, 43 ignored. SKIPPED: f16_programs_on_the_gpu (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • Six tests were skipped with --skip on NVIDIA. All fail on main too, not because of this PR: under XCL_REQUIRE_GPU=mesh, runner::skip_test turns their skips into failures. heap_window_out_of_memory_falls_back_to_the_switch_form skips when XCL_HEAP_WINDOWS is unset (Tests: heap_window_out_of_memory_falls_back_to_the_switch_form fails under XCL_REQUIRE_GPU=mesh (opt-in skip counted as missing coverage) #1651); the four lower_dxil *_programs_on_the_gpu tests skip with a "no wave64" reason the exemption does not match (follow-up on #1651); pso_measurement_compiles_an_exact_synthetic_record failed this way while Developer Mode was off here. The AMD run does not set XCL_REQUIRE_GPU.
  • The first NVIDIA run, of the previous head c163d86 with another PR's suite running on the machine, failed hle::kernelx::tests::fine_timer_makes_short_sleeps_short (a Sleep(1) timing check, sensitive to load). The run above was alone on the machine.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

@nnonno91

Copy link
Copy Markdown

Focused heap-window test of rebased head b488696e62a41cef17f98f15d65135be2432a851 on Windows. A synthetic formatted-load shader produced the expected output on both GPUs and was 6.7–7.3% smaller through direct DXIL compared with its immediate parent c4d37bec1bb4286eb373aea963404a23f13401fa.

Tested

  • Windows 11 25H2 build 26200.9974, Ryzen 7 9800X3D, AMD Radeon(TM) Graphics (32.0.21042.62, native wave64) and NVIDIA GeForce RTX 5090 (32.0.16.1742, split wave64). Rust 1.100.0 MSVC, Windows SDK DXC 1.8.2502.11, debug/test profiles. Adapters selected with XCL_ADAPTER.
  • On the clean head, XCL_DIRECT_DXIL=all XCL_HEAP_WINDOWS=1 with cargo test --locked -p xcl --lib gpu::dxil::core_tests::buffer_load_format -- --test-threads=1 --show-output gave 2 passed, 0 failed, 0 ignored on each GPU. With the same flags, cargo test --locked -p xcl --lib memory_windows -- --test-threads=1 --show-output gave 6 passed, 0 failed, 0 ignored on each GPU. No skips in either filter.
  • I reused the same temporary synthetic fixture from my dxil: eliminate giant-shader IR and CFG blowup in FormatLoad and multi-window memory #1748 test, now on the exact head and its immediate parent. cargo test --locked -p xcl --test format_windows_gpu_probe -- --exact formatted_loads_use_latest_descriptor_across_windows --test-threads=1 --nocapture gave 1 passed, 0 failed, 0 ignored per invocation, no skips. The shader reused the same SGPRs for two descriptors, then checked narrow, wide, D16 and out-of-bounds reads from 16-bit float and swizzled 8-bit normalized data in separate memory windows. Across wave32, the adapter's wave64 form, switch and heap windows, and both translators, 4,608/4,608 output dwords matched the CPU reference per GPU and revision. All direct shaders passed DXIL validation. The fixture was removed from both worktrees.
Direct shader Switch windows, bytes before → after Heap windows, bytes before → after
Wave32, both GPUs 14,576 → 13,588 13,180 → 12,212
Native wave64, AMD 14,616 → 13,628 13,216 → 12,252
Split wave64, RTX 5090 14,904 → 13,912 13,500 → 12,532

Not tested

The full workspace suite on this rebased head in my setup, retail behavior, or driver compile times.

AI use

OpenAI Codex (GPT-6 family, exact variant unavailable) ran and verified the tests and wrote this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants