Scripts: parse C integer spellings in tiling masks #2651

Open
luckyteagirl wants to merge 1 commit from upstream-pr/2661 into main
luckyteagirl commented 2026-11-26 05:23:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T05:23:11Z.


gen_tiling.py parses swizzle mask constants from a C header but rejects valid C integer spellings such as octal 010 and uppercase hexadecimal 0X10. Parse those tokens with C-style bases so regeneration does not fail when a header uses them.

What is in it

  • Accept ASCII decimal, leading-zero octal, and either case of the 0x hexadecimal prefix in swizzle values.
  • Add a synthetic header CLI fixture that checks the generated Rust mask values, including XOR with a named symbol.

Tested

  • On current main b49be183, the octal and uppercase-hex fixtures each failed; both pass with this patch. Full Python script discovery passed 26/26 on Windows.
  • An independent check with the current Mesa gfx10SwizzlePattern.h produced identical 48,204-byte output on main and this branch, matching the checked-in tiling_tables.rs byte for byte. No generated source changed.
  • git diff --check and independent source review passed. PR #1587 edits the same generator and test file for other behavior and may require a mechanical rebase.

Regression run

  • Not applicable. Only the Python generator and its test changed.

Not tested

  • A header that actually uses these alternate spellings, Rust workspace tests, GPU tests, or retail title smoke. The new fixture is synthetic.

AI use

  • Codex (GPT-6.2 Sol) implemented and tested the change; another Codex Sol agent independently checked the patch and Mesa output.
<!-- greyfinch-sync:ivall/xcl:issue:5504507832 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2661). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T05:23:11Z. --- `gen_tiling.py` parses swizzle mask constants from a C header but rejects valid C integer spellings such as octal `010` and uppercase hexadecimal `0X10`. Parse those tokens with C-style bases so regeneration does not fail when a header uses them. **What is in it** - Accept ASCII decimal, leading-zero octal, and either case of the `0x` hexadecimal prefix in swizzle values. - Add a synthetic header CLI fixture that checks the generated Rust mask values, including XOR with a named symbol. **Tested** - On current main `b49be183`, the octal and uppercase-hex fixtures each failed; both pass with this patch. Full Python script discovery passed 26/26 on Windows. - An independent check with the current Mesa `gfx10SwizzlePattern.h` produced identical 48,204-byte output on main and this branch, matching the checked-in `tiling_tables.rs` byte for byte. No generated source changed. - `git diff --check` and independent source review passed. PR #1587 edits the same generator and test file for other behavior and may require a mechanical rebase. **Regression run** - Not applicable. Only the Python generator and its test changed. **Not tested** - A header that actually uses these alternate spellings, Rust workspace tests, GPU tests, or retail title smoke. The new fixture is synthetic. **AI use** - Codex (GPT-6.2 Sol) implemented and tested the change; another Codex Sol agent independently checked the patch and Mesa output.
github-actions[bot] commented 2026-12-01 02:32:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-12-01T02:32:41Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7298730351 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2661#issuecomment-7298730351). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-12-01T02:32:41Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 08:37:02 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:37:02Z.


Triage (#1607) – head d002e93

No open PR changes integer parsing in gen_tiling.py value. #2685 changes comment stripping and table matching; the lines shared with it are the test's mode list and fixture setup. #1587 only requotes the same line.
On main, int('010', 0) raises and 0X10 is rejected; the new code reads leading-zero literals as C octal and accepts 0X prefixes, and the test checks 010, 0X10, 16 and X0 ^ 010. No problems found in the diff.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7305555371 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2661#issuecomment-7305555371). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T08:37:02Z. --- **Triage (#1607)** – head d002e93 No open PR changes integer parsing in gen_tiling.py `value`. #2685 changes comment stripping and table matching; the lines shared with it are the test's mode list and fixture setup. #1587 only requotes the same line. On main, `int('010', 0)` raises and `0X10` is rejected; the new code reads leading-zero literals as C octal and accepts `0X` prefixes, and the test checks 010, 0X10, 16 and `X0 ^ 010`. No problems found in the diff. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Decodere commented 2026-12-02 09:05:37 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-12-02T09:05:37Z.


merge-check
base: 1c8b551475
head: d002e93325
merge: clean (git merge --no-edit onto 1c8b5514, git diff --check clean; scripts/gen_tiling.py and scripts/test_gen_tiling.py, +46/-2)
build: not run (Tier 0 Python generator diff; no Rust code changed)
tests: python -m unittest discover -s scripts -p "test_gen_tiling.py" -v -> 1 passed, 0 failed (new test file); python -m unittest discover -s scripts -p "test_*.py" -> 66 passed, 1 error (test_discord_mirror.py on Windows, same failure on base 1c8b5514). Rust workspace tests not run (Tier 0).
review: Read the full diff (+46/-2). Parses uppercase 0X hex prefixes with base 16 and leading-zero ASCII digit literals as C octal (int(part, 8 if part.startswith('0') else 10)) in value() (scripts/gen_tiling.py:32-35), fixing ValueError on C octal masks like 010 and 0X10 while keeping 0 = 0 and rejecting invalid octal digits. The new test verifies 010, 0X10, 16, 0x20, 0, and X0 ^ 010 end-to-end. No problems found.
performance: none (offline table generator in scripts/; zero runtime impact)
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 4060 8 GB (driver 621.40), Intel Core i5-11400F, 32 GB RAM, Windows 11 Build 26200, Python 3.15.2, Rust 1.100.1 MSVC, DXC 1.9.2602.17 / Antigravity (Gemini 4 Neon)

<!-- greyfinch-sync:ivall/xcl:comment:7340364990 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2661#issuecomment-7340364990). Originally posted by [Decodere](https://github.com/Decodere) on 2026-12-02T09:05:37Z. --- merge-check base: 1c8b551475e1e7bfe48f94448492a4c3544a2e0f head: d002e93325456cd74aff9d07efc30757bf4325da merge: clean (`git merge --no-edit` onto `1c8b5514`, `git diff --check` clean; `scripts/gen_tiling.py` and `scripts/test_gen_tiling.py`, +46/-2) build: not run (Tier 0 Python generator diff; no Rust code changed) tests: `python -m unittest discover -s scripts -p "test_gen_tiling.py" -v` -> 1 passed, 0 failed (new test file); `python -m unittest discover -s scripts -p "test_*.py"` -> 66 passed, 1 error (`test_discord_mirror.py` on Windows, same failure on base `1c8b5514`). Rust workspace tests not run (Tier 0). review: Read the full diff (+46/-2). Parses uppercase `0X` hex prefixes with base 16 and leading-zero ASCII digit literals as C octal (`int(part, 8 if part.startswith('0') else 10)`) in `value()` (`scripts/gen_tiling.py:32-35`), fixing `ValueError` on C octal masks like `010` and `0X10` while keeping `0` = `0` and rejecting invalid octal digits. The new test verifies `010`, `0X10`, `16`, `0x20`, `0`, and `X0 ^ 010` end-to-end. No problems found. performance: none (offline table generator in `scripts/`; zero runtime impact) verdict: safe to merge hardware / tool and model: NVIDIA GeForce RTX 4060 8 GB (driver 621.40), Intel Core i5-11400F, 32 GB RAM, Windows 11 Build 26200, Python 3.15.2, Rust 1.100.1 MSVC, DXC 1.9.2602.17 / Antigravity (Gemini 4 Neon)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2661:upstream-pr/2661'
git switch 'upstream-pr/2661'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/2661'
git switch 'upstream-pr/2661'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2661'
git switch 'upstream-pr/2661'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2661'
git switch 'main'
git merge --squash 'upstream-pr/2661'
git switch 'main'
git merge --ff-only 'upstream-pr/2661'
git switch 'main'
git merge 'upstream-pr/2661'
git push origin 'main'
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
xcl-dev/xcl!2651
No description provided.