Shaders: xcl disasm prints waitcnt counters, hwreg() and sendmsg() #1007

Open
upipibi wants to merge 1 commit from upstream-pr/1014 into main
upipibi commented 2026-11-24 10:23:52 +00:00 (Migrated from github.com)

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


xcl disasm prints the immediates of s_waitcnt, s_waitcnt_depctr, s_getreg_b32 / s_setreg_b32 / s_setreg_imm32_b32 and s_sendmsg / s_sendmsghalt as one hexadecimal number (s_waitcnt 0xf7f, s_setreg_b32 0xf851, m0, s_sendmsg 0x122), which the reader has to take apart by hand. Now as LLVM writes them: s_waitcnt vmcnt(15) lgkmcnt(15), s_setreg_b32 hwreg(HW_REG_TBA_HI, 1, 32), m0, s_sendmsg sendmsg(MSG_GS, GS_OP_EMIT, 1). One more of the text gaps of #664, in operands that issue and #687 / #706 / #716 / #790 / #791 / #812 do not cover; no open PR found for it (gh pr list --search "disasm", "hwreg OR sendmsg OR waitcnt").

Independent: merges cleanly with #687, #706, #716, #790 / #791, #811 and #812.

What is in it

  • crates/xcl/src/gpu/rdna2.rs: waitcnt_text (a counter at its maximum is left out, unless all are), depctr_text (RDNA2's counters, with depctr_hold_cnt; the number when bit 5 or 6 is set, as LLVM), hwreg_text (hwreg(register) for a whole register, else hwreg(register, first bit, bits); LLVM's names for gfx10.3), sendmsg_text (names where the message has that operation, a stream only with a GS cut / emit, else the three numbers), called from operand_text before its match on the operand type.
  • Tests in the same file: llvm_gfx10_waitcnt_hwreg_sendmsg_text compares the whole line with LLVM's for the 48 such lines of tests/data/llvm-amdgpu; waitcnt_hwreg_and_sendmsg_operands has 25 words checked against llvm-mc 21.1.8 (-mcpu=gfx1030): the corpus has two hwreg forms and one sendmsg.
  • Deliberately not LLVM's: an immediate LLVM leaves as a number is hexadecimal here (LLVM: decimal), and a sendmsg immediate with bits above bit 9 stays a number (LLVM 21 ignores them). Branch targets stay addresses.

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::: 11 passed, 0 failed. With the tests on main's rdna2.rs (e50836b): 2 failed – llvm_gfx10_waitcnt_hwreg_sendmsg_text "40 of … lines differ from LLVM's" (48 lines), waitcnt_hwreg_and_sendmsg_operands.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on 7cd41d9: three runs. Run 3: 706 passed, 0 failed, 41 ignored (xcl lib: 665 passed, 0 failed, 21 ignored). Runs 1 and 2: 703 passed, 3 failed, 41 ignored – the failure of #718 (placed_title_textures_share_vram_and_preserve_pixels, "cubemap extra_pages must be reused at same va", 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/1014#issuecomment-7138422552), thanks:

main:

xcl-smoke v1
commit: e50836bdf6f5c026f281d545ed86fb2f07ba6e6a
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1261 (PresentX 1261)
presents per 2 s (last 3): 19 39 7
device removals: 0
crashes: 0
peak commit: 28653 MB

PR:

xcl-smoke v1
commit: 7cd41d98a519b8b25f0005efdb2094f64ea12ad3
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1225 (PresentX 1225)
presents per 2 s (last 3): 18 28 3
device removals: 0
crashes: 0
peak commit: 28028 MB

Not tested

  • No retail title, no XCL_SAMPLE_* data: the game-data tests passed without running.
  • AMD / Intel GPUs, wave64 hardware.
  • No D3D12 debug layer on this machine (Graphics Tools not installed): test_title_draws_with_a_root_signature_under_the_debug_layer and uploads_start_from_each_subresources_state return early.
  • The s_waitcnt_depctr lines of gfx10_sopp.txt are not compared: they are RDNA1's reading (no depctr_hold_cnt); the 19 of gfx1030_new.txt are.
  • The register and message names come from llvm-mc 21.1.8, not from hardware.

AI use

  • Claude Code with Claude Fable 5.2 (Anthropic): found the gap 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:5470340406 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1014). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-24T10:23:52Z. --- `xcl disasm` prints the immediates of `s_waitcnt`, `s_waitcnt_depctr`, `s_getreg_b32` / `s_setreg_b32` / `s_setreg_imm32_b32` and `s_sendmsg` / `s_sendmsghalt` as one hexadecimal number (`s_waitcnt 0xf7f`, `s_setreg_b32 0xf851, m0`, `s_sendmsg 0x122`), which the reader has to take apart by hand. Now as LLVM writes them: `s_waitcnt vmcnt(15) lgkmcnt(15)`, `s_setreg_b32 hwreg(HW_REG_TBA_HI, 1, 32), m0`, `s_sendmsg sendmsg(MSG_GS, GS_OP_EMIT, 1)`. One more of the text gaps of #664, in operands that issue and #687 / #706 / #716 / #790 / #791 / #812 do not cover; no open PR found for it (`gh pr list --search` "disasm", "hwreg OR sendmsg OR waitcnt"). Independent: merges cleanly with #687, #706, #716, #790 / #791, #811 and #812. **What is in it** - `crates/xcl/src/gpu/rdna2.rs`: `waitcnt_text` (a counter at its maximum is left out, unless all are), `depctr_text` (RDNA2's counters, with `depctr_hold_cnt`; the number when bit 5 or 6 is set, as LLVM), `hwreg_text` (`hwreg(register)` for a whole register, else `hwreg(register, first bit, bits)`; LLVM's names for gfx10.3), `sendmsg_text` (names where the message has that operation, a stream only with a GS cut / emit, else the three numbers), called from `operand_text` before its match on the operand type. - Tests in the same file: `llvm_gfx10_waitcnt_hwreg_sendmsg_text` compares the whole line with LLVM's for the 48 such lines of `tests/data/llvm-amdgpu`; `waitcnt_hwreg_and_sendmsg_operands` has 25 words checked against `llvm-mc` 21.1.8 (`-mcpu=gfx1030`): the corpus has two `hwreg` forms and one `sendmsg`. - Deliberately not LLVM's: an immediate LLVM leaves as a number is hexadecimal here (LLVM: decimal), and a `sendmsg` immediate with bits above bit 9 stays a number (LLVM 21 ignores them). Branch targets stay addresses. **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::`: 11 passed, 0 failed. With the tests on `main`'s `rdna2.rs` (e50836b): 2 failed – `llvm_gfx10_waitcnt_hwreg_sendmsg_text` "40 of … lines differ from LLVM's" (48 lines), `waitcnt_hwreg_and_sendmsg_operands`. - `cargo test --workspace --no-fail-fast -- --test-threads=4` on 7cd41d9: three runs. Run 3: 706 passed, 0 failed, 41 ignored (xcl lib: 665 passed, 0 failed, 21 ignored). Runs 1 and 2: 703 passed, 3 failed, 41 ignored – the failure of #718 (`placed_title_textures_share_vram_and_preserve_pixels`, "cubemap extra_pages must be reused at same va", 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/1014#issuecomment-7138422552), thanks: main: ``` xcl-smoke v1 commit: e50836bdf6f5c026f281d545ed86fb2f07ba6e6a gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1261 (PresentX 1261) presents per 2 s (last 3): 19 39 7 device removals: 0 crashes: 0 peak commit: 28653 MB ``` PR: ``` xcl-smoke v1 commit: 7cd41d98a519b8b25f0005efdb2094f64ea12ad3 gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1225 (PresentX 1225) presents per 2 s (last 3): 18 28 3 device removals: 0 crashes: 0 peak commit: 28028 MB ``` **Not tested** - No retail title, no `XCL_SAMPLE_*` data: the game-data tests passed without running. - AMD / Intel GPUs, wave64 hardware. - No D3D12 debug layer on this machine (Graphics Tools not installed): `test_title_draws_with_a_root_signature_under_the_debug_layer` and `uploads_start_from_each_subresources_state` return early. - The `s_waitcnt_depctr` lines of `gfx10_sopp.txt` are not compared: they are RDNA1's reading (no `depctr_hold_cnt`); the 19 of `gfx1030_new.txt` are. - The register and message names come from `llvm-mc` 21.1.8, not from hardware. **AI use** - Claude Code with Claude Fable 5.2 (Anthropic): found the gap 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:49Z.


Full-suite run, since this PR has no test report yet. Tested exact head 7cd41d9 (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: 706 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: waitcnt_hwreg_and_sendmsg_operands, llvm_gfx10_waitcnt_hwreg_sendmsg_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:7134333014 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1014#issuecomment-7134333014). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-24T14:24:49Z. --- Full-suite run, since this PR has no test report yet. Tested exact head `7cd41d9` (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`: **706 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: `waitcnt_hwreg_and_sendmsg_operands`, `llvm_gfx10_waitcnt_hwreg_sendmsg_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:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-24T16:55:41Z.


Regression pair for 7cd41d9 against main e50836b (this PR's base), for the Regression run section. Both runs pass: no device removal, no crash, 97 % 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: 1261 (PresentX 1261)
presents per 2 s (last 3): 19 39 7
device removals: 0
crashes: 0
peak commit: 28653 MB

this PR, 7cd41d9:

xcl-smoke v1
commit: 7cd41d98a519b8b25f0005efdb2094f64ea12ad3
gpu: NVIDIA GeForce RTX 5070 Ti
title: GTA VI
seconds: 60
exit: 0x0
frames shown: 1225 (PresentX 1225)
presents per 2 s (last 3): 18 28 3
device removals: 0
crashes: 0
peak commit: 28028 MB

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:7138422552 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1014#issuecomment-7138422552). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-24T16:55:41Z. --- Regression pair for `7cd41d9` against `main` `e50836b` (this PR's base), for the **Regression run** section. Both runs pass: no device removal, no crash, 97 % 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: 1261 (PresentX 1261) presents per 2 s (last 3): 19 39 7 device removals: 0 crashes: 0 peak commit: 28653 MB ``` this PR, `7cd41d9`: ``` xcl-smoke v1 commit: 7cd41d98a519b8b25f0005efdb2094f64ea12ad3 gpu: NVIDIA GeForce RTX 5070 Ti title: GTA VI seconds: 60 exit: 0x0 frames shown: 1225 (PresentX 1225) presents per 2 s (last 3): 18 28 3 device removals: 0 crashes: 0 peak commit: 28028 MB ``` **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:10Z.


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:7158125271 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1014#issuecomment-7158125271). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T09:17:10Z. --- 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:11 +00:00 (Migrated from github.com)

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


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:7252626790 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1014#issuecomment-7252626790). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-29T07:41:11Z. --- 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:38:07 +00:00 (Migrated from github.com)

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


Triage (#1607) – head 7cd41d9

No open or merged PR formats s_waitcnt, s_waitcnt_depctr, hwreg() or sendmsg(). Main has no OPR_WAITCNT / OPR_HWREG / OPR_SENDMSG handling in rdna2.rs. #1013 (same author) touches different operands in the same file.
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:7300934738 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1014#issuecomment-7300934738). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T04:38:07Z. --- **Triage (#1607)** – head 7cd41d9 No open or merged PR formats `s_waitcnt`, `s_waitcnt_depctr`, `hwreg()` or `sendmsg()`. Main has no `OPR_WAITCNT` / `OPR_HWREG` / `OPR_SENDMSG` handling in `rdna2.rs`. #1013 (same author) touches different operands in the same file. 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/1014:upstream-pr/1014'
git switch 'upstream-pr/1014'

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/1014'
git switch 'upstream-pr/1014'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1014'
git switch 'upstream-pr/1014'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1014'
git switch 'main'
git merge --squash 'upstream-pr/1014'
git switch 'main'
git merge --ff-only 'upstream-pr/1014'
git switch 'main'
git merge 'upstream-pr/1014'
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!1007
No description provided.