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

Closed
leonida/mandy
wetw0rks-c0ding wants to merge 0 commits from mesh-compute-vs-pc-tail into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

wetw0rks-c0ding commented 2026-11-24 21:24:20 +00:00

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.

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

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

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

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).

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

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)

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

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.)

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.)*
Sign in to join this conversation.
No description provided.