Shaders: xcl disasm prints DS, buffer and flat operands as LLVM #1006

Open
upipibi wants to merge 3 commits from upstream-pr/1013 into main
upipibi commented 2026-11-24 10:23:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by upipibi on 2026-11-24T10:23:50Z.


xcl disasm prints three families of memory instructions differently from what they encode. Each commit compares the printed line with LLVM's for every line of the in-repo LLVM corpus of that family (tests/data/llvm-amdgpu). They're one PR because all three change the same match arm of format; they're separate commits, so each can be reviewed or dropped on its own. One more set of the text gaps of #664. No open PR found for any of them (gh pr list --search "disasm"), and this merges cleanly with #687, #706, #716, #790 / #791, #811 and #812.

What is in it (all in crates/xcl/src/gpu/rdna2.rs, text only)

  • b0ec796 DS: single-address LDS / GDS instructions print one 16-bit offset: (they were split into offset0:52 offset1:18 for offset:4660); ds_read2* / ds_write2* / ds_wrxchg2* keep offset0: / offset1:. Test llvm_gfx10_ds_text: 1705 lines of gfx10_ds.txt.
  • cdc4546 MUBUF / MTBUF: the address is off, one register or a pair according to IDXEN / OFFEN (it was always two, so a constant-offset load showed a VGPR it doesn't read); format:[BUF_FMT_…] for tbuffer_*; flags in LLVM's order including lds and tfe; TFE's extra data register. Tests llvm_gfx10_buffer_text (822 lines of gfx10_mubuf.txt / gfx10_mtbuf.txt) and buffer_address_format_and_flags (5 words checked against llvm-mc 21.1.8, -mcpu=gfx1030).
  • 6d247e5 FLAT / GLOBAL / SCRATCH: only the operands the form has: no result register for an atomic that returns none, off for a missing base (it printed null / exec_hi), one address register beside an SGPR base, a signed 12-bit offset, then glc slc dlc lds. Test llvm_gfx10_flat_text: 368 lines of gfx10_flat.txt / gfx1030_new.txt.

Tested

  • NVIDIA GeForce RTX 3070 8 GB, driver 616.56 (32.0.16.1656), 32-lane waves only; Ryzen 9 5950X; Windows 11 Pro 26100; Rust 1.100.0 MSVC, debug.
  • cargo test -p xcl --lib gpu::rdna2::tests::: 13 passed, 0 failed. Before each commit its new tests fail: DS "1043 of 1705 lines differ from LLVM's", buffer "820 of 822", flat "333 of 368".
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on 6d247e5 (all three): 708 passed, 0 failed, 41 ignored (xcl lib: 667 passed, 0 failed, 21 ignored). An earlier run had the #718 cubemap flake (705 passed, 3 failed: placed_title_textures_share_vram_and_preserve_pixels and the two tests its poisoned lock takes with it), which main shows on this machine too.
  • SKIPPED GPU tests: 2, both no wave64: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.

Regression run

From Kalmarv's run (https://github.com/ivall/xcl/pull/1013#issuecomment-7138701492), thanks:

main:

xcl-smoke v1
commit: e50836bdf6f5c026f281d545ed86fb2f07ba6e6a
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1254 (PresentX 1254)
presents per 2 s (last 3): 25 34 13
device removals: 0
crashes: 0
peak commit: 28567 MB

PR:

xcl-smoke v1
commit: 6d247e569d3b30e15aa602fa0eaa0d64bbb3e4f2
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1253 (PresentX 1253)
presents per 2 s (last 3): 10 26 29
device removals: 0
crashes: 0
peak commit: 28087 MB

Not tested

  • No retail title, no XCL_SAMPLE_* data: the game-data tests passed without running.
  • AMD / Intel GPUs, wave64 hardware.
  • The 13 ds_swizzle_b32 lines with a pattern: the pattern stays a number (offset:57344) where LLVM writes offset:swizzle(FFT,0).
  • A buffer load into LDS keeps its data register in the text (LLVM leaves it out). lds and tfe were each checked alone against llvm-mc; their order among other flags is LLVM's by analogy.
  • Flat: only what the corpus has; no words of my own against llvm-mc.

AI use

  • AI-assisted (Claude Code with Claude Fable 5.2): found the gaps by comparing xcl disasm with the LLVM test lines in the repository, wrote the code, the tests and this description, and ran the tests.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5470339833 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1013). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-24T10:23:50Z. --- `xcl disasm` prints three families of memory instructions differently from what they encode. Each commit compares the printed line with LLVM's for every line of the in-repo LLVM corpus of that family (`tests/data/llvm-amdgpu`). They're one PR because all three change the same `match` arm of `format`; they're separate commits, so each can be reviewed or dropped on its own. One more set of the text gaps of #664. No open PR found for any of them (`gh pr list --search "disasm"`), and this merges cleanly with #687, #706, #716, #790 / #791, #811 and #812. **What is in it** (all in `crates/xcl/src/gpu/rdna2.rs`, text only) - `b0ec796` **DS:** single-address LDS / GDS instructions print one 16-bit `offset:` (they were split into `offset0:52 offset1:18` for `offset:4660`); `ds_read2*` / `ds_write2*` / `ds_wrxchg2*` keep `offset0:` / `offset1:`. Test `llvm_gfx10_ds_text`: 1705 lines of `gfx10_ds.txt`. - `cdc4546` **MUBUF / MTBUF:** the address is `off`, one register or a pair according to IDXEN / OFFEN (it was always two, so a constant-offset load showed a VGPR it doesn't read); `format:[BUF_FMT_…]` for `tbuffer_*`; flags in LLVM's order including `lds` and `tfe`; TFE's extra data register. Tests `llvm_gfx10_buffer_text` (822 lines of `gfx10_mubuf.txt` / `gfx10_mtbuf.txt`) and `buffer_address_format_and_flags` (5 words checked against `llvm-mc` 21.1.8, `-mcpu=gfx1030`). - `6d247e5` **FLAT / GLOBAL / SCRATCH:** only the operands the form has: no result register for an atomic that returns none, `off` for a missing base (it printed `null` / `exec_hi`), one address register beside an SGPR base, a signed 12-bit offset, then `glc slc dlc lds`. Test `llvm_gfx10_flat_text`: 368 lines of `gfx10_flat.txt` / `gfx1030_new.txt`. **Tested** - NVIDIA GeForce RTX 3070 8 GB, driver 616.56 (32.0.16.1656), 32-lane waves only; Ryzen 9 5950X; Windows 11 Pro 26100; Rust 1.100.0 MSVC, debug. - `cargo test -p xcl --lib gpu::rdna2::tests::`: 13 passed, 0 failed. Before each commit its new tests fail: DS "1043 of 1705 lines differ from LLVM's", buffer "820 of 822", flat "333 of 368". - `cargo test --workspace --no-fail-fast -- --test-threads=4` on `6d247e5` (all three): 708 passed, 0 failed, 41 ignored (xcl lib: 667 passed, 0 failed, 21 ignored). An earlier run had the #718 cubemap flake (705 passed, 3 failed: `placed_title_textures_share_vram_and_preserve_pixels` and the two tests its poisoned lock takes with it), which `main` shows on this machine too. - SKIPPED GPU tests: 2, both `no wave64`: `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. **Regression run** From Kalmarv's run (https://github.com/ivall/xcl/pull/1013#issuecomment-7138701492), thanks: main: ``` xcl-smoke v1 commit: e50836bdf6f5c026f281d545ed86fb2f07ba6e6a gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1254 (PresentX 1254) presents per 2 s (last 3): 25 34 13 device removals: 0 crashes: 0 peak commit: 28567 MB ``` PR: ``` xcl-smoke v1 commit: 6d247e569d3b30e15aa602fa0eaa0d64bbb3e4f2 gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1253 (PresentX 1253) presents per 2 s (last 3): 10 26 29 device removals: 0 crashes: 0 peak commit: 28087 MB ``` **Not tested** - No retail title, no `XCL_SAMPLE_*` data: the game-data tests passed without running. - AMD / Intel GPUs, wave64 hardware. - The 13 `ds_swizzle_b32` lines with a pattern: the pattern stays a number (`offset:57344`) where LLVM writes `offset:swizzle(FFT,0)`. - A buffer load into LDS keeps its data register in the text (LLVM leaves it out). `lds` and `tfe` were each checked alone against `llvm-mc`; their order among other flags is LLVM's by analogy. - Flat: only what the corpus has; no words of my own against `llvm-mc`. **AI use** - AI-assisted (Claude Code with Claude Fable 5.2): found the gaps by comparing `xcl disasm` with the LLVM test lines in the repository, wrote the code, the tests and this description, and ran the tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
futurepro62 commented 2026-11-24 15:05:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T14:24:46Z.


Full-suite run, since this PR has no test report yet. Tested exact head 6d247e5 (on its base e50836b).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 708 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: llvm_gfx10_flat_text, buffer_address_format_and_flags, llvm_gfx10_buffer_text, llvm_gfx10_ds_text.

Not tested

  • AMD, a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:ivall/xcl:comment:7134331485 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1013#issuecomment-7134331485). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-24T14:24:46Z. --- Full-suite run, since this PR has no test report yet. Tested exact head `6d247e5` (on its base `e50836b`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4`: **708 passed, 0 failed, 41 ignored**. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - The new tests ran and passed: `llvm_gfx10_flat_text`, `buffer_address_format_and_flags`, `llvm_gfx10_buffer_text`, `llvm_gfx10_ds_text`. **Not tested** - AMD, a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Kalmarv commented 2026-11-24 17:06:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-24T17:06:42Z.


Regression pair for 6d247e5 against main e50836b (this PR's base), for the Regression run section. Both runs pass: no device removal, no crash, 100 % of main's frames, 98 % of its peak commit.

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74), AMD Ryzen 9 9950X, Windows 11 Pro 26200.
  • scripts/smoke.ps1, the same retail title for 60 s each: main at e50836b (this PR's base, 67 commits behind today's main) first, then this PR's head, one after the other on the same machine.

main e50836b:

xcl-smoke v1
commit: e50836bdf6f5c026f281d545ed86fb2f07ba6e6a
gpu: NVIDIA GeForce RTX 5070 Ti
title: GTA VI
seconds: 60
exit: 0x0
frames shown: 1254 (PresentX 1254)
presents per 2 s (last 3): 25 34 13
device removals: 0
crashes: 0
peak commit: 28567 MB

this PR, 6d247e5:

xcl-smoke v1
commit: 6d247e569d3b30e15aa602fa0eaa0d64bbb3e4f2
gpu: NVIDIA GeForce RTX 5070 Ti
title: GTA VI
seconds: 60
exit: 0x0
frames shown: 1253 (PresentX 1253)
presents per 2 s (last 3): 10 26 29
device removals: 0
crashes: 0
peak commit: 28087 MB

An earlier pair on the same two commits had this PR's run crash at 30.8 s: 0xc0000005 in VCRUNTIME140.dll+0x1c45a (the memcpy of copy_from_slice) ← tiling::Chain::detile_level (tiling.rs:438) ← title_textures::subresources (title_textures.rs:1170) on a subresources_on worker, reading title memory outside the coherent window. This PR doesn't touch that code; it is the in-place read race that open #751 addresses. The blocks above are the second pair, run after it.

Not tested

  • xcl disasm itself: the run doesn't print a disassembly, so it shows only that the rest of the runtime is unchanged.
  • World loading: a 60 s run ends before it.
  • AMD, Linux.

AI use: Claude Code (Claude Opus 5.5)

<!-- greyfinch-sync:ivall/xcl:comment:7138701492 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1013#issuecomment-7138701492). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-24T17:06:42Z. --- Regression pair for `6d247e5` against `main` `e50836b` (this PR's base), for the **Regression run** section. Both runs pass: no device removal, no crash, 100 % of `main`'s frames, 98 % of its peak commit. **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74), AMD Ryzen 9 9950X, Windows 11 Pro 26200. - `scripts/smoke.ps1`, the same retail title for 60 s each: `main` at `e50836b` (this PR's base, 67 commits behind today's `main`) first, then this PR's head, one after the other on the same machine. `main` `e50836b`: ``` xcl-smoke v1 commit: e50836bdf6f5c026f281d545ed86fb2f07ba6e6a gpu: NVIDIA GeForce RTX 5070 Ti title: GTA VI seconds: 60 exit: 0x0 frames shown: 1254 (PresentX 1254) presents per 2 s (last 3): 25 34 13 device removals: 0 crashes: 0 peak commit: 28567 MB ``` this PR, `6d247e5`: ``` xcl-smoke v1 commit: 6d247e569d3b30e15aa602fa0eaa0d64bbb3e4f2 gpu: NVIDIA GeForce RTX 5070 Ti title: GTA VI seconds: 60 exit: 0x0 frames shown: 1253 (PresentX 1253) presents per 2 s (last 3): 10 26 29 device removals: 0 crashes: 0 peak commit: 28087 MB ``` An earlier pair on the same two commits had this PR's run crash at 30.8 s: `0xc0000005` in `VCRUNTIME140.dll+0x1c45a` (the memcpy of `copy_from_slice`) ← `tiling::Chain::detile_level` (tiling.rs:438) ← `title_textures::subresources` (title_textures.rs:1170) on a `subresources_on` worker, reading title memory outside the coherent window. This PR doesn't touch that code; it is the in-place read race that open #751 addresses. The blocks above are the second pair, run after it. **Not tested** - `xcl disasm` itself: the run doesn't print a disassembly, so it shows only that the rest of the runtime is unchanged. - World loading: a 60 s run ends before it. - AMD, Linux. **AI use:** Claude Code (Claude Opus 5.5)
DavidM1911 commented 2026-11-25 10:10:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T09:17:11Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7158125855 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1013#issuecomment-7158125855). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T09:17:11Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
github-actions[bot] commented 2026-11-29 07:41:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T07:41:13Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7252627125 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1013#issuecomment-7252627125). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-29T07:41:13Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 04:37:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:37:51Z.


Triage (#1607) – head 6d247e5

No open or merged PR formats DS, MUBUF/MTBUF or FLAT operands for xcl disasm. Main's rdna2.rs still prints these encodings with the generic offset loop. #1014 (same author) changes other operands in the same file and does not overlap.
No problems found in the diff.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7300930287 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1013#issuecomment-7300930287). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T04:37:51Z. --- **Triage (#1607)** – head 6d247e5 No open or merged PR formats DS, MUBUF/MTBUF or FLAT operands for `xcl disasm`. Main's `rdna2.rs` still prints these encodings with the generic offset loop. #1014 (same author) changes other operands in the same file and does not overlap. No problems found in the diff. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1013:upstream-pr/1013'
git switch 'upstream-pr/1013'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1013'
git switch 'upstream-pr/1013'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1013'
git switch 'upstream-pr/1013'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1013'
git switch 'main'
git merge --squash 'upstream-pr/1013'
git switch 'main'
git merge --ff-only 'upstream-pr/1013'
git switch 'main'
git merge 'upstream-pr/1013'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1006
No description provided.