Repository navigation
tests/semantic: run structured wave64 emulation in the loop/ballot tests - #4677
YaBulochka wants to merge 1 commit into
Conversation
Two failures on main were test drift, not translator bugs. test_loop_ballot_barrier's private interpreter only knew %main and discarded helper functions, so it raised NotImplementedError on the OpFunctionCall that the structured emulation plan (ItsNotRexed#884) outlines for cross-lane helpers. _parse_spv now collects every function and inlines single-block helpers at their call sites, which is exactly the invocation's sequential stream. The divergent-loop test also accepts "emulated wave64 structured" next to "emulated wave64 rounds": both shapes are checked by the same per-lane oracle, and tests/test_translate already treats them as interchangeable. The structured output was verified against the native results before relaxing the assertion. test_mutations' v_mul_legacy_f32 anchor still quoted the pre-c82fbe37 body, which now flushes operands and the product, so the exact-once guard rejected every run. The anchor follows the current body and the mutation still drops only the zero-times-anything select; test_ps_legacy_mul catches it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
e9ae400 to
a5fdd5c
Compare
|
Tested What I ran:
Code review:
|
Kam471
left a comment
There was a problem hiding this comment.
Ran this at a5fdd5c4c on Windows 11: tests/semantic/test_loop_ballot_barrier.py -> 15 tests, OK; git diff --check clean.
The loop/ballot cases now run both the round-based and the structured wave64 emulation, with the same expected words/barrier checks for each; the added helper keeps the uniform-barrier assertion. Test-only, no product change. No blocking issue.
|
Tested
No game files. AI-assisted (Devin). |
|
Verified on Linux: cherry-picked onto plain current main the file now runs 15/15 under python -I (re-run here) — and that matters, because main's own copy of test_loop_ballot_barrier currently fails 3 + errors 2 now that the structured plan emits "emulated wave64 structured"; this fixes real redness on main. The OpFunctionCall inlining is a no-op for the rounds output so both emulation shapes stay covered; wave64_halves (101) and wave64_emulate_opt (22) and the translator-use guard pass. Heads-up: #4727 and #4152 touch the same test/file area — worth coordinating which lands. The head rides an integration branch but the commit stands on its own. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). Correction (2026-11-23): the rebase/integration-stack note above was wrong — our verifier tracked a stale main ref. Those base commits are current main; this head contains main and merge-trees cleanly against de67135. No rebase needed; the tests-pass verdict stands unchanged. See the correction note on #4421. |
|
Tested
|
The seven failures a full
tests/semanticrun reports ond0835dd9are all in the tests, not in the translator: 5 intest_loop_ballot_barrier.pyand 2 intest_mutations.py. This fixes both files.test_loop_ballot_barrier.pygen.control_flow == "emulated wave64 rounds", but the structured inline/hybrid plan from RTX 4080 / NVIDIA 621.01: the corpus's two largest compute pipelines fail to compile (NVVM), a few take 8-16 GB and up to 26 min, and --jobs 14 crashed the driver #884 (4d9ef4eb) is what the translator now picks for those programs, so it reports"emulated wave64 structured". The translator is correct: the same emulated modules (40/64/128 threads) run throughtest_wave64_emulate_opt.run_emulated_workgroupwith 0 wrong lanes and 21/21/22 barriers. The assert now accepts either emulation mode, and the per-lane memory checks below it are unchanged.NotImplementedError: Unsupported SPIR-V op OpFunctionCall: the structured plan moves the cross-lane helpers into functions, and the test's private_parse_spvkept only%main. It now collects every function and inlines single-block helpers at the call site (renaming result ids, substituting parameters, with explicit errors on anOpVariablein a helper and on depth > 16), so the tests really exercise bothinline_allandstructured_hybrid.test_mutations.pyThe
v_mul_legacy_f32anchor went stale whenc82fbe37changed that body (operand/product flushing). The exact-once guard did its job; the anchor is updated to the current body, and the mutation still removes only the zero-times-anythingOpSelect, whichtest_ps_legacy_mulcatches.Results
test_wave64_*,test_ps_semantics,tests/test_translate.py,tests/test_fssm_wave_size.py: 759 passed, 4 skipped, 207 subtests;tests/semantic(7,456 tests): 95% with no failures before a timeout, and the tail (test_valu_subrev_f16onward) run separately: 464 passed, 3,666 subtests.Two other asserts that still say
"emulated wave64 rounds"(test_uniform_loop_barrier_wave64_emulateand the divergent-barrier one) are deliberately untouched: programs withs_barriergetemulate_plan is None, and those tests are about rounds/x_scheduler. No translator change.