Skip to content

crosslane_fuzz: refuse a program or op count below 1 instead of running nothing - #1452

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
bobcatchris:fix/crosslane-fuzz-counts
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
bobcatchris:fix/crosslane-fuzz-counts

Conversation

@bobcatchris

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as a new FUZZ item: claim.

What and why

crosslane_fuzz.py was the last fuzzer still taking a bare type=int for its counts:

$ python -I tools/crosslane_fuzz.py --programs 0
summary:
$ echo $?
0

No program is generated, summary: is printed with no line under it, and the exit code is 0. That reads as a clean pass for the differential fuzzer of the cross-lane model, and the summary is the only place the count appears. --programs -1 behaves the same, and --ops 0 builds a program with no ops instead of refusing.

The other fuzzers already refuse below 1 — valu_fuzz.py and lds_fuzz.py (--programs/--max-report), salu_diff.py (--programs/--max-ops), f32_fuzz.py (--programs) and mem_diff.py (--programs/--max-ops) — so this closes the last gap from that sweep.

--programs and --ops now go through one ArgumentTypeError, so an invalid value is a single argparse line naming the option and the value, with exit 2, before anything is generated or the harness path is looked for. The --modes parser added in #638 is the same idea and this sits next to it. Defaults (100 / 24), the summary format and the exit codes (0 pass, 1 mismatch, 2 harness error, 77 no oracle tools) are unchanged.

Tested

CPU only, no GPU, no game data, no llvm-mc runs; Windows 11, CPython 3.12.13.

  • python -m pytest tests/test_crosslane_fuzz.py -q -> 35 passed, 1 skipped.
  • Direct: --programs 0, --programs -1, --programs -5, --ops 0 -> crosslane_fuzz.py: error: argument --programs: must be at least 1 (got 0) (and --ops likewise), exit 2, no stdout.
  • Unchanged: --programs 2 --ops 2 --self-test -> self-test OK, exit 0; --programs 1 --ops 1 --self-test likewise.
  • Negative control with only tools/crosslane_fuzz.py reverted to main (bb2e1842) and the new tests kept -> 3 failed, 32 passed, 1 skipped: exactly the three refusal tests fail; the pre-existing ones and the count-of-one test still pass.
  • python -m compileall -q tools tests -> clean.

Not covered: a real --programs 100 comparison run, which needs a Vulkan GPU (vk_compute_test on this machine returns the unwritten-buffer sentinel for every program whatever the op count, so the run path itself is unverified here).

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (N/A, tool CLI only.)

--programs 0, or any negative count, generated no program and still printed a
bare "summary:" with no lines and exit 0, which reads as a pass from a fuzzer
whose whole job is to fail loudly; --ops 0 built a program with no ops instead
of refusing. valu_fuzz, lds_fuzz, salu_diff, f32_fuzz and mem_diff already
refuse below 1, so this was the last fuzzer without the guard.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@kapitche

Copy link
Copy Markdown
Contributor

Tested on Linux (WSL2 Ubuntu), Python 3.12, CPU only: pass. Tests: 35 passed. With tools/crosslane_fuzz.py from main, 5 fail.

@bobcatchris

Copy link
Copy Markdown
Contributor Author

The check failure on this PR is not from this change.

@ItsNotRexed
ItsNotRexed merged commit 8cb875e into ItsNotRexed:main Nov 22, 2026
10 of 11 checks passed
@UlteriorMotive00

Copy link
Copy Markdown
Contributor

Tested a0b14cb (0 behind main) on Windows 11 Home 10.0.26300 (ANSI code page 1252), Python 3.14.7, pytest 9.2.0.

test file this PR with main's tools/crosslane_fuzz.py
test_crosslane_fuzz.py 35 passed, 1 skipped, 7 subtests 5 failed, 33 passed, 1 skipped

The new tests fail without the change, so they cover it.

AI-assisted (Claude Code). No game files.

bobcatchris added a commit to bobcatchris/Leonida that referenced this pull request Nov 22, 2026
`--wave 32 --modes emulate` and `--wave 64 --modes native` (without
`--w64-native`) each select no program that mode could run, so nothing ran,
`summary:` printed with no line under it, and the exit code was 0. That is the
same false pass ItsNotRexed#1452 fixed for a count below 1, reached through a flag
combination, so both become usage errors before anything is generated or the
harness is looked for.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants