Recompiler: track SMEM register offsets as scalar reads #1540
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!1540
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1540"
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?
@oni-swr on GitHub · 2026-11-24 17:25 UTC · original
oni-swr:recompiler/smem-offset-uses→main· +12 −1 · 1 files · 1 commits · openSMEM's register offset has operand type
OPR_SMEM_OFFSET, whichsgpr_usesomitted. A register used only asSOFFSETwas therefore absent from the read set; the per-lane lowering on gefydev's branch could reject such a load because its initial SGPR value was not loaded. Part of #1269.What is in it
rdna2.rs: include SMEM register offsets in scalar reads; test s4, s7 and NULL offsets, preserving the destination write set.Tested
cargo test -p xcl --lib gpu::rdna2::tests::scalar_memory_register_offset_is_a_read -- --exact: on main9e3831ewith only the test added, 0 passed / 1 failed / 0 ignored. The fixed test passes in the full suite below.cargo build --workspace: passed ata8683ef.cargo test --workspace -- --test-threads=4 --nocapture: 777 passed / 0 failed / 41 ignored. One SKIPPED test (included in the harness's passed count):heap_window_out_of_memory_falls_back_to_the_switch_form, reasonno heap windows; this is not coverage.Regression run
Not tested
AI use
github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@upipibi on GitHub · 2026-11-24 18:13 UTC · original
Read the diff against the ISA tables: the scope is right. In
rdna2_spec.rsthe only field typedOPR_SMEM_OFFSETis SMEM'sSOFFSET(all theS_LOAD/S_BUFFER_LOAD/ store / atomic forms). The 21-bit immediateOFFSETis not an operand there, so this can't make an immediate look like an SGPR read.SOFFSET0 is s0, not NULL (0x7D), so a load with an unsetSOFFSETnow reads s0, which is right (the same distinction as #1456's test fix). M0 (124) asSOFFSETis a read too, as it should be. I haven't run it.AI use: Claude Code (Claude Opus 5.5) read the change and wrote this.
@nnonno91 on GitHub · 2026-11-24 18:13 UTC · original
Independent NVIDIA and per-lane lowering test for
a8683ef45d1a38e0200558e6666ec965476e5e6b.Tested
cargo build --workspace --lockedpassed.cargo test --locked -p xcl --lib -- --exact gpu::rdna2::tests::scalar_memory_register_offset_is_a_read --test-threads=1passed.cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --show-outputreported 777 passed, 0 failed, and 41 ignored. Three reported GPU skips in that pass count:gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware(no wave64), plusheap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows). The bundled title passed.gefydev/xcl:direct-on-1426revisionc391dbf9dedcd87e4e6968a70c0280d5d88aa7dd, I rancargo test --locked -p xcl --test smem_offset_probe -- --exact register_offset_reaches_per_lane_dxil --nocapture --test-threads=1with a temporary three-instruction shader before and after applying just the PR’s production change. Before,S_LOAD_DWORDlisteds0ands1as reads and per-lane lowering refused withs4: a mask read as a number. After, it also listeds4, validated the directly generated DXIL, and executed it on the RTX 5090. Register offsets of 0, 4, and 12 bytes selected the expected three memory words across all 32 lanes each time. Both versions listeds16as the destination.Not tested
Retail titles, Wine, or release builds. The per-lane run used a synthetic kernel on the pinned experimental revision with the one-line fix applied locally.
AI use
OpenAI Codex (GPT-6 family, exact variant unavailable) wrote the temporary probe, ran the checks, and drafted this report.
@DavidM1911 on GitHub · 2026-11-24 19:12 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
@vakaobr on GitHub · 2026-11-25 09:28 UTC · original
Test report from a Mac (D3DMetal), #1540 at
a8683efmerged intomainc4d37be.The per-lane form refuses every kernel whose
s_load_dwordnames an SGPR asSOFFSETthat the program didn't write first:s_load_dword s4, s[2:3], s0, 0x8and the same withs1both gives0/s1:a mask read as a numberonmain. With the same register as ans_add_u32source, or after ans_mov_b32writes it, it's accepted, which fits your reading (the prologue never loads a registersgpr_usesdoesn't list). In my differential harness that was 995 of 1000 generated programs refused onmain.Tested
x86_64-pc-windows-gnu, debug, DXC 1.9.2609. Each test in its own process.gpu::rdna2::tests::scalar_memory_register_offset_is_a_read: 1 passed.lower_dxil::kernel_split(SOFFSETs0,s1, null,s0afters_mov_b32, ands0/s1as ALU sources): refused 2 onmain, all 9 accepted with this PR.main.ifs, HLSL path against the per-lane form: 996 identical and 0 refused with this PR (995 refused onmain). The other 4 differ in the HLSL path only; the per-lane and per-instruction forms agree with each other there (details on #1269).Not tested
lower_dxil::compute*), where the samesgpr_useslist may decide which user SGPRs are loaded.AI use: Claude Code, Claude Opus 5.5 found the refusals with the harness, ran the tests above on this machine and wrote this report.
@throny on GitHub · 2026-11-25 10:28 UTC · original
Test report for exact head
a8683ef.Tested
cargo build --workspace && cargo test --workspace -- --test-threads=4ona8683efas it is (its own base): 777 passed, 0 failed, 41 ignored.SKIPPED: 3 lines (no wave64 on this adapter, and the like).scripts/smoke.ps1, the retail title, 60 s, release builds,main568e7dbfirst, then this head. Both runs started without the preload list newer builds leave behind (used-pipelines.txtin the DXIL cache), which makes builds on an older base run out of memory at start:main:
PR:
Not tested: AMD, the head merged onto current
main, a world load.AI use: Claude Code (Claude Opus 5.5) ran this and wrote the report; the diff was read for safety by a Claude Opus 5.5 sub-agent before it was built.
@ClosetPie107 on GitHub · 2026-11-26 06:48 UTC · original
AMD RDNA4 / Linux (Proton Experimental) test report on head
a8683ef4(merged cleanly ontomainb49be183):Hardware & environment
experimental-11.0-20261112),vkd3d-protonmasterec207194(3.2.0) +dxil-spirvb540c8a2+ relaxed-vtable patch (-Db_ndebug=true), DXVKv3.1.1-209, DXC1.9.2609.5, Rustx86_64-pc-windows-gnuIsolated unit tests (
mainb49be183+ #1540a8683ef4, debug,--test-threads=1):xcl.exe gpu::rdna2:: -- --test-threads=1: 19 passed, 0 failed, 0 ignored (0 skipped).Combined 300 s retail sanity run (release,
mainb49be183+ #1540 + #1675 + #1844 + #1899 + #2123 + #2369 + #2422, retail 1.0.2.1 pressingApast menus):exit=0), 0 crashes, 0 device removals,2,014PresentXframes,131,072translated draws,660,943dispatches (44,546chained split-compute dispatches),102,631Opus packets (0 errors).Not tested
AI use
main, ran the Proton unit tests and combined retail run on this machine, and drafted this report.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.