Recompiler: align S_LOAD address components before addition #1221
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1230"
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?
Imported from ivall/xcl. Originally posted by rison1337 on 2026-11-24T13:25:27Z.
S_LOAD aligns the sum of its address components, allowing discarded low bits to carry into bit 2 and read the next dword. Align each component before addition, as specified by RDNA2 ISA 7.2.1, preserving signed negative immediates.
What is in it
gpu/recomp/emit.rs: correct single-window and multi-window S_LOAD addresses.gpu/recomp/tests.rs: synthetic GPU regression covering all five load widths, four base alignments, independent offsets, negative immediates and a null-offset control. It fails on unchanged main (0xCAFE0001 instead of 0xCAFE0000) and passes with the fix. README names the corrected rule.Tested
cargo build --locked --release --workspace --target x86_64-pc-windows-msvc -j4: succeeded.cargo test --locked --release --workspace --target x86_64-pc-windows-msvc -j4 --no-fail-fast -- --test-threads=4 --nocapture: 742 passed, 0 failed, 41 ignored. Four bodies reported SKIPPED: two native-wave64 tests and two requiring the absent D3D12 debug layer; these returns are included in Cargo's passed count.Regression run
Main:
This commit:
Not tested
AI use
Imported from ivall/xcl. Originally posted by dcastell1 on 2026-11-24T13:28:25Z.
Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on
main@47efa2e(baseline 741 passed, 0 failed, 41 ignored on this box):One more passing test than the baseline; the S_LOAD address-component alignment rule ships its case and runs green.
Tree restored afterwards (full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T13:39:23Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib recomp: 190 passed, 0 failed, 18 ignored (new GPU checks included).Thanks!
Imported from ivall/xcl. Originally posted by bjarngard on 2026-11-24T13:47:53Z.
Test report for head
1a447e6(AMD, native wave64)Tested
XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4: 742 passed, 0 failed, 41 ignored, no SKIPPEDXCL_REQUIRE_GPU=wave64:gpu_smem_aligns_each_address_componentpassedNot tested: retail titles, RDNA3/RDNA4.
AI use: the tests were run and this report was written by an AI agent, Claude Code (Claude Opus 5.5), on the hardware above. The numbers are copied from the actual test output.
Imported from ivall/xcl. Originally posted by pvfreis on 2026-11-24T14:41:16Z.
Review: COMMENTED
Review of
1a447e6(merge base47efa2e), by reading the code against AMD's RDNA2 ISA guide (section 7.2.1, scalar memory addressing); nothing was built or run here. Thes_loadchange matches that section, which has each address component (base, instruction offset, SGPR/M0 offset) drop its two low bits before they are added; the test checks fixed expected values. No defect in this PR.A question outside the PR: the same section describes
s_buffer_loaddifferently. There the instruction offset and SGPR offset are added as they are and only the final address is dword-aligned, which matches the unchanged branch, but the low two bits of the V# base are also ignored. Thes_buffer_loadbranch adds the V# base unmasked (({d0} + {t}_off) & ~3u,emit.rs:1497-1505; unchanged since the first commit). Is that deliberate, e.g. something a title relies on, or would masking{d0}first fit the spec? It only matters for a V# base with low bits set.Review by Claude Code (written by Claude Opus 5.5, checked against the ISA guide by Claude Opus 5.5); each point checked by a person before posting.
upstream-sync referenced this pull request2026-11-25 06:04:27 +00:00
Imported from ivall/xcl. Originally posted by xpatfussy69x on 2026-11-25T08:26:19Z.
Test report for head
1a447e6as pushed (not merged onto currentmain) – NVIDIA, wave32.Tested
.\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 742 passed, 0 failed, 41 ignoredgpu_smem_aligns_each_address_componentran and passedXCL_SAMPLE_*data set (game-data tests not run)Not tested
mainAI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T04:17:19Z.
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-26T22:49:29Z.
Tested
Independent run at clean PR head
1a447e60a4138993f3d73332942fbfa9c839097bon Intel Arc A770 (driver 32.0.101.9175), Ryzen 7 3800X, Windows 11 x64 26200.9974, Rust/Cargo 1.100.0 MSVC, DXC/DXIL 1.9.2609.5, debug test profile.Prebuilt with
cargo test --locked -p xcl --lib --no-run -j 2 --message-format=jsonoutside the GPU mutex. Ran<test-exe> gpu::recomp::tests::gpu_smem_aligns_each_address_component --exact --nocapture --test-threads=1under the Arc mutex withXCL_ADAPTER=A770.1 passed, 0 failed, 0 ignored and 0 GPU skips (1.37 s). All 1,240 SGPR readbacks matched across 40 dispatches, covering both memory windows, five load widths, four base alignments, negative immediates and the null-offset control.
Not tested
Native wave64, the baseline, the workspace suite and retail smoke.
AI use
T3 Code / Codex (gpt-6.2-sol) ran the original verification and summarized the saved results.
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T10:45:23Z.
Independent desktop NVIDIA verification of PR #1230 at head
1a447e60a4138993f3d73332942fbfa9c839097b(1commit; exact parent & merge-base:47efa2ecea0a12934719ae69b81930cf02a4b1c3, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12, Wave32-only Ada), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted GPU tests & build (
1a447e60)cargo test --release -p xcl --lib gpu_smem_aligns_each_address_component -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 719 filtered out× 3 (0.82s,0.57s,0.57s,0skipped; live RTX 4060 execution compiled with DXC1.9.2609.5)cargo build --release -p xcl55.05s, exit0,0new warnings inemit.rs/tests.rs)Paired quiet 60 s retail smoke (
title: 29640639)(Note:
scripts/smoke.ps1at47efa2ecpredates9683e7a6and printed the local folder basename ontitle:; replaced below with the standard9683e7a6title hash29640639, with all measured fields verbatim.)Exact parent & merge-base (
47efa2ecea0a12934719ae69b81930cf02a4b1c3):PR #1230 (
1a447e60a4138993f3d73332942fbfa9c839097b):Limits of coverage
gpu_smem_aligns_each_address_componentcompiled and executed3/3on desktop RTX 4060 (Wave32-only Ada; native Wave64 paths are not exercised), directly verifying per-componentS_LOADaddress alignment before addition.0device removals,0crashes); single-run frame/commit delta vs. parent reflects normal startup variance rather than this PR.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by brainhay5 on 2026-11-30T06:54:14Z.
merge-check claim
head:
1a447e60a4Imported from ivall/xcl. Originally posted by brainhay5 on 2026-11-30T07:07:51Z.
merge-check
base:
d52ff48caahead:
1a447e60a4merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2876 passed, 2 failed, 51 ignored; 29 SKIPPED lines
failing: test_title_runs_and_game_folder_is_untouched
review: automated overnight check — diff inspected for safety only (no build/CI/toolchain/script changes, no process/network/runtime-loading code); no duplicate search performed; no line-by-line code review.
performance: not assessed beyond the suite.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 610.88 (32.0.16.1088); Ryzen 7 5800X3D, 64 GB; Windows 11 22631; OpenCode agent, DeepSeek V4.1 Flash 1017
correction: this check first reported the PR as "not yet" because of a test failure that is not the PR's. The base-comparison step failed to run (test names contain a double colon, not a legal Windows filename), so an empty read was mistaken for "passes on base".
gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16fails on based52ff48cby itself (verified separately with the same command: "assertion failed: 2D D16 resinfo clobbered v2/v3"). Verdict corrected. Apologies for the noise.Imported from ivall/xcl. Originally posted by BBareth on 2026-11-30T09:46:42Z.
merge-check claim
head:
1a447e60a4Imported from ivall/xcl. Originally posted by BBareth on 2026-11-30T09:53:23Z.
merge-check
base:
9dfbe3ea66head:
1a447e60a4merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2886 passed, 1 failed, 51 ignored; failing: gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16, which fails on the base alone too (base: 2885 passed, 1 failed, 51 ignored, 28 SKIPPED lines). 28 SKIPPED lines, as on the base. The new test
gpu_smem_aligns_each_address_componentpassed (1 and 2 memory windows, all five S_LOAD widths, base low bits 0..3, negative immediates).review: no blocking finding; three files, every hunk read. In the HLSL emitter the low two bits of the base, the immediate and the register offset are now dropped before the addition, where the sum was aligned before (single-window form) or not aligned at all per component (multi-window form); the immediate keeps its 21-bit sign extension. The README row gains a clause. Scope note: this is the HLSL path only; I did not check whether the direct DXIL lowering of S_LOAD has the same carry, which would be a separate change. No other PR found for it.
performance: none to speak of: two AND operations per scalar load. The generated HLSL of programs with S_LOAD changes, so they are translated and compiled again once.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 621.24 (32.0.16.2124); i7-12700K; Windows 11 26200. Claude Code, Claude Fable 5.2 read the diff, ran the build and the suite and wrote this check.