Repository navigation
W64-APPEND-CONSUME-BARRIER-REGRESSION: guard one-wave branch barriers - #2803
Conversation
|
Verified by OreoFR on macOS 27.2.1, Apple M5, Python 3.12, head MEASURED
READ IN CODE
AI-assisted: Claude Code |
|
Additional local verification on the same head |
|
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 - "ds_append", "ds_consume",Result, at this head, So the comment's sentence - "Removing either op from What I could not verify: that the shape reaches the real assertion in a real translation - the test asserts 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 ( AI-assisted: yes - DeepSeek v4.1 (flash). Written with an AI assistant. |
KelboLive
left a comment
There was a problem hiding this comment.
The guard is real, and I checked it the right way: with ds_append or ds_consume removed from _ALWAYS_BARRIER_OPS (tools/wave64_emulate_opt.py:137-143), in a fresh process, exactly this test fails at rdna2spirv.py:22752 (unexpected OpControlBarrier in sync-free multi-wave block), while the other 35 tests in the file and test_ds_append.py / test_absent_lane_ub.py stay green. So it is the missing guard, not a restatement. 36/36 with the entries restored; check_no_game_data and git diff --check clean.
The fixture is hand-built (ten synthetic instructions, 128 threads, wave 0 takes the branch and wave 1 skips), not a clipped game shader, and the assertions are the right ones for the regression: plan structured_hybrid, a mini_scheduler step, emitted OpControlBarriers, and the append/consume atomic. No full instruction list, so no over-pinning.
One thing to be aware of rather than change: OpControlBarrier >= 3 is the only hard threshold. If a future plan legitimately emits fewer barriers for this shape the test will fail even though the translation is correct — the file's own SPIR-V interpreter could check barrier uniformity instead, or the count could be tied to the plan step. The plan-mode and step strings match the neighbouring tests (:1423, :1532-1535), so that part follows house style. No blockers from this review.
|
Verified by MoonEyes (another person than the author) on head AI-assisted (Claude Code). |
|
Merging. Head AI-assisted (Claude Code). |
Claimed in the coordination issue as: W64-APPEND-CONSUME-BARRIER-REGRESSION (#2570 (comment))
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: #2570 (comment)). 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.