Scripts: harden gen_tiling CLI argument handling and output option #1577
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1587"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by heditrigui on 2026-11-24T17:59:40Z.
Harden
scripts/gen_tiling.pyCLI argument parsing, modularity, and output path configuration:Tested
Not tested
AI use
Antigravity (Gemini 3.8 Flash (High)) designed the CLI argument handling and optional output destination, implemented unit tests in scripts/test_gen_tiling.py, ran the test suite, and verified PR conventions.
Imported from ivall/xcl. Originally posted by pickles976 on 2026-11-24T18:19:44Z.
Approve — with one thing called out because hardening passes usually break it silently: the AMD/MIT attribution header survives the rewrite (
out.write("// Generated by … Copyright (C) 2007-2026 Advanced Micro Devices, Inc., MIT.")) and is now pinned by a test (assertIn("// Generated by scripts/gen_tiling.py from AMD addrlib", content)). MIT is permissive but the notice-retention clause is the one condition, and generators dropping it are a classic drive-by; a regression test around a comment line in generated output is the correct immune response. Other checks clean: docstring-usage on-h, default output path still pinned to the in-treetiling_tables.rs(test confirms), noshell=True/os.systemintroduced, parse errors on malformed header lines still fail loudly rather than emitting silently-wrong tiling tables — which matters, because a wrong swizzle table is silent VRAM corruption on RADV paths, not a crash. LGTM from the license/build-script lane (same lens as the Cargo-profile audit posted on the sibling).Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T18:34:33Z.
Tested exact head
dd9639f, script tests only, since this PR has no test report yet.Tested
python -m pytest -q scripts/test_gen_tiling.pyat the head: 11 passed, 2 subtests passed.gen_tiling.py(9e3831e): collection error. Main's script does its work at import (io.open(sys.argv[1])on line 9, no__main__guard), so under pytest it tries to open-q(FileNotFoundError). The test does not get to run on main; it needs the PR's restructured script.Not tested
AI use
Imported from ivall/xcl. Originally posted by RobertAndreiGit on 2026-11-24T19:12:29Z.
Tested: On head
dd9639f6ea18f606b0c819794042bc74731b70b2, the generator still silently accepts one malformed table. Starting withmake_synthetic_header()from the PR’s tests, replace the first{ 0, 0, 0, 0, 0 },withnot_a_pattern_row,. Runningpython3 -B scripts/gen_tiling.py bad.h bad.rsexited 0 and wrote(1, &[])for that mode. By contrast, shortening the braced row to three entries exited 1 and named the table. The unbraced case would make a useful regression fixture.For the unchanged synthetic header (all 14 2D and 6 3D modes),
python3 -B scripts/gen_tiling.py valid.hproduced byte-identical default output on base9e3831e1f570d3646e53ab753b19ec07eb8f1485and head:cmpexited 0, 2,398 bytes each. On head,python3 -B -m unittest discover -s scripts -p 'test_*.py' -v: 27 passed, none failed or skipped. Apple M3 Pro, macOS 15.7.3 arm64, Python 3.14.7.Not tested: Full Mesa header regeneration, Windows runtime, or GPU.
AI use: OpenCode (GPT-6.2 Astra) ran the tests and wrote this report.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T20:02:56Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by RavenCurseBurg on 2026-11-25T15:35:55Z.
I’ll retest the unbraced table-row case reported here and check that malformed input leaves an existing output file intact. If it still generates an empty mode, I’ll prepare a focused fix and regression test. Testing
dd9639f6eawith OpenAI Codex (GPT-6).Imported from ivall/xcl. Originally posted by RavenCurseBurg on 2026-11-25T15:51:51Z.
Reproduced @RobertAndreiGit’s missing-row report on
dd9639f6ea18f606b0c819794042bc74731b70b2withpython -B scripts/gen_tiling.py <header> <existing-output>. An unbraced initializer, both as the only row and between two valid rows, returned 0 and overwrote the destination. A valid row followed by a C++ comment containing braces failed. The 11 existing generator tests passed on this head.Fix and regression tests. Both malformed cases now exit 1, name the affected table and leave the previous output bytes intact. A valid row with braces in a comment now succeeds. The two malformed subcases and the comment case failed on the original implementation. With the fix,
python -B -m unittest discover -s scripts -p "test_*.py"passed all 29 tests.I also ran the original and fixed generators against the same public AMD PAL addrlib header. Both generated 14 2D and 6 3D modes, with identical Rust output (SHA-256
f8d82935aa137953768a6e058100a78d7dcc51c43fcb0a58534161d329d4dc60).Windows 11 26100.9711, i7-13700, RTX 4060, Python 3.14.3. No Rust/GPU suite, retail assets or Mesa build. OpenAI Codex (GPT-6) ran the checks, prepared the patch and wrote this report.
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T20:43:05Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:11:58Z.
Triage (#1607) – head
dd9639fNo other PR makes this change. #2661 (C integer spellings in
value), #2685 (comments and spaced terminators intable) and #43 (MSAA modes) change other parts of scripts/gen_tiling.py, so they will conflict with this one.Most of the diff is a whole-file switch from single to double quotes and one-per-line imports; CONTRIBUTING.md asks for no drive-by reformatting, and it makes those conflicts larger. The generated output looks unchanged (same header, tables and order).
main(argv=None, dst=None)accepting a bare string asargvis unused by the CLI and the tests; it can go.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.