Repository navigation
Recompiler: image instructions name the registers they use - #1797
MiguelMachado-dev wants to merge 1 commit into
Conversation
`vgpr_uses` took an image instruction's registers from the operand tables, which give the largest case: a 3-D address with every modifier and four data registers. It missed the addresses in the NSA dwords (VADDRA, VADDRB, ...) and a compare-swap's compare value (VDATA + 1), took a G16 sample's address as shorter than the translators read it, took an atomic's data as written only (and written without GLC too), and claimed data registers that DMASK and D16 leave alone. Its callers act on those registers: the direct DXIL VS sets up the initial VGPRs it lists (vertex and instance id, fetched attributes), the HLSL path bounds its movrel switches with them, `xcl shaders` reports the inputs a program reads from them, and the per-lane form of xcl-dev#1745 passes exactly them to xcl-dev#1426's lowering, which refuses an instruction that reads another: every image instruction with NSA addresses. `vgpr_uses` now counts them as `recomp::emit` and `dxil::lower_image` read them: the address dwords from the opcode's modifiers, DIM and A16, at VADDR and the registers after it or VADDR then the NSA bytes; the data from DMASK, D16, TFE/LWE, GLC and the opcode. `dxil::lower_image` read VDATA + 1 for every atomic; it reads it for a compare-swap only now. In xcl-dev#1745's per-lane form (at 3ca3633), a sweep of every IMAGE_* instruction over DIM, A16, D16, DMASK, GLC and sequential or scattered NSA addresses through the per-lane compute lowering: 6562 of 28032 cases refused for a register not passed before (6130 NSA, 288 compare-swap, 144 G16), none after, and no case that lowered before refused. Assisted-by: Claude Code (Claude Opus 5.5, xhigh)
|
@MiguelMachado-dev the paired Tested
#1797 The PR's run has 97.9 % of Not tested: AMD, native wave64, heap windows, a longer run into the world load. AI use: Claude Code (Claude Opus 5.5) built both commits, ran the smoke script and wrote this comment. |
|
Test report on NVIDIA GeForce RTX 5070 (12 GB)
|
|
A paired run that reaches the direct DXIL path, for the gap noted in the Regression run section (the 60 s runs end in the menus). RTX 4090 24 GB (driver 617.14, 32-lane waves), Windows 11, release, Both runs go through the menus into the world load. On each, about 13 300–13 600 draws ran with translated pipelines (none skipped) and around 400 compute pipelines were built on the direct path. Presents stop at ~70 s on both, which is
This PR's head 101.5 % of Not tested: whether any of the changed register counts decided a translation in these runs (the log does not say which programs took the changed path), AMD. AI use: Claude Code (Claude Opus 5.5) ran both builds and runs and wrote this comment for @Raghav314. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
rdna2::vgpr_usestook an image instruction's registers from the operand tables, which give the largest case: a 3-D address with every modifier, and four data registers. That gets several things wrong:VDATA + 1);It now counts what
recomp::emitanddxil::lower_imageread. Fixes #885. Part of #1269.On
main, these callers act on the registers:dxil/kernel.rs→setup_vertex).max_vgpr, as Recompiler: VGPR tracking misses non-sequential MIMG address registers #885 describes).xcl shadersreports a program's inputs from them.The per-lane form in #1745 passes exactly these registers to #1426's lowering, so without this it refuses every image instruction with NSA addresses. The per-lane tests are a follow-up on top of #1745.
This overlaps draft #886 (also
Fixes #885), which counts every encoded NSA byte, padding included, and leaves the data registers as they are. This PR counts the address dwords and the data registers exactly, and its tests cover NSA1, NSA2, NSA3 and the v255 bound.What is in it
Recompiler: image instructions name the registers they usecrates/xcl/src/gpu/rdna2.rs:mimg_vgpr_usesandmimg_address_dwords, and the testsimage_register_usesandimage_address_counts_reach_the_operand_tables.crates/xcl/src/gpu/dxil/lower_image.rs: an atomic readsVDATA + 1for a compare-swap only.Tested
Setup:
cargo build --workspace && cargo test --workspace -- --test-threads=4:main4178e88: 891 passed, 0 failed, 42 ignored (lib: 842 / 0 / 22).SKIPPED GPU tests, the same 4 on both runs:
gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windowsshaders::tests::pso_measurement_compiles_an_exact_synthetic_record: cannot disable the driver cache (Windows Developer Mode is required)image_register_usesfails without the change. For a 2-D load with DMASK 0x5, it gets([3, 4, 5, 6], [14, 15, 16, 17])where([3, 4], [14, 15])is expected.image_address_counts_reach_the_operand_tableschecks the address count of every image instruction against the operand tables.On Recompiler: a per-lane form for the direct DXIL backend (XCL_PER_LANE) #1745's per-lane form (at 3ca3633), a sweep sent every
IMAGE_*instruction through the per-lane compute lowering, over DIM, A16, D16, DMASK, GLC and sequential or scattered NSA addresses:The follow-up's GPU tests compare loads and samples with NSA and sequential addresses, D16, a store, a gather, resinfo, GLC atomics and BVH with NSA addresses against the HLSL path.
Regression run
scripts/smoke.ps1with-Xclpointing at that worktree'sxcl.exemain's frames and 103.8 % of its peak commit, with no device removal or crash.main4178e88:This PR's head
8ec49c0:XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_PRESS_A_AT=20, network offmain's frames and 102.9 % of its peak commit.main4178e88, 180 s:This PR's head
8ec49c0, 180 s:Not tested
main's world-load stall (Roadmap: retail title past world load #1833).main-side effects listed above come from reading the code, not from a run. I have no title with a VS that reads its inputs only as NSA addresses, or with a movrel past them.vgpr_usesfollows the translators, andimage_address_counts_reach_the_operand_tablespins the difference.AI use