Skip to content

Recompiler: XCL_RECOMP_NO_STRUCTURED picks the default, not an override - #1810

Open
b3IKK wants to merge 1 commit into
xcl-dev:mainfrom
b3IKK:recomp/no-structured-is-a-default
Open

b3IKK wants to merge 1 commit into
xcl-dev:mainfrom
b3IKK:recomp/no-structured-is-a-default

Conversation

@b3IKK

@b3IKK b3IKK commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

The XCL_RECOMP_NO_STRUCTURED=1 debug switch was read inside translate() (recomp/mod.rs:1481), so it also overrode an explicit Options { structured: true }. The tests that assert what the structured form generates therefore failed whenever a developer ran the suite with the switch set — with output that reads like a translator regression, not a configuration switch.

This reads the switch in Options::default() — which is what the runtime asks for — so an explicit request wins, and the tests that check the structured form ask for it outright (including oversized_structured_code_falls_back_to_pc_blocks, from #1321, whose size bound is also about what the structured form generates).

What is in it

  • crates/xcl/src/gpu/recomp/mod.rs: Default for Options sets structured from XCL_RECOMP_NO_STRUCTURED; translate no longer reads the environment.
  • crates/xcl/src/gpu/recomp/tests.rs: hlsl_is_generated_for_straight_line_and_branches, far_jumps_are_direct_branches and oversized_structured_code_falls_back_to_pc_blocks pass Options { structured: true, ..Default::default() } (the loop test already did).

Evidence (same machine, cargo test -p xcl --lib -- --test-threads=4):

  • before, with XCL_RECOMP_NO_STRUCTURED=1 on 4178e88: 840 passed; 3 failed; 22 ignored — far_jumps_are_direct_branches, hlsl_is_generated_for_straight_line_and_branches, jumps_to_outer_loop_heads_are_structured
  • after, with it, rebased on e9e94ce: 843 passed; 0 failed; 22 ignored
  • after, without it (the default): 843 passed; 0 failed; 22 ignored — unchanged

Tested

  • hardware (GPU + driver, CPU), Windows build, Rust version, debug / release: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1)
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4): 892 passed, 0 failed, 42 ignored (SKIPPED: 2 no wave64; 1 no heap windows; 1 cannot disable the driver cache (Windows Developer Mode is required))

Regression run

main (e9e94ce, clean tree, no local changes):

xcl-smoke v1
commit: e9e94ce665d16bb0e2d2e4cb6b37e149f0d27721
gpu: NVIDIA GeForce RTX 5080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1646 (PresentX 1646)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14489 MB

PR (f46ebd6, clean tree, no local changes):

xcl-smoke v1
commit: f46ebd6280652057a9ed2ef377cd9c2103f58f70
gpu: NVIDIA GeForce RTX 5080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1643 (PresentX 1643)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14613 MB

Not tested

  • the switch under the retail title (the smoke run uses the default)
  • AMD GPUs and native wave64 hardware
  • other titles (Minecraft Preview, Unicorn Overlord, Fortnite, XDefiant) and Linux / Wine

AI use

  • OpenCode, Gemini 4 Neon: ran the suite under XCL_RECOMP_NO_STRUCTURED=1 and XCL_CONSOLE_LISTS=1, found the switch overriding explicit requests, wrote the change, rebased onto e9e94ce (where the new oversized_structured_code_falls_back_to_pc_blocks needed the same explicit option) and confirmed both configurations pass, ran the test suite and scripts/smoke.ps1 regression runs with Scripts: smoke blocks print the game folder's name #677's title hashing, and drafted this PR description.

The switch was read inside translate(), so it also overrode an explicit
Options { structured: true }: three tests that assert what the
structured form generates failed whenever a developer ran the suite
with it set (as I did: 3 of 843), with output that reads like a
regression in the translator rather than a configuration switch.

Read it in Options::default() (the runtime asks for the default), where
an explicit request then wins, and have the tests that check the
structured form ask for it outright.

Assisted-by: OpenCode (Gemini 4 Neon)
@b3IKK
b3IKK force-pushed the recomp/no-structured-is-a-default branch from fbd01e9 to f46ebd6 Compare November 24, 2026 21:09
@b3IKK

b3IKK commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto e9e94ce (which merged #1321): the new oversized_structured_code_falls_back_to_pc_blocks had the same dependency on Options::default(), so it now asks for the structured form explicitly too — with XCL_RECOMP_NO_STRUCTURED=1 the suite is 843 passed; 0 failed (it was 840 passed; 3 failed before this PR), and unchanged without it. The smoke blocks were re-run on the new main with #677's title hashing.

@futurepro62

futurepro62 commented Nov 24, 2026 •

Copy link
Copy Markdown

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

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: 890 passed, 0 failed, 42 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • No new #[test] functions in the diff.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 892 passed, 0 failed, 42 ignored. SKIPPED: heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • Two tests were skipped with --skip on NVIDIA. Both fail on main 7f7e768 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), and shaders::tests::pso_measurement_compiles_an_exact_synthetic_record skipped because Developer Mode was off. Developer Mode was turned on before the AMD run, and there pso_measurement_compiles_an_exact_synthetic_record ran and passed.

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:

Thanks!

@JJAutoCompare

Copy link
Copy Markdown

Tested

  • XCL PR #1810 was open at f46ebd6280652057a9ed2ef377cd9c2103f58f70 before and after testing. The reused detached checkout matched that SHA and was clean both times. The live discussion had author and other-machine results, with no matching STOR-WINLAB CPU matrix.
  • STOR-WINLAB, Windows 11 Enterprise Evaluation build 26200.9974, Ryzen 7 3800X (6 cores and 12 logical processors exposed), Arc A770 driver 32.0.101.9175, stable-x86_64-pc-windows-msvc, rustc 1.100.0 (0ef1bc386 2026-11-09), Cargo 1.100.0 (3acc79c0c 2026-11-05), unoptimized test profile with debug info disabled.
  • All three fixtures passed with XCL_RECOMP_NO_STRUCTURED absent and with it set to 1. The explicit structured requests preserved the expected generated HLSL under both defaults. That included forward and backward branches, a resolved far jump emitted without PC dispatch, and the size-bound case staying structured for 50 crossing jumps and falling back to PC blocks for 200. The straight-line fixture also passed its explicit unstructured assertion in both modes.
  • Each CPU-only invocation exited 0 and reported 1 passed, 0 failed, 0 ignored, 864 filtered. Per setting: 3 fixtures passed their CPU assertions, 0 failed, 0 ignored, with 1 optional GPU tail marked SKIPPED by far_jumps_are_direct_branches. Total: 6 fixture passes, 0 failed, 0 ignored, 2 GPU-tail skips. DXC and DXIL 1.9.2609.5 were loaded by the far-jump availability probe. The CPU-only run performed no shader compilation, DXIL validation, or GPU dispatch.
$run = 'L:/XclTooling/pr1810'
$env:PATH = "$env:USERPROFILE/.cargo/bin;$env:PATH"
$env:TEMP = Join-Path $run 'temp'
$env:TMP = $env:TEMP
$env:CARGO_TARGET_DIR = 'L:/XclTooling/pr1512-tiling-edges-fddfa267/target'
$env:CARGO_BUILD_JOBS = '2'
$env:CARGO_INCREMENTAL = '0'
$env:CARGO_PROFILE_DEV_DEBUG = '0'
$env:CARGO_PROFILE_TEST_DEBUG = '0'
$env:XCL_ADAPTER = 'pr1810-cpu-only-no-adapter'
$env:XCL_DXC_DIR = "$env:LOCALAPPDATA/XclTooling/dxc-1.9.2609/bin/x64"
foreach ($mode in @('absent', '1')) {
  if ($mode -eq 'absent') {
    Remove-Item Env:XCL_RECOMP_NO_STRUCTURED -ErrorAction SilentlyContinue
  } else {
    $env:XCL_RECOMP_NO_STRUCTURED = '1'
  }
  cargo test --locked -p xcl --lib gpu::recomp::tests::hlsl_is_generated_for_straight_line_and_branches -- --exact --nocapture
  cargo test --locked -p xcl --lib gpu::recomp::tests::far_jumps_are_direct_branches -- --exact --nocapture
  cargo test --locked -p xcl --lib gpu::recomp::tests::oversized_structured_code_falls_back_to_pc_blocks -- --exact --nocapture
}

The initial matrix omitted the adapter selection and DXC directory settings. The far-jump fixture consequently also compiled and dispatched a shader in both modes using the Windows SDK DXC and DXIL 1.9.2602.17, outside the requested CPU-only scope. That matrix recorded 6 passed, 0 failed, 0 ignored, 0 skipped. I reran the three fixtures with the unmatched adapter selector shown above. The cpu-only.*.log files record the corrected matrix. The initial run is recorded in the absent.*.log and 1.*.log files.

Not tested

Base revision, full suite, retail titles, smoke runs, release builds, and other adapters. The CPU matrix did not run the optional GPU tail.

AI use

T3 Code / Codex (gpt-6.2-sol) ran the checked-in fixtures, checked the live PR, and wrote this report.

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.

4 participants