Recompiler: reuse operands when writing DXIL instruction records #1927
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1927
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1927/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@philip-roy-jones on GitHub · 2026-11-24 23:30 UTC · original
philip-roy-jones:recompiler-reuse-bitcode-operands-1269→main· +37 −12 · 2 files · 1 commits · merged 2026-11-25 01:01 UTCPart of #1269. Please apply the
goal:world-loadlabel from #1833. Two compute shaders traced during world loading contain 36,223 instruction records that each allocated a temporary operand vector.What is in it
crates/xcl/src/gpu/dxil/module.rsreuses one vector for binary operations, calls, PHIs, GEPs and switches. A bitcode-reader test checks the operands after a longer record is followed by a shorter one.Tested
Upstream
20cf13022f76/ PR3f50b7903989. Ryzen 7 7700X, Radeon RX 580 (31.0.21925.1001), Windows 11 Pro 26200.9974, Rust 1.100.0 MSVC, DXC 1.9.2609.5.All three shaders produced byte-identical, validated DXIL. Total translation for the larger shader was faster in 10/12 paired rounds. Two-shader trace and larger AMD workload.
RX 580 workspace suite on main and the PR reported 885 / 886 passed, 91 / 91 failed, 45 / 45 ignored. The failures matched by name. Both pass counts include 53 hardware skips.
The local Windows CI command reported 976 passed, 0 failed, 45 ignored, 1 filtered. 141 tests emitted 261 hardware skip messages on WARP.
Independent RTX 3070 run by @upipibi on
3f50b79with main20cf130. The operand regression test passed. The direct-DXIL GPU filter matched main with 110 passed, 0 failed and 1 ignored. The sparse test was excluded. Commands and driver versionCommands and measurement details
cargo build --release --locked -p xcl. Timings use split wave64 and four switch-based memory windows. The full translator was timed over 24 paired rounds for the two shaders and 12 for the larger one. Identical temporaryModule::write_bitcodetimers measured the writing stage on each revision (20/20 and 12/12 paired rounds faster). Allocation counts use a separate counting allocator.cargo build --locked --workspaceandcargo test --locked --workspace --no-fail-fast -- --test-threads=4. The hardware skips covered 34 wave-size, 6 mesh-shader, 12 unavailable-device and 1 heap-window cases. On each build, 84 failures reported device removal and 6 reported an invalid argument.cargo test --locked -p xcl --lib gpu::dxil::bitreader_tests -- --test-threads=1 --nocapturepassed all 4 tests. The RX 580 created eight native-wave64 pipelines across both shader paths and revisions.gpu::dxil::tests::emitted_kernel_runs_on_the_gpupassed on both revisions in a fresh process withXCL_REQUIRE_GPU=wave64..\scripts\test.ps1 --skip test_title_runs_and_game_folder_is_untouchedran on WARP with Windows SDK DXC 1.8.2502.11.Regression run
scripts/smoke.ps1 -Game <folder> -Title Retail -Seconds 60withXCL_DIRECT_DXIL=1andXCL_PSO_PRELOAD=0. With default asynchronous pipelines, all four cold/warm runs exited with0xc0000409before presenting a frame. WithXCL_ASYNC_PSO=0, all six runs exited normally. The cold runs showed fewer frames on the PR in both orders. All 737 cached DXIL files matched byte for byte in both cold comparisons.Cold retail smoke output
Every run used fresh title data. Cold runs started with empty XCL caches, main first and PR first on the repeat. Warm runs used separate copies of the same upstream-produced cache, PR first.
Not tested
Time to enter the world, driver compilation of the larger shader, retail on NVIDIA, RDNA4 hardware, and optional
XCL_SAMPLE_*fixtures.AI use
OpenAI Codex, GPT-6.2 Astra (
gpt-6.2-astra) at maximum reasoning effort (max) wrote the change and test, ran the comparisons and prepared the report.@upipibi on GitHub · 2026-11-24 23:42 UTC · original
NVIDIA run: RTX 3070 8 GB (32-lane waves, split wave64), driver 616.56, Windows 11, debug,
3f50b79merged ontomain20cf130(clean).a_shorter_binop_record_has_only_its_own_operands: passes.XCL_DIRECT_DXIL=1 cargo test -p xcl --lib -- gpu_ --skip gpu_sparse_vram --test-threads=4: 110 passed, 0 failed, 1 ignored, the same asmainon this machine. The sparse test was skipped because of #1727.AI-assisted (Claude Code). Synthetic tests only.
@anes66 on GitHub · 2026-11-25 00:41 UTC · original
CPU-only mixed-record check on exact head
3f50b7903989a83f7a37e7f99c8b2e3bd4514016: the synthetic bitcode matched the parent's writer byte for byte. Optional test companion d54e613, directly on that head, adds tests only.Tested
XCL_TEST_BITCODE_OUTwrites this synthetic raw LLVM bitcode for comparison.cargo test --locked -p xcl --lib gpu::dxil::bitreader_tests:: -- --nocapture --test-threads=1with the PR writer and with onlymodule.rsrestored to parent20cf13022f764208384c610c2ae6a3f4eed201a2: 6 passed / 0 failed / 0 ignored on each, no skips. The same test overlay was retained on both.f2f7fed408e1e265ca3b7e39f5139dae858c743062d1804efb90926a3f5f3576.Binstill permits the existing short-binop case but makes the new mixed case fail on CALL lengths[4,16,20]instead of[4,12,4]. Runtime control edits were restored before the final passing run and commit.Not tested
Full workspace/GPU suite, shader validator, release, retail shaders, allocation counts, newer-main integration or a controlled performance benchmark. The printed debug writer timings are diagnostics, not evidence of a runtime speed-up. This fixture checks raw bitcode serialization, not shader execution. No competing upstream PR.
AI use
Codex (GPT-6; exact variant unavailable) wrote the tests, ran CPU controls and byte comparisons, and prepared this report.
@DavidM1911 on GitHub · 2026-11-25 02:33 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!