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

Closed
QuentinDanblon wants to merge 1 commit from upstream-pr/200 into main
QuentinDanblon commented 2026-11-23 01:02:35 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by QuentinDanblon on 2026-11-23T01:02:35Z.


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

<!-- greyfinch-sync:omonkeyz/xbox-emulator:issue:6550141355 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/200). Originally posted by [QuentinDanblon](https://github.com/QuentinDanblon) on 2026-11-23T01:02:35Z. --- **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)
omonkeyz commented 2026-11-23 01:10:51 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by omonkeyz on 2026-11-23T01:10:51Z.


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.

<!-- greyfinch-sync:omonkeyz/xbox-emulator:comment:7088938288 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/200#issuecomment-7088938288). Originally posted by [omonkeyz](https://github.com/omonkeyz) on 2026-11-23T01:10:51Z. --- 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 commented 2026-11-23 14:07:56 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by omonkeyz on 2026-11-23T14:07:56Z.


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.

<!-- greyfinch-sync:omonkeyz/xbox-emulator:comment:7103527661 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/200#issuecomment-7103527661). Originally posted by [omonkeyz](https://github.com/omonkeyz) on 2026-11-23T14:07:56Z. --- 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 commented 2026-11-25 13:07:38 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by omonkeyz on 2026-11-25T13:07:38Z.


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

<!-- greyfinch-sync:omonkeyz/xbox-emulator:comment:7163328633 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/200#issuecomment-7163328633). Originally posted by [omonkeyz](https://github.com/omonkeyz) on 2026-11-25T13:07:38Z. --- 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

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
omonkeyz/xbox-emulator!200
No description provided.