OLD-2528: mesh_compute_vs: read output address from %pc_tail when pc_tail_address_dwords is set #1295

Closed
wetw0rks-c0ding wants to merge 2 commits from upstream-pr/1295 into main
wetw0rks-c0ding commented 2026-11-24 21:24:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by wetw0rks-c0ding on 2026-11-24T21:24:20Z.


Claimed in the coordination issue as: OLD-2528

What and why

When index.json's mesh_compute layout carries pc_tail_address_dwords, tools/mesh_compute_vs.py still emitted a 152-byte PushConstant block that does not fit 128-byte push-constant devices. It now reads the output-buffer address from the set-1 binding-0 Uniform block %pc_tail and omits PushConstant entirely; output is unchanged when that layout field is absent.

Tested

  • python3 -m pytest tests/test_mesh_compute_vs.py tests/test_mesh_compute.py -q -> 44 passed, 13 subtests
  • python -I scripts/check_no_game_data.py tools/mesh_compute_vs.py tests/test_mesh_compute_vs.py tests/test_mesh_compute.py -> clean
  • Environment: Linux (CachyOS), CPU-only tests, no GPU required

AI-assisted: Yes. This work was done with OpenCode agents.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5480584925 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1295). Originally posted by [wetw0rks-c0ding](https://github.com/wetw0rks-c0ding) on 2026-11-24T21:24:20Z. --- Claimed in the coordination issue as: OLD-2528 ### What and why When `index.json`'s `mesh_compute` layout carries `pc_tail_address_dwords`, `tools/mesh_compute_vs.py` still emitted a 152-byte `PushConstant` block that does not fit 128-byte push-constant devices. It now reads the output-buffer address from the set-1 binding-0 `Uniform` block `%pc_tail` and omits `PushConstant` entirely; output is unchanged when that layout field is absent. ### Tested - `python3 -m pytest tests/test_mesh_compute_vs.py tests/test_mesh_compute.py -q` -> 44 passed, 13 subtests - `python -I scripts/check_no_game_data.py tools/mesh_compute_vs.py tests/test_mesh_compute_vs.py tests/test_mesh_compute.py` -> clean - Environment: Linux (CachyOS), CPU-only tests, no GPU required AI-assisted: Yes. This work was done with OpenCode agents.
PierreEbele commented 2026-11-25 14:54:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T14:54:03Z.


Reviewed 5684a06: ran tests/test_mesh_compute_vs.py and tests/test_mesh_compute.py on the PR tree and on main with the PR's tests copied in - the new tests fail on main and pass on the PR, the rest are unchanged; probed that without pc_tail_address_dwords the emitted assembly is byte-identical to main over 10 layouts, and that the tail-mode shader matches rdna2spirv's %pc_tail block (set 1 binding 0, 6 dwords, offsets 0..20). I could not run spirv-as/val here, so the assemble-and-validate tests skipped - please run them where SPIRV-Tools exist. AI-assisted review.

Recommendation: Merge

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7165990758 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1295#issuecomment-7165990758). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-25T14:54:03Z. --- Reviewed 5684a06: ran tests/test_mesh_compute_vs.py and tests/test_mesh_compute.py on the PR tree and on main with the PR's tests copied in - the new tests fail on main and pass on the PR, the rest are unchanged; probed that without pc_tail_address_dwords the emitted assembly is byte-identical to main over 10 layouts, and that the tail-mode shader matches rdna2spirv's %pc_tail block (set 1 binding 0, 6 dwords, offsets 0..20). I could not run spirv-as/val here, so the assemble-and-validate tests skipped - please run them where SPIRV-Tools exist. AI-assisted review. **Recommendation:** Merge
wavehs commented 2026-11-26 18:48:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by wavehs on 2026-11-26T18:48:03Z.


Related to #765 (whoalin1, 2026-11-24 13:35, earlier): same feature (read the output address from %pc_tail when --pc-tail-ubo is used), same three files, different validation.

The concrete difference is _pc_tail_dwords in tools/mesh_compute_vs.py:

  • #765 requires two distinct dwords and bounds each to 0..63 (PC_TAIL_MAX_DWORDS), so [4, 4], [64, 65] and [70000, 70001] are rejected, and it tests each in test_pc_tail_address_dwords_rejects_malformed_values.
  • This PR accepts any two non-negative ints, including duplicates and arbitrarily large values, and its test list drops those three cases.

When the layout index is wrong, a duplicate or out-of-range pair would emit an OpAccessChain outside the %pc_tail block instead of failing the tool, so #765 looks like the safer of the two. Not a duplicate in the "identical diff" sense, so I am not recommending a close outright — but the coordinator should pick one, and if this one lands the three missing negative cases should be added.

AI-assisted (review only).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7200865396 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1295#issuecomment-7200865396). Originally posted by [wavehs](https://github.com/wavehs) on 2026-11-26T18:48:03Z. --- Related to **#765** (whoalin1, 2026-11-24 13:35, earlier): same feature (read the output address from `%pc_tail` when `--pc-tail-ubo` is used), same three files, different validation. The concrete difference is `_pc_tail_dwords` in `tools/mesh_compute_vs.py`: - #765 requires two **distinct** dwords and bounds each to `0..63` (`PC_TAIL_MAX_DWORDS`), so `[4, 4]`, `[64, 65]` and `[70000, 70001]` are rejected, and it tests each in `test_pc_tail_address_dwords_rejects_malformed_values`. - This PR accepts any two non-negative ints, including duplicates and arbitrarily large values, and its test list drops those three cases. When the layout index is wrong, a duplicate or out-of-range pair would emit an `OpAccessChain` outside the `%pc_tail` block instead of failing the tool, so #765 looks like the safer of the two. Not a duplicate in the "identical diff" sense, so I am not recommending a close outright — but the coordinator should pick one, and if this one lands the three missing negative cases should be added. AI-assisted (review only).
MoonEyes commented 2026-11-27 23:36:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-27T23:36:19Z.


Thanks for this, @wetw0rks-c0ding. The item (OLD-2528) was claimed and restored first by whoalin1 in #765, and its code does the same thing as yours apart from one error message. What this pull request adds is tests: test_pc_tail_dwords_accept_only_distinct_indices_in_range (the accepted [0, 63] edge and the rejected [63, 64] and [0, 64]) and seven more malformed inputs, which pass on #765's code. Once #765 lands, could you cut this pull request down to those tests? cc @whoalin1, or add them to #765 directly if you prefer, then this one can be closed.

AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7230268447 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1295#issuecomment-7230268447). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-27T23:36:19Z. --- Thanks for this, @wetw0rks-c0ding. The item (OLD-2528) was claimed and restored first by `whoalin1` in #765, and its code does the same thing as yours apart from one error message. What this pull request adds is tests: `test_pc_tail_dwords_accept_only_distinct_indices_in_range` (the accepted `[0, 63]` edge and the rejected `[63, 64]` and `[0, 64]`) and seven more malformed inputs, which pass on #765's code. Once #765 lands, could you cut this pull request down to those tests? cc @whoalin1, or add them to #765 directly if you prefer, then this one can be closed. AI-assisted (Claude Code, Claude Opus 5.5)
aslan2142 commented 2026-12-01 11:45:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:45:51Z.


Closing as superseded: OLD-2528 (%pc_tail output address support and _pc_tail_dwords bounds/distinctness validation in tools/mesh_compute_vs.py:33-51) is already merged on main via #765. If you'd like to contribute any remaining edge-case unit tests from tests/test_mesh_compute_vs.py, please open a small test-only PR on current main.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7310103431 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1295#issuecomment-7310103431). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:45:51Z. --- Closing as superseded: OLD-2528 (`%pc_tail` output address support and `_pc_tail_dwords` bounds/distinctness validation in `tools/mesh_compute_vs.py:33-51`) is already merged on `main` via #765. If you'd like to contribute any remaining edge-case unit tests from `tests/test_mesh_compute_vs.py`, please open a small test-only PR on current `main`. *(AI-assisted review.)*

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
ProjectLeonida/mandy!1295
No description provided.