W64-APPEND-CONSUME-BARRIER-REGRESSION: guard one-wave branch barriers #2803
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2803
Loading…
Reference in a new issue
No description provided.
Delete branch "test/w64-append-consume-barrier"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request successfully merged and closed
Claimed in the coordination issue as: W64-APPEND-CONSUME-BARRIER-REGRESSION (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7296006442)
What and why
Adds a mutation-sensitive regression test for
ds_append/ds_consumethrough the Wave64 optimizer. In a 128-thread shader only wave 0 enters the SCC branch; the wave-wide LDS counter operation requires an isolated mini-scheduler and real workgroup barriers. The test checks the structured-hybrid plan, mini-scheduler, emittedOpControlBarriers, and the append/consume atomic operation.Previously, restoring the source to its pre-classifier form left all 31 PR tests green (finding: https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7288312704). This shape fails when either classifier entry is removed instead of merely restating the classifier membership.
Tested
python3 -I tests/semantic/test_wave64_emulate_opt.py— 36 tests, OK.ds_appendalone andds_consumealone from_ALWAYS_BARRIER_OPS(and clearing the metadata cache) each makes its new subtest fail atrdna2spirv.py:unexpected OpControlBarrier in sync-free multi-wave block. Restoring the entries gives the green result above.python3 -m compileall -q tests/semantic/test_wave64_emulate_opt.py,scripts/check_no_game_data.pyon the changed file, andgit diff --check: clean.python3 -I scripts/run_semantic_tests.py tests/semantic— 553 files, 6,721 tests, 0 files failed in 386 s with 8 jobs. No hardware shader corpus/GPU comparison performed.GPUs tested: n/a (synthetic CPU translation only)
AI-assisted: yes (Kimi K3.1 Pro lead, GLM 5.3 Flash review)
Checklist
mainand merges cleanly.Verified by OreoFR on macOS 27.2.1, Apple M5, Python 3.12, head
8aada4fc2, mainb7a1be296. CPU only, synthetic translation.MEASURED
tests/semantic/test_wave64_emulate_opt.pygives 36 passed, 40 subtests passed, both on main + this test and on main + the PR (merge-tree)."ds_append"in_ALWAYS_BARRIER_OPS(tools/wave64_emulate_opt.py:137): 1 failed, 35 passed. The failure istest_append_consume_in_one_wave_branch_keeps_workgroup_barriers (op='ds_append'), withunexpected OpControlBarrier in sync-free multi-wave block."ds_consume": 1 failed, 35 passed. Same test, subtestop='ds_consume', same message.READ IN CODE
_ALWAYS_BARRIER_OPSis used atwave64_emulate_opt.py:316(op in _ALWAYS_BARRIER_OPS), which is the path the mutation changes.AI-assisted: Claude Code
Additional local verification on the same head
8aada4fc2d012a22081383911a36c18f77b58eb1: fullpython3 -I scripts/run_semantic_tests.py tests/semanticcompleted with 553 files, 6,721 tests, 0 files failed in 386 s using 8 jobs. Still no GPU or hardware-corpus run; this is the no-game-data synthetic suite.Verified on Windows, and the test does what its comment claims: it catches a mutation that the other 35 tests in the file do not.
The PR only adds a test, so the check that matters is not "do the tests pass" - they pass on the base too, which is what
scripts/red_green.pycorrectly reported asverdict: no red. The check is whether the new test catches the change it was written for. So I made the change it names, intools/wave64_emulate_opt.py:141only:Result, at this head,
maind920d850dplus the PR:So the comment's sentence - "Removing either op from
_ALWAYS_BARRIER_OPSlet every existing test pass even though this shape reaches the sync-free-block assertion" - is exactly right, and this is the test that stops it. Both subtests fail independently, which is what thefor op in (...)loop is for.What I could not verify: that the shape reaches the real assertion in a real translation - the test asserts
spv.count("OpControlBarrier") >= 3and the plan's steps, not that a later stage rejects it. That is enough for the claim as written ("keeps workgroup barriers"), and it is not the same as proving the sync-free-block path fires.One note on my first attempt, since it is a trap: I removed the ops by matching the text, and that also hit a second set (
"ds_consume", "ds_append", "ds_ordered_count",), which made the "other tests" arm fail and would have made me report the opposite conclusion. The precise cut is the line in_ALWAYS_BARRIER_OPSand nothing else.AI-assisted: yes - DeepSeek v4.1 (flash).
Written with an AI assistant.
Verified by MoonEyes (another person than the author) on head
8aada4fc2merged withmain9372a4d4f: Windows 11, Python 3.14.tests/semantic/test_wave64_emulate_opt.py36 OK. By mutation, withds_appendandds_consumeout of_ALWAYS_BARRIER_OPS, exactly this test fails (both subtests), as KelboLive found.AI-assisted (Claude Code).
Merging. Head
8aada4fc2merges cleanly withmain1d73465e8and does not force a rebase of #2566. CI green on this head and on main. fiestorra and KelboLive checked it on this head by mutation; I did the same on main + PR (Windows, Python 3.14): 36 tests OK, and removing ds_append and ds_consume from the barrier list fails only this test. MoonEyes asked for this merge. A test only. Merged by MoonEyes.AI-assisted (Claude Code).