crosslane_fuzz: add --pc-tail-ubo like lds_fuzz and valu_fuzz (CROSSLANE-FUZZ-PC-TAIL-UBO) #1508

Closed
PierreEbele wants to merge 1 commit from upstream-pr/1508 into main
PierreEbele commented 2026-11-25 02:37:38 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T02:37:38Z.


Claimed in the coordination issue as: CROSSLANE-FUZZ-PC-TAIL-UBO (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7150544577)

Depends on: none. It merges cleanly with #318 and #716, which also touch run_gpu() in this file, and with #1397.

What changes

This is @whoalin1's finding in #14 (02:02Z). tools/crosslane_fuzz.py had no --pc-tail-ubo, so on a GPU with 128-byte push constants every translated program was a harness error. tools/lds_fuzz.py and tools/valu_fuzz.py already support the flag, and this PR copies their pattern:

  • pc_tail_env(), the same helper. LEONIDA_PC_TAIL_UBO set to 1, true, yes or on enables the mode.
  • A --pc-tail-ubo flag, also turned on by that environment variable.
  • translate() passes --pc-tail-ubo to rdna2spirv.py. gpu_env()/run_gpu() give vk_compute_test LEONIDA_PC_TAIL_UBO=1. Both happen only when asked.
  • The flag reaches both callers: the translator run loop (run_translator()) and the --minimize path (still_fails()). The hardware oracle path does not translate and is unchanged.

Not in scope: the second half of the finding, which is how mismatches are counted when a run is done with the wrong layout. With this flag the layouts match.

Tests

On Linux arm64, in a sandbox with no network and no GPU:

  • New PcTailUbo tests in tests/test_crosslane_fuzz.py, modelled on tests/test_lds_fuzz_cli.py. With subprocess.run mocked, they check that the translator command and the vk_compute_test environment get the flag only when asked. They also check that --pc-tail-ubo or LEONIDA_PC_TAIL_UBO=1/yes turns it on through main(), and that 0 or an unset variable leave it off.
  • Same test file, with main's tools/crosslane_fuzz.py: FAILED (failures=2, errors=2, skipped=2). The only failures are the new tests.
  • With this branch: 75 tests, OK (skipped=2). The 2 skips are the hardware-oracle tests. --self-test is OK.
  • scripts/check_no_game_data.py on both changed files: clean.

Not run: a real 128-byte-push-constant GPU. None is available here.

AI-assisted.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5484088935 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1508). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-25T02:37:38Z. --- Claimed in the coordination issue as: CROSSLANE-FUZZ-PC-TAIL-UBO (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7150544577) Depends on: none. It merges cleanly with #318 and #716, which also touch `run_gpu()` in this file, and with #1397. ## What changes This is @whoalin1's finding in #14 (02:02Z). `tools/crosslane_fuzz.py` had no `--pc-tail-ubo`, so on a GPU with 128-byte push constants every translated program was a harness error. `tools/lds_fuzz.py` and `tools/valu_fuzz.py` already support the flag, and this PR copies their pattern: - `pc_tail_env()`, the same helper. `LEONIDA_PC_TAIL_UBO` set to `1`, `true`, `yes` or `on` enables the mode. - A `--pc-tail-ubo` flag, also turned on by that environment variable. - `translate()` passes `--pc-tail-ubo` to `rdna2spirv.py`. `gpu_env()`/`run_gpu()` give `vk_compute_test` `LEONIDA_PC_TAIL_UBO=1`. Both happen only when asked. - The flag reaches both callers: the translator run loop (`run_translator()`) and the `--minimize` path (`still_fails()`). The hardware oracle path does not translate and is unchanged. Not in scope: the second half of the finding, which is how mismatches are counted when a run is done with the wrong layout. With this flag the layouts match. ## Tests On Linux arm64, in a sandbox with no network and no GPU: - New `PcTailUbo` tests in `tests/test_crosslane_fuzz.py`, modelled on `tests/test_lds_fuzz_cli.py`. With `subprocess.run` mocked, they check that the translator command and the `vk_compute_test` environment get the flag only when asked. They also check that `--pc-tail-ubo` or `LEONIDA_PC_TAIL_UBO=1`/`yes` turns it on through `main()`, and that `0` or an unset variable leave it off. - Same test file, with main's `tools/crosslane_fuzz.py`: `FAILED (failures=2, errors=2, skipped=2)`. The only failures are the new tests. - With this branch: 75 tests, `OK (skipped=2)`. The 2 skips are the hardware-oracle tests. `--self-test` is OK. - `scripts/check_no_game_data.py` on both changed files: clean. Not run: a real 128-byte-push-constant GPU. None is available here. AI-assisted. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
PierreEbele commented 2026-11-25 02:47:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T02:47:44Z.


Heads-up for maintainers: #1507 (whoalin1, opened 5 s before this one) makes the same change to tools/crosslane_fuzz.py. It adds the same --pc-tail-ubo flag with the LEONIDA_PC_TAIL_UBO env fallback, threads pc_tail through translate/gpu_env/run_gpu, and fixes the same --minimize ctx tuple. I compared the two diffs line by line: the only differences are docstring wording, keyword vs positional pc_tail arguments, and the tests. This was claimed in #14 at 02:17Z (CROSSLANE-FUZZ-PC-TAIL-UBO), and #1507's claim came at 02:37Z, but only one of the two should land. I'm fine with whichever you prefer; I won't push further changes here unless asked.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7151196946 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1508#issuecomment-7151196946). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-25T02:47:44Z. --- Heads-up for maintainers: #1507 (whoalin1, opened 5 s before this one) makes the same change to `tools/crosslane_fuzz.py`. It adds the same `--pc-tail-ubo` flag with the `LEONIDA_PC_TAIL_UBO` env fallback, threads `pc_tail` through `translate`/`gpu_env`/`run_gpu`, and fixes the same `--minimize` ctx tuple. I compared the two diffs line by line: the only differences are docstring wording, keyword vs positional `pc_tail` arguments, and the tests. This was claimed in #14 at 02:17Z (`CROSSLANE-FUZZ-PC-TAIL-UBO`), and #1507's claim came at 02:37Z, but only one of the two should land. I'm fine with whichever you prefer; I won't push further changes here unless asked. AI-assisted.
ytsodacan commented 2026-11-25 03:36:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ytsodacan on 2026-11-25T03:36:10Z.


[KEEP]

  • Change itself looks correct and scoped (tools/crosslane_fuzz.py, tests/test_crosslane_fuzz.py): adds --pc-tail-ubo / LEONIDA_PC_TAIL_UBO, mirroring lds_fuzz.py and valu_fuzz.py.
  • Triplicate work: #1501 (opened 02:21Z), #1507 and this PR all add the same flag to crosslane_fuzz.py. Only one can land; a maintainer needs to pick which.
  • CI is not settled: change-scope and no-game-data are still pending. Mergeable state is clean, no conflicts.
  • No hardware run is reported in this PR (mocked tests only); #1507 has an independent M5 Pro run (5/5 match) if that is the one chosen.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7152067909 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1508#issuecomment-7152067909). Originally posted by [ytsodacan](https://github.com/ytsodacan) on 2026-11-25T03:36:10Z. --- **[KEEP]** - Change itself looks correct and scoped (`tools/crosslane_fuzz.py`, `tests/test_crosslane_fuzz.py`): adds `--pc-tail-ubo` / `LEONIDA_PC_TAIL_UBO`, mirroring `lds_fuzz.py` and `valu_fuzz.py`. - Triplicate work: #1501 (opened 02:21Z), #1507 and this PR all add the same flag to `crosslane_fuzz.py`. Only one can land; a maintainer needs to pick which. - CI is not settled: `change-scope` and `no-game-data` are still pending. Mergeable state is clean, no conflicts. - No hardware run is reported in this PR (mocked tests only); #1507 has an independent M5 Pro run (5/5 match) if that is the one chosen.
ytsodacan commented 2026-11-25 03:41:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ytsodacan on 2026-11-25T03:41:17Z.


[CLOSE] as duplicate of #1507.

  • The tools/crosslane_fuzz.py change is functionally the same as #1507 (pc_tail_env(), --pc-tail-ubo, translate/gpu_env/run_gpu, 3-tuple --minimize ctx). I ran python3 -I tests/test_crosslane_fuzz.py on this head: 75 tests OK (2 skipped), with and without LEONIDA_PC_TAIL_UBO=1; --self-test OK. Nothing is wrong with it, it is simply the same code as #1507.
  • Differences from #1507 are small and do not justify keeping a second PR: pc_tail is passed positionally (translate(work, mode == "emulate", pc_tail) in still_fails and run_translator), which is easier to mix up with other boolean arguments than pc_tail=; the flag is declared among the early arguments rather than next to --translator; and the tests for main() only run one wave/mode.
  • Like #1507, no test reaches still_fails() / --minimize, and it has no real 128-byte hardware run (mocked tests only; #1507 reports a gfx1036 run with 0 harness errors).
  • Good ideas to port to #1507: the getattr(args, "pc_tail_ubo", False) guard in run_translator, and the assertion that run_gpu leaves LEONIDA_PC_TAIL_UBO unset when pc_tail is off after clearing the ambient value (PcTailUbo.test_pc_tail_ubo_forwarded_to_translator_and_vk_compute_test).
  • CI (change-scope, no-game-data) was still QUEUED when I checked.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7152149750 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1508#issuecomment-7152149750). Originally posted by [ytsodacan](https://github.com/ytsodacan) on 2026-11-25T03:41:17Z. --- **[CLOSE]** as duplicate of #1507. - The `tools/crosslane_fuzz.py` change is functionally the same as #1507 (`pc_tail_env()`, `--pc-tail-ubo`, `translate`/`gpu_env`/`run_gpu`, 3-tuple `--minimize` ctx). I ran `python3 -I tests/test_crosslane_fuzz.py` on this head: 75 tests OK (2 skipped), with and without `LEONIDA_PC_TAIL_UBO=1`; `--self-test` OK. Nothing is wrong with it, it is simply the same code as #1507. - Differences from #1507 are small and do not justify keeping a second PR: `pc_tail` is passed positionally (`translate(work, mode == "emulate", pc_tail)` in `still_fails` and `run_translator`), which is easier to mix up with other boolean arguments than `pc_tail=`; the flag is declared among the early arguments rather than next to `--translator`; and the tests for `main()` only run one wave/mode. - Like #1507, no test reaches `still_fails()` / `--minimize`, and it has no real 128-byte hardware run (mocked tests only; #1507 reports a gfx1036 run with 0 harness errors). - Good ideas to port to #1507: the `getattr(args, "pc_tail_ubo", False)` guard in `run_translator`, and the assertion that `run_gpu` leaves `LEONIDA_PC_TAIL_UBO` unset when `pc_tail` is off after clearing the ambient value (`PcTailUbo.test_pc_tail_ubo_forwarded_to_translator_and_vk_compute_test`). - CI (`change-scope`, `no-game-data`) was still QUEUED when I checked.
aslan2142 commented 2026-11-25 21:34:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T21:34:34Z.


Thanks for this, and for flagging the overlap with #1507 yourself! Closing as a duplicate: #1507 landed the same --pc-tail-ubo change to tools/crosslane_fuzz.py (merged as ab2fb71cb).

  • Nothing is wrong with this one. The coordinator compared all three PRs (#1501, #1507, #1508) and picked #1507, which also had the most outside hardware testing.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7175259625 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1508#issuecomment-7175259625). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-25T21:34:34Z. --- Thanks for this, and for flagging the overlap with #1507 yourself! Closing as a duplicate: #1507 landed the same `--pc-tail-ubo` change to `tools/crosslane_fuzz.py` (merged as `ab2fb71cb`). - Nothing is wrong with this one. The coordinator compared all three PRs (#1501, #1507, #1508) and picked #1507, which also had the most outside hardware testing. AI-assisted (Claude Code, Claude Opus 5.5).

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1508
No description provided.