Repository navigation
Recompiler: direct DXIL makes a pointer to storage again in each block - #2082
Royalflamejlh wants to merge 1 commit into
Conversation
|
NVIDIA RTX 3070 on native Windows, head Tested
Regression run ( PR head That is 100 % of the base's frames and 100 % of its peak commit. Not tested
AI use
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Reviewed
LGTM — clean, minimal fix for NVIDIA Wave32 + AI use: Antigravity (Gemini 4 Carbon) assisted with verifying merge cleanliness and pass interactions in |
|
Heads-up from a batch run (B19 in #1607): this PR's own test fails once it is merged with current
My guess is that main now merges the test program's two linear blocks into one before your pass runs. If so, the test needs a CFG that keeps both blocks, or the new block count. That's from reading, not checked. Ran with |
Module::optimize merged identical getelementptrs along the dominator
tree, so one pointer into the wave64 exchange words or the LDS was used
in up to 136 blocks of a program. dxil-spirv (under vkd3d-proton)
restructures the blocks, and for five programs of the retail title's
pack the block that makes the pointer then no longer dominates a use:
the SPIR-V fails spirv-val ("ID ... defined in block ... does not
dominate its use"). A value gets a phi there; a pointer does not.
A getelementptr is now merged within its block only, unless it points
into a constant global (the lookup tables, whose loads are merged along
the tree).
Direct pack of main aaa0936, compute, split wave64 (2,682 programs),
through dxil-spirv legacy-struct-remove e084e35c and spirv-val
--target-env vulkan1.3: 5 invalid before, 0 after; the same five
through dxil-spirv 34f0ff8 (vkd3d-proton v3.1-90): invalid before,
valid after. DXIL 935,669,256 B before, 936,012,404 B after (+0.04 %);
682 programs change.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
6818f70 to
cab89ed
Compare
|
@NWProgramming00 thank you, your bisect was right: #2194's AI use: Claude Code (Claude Opus 5.5) fixed the test and wrote this reply. Posted without review by a person: the account owner was away and reads replies later. |
|
Independent native Windows check of #2082 head
I also merged that head without committing into This run verifies the native regression and broader Windows GPU suite. I did not run the retail title or the PR's central DXIL → dxil-spirv → Vulkan SPIR-V validation: |
|
The split compute form emits valid SPIR-V here (Linux, RTX 5090, vkd3d-proton 3.2.0, direct Not tested: Windows.
|
On Linux, vkd3d-proton's dxil-spirv turns five of the retail title's 2,682 direct-DXIL compute programs into SPIR-V that
spirv-valrejects: a pointer into groupshared storage is used in a block its definition does not dominate. The direct backend now merges identicalgetelementptrs within a block only, and all five convert to valid SPIR-V. Part of #1805.Module::optimizemerged identicalgetelementptrs along the dominator tree, so one pointer into the wave64 exchange words or the LDS was used in up to 136 blocks. In the DXIL the definition dominates every use. In the smallest of the five (abeb82838a13d6d9) the pointer is made inside a loop that has two exits and is used after one of them: dxil-spirv routes both exits through one merge block and picks the way on with a flag, so the block inside the loop no longer dominates the code after it. The values made in the loop get a phi there; the pointer does not (my reading of that one output, not of dxil-spirv's code). DXC's DXIL carries such pointers across blocks too and all of it converts validly here, so the merging alone is not a fault: it is avoided because that costs 0.04 % of DXIL.What is in it
crates/xcl/src/gpu/dxil/module/opt.rs: one arm incse_kind. Agetelementptris merged within its block (Cse::Block) unless it points into a constant global, where loads are still merged along the tree. One unit test, red without the arm.Tested
Head
cab89ed5, onmain2898511a(rebased today from6818f70onaaa0936; the numbers below that name those two are from before the rebase). The change is the same. Its unit test now leaves the entry block by a conditional branch: Recompiler: collapse empty trampolines and merge linear blocks in direct DXIL opt #2194'ssimplify_cfg(merged) folds two blocks joined by one unconditional branch into one after this pass, so the old test's count per block no longer held (NWProgramming00's report below). The test passes with the change and fails without theCse::Blockarm ([1, 0, 0]), under Wine and on an RTX 2070 SUPER (Windows, debug, 1 passed).Retail title 1.0.2.1,
xcl shaders shaders.rpf --precompile --only cs --split 1withXCL_DIRECT_DXIL=1, atmainaaa0936and at80f5d50(the tree of this head,6818f70; only the commit message differs); each program's DXIL through dxil-spirv built natively, with the options vkd3d-proton passes, thenspirv-val --target-env vulkan1.3:mainaaa0936e084e35c+061225da+ three patches from [OFFICIAL] Looking for PRs with shaders optimization #1269 (0naku's, the split-loop patch and the fourth)34f0ff8(the one in vkd3d-proton v3.1-90-g30b0eb9b)The unsplit form of the pack (
--split 0, what a card with 64-lane waves gets) is byte-identical with and without the change, all 2,682 programs, and all of its SPIR-V passesspirv-valonmain: only the split form's exchange words were reached through a merged pointer.The five records:
25b531863bfb0d42,2a098601171855aa,8b1f2896e2354d1b,a9f2cd53943d5dc4,abeb82838a13d6d9.Again on today's
main, with this commit merged locally (it merges with Recompiler: collapse empty trampolines and merge linear blocks in direct DXIL opt #2194'ssimplify_cfgwithout conflict), 1 pass each: on426a5a7through34f0ff8, 5 of 2,682 outputs failspirv-valonmainand 0 with it; on5478c4athroughe084e35c(whose five commits are in dxil-spirv'smastersince today), 5 and 0.On
mainb49be183through dxil-spirv's ownmasterb540c8a2(vkd3d-proton'smastercarries it since today,89439562), the split form, 1 pass each: onmain, 7 of 11,115 programs and pieces failspirv-val: the five above, a piece of73000efc296c082eand a piece ofc458137fcd97caf3("ID ... does not dominate its use"). With this commit, 0 of 11,117. With Recompiler: direct DXIL gives every loop head and block one back edge #1860 alone, the same 7.No GPU: Ryzen 9 9950X3D, Fedora 44, Wine 11.21 Staging with Mesa lavapipe only, rustc 1.98.0, release, cross-compiled to
x86_64-pc-windows-gnu; 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 in the prefix.cargo test --workspace --release --target x86_64-pc-windows-gnu --no-fail-fast -- --test-threads=4 --skip d32s8 --skip reservable_agrees_with_the_driveratcab89ed5: 1,353 passed, 9 failed, 46 ignored. The same command onmain2898511a: 1,352 passed, 9 failed, 46 ignored, the same nine (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 one more that passes is this change's test. Before the rebase, at6818f70andaaa0936without the two skips: 1,147 and 1,146 passed, 5 failed each.At
6818f70: RTX 4070 12 GB (driver 615.71.09), the same Wine with vkd3d-proton v3.1-90-g30b0eb9b:cargo test --release -p xcl --lib --target x86_64-pc-windows-gnu -- gpu_ gpu::dxil coverage --test-threads=4: 242 passed, 2 failed, 5 ignored. Onmainaaa0936: 241 passed, 2 failed, 5 ignored, the same two (directed_reference_basics,gpu_depth_buffer_created_for_unordered_access_is_placed). SKIPPED on both: the two "no wave64" tests.At
6818f70: Windows 11 Pro 26300, RTX 5070 Ti 16 GB (driver 621.24), Ryzen 7 9800X3D, rustc 1.99.1, debug:cargo test --workspace --no-fail-fast -- gpu::dxil coverage --test-threads=4: 119 passed, 4 failed, 4 ignored. The four arefuzz_validate_and_gpu_0to_3(CreateComputePipelineState: Not enough memory resources are available, seeds 70, 545, 1019 and 1507). They fail the same way, with the same seeds, onmain689f2dbon that machine, and again here run alone on one thread.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; the PR's first, then
main, back to back. That PC is shared, and its frame rate varied between runs: the two earlier pairs gave 388 and 756 frames for this head and 1,380 and 412 formain, the low runs at 22 presents per 2 s on either tree.main:
PR:
Before the rebase, at
6818f70, under Wine 11.21 Staging with vkd3d-proton v3.1-90-g30b0eb9b on an RTX 4070 12 GB (driver 615.71.09),mainfirst, 1 run each: 1423 frames onmainaaa0936and 1522 on6818f70, the last three counts 60 60 60, 0 device removals and 0 crashes in both (under Wine the exit code reads0x89and peak commit 0 MB on every tree).On
nvidia-devnvidia-devc044dc6dwithout a conflict; the branch as a whole sits on a newermainand does not merge.XCL_DIRECT_DXIL=1in the split wave64 form (2,682 programs, 8,825 pieces) through dxil-spirv34f0ff8natively, 1 pass, gave no output that fails spirv-val without it. The six that fail onmainstay whole there and convert.Not tested
gpu_tests cover.--only cs).AI use
mainand onnvidia-dev, rebased the branch and fixed its test after Recompiler: collapse empty trampolines and merge linear blocks in direct DXIL opt #2194, and ran the tests and the regression runs forcab89ed5.