xshader mesh: full merged_wave_info in s3, GS_ALLOC_REQ field widths per the ISA (was #58) #200

Closed
github-bot wants to merge 1 commit from gh-pr/200/head into gh-pr/200/base
Owner

@⁠QuentinDanblon on GitHub · 2026-11-23 01:02 UTC · original
QuentinDanblon:pr/mesh → main · +54 −14 · 2 files · 1 commits · closed without merging

Library / area: tombox-xshader (mesh shaders)

Exports changed (exports.txt rows): none

Source of the behaviour: RDNA2 ISA 3.12.2 (ES+GS SGPR 3) and 12.5.1 (GS_ALLOC_REQ); Mesa ac_nir_lower_intrinsics_to_args.c and ac_nir_lower_ngg.c, LLPC MeshTaskShader.cpp (reference only, no code copied).

Part of the split of #152 you asked for (was #58). Based on c2a3522, 2 files, +54 / -14.

  • s3 carries the full merged_wave_info: TGsize in [31:28] (ceil(threads / wave)), the wave index in [27:24], and the per-wave ES vertex and GS primitive counts in [7:0] and [15:8].
  • GS_ALLOC_REQ decodes M0[9:0] as the vertex count and M0[22:12] as the primitive count.
  • Written for the two-pass path main now has for 256-thread shaders: the single-pass path and each pass of the loop fill s3 from the same expression. v5 is unchanged.

Tests (tests/mesh.rs): gpu_mesh_merged_wave_info_fields extracts s3[31:28] and s3[15:0] for wave64 and wave32 at 256, 128, 96 and 80 threads (the 256-thread rows are new and go through the two-pass path), and a GS_ALLOC_REQ at the 128 / 128 limit with bits set outside both fields.

Results

WARP, --release, this branch alone on c2a3522:

  • cargo test -p tombox-xshader --test mesh: 26 passed, 0 failed, 1 ignored.
  • The xshader branches of this split (mesh, opcode tables, f16 constants, v_med3_f32, SMEM) merged together on c2a3522, cargo test -p tombox-xshader, all targets: 0 failed. exec 115 passed (2 ignored), lib 90, mesh 26, opcodes 24, synthetic 24, isa_table 3, linkage 3, mixed_table 3, gcn_dims 3. isa_sweep: 541 mnemonics, 530 pass, 0 fail, 11 known WARP deviations.
  • The branch merges into 2eda8b0 without conflict (git merge-tree); it was not rerun there.

Hardware: not rerun on this base, the GPU of my machine is busy for now. The same change passed on an RTX 5090 in #152 (2f1cfd0 on f10db75), and MiguelMatMar ran that branch on an RTX 40-series (results in #152). I will post a hardware run of this branch when the card is free. The two 256-thread rows are new since #152 and have run on WARP only.

No comment lines added (PR gate: 2 files checked, 0 problems). Not run against a title.

  • cargo test -p tombox-xshader passes on WARP
  • No game or console files and no binaries included
  • No fake success; anything not possible is left missing with a note

🤖 Generated with Claude Code

**@⁠QuentinDanblon** on GitHub · 2026-11-23 01:02 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/200) `QuentinDanblon:pr/mesh` → `main` · +54 −14 · 2 files · 1 commits · closed without merging **Library / area:** tombox-xshader (mesh shaders) **Exports changed (exports.txt rows):** none **Source of the behaviour:** RDNA2 ISA 3.12.2 (ES+GS SGPR 3) and 12.5.1 (GS_ALLOC_REQ); Mesa `ac_nir_lower_intrinsics_to_args.c` and `ac_nir_lower_ngg.c`, LLPC `MeshTaskShader.cpp` (reference only, no code copied). Part of the split of #152 you asked for (was #58). Based on `c2a3522`, 2 files, +54 / -14. - `s3` carries the full `merged_wave_info`: TGsize in [31:28] (`ceil(threads / wave)`), the wave index in [27:24], and the per-wave ES vertex and GS primitive counts in [7:0] and [15:8]. - `GS_ALLOC_REQ` decodes M0[9:0] as the vertex count and M0[22:12] as the primitive count. - Written for the two-pass path main now has for 256-thread shaders: the single-pass path and each pass of the loop fill `s3` from the same expression. `v5` is unchanged. Tests (`tests/mesh.rs`): `gpu_mesh_merged_wave_info_fields` extracts s3[31:28] and s3[15:0] for wave64 and wave32 at 256, 128, 96 and 80 threads (the 256-thread rows are new and go through the two-pass path), and a `GS_ALLOC_REQ` at the 128 / 128 limit with bits set outside both fields. ### Results WARP, `--release`, this branch alone on `c2a3522`: - `cargo test -p tombox-xshader --test mesh`: 26 passed, 0 failed, 1 ignored. - The xshader branches of this split (mesh, opcode tables, f16 constants, `v_med3_f32`, SMEM) merged together on `c2a3522`, `cargo test -p tombox-xshader`, all targets: 0 failed. exec 115 passed (2 ignored), lib 90, mesh 26, opcodes 24, synthetic 24, isa_table 3, linkage 3, mixed_table 3, gcn_dims 3. `isa_sweep`: 541 mnemonics, 530 pass, 0 fail, 11 known WARP deviations. - The branch merges into `2eda8b0` without conflict (`git merge-tree`); it was not rerun there. Hardware: not rerun on this base, the GPU of my machine is busy for now. The same change passed on an RTX 5090 in #152 (`2f1cfd0` on `f10db75`), and MiguelMatMar ran that branch on an RTX 40-series (results in #152). I will post a hardware run of this branch when the card is free. The two 256-thread rows are new since #152 and have run on WARP only. No comment lines added (PR gate: 2 files checked, 0 problems). Not run against a title. - [x] `cargo test -p tombox-xshader` passes on WARP - [x] No game or console files and no binaries included - [x] No fake success; anything not possible is left `missing` with a note 🤖 Generated with [Claude Code](https://claude.com/claude-code)
s3 now carries TGsize[31:28] = ceil(threads/wave), the wave index [27:24] and
the per-wave ES vertex / GS primitive counts [7:0]/[15:8] (RDNA2 ISA 3.12.2,
ES+GS SGPR 3; Mesa ac_nir_lower_intrinsics_to_args.c, ac_nir_lower_ngg.c; LLPC
MeshTaskShader.cpp). GS_ALLOC_REQ decodes M0[9:0] vertices and M0[22:12]
primitives (RDNA2 ISA 12.5.1). v5 semantics unchanged.

Both the single-pass path and the two-pass path of 256-thread shaders fill s3.

Tests: synthetic mesh programs extract s3[31:28] and s3[15:0] for wave64/wave32
at 256, 128, 96 and 80 threads, and a GS_ALLOC_REQ at the 128/128 limit with bits
outside both fields set.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:13:36 +00:00
github-bot closed this pull request 2026-11-26 06:13:36 +00:00
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-23 01:10 UTC · original

Thanks, this checks out against the ISA fields. It's on hold for now, not rejected. There is an open amp.rs mesh test failure that is still being bisected, and we don't want to stack two mesh changes while that is unresolved. It will be applied, with your authorship kept, once that bisect clears. No changes needed from you unless the bisect points at this code.

**@⁠omonkeyz** on GitHub · 2026-11-23 01:10 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/200#issuecomment-7088938288) Thanks, this checks out against the ISA fields. It's on hold for now, not rejected. There is an open amp.rs mesh test failure that is still being bisected, and we don't want to stack two mesh changes while that is unresolved. It will be applied, with your authorship kept, once that bisect clears. No changes needed from you unless the bisect points at this code.
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-23 14:07 UTC · original

Applied locally on main with your authorship kept (cherry-picked, 9d565d6); the tombox-xshader suite passes in a sandbox (exec 155/155 on WARP). It ships in the next release; this PR will be closed when that is pushed. Thanks.

**@⁠omonkeyz** on GitHub · 2026-11-23 14:07 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/200#issuecomment-7103527661) Applied locally on main with your authorship kept (cherry-picked, 9d565d6); the tombox-xshader suite passes in a sandbox (exec 155/155 on WARP). It ships in the next release; this PR will be closed when that is pushed. Thanks.
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-25 13:07 UTC · original

Applied on main in 9d565d6 (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

**@⁠omonkeyz** on GitHub · 2026-11-25 13:07 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/200#issuecomment-7163328633) Applied on main in 9d565d6 (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.