WIP: wave64_emulate_opt: ds_append and ds_consume always barrier under --wave64-emulate #106

Closed
leonida/mandy
Andretuta wants to merge 0 commits from old-pr/9838 into main

Pull request closed

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

Andretuta commented 2026-11-24 02:19:03 +00:00

Carried over from old PR 9838 by tedin7 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9838, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
This branch conflicts with the current main and needs a rebase.
tedin7: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

@ItsNotRexed: an exe PR, as you asked.

What

ds_append and ds_consume join _ALWAYS_BARRIER_OPS in tools/wave64_emulate_opt.py, with a unit test on the classification (_insn_may_barrier and _classify_block_body).

Why

Under --wave64-emulate these two ops hand the LDS counter's old value to every lane through an exchange round, which emits OpControlBarrier. Without the entry, a block holding one can be classed sync-free in a 128+ thread group and make_game.py --stages shaders aborts with "unexpected OpControlBarrier in sync-free multi-wave block". @autogenes-sudo reported this on #7154 with the #3976 translator; an independent check with the same one-line fix is in the #3976 thread.
Honest scope: today's origin/main translator does not emit ds_append/ds_consume (#3976 was closed in the org migration), so this prepares the classification for when it lands; it does not change output on current main.

Tested

python3 -I tests/semantic/test_wave64_emulate_opt.py on origin/main 2d53a8055 + this commit: 31 tests OK. Negative control: without the one-line change the new test fails ("False is not true : ds_append"). Synthetic data only; no game files.

> Carried over from **old PR 9838** by `tedin7` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9838`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > This branch conflicts with the current `main` and needs a rebase. > `tedin7`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): `@ItsNotRexed`: an exe PR, as you asked. ## What `ds_append` and `ds_consume` join `_ALWAYS_BARRIER_OPS` in `tools/wave64_emulate_opt.py`, with a unit test on the classification (`_insn_may_barrier` and `_classify_block_body`). ## Why Under `--wave64-emulate` these two ops hand the LDS counter's old value to every lane through an exchange round, which emits `OpControlBarrier`. Without the entry, a block holding one can be classed sync-free in a 128+ thread group and `make_game.py --stages shaders` aborts with "unexpected OpControlBarrier in sync-free multi-wave block". `@autogenes-sudo` reported this on `#7154` with the `#3976` translator; an independent check with the same one-line fix is in the `#3976` thread. Honest scope: today's `origin/main` translator does not emit `ds_append`/`ds_consume` (`#3976` was closed in the org migration), so this prepares the classification for when it lands; it does not change output on current main. ## Tested `python3 -I tests/semantic/test_wave64_emulate_opt.py` on `origin/main` 2d53a8055 + this commit: 31 tests OK. Negative control: without the one-line change the new test fails ("False is not true : ds_append"). Synthetic data only; no game files.
Len1k commented 2026-11-24 09:05:18 +00:00

Ran this pull request's own tests, then put tools/wave64_emulate_opt.py back to the branch's base version (9ec34cdff) and ran them again — green both times, so the tests do not pin the change.

baseline (head sources, head tests)   tests/semantic/test_wave64_emulate_opt.py  rc=0  OK   (31 tests)
swapped tools/wave64_emulate_opt.py to its base version
mutation (base sources, head tests)   tests/semantic/test_wave64_emulate_opt.py  rc=0  OK   (31 tests)

This is not "already merged": head is 68,014 B, base is 67,935 B, current main is 68,965 B — three different files. So the source change is real and present, and the 31 tests simply do not observe the ds_append/ds_consume barrier under --wave64.

To make the test guard the fix, at least one case has to fail on the base source — e.g. translate a shader that uses ds_append with --wave64 and assert on the emitted barrier, not only that translation succeeds. Worth checking on review, because a reviewer reading 31 green tests will assume the behaviour is covered.

The change itself may be perfectly correct — I only measure whether the test would notice if it were gone.

AI-assisted. Standard library only, no game files, no GPU.

Ran this pull request's own tests, then put `tools/wave64_emulate_opt.py` back to the branch's base version (`9ec34cdff`) and ran them again — **green both times**, so the tests do not pin the change. ``` baseline (head sources, head tests) tests/semantic/test_wave64_emulate_opt.py rc=0 OK (31 tests) swapped tools/wave64_emulate_opt.py to its base version mutation (base sources, head tests) tests/semantic/test_wave64_emulate_opt.py rc=0 OK (31 tests) ``` This is not "already merged": head is 68,014 B, base is 67,935 B, current `main` is 68,965 B — three different files. So the source change is real and present, and the 31 tests simply do not observe the `ds_append`/`ds_consume` barrier under `--wave64`. To make the test guard the fix, at least one case has to fail on the base source — e.g. translate a shader that uses `ds_append` with `--wave64` and assert on the emitted barrier, not only that translation succeeds. Worth checking on review, because a reviewer reading 31 green tests will assume the behaviour is covered. The change itself may be perfectly correct — I only measure whether the test would notice if it were gone. *AI-assisted.* Standard library only, no game files, no GPU.
DadaCap commented 2026-11-28 10:33:40 +00:00

Thanks for the contribution! This PR was reviewed by the maintainers and is being closed as part of a large batch of closures.

Reason: superseded by main.

If this looks like a mistake, mention @DadaCap here at any time and it will be looked at again.

AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.

Thanks for the contribution! This PR was reviewed by the maintainers and is being closed as part of a large batch of closures. Reason: superseded by main. If this looks like a mistake, mention @DadaCap here at any time and it will be looked at again. AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.
Sign in to join this conversation.
No description provided.