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

Closed
github-bot wants to merge 1 commit from gh-pr/1508/head into gh-pr/1508/base
Owner

@⁠PierreEbele on GitHub · 2026-11-25 02:37 UTC · original
PierreEbele:crosslane-fuzz-pc-tail-ubo → main · +106 −16 · 2 files · 1 commits · closed without merging

Claimed in the coordination issue as: CROSSLANE-FUZZ-PC-TAIL-UBO (#14)

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

**@⁠PierreEbele** on GitHub · 2026-11-25 02:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1508) `PierreEbele:crosslane-fuzz-pc-tail-ubo` → `main` · +106 −16 · 2 files · 1 commits · closed without merging Claimed in the coordination issue as: CROSSLANE-FUZZ-PC-TAIL-UBO (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) 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)
crosslane_fuzz.py gets a pc_tail_env() helper (LEONIDA_PC_TAIL_UBO in 1/true/yes/on) and a --pc-tail-ubo flag.
The flag is threaded through translate(), gpu_env(), run_gpu(), run_translator() and the --minimize path
(still_fails()). rdna2spirv.py gets --pc-tail-ubo, and vk_compute_test gets LEONIDA_PC_TAIL_UBO=1, only when the
flag or the environment variable asks for it. Without it, every translated program is a harness error on a GPU
with 128-byte push constants.

The tests mirror tests/test_lds_fuzz_cli.py. The existing fakes in tests/test_crosslane_fuzz.py take the new
pc_tail argument.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:54:42 +00:00
github-bot closed this pull request 2026-11-26 09:54:42 +00:00
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-25 02:47 UTC · original

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.

**@⁠PierreEbele** on GitHub · 2026-11-25 02:47 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1508#issuecomment-7151196946) 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.
Author
Owner

@⁠ytsodacan on GitHub · 2026-11-25 03:36 UTC · original · edited 2026-11-25 03:44 UTC

[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** on GitHub · 2026-11-25 03:36 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1508#issuecomment-7152067909) · edited 2026-11-25 03:44 UTC **[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.
Author
Owner

@⁠ytsodacan on GitHub · 2026-11-25 03:41 UTC · original · edited 2026-11-25 03:44 UTC

[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.
**@⁠ytsodacan** on GitHub · 2026-11-25 03:41 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1508#issuecomment-7152149750) · edited 2026-11-25 03:44 UTC **[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.
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-25 21:34 UTC · original

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).

**@⁠aslan2142** on GitHub · 2026-11-25 21:34 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1508#issuecomment-7175259625) 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

This discussion has been locked. Commenting is limited to contributors.
No description provided.