Shaders: resolve deep DXIL SSA joins without recursion #1844
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!1844
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1844"
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?
@gloger2003 on GitHub · 2026-11-24 21:43 UTC · original
gloger2003:fix/dxil-iterative-ssa-joins→main· +116 −63 · 1 files · 1 commits · openPart of #1805. The direct DXIL SSA reader could exhaust a worker stack when resolving a definition across many sealed control-flow joins. A synthetic chain of 8,192 joins reproduces the overflow on a 256 KiB stack.
What is in it
Tested
Windows x64, Ryzen 7 5700X, Radeon RX 7800 XT.
cargo build --offline --locked --release -p xclon the baseline and this head.cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --show-output. 958 reported passed, 0 failed, 42 ignored. Runtime GPU skips: 7 (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, 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 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, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's)), 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, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's)), heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows).gpu_scalar_loop_and_sccwithXCL_DIRECT_DXIL=1andXCL_REQUIRE_GPU=wave64. One passed.The new test overflowed before the patch and passed with it.
Supplemental integration on
main 689f2dbplus this patch (cc07eac), RX 7800 XT. DXIL suite: 100 passed, one failed, three ignored. The new deep-join test passed. The failure was seed 722 infuzz_validate_and_gpu_1. A targeted run on clean689f2dbreproduced the same mismatch at output 30. The GPU scalar-loop and divergent-execution tests both passed withXCL_DIRECT_DXIL=1andXCL_REQUIRE_GPU=wave64.Regression run
Minecraft Preview, 30 seconds per build with matching settings and the default shader path.
Not tested
The title and Wine setup reported in #1805.
AI use
OpenAI Codex (GPT-6.2 Sol, high reasoning effort, Fast mode) wrote the code and regression test, ran the checks and drafted this description.
@frenziedcoder on GitHub · 2026-11-24 22:31 UTC · original
NVIDIA test report for
71f2ceb: full suite green, its own testdeep_joins_read_on_a_small_stackpasses, and a clean smoke pair on the retail title (1654 vs 1655 frames).Tested
stable-x86_64-pc-windows-msvc, DXC 1.8.2502.11 (SDK 10.0.26100.0). Exact head71f2ceb5a05951f8d3d1f6aebe92c13eec240317, no local changes.cargo build --workspace && cargo test --workspace -- --test-threads=4(debug): 958 passed, 0 failed, 42 ignored; the PR's own testdeep_joins_read_on_a_small_stackpasses. 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).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 (
177cd40, 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.
@YaBulochka on GitHub · 2026-11-24 22:41 UTC · original
AMD/RADV check, and it does not reproduce as a speed-up here: on this machine the per-shader numbers improve but the wall time doubles.
x86_64-pc-windows-gnu, releasexcl shaders <retail shaders.rpf> --compile 500 --json,XCL_DIRECT_DXIL=1,XCL_DXIL_CACHE=0 XCL_PSO_DISK_CACHE=0, no title runFive runs in total; the last pair was taken with the same environment and no
XCL_DXC_THREADSset:c160d86Reading: the CPU sum is the same (555 vs 558 on the clean pair), the medians favour the PR, but the wall is 2.2x worse and remarkably stable at ~188 s while the base swings 79-98 s. The same shape appears with
XCL_DXC_THREADS=8fixed, so it does not look like a thread-count artefact on my side.My guess, offered as a guess: the explicit-stack walk shares state that serialises the workers, so the work is the same but less of it runs concurrently. If you have a way to log how many DXC compiles are in flight at once, that would confirm or kill it in one run.
No crash or stack overflow at 500 shaders on this box, so the overflow this PR targets did not show up in this mode.
@itsd-effex on GitHub · 2026-11-24 22:47 UTC · original
A note from #1805's reporter: the
Ssa::readsuspicion in #1805's description was mine and is withdrawn. The retail crash there is in dxil-spirv (Royalflamejlh's analysis on #1805), and #1860 alone fixes it: withssa.rsunchanged and dxil-spirv unpatched, the 21 retail pipelines that killed workers all build (test), against 0 of 21 without it. So this PR doesn't fix #1805's crash as far as I can tell. The deep-join recursion it removes is real on small stacks (vitor127wt's 2 MiB runs), so it may still be worth having as hardening. I haven't tested this PR against those 21. Sorry for the misdirection.AI use
@throny on GitHub · 2026-11-25 00:51 UTC · original
Two contributors checked independently and found that #1852 solves the same problem (for #1805) in a different way: #1607, group D70. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
@JJAutoCompare on GitHub · 2026-11-25 01:01 UTC · original
Exact-head CPU validation with DXC 1.9.2609.5
On clean
71f2ceb5a05951f8d3d1f6aebe92c13eec240317, both focused tests ran and passed:gpu::dxil::ssa::tests::deep_joins_read_on_a_small_stackandgpu::dxil::core_tests::long_pixel_shader_translates_fast(2 passed, 0 failed, 0 ignored, 0 skipped). I usedcargo test --locked -p xcl --lib <exact-name> -- --exact --nocapture --test-threads=1separately for each. The long-shader case used DXC/DXIL 1.9.2609.5 for CPU validation.Host: Ryzen 7 3800X, Windows 11 25H2 build 26200.9974, Rust 1.100.0 MSVC debug, Windows SDK 10.0.26100.0, Intel Arc A770 (driver 32.0.101.9175). This adds a newer DXC version to the existing exact-head report.
Not tested: GPU execution, full workspace suite, retail smoke, or the pre-fix baseline. Codex in T3 Code (
gpt-6.2-sol) ran the checks and prepared the test evidence.@DavidM1911 on GitHub · 2026-11-25 01:15 UTC · original
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 / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@raylitebull on GitHub · 2026-11-25 10:58 UTC · original
Diff review on
71f2cebconfirmsSsa::readincrates/xcl/src/gpu/dxil/ssa.rsuses purely per-call local vectors (chainandjoins: Vec<ReadJoin>) with no shared or global synchronization state, and@lewisnic94-max+@frenziedcoder+ RX 7800 XT runs are strong.Before merge, it would be helpful to briefly close out
@YaBulochka's Wine--compile 500wall-time anomaly report (78-98svs187-190s) with a confirmation/note so there are no open timing questions on the thread.@ClosetPie107 on GitHub · 2026-11-26 06:48 UTC · original
AMD RDNA4 / Linux (Proton Experimental) test report on head
71f2ceb5(merged cleanly ontomainb49be183):Hardware & environment
experimental-11.0-20261112),vkd3d-protonmasterec207194(3.2.0) +dxil-spirvb540c8a2+ relaxed-vtable patch (-Db_ndebug=true), DXVKv3.1.1-209, DXC1.9.2609.5, Rustx86_64-pc-windows-gnuIsolated unit tests (
mainb49be183+ #184471f2ceb5, debug,--test-threads=1):xcl.exe gpu::dxil::ssa:: -- --test-threads=1: 1 passed, 0 failed, 0 ignored (0 skipped).Combined 300 s retail sanity run (release,
mainb49be183+ #1540 + #1675 + #1844 + #1899 + #2123 + #2369 + #2422, retail 1.0.2.1 pressingApast menus):exit=0), 0 crashes, 0 device removals,2,014PresentXframes,131,072translated draws,660,943dispatches (44,546chained split-compute dispatches),102,631Opus packets (0 errors).Not tested
AI use
main, ran the Proton unit tests and combined retail run on this machine, and drafted this report.@lewisnic94-max on GitHub · 2026-11-25 09:30 UTC · original · reviewed
Reviewed commit
71f2ceb5a05951f8d3d1f6aebe92c13eec240317.Both 8,192-level diamond and region shapes completed seven times each on a 256 KiB thread stack. The same probes overflowed the stack on the merge base
177cd407e0. A 4,000-deep shader join also translated on a 2 MiB stack. All 24 seeded draws on the head returned the expected 64 RGBA pixels, and all 24 DXIL blobs matched the corresponding base draw byte-for-byte.The graphics dependency benchmark distinguishes this PR from #1852. At 1,024 steps the median additional peak process commit inside the walker was 0.832 MiB here, versus 16.531 MiB on #1852 at
c2b1029c22(seven release processes each). Median phase times were 43.09 and 50.78 ms respectively. Both produced the same DXIL SHA-256. This PR changes SSA join resolution. The other PR also changes graphics dependency traversal. Their SSA edits overlap, so applying both as-is produces a conflict in ssa.rs.Windows 11 x64, Ryzen 7 5800X, GeForce RTX 3080 (616.92), Rust 1.100.0 MSVC and DXC 1.9.2602.17. No skips in those draw or head stack probes. Timing is specific to this synthetic shader and machine. No retail shader or native RDNA2 run. No additional actionable defect identified in this scope.
AI assistance: OpenAI Codex (GPT-6) inspected the implementation, analyzed the synthetic test evidence and drafted this review.
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.