Repository navigation
rdna2spirv: quad_any's docstring says partial quads are exact (DOC-QUAD-ANY-PARTIAL) - #2799
Conversation
The comment still claimed an absent invocation in a partial non-fragment quad gave an undefined value natively, while the non-fragment branch reads every lane's activity with OpGroupNonUniformBallot. Wording only. DOC-QUAD-ANY-PARTIAL.
|
Verified by OreoFR on macOS 27.2.1, Apple M5, Python 3.12, head READ IN CODE
MEASURED
AI-assisted: Claude Code |
Verification — VERIFY-2799Verdict: PASS
AI-assisted: yes (Muse Wonder, Muse by Meta) |
KelboLive
left a comment
There was a problem hiding this comment.
The new sentence matches the code: the non-fragment branch ballots v != 0 (tools/rdna2spirv.py:7211), ORs the selected word and masks the quad nibble (:7223-7225), so absent lanes contribute 0 and the result is exact for the running lanes — which is also what docs/design.md:551 and :575 already say. test_absent_lane_ub.py (18/18), test_translate.py -k wqm (13/13) and test_salu_wqm32.py (10/10) pass, and test_quad_any_partial_quad_in_vs_and_cs does exercise a partial quad (VS with lanes 5 and 6 of 32, CS with a two-lane workgroup, both in the strict interpreter).
But the change leaves the docstring contradicting itself two lines above:
:7173-7174still says "vertex, geometry and mesh shaders shuffle". That is stale from before9e085fa6creplaced the shuffle path with ballot for CS/VS/GS/MS, and it now reads as two different mechanisms in one paragraph. Fix that clause here ("the fragment stage uses the 2x2 quad; the other stages ballot"), or the next editor will follow the wrong one.- The parenthetical is narrower than the code and than your own test:
:7206says "subgroup size or thread count not a multiple of 4", while the new text says "a group whose size is not a multiple of 4" — your VS case is 2 active lanes of a 32-lane subgroup, i.e. a partial wave, not an odd group size. - "is exact too" lost the qualifier the old sentence had: the ballot reason holds only without emulation — the
if self.emulatebranch above reads%x_buf, notBallot.
Minor, outside the diff but about the same rule: tests/semantic/test_salu_wqm32.py:7-8 still claims the vertex path uses OpGroupNonUniformShuffle for quad_any, while the test itself asserts QuadSwap for PS and Ballot at :312-313 — its header is stale. No contract-table change is needed; docs/design.md:551 already records this.
|
Addressed in d696c86:
|
|
Verified by MoonEyes (another person than the author) on head AI-assisted (Claude Code). |
|
Thanks — AI-assisted. |
|
Merging. Head AI-assisted (Claude Code). |
Claimed in the coordination issue as: DOC-QUAD-ANY-PARTIAL
What and why
The
quad_anydocstring said an absent invocation in a partial quad gives an undefined value natively. That is stale: the non-fragment branch already answers partial quads exactly by reading each lane's activity withOpGroupNonUniformBallot, andtests/semantic/test_absent_lane_ub.py::test_quad_any_partial_quad_in_vs_and_cscovers partial VS and CS quads (it asserts the module uses ballot, notQuadSwapor an unguarded shuffle). This changes comments only; no translation output changes.After review, three more stale lines in the same docstring/comment and one in a test header: the docstring no longer says the vertex, geometry and mesh shaders shuffle (they ballot); a partial quad is described as fewer than 4 of the quad's lanes running (a partial wave such as 2 active lanes of a 32-lane subgroup, not only a size that is not a multiple of 4); the exactness claim is limited to the non-emulated path; and the
tests/semantic/test_salu_wqm32.pyheader now says the vertex path uses ballot, not a shuffle.Tested
CPU only, no game files or GPU:
python -I tests/semantic/test_absent_lane_ub.py— 18 tests pass.python -I tests/semantic/test_salu_wqm32.py— 10 tests pass.python -m compileall -q tools/rdna2spirv.pyandscripts/check_no_game_data.pyon the changed files.GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: wording only, no new rule)