Recompiler: avoid repeated sine calls when signing direct DXIL #1878
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!1878
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1878"
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 22:33 UTC · original
philip-roy-jones:recompiler-dxbc-digest-rounds-1269→main· +26 −9 · 1 files · 1 commits · openPart of #1269. On the two compute shaders traced during world loading, reusing the DXBC digest constants cut signing from 3.36 to 0.68 ms. World-loading trace
The maintainer roadmap lists #1269 under world loading. Please add
goal:world-loadto this PR. Roadmap #1833What is in it
crates/xcl/src/gpu/dxil/container.rsuses the RFC 1321 round constants and reads each block's 16 words directly. An existing DXC-signed shader supplies a known answer at the two-block padding boundary.Tested
689f2db477c3and PR6376287f0aa7. Windows 11 Pro 26200.9974, Ryzen 7 7700X, Radeon RX 580 (31.0.21925.1001), Rust 1.100.0 MSVC, DXC 1.9.2609.5.Commands and coverage
cargo build --release --locked -p xcl. Timings used split wave64 and four switch-based memory windows. Direct translation was faster in 14/16 rounds. HLSL emission measured 37.71 and 37.73 ms.cargo test --locked -p xcl --lib gpu::dxil::container::tests -- --test-threads=1 --nocapturepassed all four tests.gpu::dxil::tests::emitted_kernel_runs_on_the_gpupassed on both builds in a fresh process withXCL_REQUIRE_GPU=wave64.cargo build --locked --workspacesucceeded on both.cargo test --locked --workspace --no-fail-fast -- --test-threads=4had 831 / 832 passes after excluding hardware skips. The failures comprised 84 device removals, six invalid arguments and one sparse-VRAM assertion. The skips comprised 34 wave-size, six mesh-shader, 12 unavailable-device and one heap-window case..\scripts\test.ps1 --skip test_title_runs_and_game_folder_is_untouchedran on WARP with SDK DXC 1.8.2502.11.Regression run
scripts/smoke.ps1 -Game <folder> -Title Retail -Seconds 60withXCL_DIRECT_DXIL=1andXCL_ASYNC_PSO=0. Each run used fresh title data and a copy of its pair's starting cache. All six exited with zero crashes and device removals.The first pair exceeded the 125% peak-memory limit. Both repeats met the frame and memory limits. The first four runs compiled the same four byte-identical shader cache entries. The last pair had zero shader cache misses. The cause of the memory variation is unresolved.
Smoke output for the upstream-warmed pair
Not tested
Time to enter the retail world, the direct-DXIL retail path on NVIDIA, RDNA4 hardware, and optional
XCL_SAMPLE_*fixtures in the workspace suite. CPU timings exclude driver pipeline creation.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 this report.@frenziedcoder on GitHub · 2026-11-24 22:42 UTC · original
NVIDIA test report for
6376287: no new test failures (the 4 that fail also fail on689f2db), its own testdigest_matches_dxc_at_the_two_block_padding_boundarypasses, and a clean smoke pair on the retail title (1655 vs 1657 frames).Tested
stable-x86_64-pc-windows-msvc, DXC 1.8.2502.11 (SDK 10.0.26100.0). Exact head6376287f0aa7a10e572983b8eba5148dedf4ac18, no local changes.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4(debug): 972 passed, 4 failed, 45 ignored; the PR's own testdigest_matches_dxc_at_the_two_block_padding_boundarypasses. SKIPPED:gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu(no wave64),gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu(no wave64),gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu(no wave64),gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu(no wave64),gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu(no wave64),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))),gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu(f16 arithmetic, wave64: no wave64),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))),gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu(f16 packed, wave64: no wave64),gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu(f32 arithmetic, wave64: no wave64),gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu(f32 compares, wave64: no wave64),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))),gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu(f32 conversions, wave64: no wave64),gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu(f32 rounding, wave64: no wave64),gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu(f32 three-source, wave64: no wave64),gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu(f32 transcendentals, wave64: no wave64),gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu(f64, wave64: no wave64),gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu(integer arithmetic, wave64: no wave64),gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu(integer carries, wave64: no wave64),gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu_wave32_program_in_wave64_hardware(no wave64),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).fuzz_validate_and_gpu_0,fuzz_validate_and_gpu_1,fuzz_validate_and_gpu_2,fuzz_validate_and_gpu_3ingpu::dxil::fuzz_tests. They fail the same way on the base689f2dbhere (0x8007000EfromCreateComputePipelineStateon seeds 70, 545, 1019 and 1507, the NVIDIA refusal @PHeitor1 reported on #1679), so this PR adds no failure.test_title_draws_with_a_root_signature_under_the_debug_layerreports ok, but this machine has no D3D12 debug layer (debug layer requested but unavailable … (0x887A002D)), so it ran without the layer and is no evidence either way.Regression run (
scripts/smoke.ps1 -Seconds 60, release, the retail title of #505 at its start screen;XCL_PSO_PRELOAD=0for both builds, because this machine's preload list holds the program of #1307)base (
689f2db, this PR's merge base withmain):this PR:
Not tested: this code in the title: it is on the opt-in direct-DXIL path (
XCL_DIRECT_DXIL), which the smoke runs leave unset (default HLSL backend), so they show only that nothing else regressed; the world load (the smoke runs stop at the start screen, so code that only runs later is not exercised there); AMD.AI use: Claude Code (Claude Opus 5.5) built and ran the tests and smoke runs on my machine and wrote this report; I checked it.
@futurepro62 on GitHub · 2026-11-24 23:31 UTC · original
Adding an AMD GPU (RDNA2, native wave64) to the report above, which has none, with an NVIDIA run alongside. Tested exact head
6376287(on its base689f2db).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --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 --skip gpu::dxil::fuzz_tests: 966 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.digest_matches_dxc_at_the_two_block_padding_boundary.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 926 passed, 1 failed, 25 ignored. SKIPPED:f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #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 #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 #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 #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 #1426 semantics differ from the console's))).--skipleaves out tests that fail on main689f2dbtoo, not because of this PR.heap_window_out_of_memory_falls_back_to_the_switch_form(#1651) and the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests (follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh. Ingpu::dxil::fuzz_tests, seeds 70, 545, 1019 and 1507 failCreateComputePipelineStatewithE_OUTOFMEMORYon this card on main as well, with drivers 616.64 and 621.40. With fuzz_tests included, this PR showed the same 4 failures and no others (driver 616.64).XCL_REQUIRE_GPU. Its one failure,gpu::dxil::fuzz_testsseed 540 (res[833]0x7 vs CPU 0x6), happens on main689f2dbtoo.Not tested
AI use
@DavidM1911 on GitHub · 2026-11-25 01:56 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!
@JJAutoCompare on GitHub · 2026-11-25 03:25 UTC · original
PR #1878 CPU verification
Tested
The clean detached checkout on STOR-WINLAB was at
6376287f0aa7a10e572983b8eba5148dedf4ac18. The live PR was open at the same SHA before and after the run. Windows 11 Enterprise Evaluation 26200.9974, Ryzen 7 3800X, Rust and Cargo 1.100.0 x86_64-pc-windows-msvc, unoptimized test profile with debug info disabled. The installed Arc A770 driver was 32.0.101.9175. This run was CPU-only.cargo test --locked -p xcl --lib gpu::dxil::container::tests -- --test-threads=1 --nocapture4 passed, 0 failed, 0 ignored, 0 explicit skips, 948 filtered out. Cargo exited 0. The four tests completed in 0.00 s as reported by the harness.
digest_matches_dxc_signed_containerdigest_matches_dxc_at_the_two_block_padding_boundarydigest_covers_both_tail_layoutspsv_matches_dxc_layout_for_compute_with_two_raw_uavsThe tests read checked-in DXC output. They invoked no compiler or validator and had no validation skip branches. A separate version check confirmed the installed DXC and DXIL files were version 1.9.2609.5.
Not tested
Live DXC compilation or DXIL validation, GPU dispatch, malformed inputs, timings, workspace suite, or retail smoke.
AI use
T3 Code / Codex gpt-6.2-sol ran the tests, checked the assertions, and wrote this report.
@Royalflamejlh on GitHub · 2026-11-25 05:34 UTC · original
Linux, a MinGW build under Wine,
6376287against its base689f2db: the direct backend's offline pass over the retail title's compute programs used 13 % less user CPU and finished 10 % sooner (means of 3 runs), with every cached entry byte-identical. The description measured 3 % with an MSVC build, on two shaders' translation. In this MinGW buildsinruns mingw-w64's__sinl_internal, an x87fsin, which had 14.5 % of the base's sampled cycles; that this is why the gain is larger here is a guess.Setup: Fedora 44, Ryzen 9 9950X3D, Wine 11.21 Staging, rustc 1.98.0, release, cross-compiled to
x86_64-pc-windows-gnu(MinGW gcc 16.2.1, mingw-w64 13.0.0); no card used. Retail title 1.0.2.1,xcl shaders shaders.rpf --precompile --only cs --limit 30000 --split 1withXCL_DIRECT_DXIL=1(2,689 programs compiled into 2,682 cache entries). Base and head in turn, 3 runs each, each from an empty cache, on a machine shared with other benches.689f2db6376287/usr/bin/time), s/usr/bin/time), s__sinl_internalinperfcycles (1 pass each)Read:
container.rsnow takes the 64 round constants from a table and reads each block's words in place, so the per-blockVecgoes too. It was the onlysincall undergpu/dxiloutside tests, which matches the profile. The fourgpu::dxil::containertests pass here under Wine, the new one among them.Not tested: the rest of the test suite, a GPU, the title, an MSVC build.
AI use: Claude Code (Claude Fable 5.2) ran the passes and the profile and wrote this comment.
Posted without review by a person: the account owner was away and reads replies later.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.