Recompiler: image instructions name the registers they use #1797
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!1797
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1797"
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?
@MiguelMachado-dev on GitHub · 2026-11-24 20:52 UTC · original
MiguelMachado-dev:recomp/mimg-vgpr-uses→main· +157 −2 · 2 files · 1 commits · openrdna2::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 #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:8ec49c0: 893 passed, 0 failed, 42 ignored (lib: 844 / 0 / 22);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 #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 (#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
@Raul-Paiva on GitHub · 2026-11-24 21:06 UTC · original
@MiguelMachado-dev the paired
xcl-smokeblocks you asked for, same title and same time (60 s) on both commits.Tested
cargo build --release -p xcl), andscripts/smoke.ps1was run from that worktree. On Windows PowerShell 5.1 the script's default-Xclpath fails ($PSScriptRootis empty inside theparamblock), so I passed-Xclwith the worktree'starget\release\xcl.exe; nothing else was changed.main4178e88:#1797
8ec49c0:The PR's run has 97.9 % of
main's frames and 103.8 % of its peak commit, with no device removal or crash. 60 s on this title is the intro and menus, before the world load, so it does not reach the direct-DXIL VS path or the per-lane form this PR feeds.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.
@FIJI1299 on GitHub · 2026-11-24 21:30 UTC · original
Test report on NVIDIA GeForce RTX 5070 (12 GB)
8ec49c0)621.35), 32 GB DDR5 6000MT/s26300),rustc 1.100.0 (0ef1bc386 2026-11-09), Windows SDK10.0.26100.0(debug build).\scripts\test.ps1(cargo test --workspace -- --test-threads=4)852 passed; 0 failed; 34 ignored(includingxcl --liband integration tests).gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask&gpu_wave32_program_in_wave64_hardware(no wave64)shaders::tests::pso_measurement_compiles_an_exact_synthetic_record(requires Windows Developer Mode for driver cache)no heap windows).@Raghav314 on GitHub · 2026-11-24 22:13 UTC · original
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,
XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_PRESS_A_AT=20, 180 s, network off, the same retail title for both.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
main's known world-load stall (#1833), not this PR. No fallback, device removal or crash on either.main4178e88:This PR's head
8ec49c0:101.5 % of
main's frames, 102.9 % of its peak commit.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.
@DavidM1911 on GitHub · 2026-11-25 00:04 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.Thanks!
@throny on GitHub · 2026-11-25 15:33 UTC · original
Two contributors checked independently and found that #886 #2287 solves the same problem (for #885) in a different way: #1607, group D81. 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.
@Chrysana on GitHub · 2026-11-25 19:53 UTC · original
AMD results for this change, for "AMD, wave64, heap windows" under Not tested. They come from my run of #1825 (comment), whose head carries this PR's commit (
c2b0c00, the same patch as8ec49c0:git patch-id --stablematches). I didn't run8ec49c0on its own base. On an RX 9070 XT (RDNA4, wave64) and an RDNA2 iGPU, both new tests pass, the per-lane image tests that depend on this change pass on both GPUs, and nothing fails in the full suite.Setup: AMD Radeon RX 9070 XT 16 GB, driver 32.0.32015.2008; Ryzen 7 9800X3D with its RDNA2 Radeon iGPU (
XCL_ADAPTER=1); Windows 11 26200.9974, rustc 1.100.0 MSVC, debug. #1825's head434f428onc4d37be, and that base alone, each in its own checkout and target folder.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4(RX 9070 XT): 965 passed, 0 failed, 43 ignored with this commit and #1825's tests, against 959 / 0 / 43 onc4d37be. The difference is the six tests: two here, four in #1825.gpu::rdna2::tests::image_register_usesandimage_address_counts_reach_the_operand_tables: ok on both GPUs (gpu::rdna2::11 passed on each).gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardwareboth pass. Neither is changed by this PR, so that only shows the wave64 side of the base is fine here.per_lane_image_instructions_agree_with_the_hlsl_path_on_the_gpuanda_per_lane_bvh_with_nsa_addresses_runs_on_the_gpu(NSA and sequential addresses, D16, compare-swap, BVH with NSA), pass on both GPUs. They run their programs as wave32, so they don't cover wave64 image instructions.heap_window_out_of_memory_falls_back_to_the_switch_formis SKIPPED here too (no heap windows).Not tested
8ec49c0on its own base4178e88, or merged onto currentmain.AI use
github-bot referenced this pull request2026-11-26 06:18:30 +00:00
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.