Repository navigation
Recompiler: direct DXIL gives every loop head and block one back edge - #1860
Royalflamejlh wants to merge 3 commits into
Conversation
|
On real hardware: RTX 3070 8 GB (32-lane waves, split wave64), driver 616.56, Windows 11, debug. It no longer builds on Locally I used the loop head's offset, as main's split copies take their original's ( With that,
( AI-assisted (Claude Code). Synthetic tests only. |
d812f24 to
a6e5c0e
Compare
|
@upipibi thank you: rebased onto Yours is the only run of it on Windows so far. The description has the new counts; the smoke block for the new head is to come. AI use: Claude Code (Claude Fable 5.2) made the rebase, ran the tests and wrote this. Posted without review by a person: the account owner was away and reads replies later. |
|
Tested on a GPU, with the pipelines from #1805: this change alone stops the worker deaths, with dxil-spirv unpatched. Two builds of the same tree: this PR's head
The 21: Tested: Linux (CachyOS), Proton Experimental's Wine, RTX 3080 Ti (NVIDIA 620.73.04), i7-11700KF, 32 GB RAM. Retail 1.0.2.1, the title's own journal. Release, cross-built for Not tested: the test suite on this head; the title's own runtime compiles; AMD; native Windows; the pack's other ~58,000 pipelines with this change. AI use
|
|
CPU-only follow-up on rebased head Tested
Not tested Earlier report below applies only to The latch change needs a direct-translator cache-version bump. Exact head Companion patch: b780cdd, directly on that head. It bumps 7 to 8, adds a disk-cache regression, and adds a synthetic GPU output check for the latch rewrite. No competing upstream PR. Tested
Parallel limitation An unmodified exact-head control, Not tested AI use |
|
Tested on AMD / RADV under Wine: no regression here, but the AMD-side abort is a different failure from #1805 and this change does not touch it.
Not tested: a retail title (no |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
@anes66 thank you: your GPU test is in as your commit ( I did not take the version bump: #1947, merged since, makes the direct translator's cache entries change when the AI use: Claude Code (Claude Fable 5.2) made the commit from yours, ran the test and the regression run and wrote this reply. Posted without review by a person: the account owner was away and reads replies later. |
|
Still needed after #2034: on Setup: Fedora 44, Ryzen 9 9950X3D, Wine 11.21 Staging, no GPU. Retail title 1.0.2.1,
Not tested: the title or a GPU on this merge; whether the 79 changed programs compute the same; the unsplit form with the subgroup sizes a card with 64-lane waves reports; pixel and vertex programs. AI use: Claude Code (Claude Fable 5.2) built the trees, ran the conversions and wrote this comment. Posted without review by a person: the account owner was away and reads replies later. |
|
Tested Independent Arc A770 run of open PR #1860 at Windows 11 Enterprise Evaluation x64 26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust and Cargo 1.100.0 MSVC, DXC/DXIL 1.9.2609.5. Used two Cargo jobs with incremental compilation and test debug info disabled. cargo test --locked -p xcl --lib --no-run
$env:XCL_ADAPTER = 'A770'
$env:XCL_DXC_DIR = Join-Path $env:LOCALAPPDATA 'XclTooling/dxc-1.9.2609/bin/x64'
& 'L:/XclTooling/Invoke-ArcTest.ps1' -Test {
& 'L:/XclTooling/pr2014-1c971de6/target/debug/build/xcl/77aca8ccb20e299f/out/xcl-77aca8ccb20e299f.exe' gpu::dxil::core_tests::latch_blocks_preserve_loop_registers_on_the_gpu --exact --nocapture --test-threads=1
}The build completed outside the Arc mutex. The fully captured GPU invocation reported 1 passed, 0 failed, 0 ignored, 0 explicit skips, 953 filtered out, 0.34 s. The wrapper exited 0 and logged lock release. An earlier invocation printed a pass, and PowerShell lost part of its stderr. This report uses the fully captured rerun. The fixture checked both the two-return and nested loop shapes in wave32 and split wave64, with iteration counts 0, 1, 2, and 5. It validated direct DXIL, compiled the HLSL/DXC reference, and matched registers v1–v3 against expected values and the HLSL/DXC GPU output. Not tested Native wave64, other adapters or drivers, additional fixtures, the workspace suite, retail smoke, and performance. AI use T3 Code / Codex (gpt-6.2-sol) ran the checked-in fixture and checked the captured logs. The coordinator prepared this summary from the completed run. |
|
Independent Windows run on 1160f92. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (621.35), Rust 1.99.1 MSVC, DXC 1.8.2502.11.
I also assembled both synthetic loop forms with LLVM MC 23.1.6 for AI use: Codex (GPT-6, exact variant unspecified) assembled the inputs, adapted the scratch fixture, ran the tests and drafted this report. Current-head recheck. On the same RTX 3080 Ti and Windows toolchain, I tested exact bcc71b6 and its clean local integration onto main 06c9f55.
Test commands were |
|
Diff review on Only item remaining before merge is an AMD GPU pass (e.g. |
|
@raylitebull thank you. We have no AMD card to run it on, so that pass has to come from someone who has one.
It prints a Not tested: AMD, as said. AI use: Claude Code (Claude Fable 5.2) read the two commits and wrote this reply. Posted without review by a person: the account owner was away and reads replies later. Edited 11:37 UTC: 15 minutes after this was posted the branch was rebased onto |
|
On the #1607 hint (group D87): #1844 and #1852 fix a different crash from this one, so this pull request is needed with either of them. They keep XCL's own AI use: Claude Code (Claude Opus 5.5) ran the conversions and wrote this comment. Posted without review by a person: the account owner was away and reads replies later. |
bmjask
left a comment
There was a problem hiding this comment.
No concrete source-level defect found. Single latches preserve the required loop/back-edge invariant, optimizer behavior is adjusted to retain them, and GPU coverage compares Direct-DXIL to HLSL/DXC across wave32/split-wave64; current CI and regression evidence are green. Residual disclosed gaps are no AMD run and no output comparison for changed retail programs. I found no blocker.
|
Reopening: this is not a duplicate of #1844 / #1852. They stop XCL's own AI use: Claude Code (Claude Opus 5.5) wrote this comment. |
|
Retail title 1.0.2.1 on Linux / RTX 5090: with this change + #1844 + #2082 the overflow no longer ends the process Machine: Linux x64 (kernel 7.3.5), 14 cores, RTX 5090 32 GiB, Proton 11 Wine, vkd3d-proton 3.2.0 Before ( After
What is left of the recursion after this change is still very deep: XCL's pipeline workers grow Not tested: Windows with this change (everything above is Linux + vkd3d-proton).
|
|
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
Thanks! — Devin |
|
NVIDIA re-run for |
On Linux, vkd3d-proton's dxil-spirv segfaults on 77 of the retail title's 2,682 direct-DXIL compute programs in the split wave64 form. The direct backend now gives every loop head and every block one back edge, and dxil-spirv as it is converts all of them. Part of #1805.
dxil-spirv keeps one back edge per loop head. Its main pass merges several first, but the pass it runs for shaders with wave shuffles analyses the CFG before that, and a second back edge then sends its dominator computation into endless recursion. A block with back edges to two loop heads keeps the second among its forward successors, which its loop tracer then follows without end (my reading of the code; not checked per program). The detail is in this comment on #1805.
What is in it
crates/xcl/src/gpu/dxil/cfg.rs:single_latch, called fromCfg::build_withaftermake_reducible. A loop head with several back edges, or one whose back edge leaves a block that has a second, gets a new empty block that jumps to it and takes those edges; the block takes the head'spc, asmake_reducible's copies take their original's. Two unit tests.crates/xcl/src/gpu/dxil/module/opt.rs:simplify_cfg(Recompiler: collapse empty trampolines and merge linear blocks in direct DXIL opt #2194) no longer bypasses an empty block along a back edge, so those blocks stay. One unit test, red without it.Tested
bb2165b9, onmain2898511a: the change837582c4;f0b6ff84, a test by @anes66 from their companion commitb780cdd; andbb2165b9, which keeps the latch blocks from Recompiler: collapse empty trampolines and merge linear blocks in direct DXIL opt #2194'ssimplify_cfg: it bypassed them, an empty[Br(t)]block with one incoming edge being bypassed even whenthas phis, so a block had back edges to two loop heads again. Rebased from1160f92on689f2dband twice more today asmainmoved (the last time beside Recompiler: fold shift-masks, nested masks, double-xor, and all-ones or in direct DXIL opt #2279's new test inmodule/opt.rs); the first two commits are unchanged. @anes66's test:latch_blocks_preserve_loop_registers_on_the_gpuruns two loop shapes (two returns to one head; a nested loop with returns to either head) through the direct translator in wave32 and split wave64 and compares the registers with HLSL + DXC and with expected values. The other half of that commit, a bump of the direct translator's cache version, is not taken: since Recompiler: direct DXIL cache entries change when its sources do #1947 (merged) the cache entries change when thegpu/dxilsources do.bb2165b9:cargo test --workspace -- latch simplify_cfg a_block_keeps --test-threads=1, 9 passed, 0 failed, the GPU one among them (1 run). Atbcc71b6(the same three commits onmain426a5a7), withXCL_DIRECT_DXIL=1,cargo test --workspace -- gpu_ --test-threads=4: 145 passed (2 of them print SKIPPED: no wave64), 0 failed, 1 ignored, the same onmain426a5a7(1 run each). Earlier, on an RTX 5070 Ti (Windows 11, driver 621.24, debug) at1160f92:cargo test --workspace -- latch --test-threads=1, 2 passed, 0 failed.x86_64-pc-windows-gnu; in the prefix, vkd3d-proton v3.1-90-g30b0eb9b with Linux (Wine + vkd3d-proton): a retail game reaches whatmainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175's patch, the build of the bullets below.cargo test --workspace --release --target x86_64-pc-windows-gnu --no-fail-fast -- --test-threads=4 --skip d32s8 --skip reservable_agrees_with_the_driveratbb2165b9: 1,356 passed, 9 failed, 46 ignored. The same command onmain2898511a: 1,352 passed, 9 failed, 46 ignored. The same 9 fail on both (a_tile_decommitted_and_committed_again_keeps_its_video_memory,directed_reference_basics,disk_free_space_ex_reports_pls_quota,fence_and_command_queue_sync_timing_and_allocator_reset_match_host_and_console,gpu_depth_buffer_created_for_unordered_access_is_placed,gpu_promoted_uav_clear_values_pass_create_committed_resource,split_compute_program_prebuilds_and_caches_chain_pieces,stale_blob_cannot_bypass_the_offline_pipeline_cap,test_title_runs_and_game_folder_is_untouched); the 4 more that pass are the new tests. The two tests skipped by name did not finish under Wine in our earlier runs ofmain. SKIPPED GPU tests: 351 lines onmain, 352 here (the new GPU test, which needs a card). 1 run each.d812f24before the rebase:cargo test --release -p xcl --lib --target x86_64-pc-windows-gnu -- gpu_ gpu::dxil coverage --test-threads=4: 188 passed, 1 failed, 3 ignored; the failure isgpu_depth_buffer_created_for_unordered_access_is_placed, which fails onmainunder Wine too. SKIPPED: the two "no wave64" tests.xcl shaders shaders.rpf --precompile --only cs --split 1withXCL_DIRECT_DXIL=1(the split wave64 form), atmain3f277701and at this branch on it (90c578f9; itsgpu/dxilsources are those ofbb2165b9, andmain2898511achanges none there); every program and every compute-split piece after it (2,682 programs, 7,914 pieces) through dxil-spirv34f0ff8(the one in that vkd3d-proton), built natively, with the options vkd3d-proton passes, 300 s limit, 1 pass each. Segfaults: 62 onmain(57 programs, 5 pieces), 0 at this head; none at the limit (95cc13288a27a96eis 1.2 MB since Recompiler: direct compact form stores a branch's target in the entry #2076 and converts in 0.6 s). 121 programs' DXIL changes againstmain, 21,448 bytes more in 879 MB. Of the 62 new SPIR-V outputs, 61 passspirv-val --target-env vulkan1.3;c458137fcd97caf3's second piece fails as the five programs Recompiler: direct DXIL makes a pointer to storage again in each block #2082 fixes do, and passes with Recompiler: direct DXIL makes a pointer to storage again in each block #2082 merged too (0 of 10,614 invalid with both, onmain50a9fde). Since Recompiler: enormous compute programs take the direct DXIL translator #2120 three of the 57 programs take the direct translator withoutXCL_DIRECT_DXILtoo:c963276f38285bf4,f839072880d49fb4and219287eb2f6021fe(over 8 MB of HLSL each). Before, onmain426a5a7(no split yet): 57 segfaults, 7 with the first two commits, 0 with all three; onmain689f2db: 77 and 0.masterb540c8a2, which vkd3d-proton'smastercarries since today (89439562; its latest release, v3.1, carries an older one), converts all 11,115 ofmainb49be183's direct programs and pieces without this change: 0 segfaults (1 pass; the standard kit's34f0ff8: 42). So this change is for vkd3d-proton v3.1 and other builds with an older dxil-spirv, until they move.Regression run
Windows 11 Pro 26200, RTX 2070 SUPER 8 GB (driver 621.01), Ryzen 7 5700X3D; the title's first-run screens completed once, no story progress, no input; 1 run each, back to back.
main:
PR:
Under Wine on an RTX 4060 Ti 16 GB (driver 615.71.09), before the rebase: 1558 frames on
mainc4d37beand 1568 ond812f24, 0 device removals and 0 crashes in both.The title with
XCL_DIRECT_DXIL=1under Wine + vkd3d-proton v3.1-90-g30b0eb9b (its own dxil-spirv, unpatched for this), RTX 4070 12 GB, 120 s,mainc4d37be+ #684 with and withoutd812f24: with it 121 and 230 compute pipelines were made by 120 s (2 runs) and Wine logged no stack overflow; without it 23, and onevirtual_setup_exception stack overflowline (1 run). Presents stop at about 80 to 93 s either way.On
nvidia-devnvidia-deveae01502: both add code at the same places incfg.rs. The same three commits on it, both sides kept:linux/direct-single-latch-nvidia-deve5d3ed31.XCL_DIRECT_DXIL=1in the split wave64 form (2,682 programs, 9,489 pieces) through dxil-spirv34f0ff8natively, 1 pass each: 26 programs segfault oneae01502, none with these commits; no output fails spirv-val in either. (The same 26 on the olderaf2cecc4; 52 onc044dc6d; none with these commits on either.)cargo test --release -p xcl --lib -- gpu::dxilunder Wine, no GPU: 203 passed, 1 failed with them; 199 passed, 1 failed oneae01502. The failure isdirected_reference_basicsin both.Not tested
bb2165b9.--only cs).xcl pipelines, the path Direct DXIL: xcl pipelines workers overflow their 512 MB stack on big compute programs under Wine #1805 reports, by us; @itsd-effex's comment below has it on an RTX 3080 Ti with unpatched dxil-spirv.AI use
bb2165b9and its test, rebased the branch and made itsnvidia-devcopy, updated this description, and ran the tests and the measurements on today'smainand onnvidia-dev.