Ignore whitespace in RDNA2 instruction flags #2664

Merged
luckyteagirl merged 1 commit from upstream-pr/2674 into main 2026-12-03 02:26:19 +00:00
luckyteagirl commented 2026-11-26 05:46:30 +00:00 (Migrated from github.com)

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


gen_rdna2.py dropped an instruction flag when its XML text contained surrounding whitespace. Trim the text before matching TRUE so reformatting the XML preserves instruction flags.

What is in it

  • Trim XML instruction flags before the existing case-insensitive comparison.
  • Add a synthetic generator test that compares the complete Rust output for compact and padded flags.

Tested

  • Main b49be183 generated flags 2 for the padded fixture and 11 for the compact fixture. The patched generator emits identical output for both.
  • python -B -m unittest discover -s scripts -p 'test_*.py': 26 passed, 0 failed, 0 skipped on Windows with Python 3.11.
  • The synthetic fixture uses AMD's AMD RDNA 2 architecture name; the focused fixture also passes with the input guard from open PR #2612.
  • Generated 42 encodings and 1,153 instructions from AMD's current RDNA 2 XML with both generators. The Rust outputs were byte-identical (SHA-256 910af8ceac019cf8e68355df222b1ec70dee1dfac4cf69fdb6f116026dafff42). AMD GPUOpen XML distribution
  • git diff --check passed.

Regression run

  • Not applicable. The change affects only the generator and its test. The current AMD XML produced identical generated Rust.

Not tested

  • Rust or GPU tests, or a retail title run.

AI use

  • Codex (GPT-6.2 Sol) implemented the change and test, verified it against main and AMD's XML, and drafted this description.
<!-- greyfinch-sync:ivall/xcl:issue:5504741812 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2674). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T05:46:30Z. --- `gen_rdna2.py` dropped an instruction flag when its XML text contained surrounding whitespace. Trim the text before matching `TRUE` so reformatting the XML preserves instruction flags. **What is in it** - Trim XML instruction flags before the existing case-insensitive comparison. - Add a synthetic generator test that compares the complete Rust output for compact and padded flags. **Tested** - Main `b49be183` generated flags `2` for the padded fixture and `11` for the compact fixture. The patched generator emits identical output for both. - `python -B -m unittest discover -s scripts -p 'test_*.py'`: 26 passed, 0 failed, 0 skipped on Windows with Python 3.11. - The synthetic fixture uses AMD's `AMD RDNA 2` architecture name; the focused fixture also passes with the input guard from open PR #2612. - Generated 42 encodings and 1,153 instructions from AMD's current RDNA 2 XML with both generators. The Rust outputs were byte-identical (SHA-256 `910af8ceac019cf8e68355df222b1ec70dee1dfac4cf69fdb6f116026dafff42`). [AMD GPUOpen XML distribution](https://gpuopen.com/machine-readable-isa/) - `git diff --check` passed. **Regression run** - Not applicable. The change affects only the generator and its test. The current AMD XML produced identical generated Rust. **Not tested** - Rust or GPU tests, or a retail title run. **AI use** - Codex (GPT-6.2 Sol) implemented the change and test, verified it against main and AMD's XML, and drafted this description.
RavenCurseBurg commented 2026-11-26 10:06:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by RavenCurseBurg on 2026-11-26T09:45:49Z.


All 32 possible combinations of the five instruction flags produced the expected integer (0 through 31) on 72e160e05d343783f97836f627b154aa3e03b12f. I used one XML instruction per mask and compared the entire Rust file across compact mixed-case flags, padded UTF-8 and padded UTF-16. Main b49be1836844 produced zero for every padded mask. Combining this head with #2612 at 5efcf08de944 kept all 32 masks and rejected an RDNA 3 input before writing over the output.

The regression test runs through the generator CLI. python -B -m unittest discover -s scripts -p "test_*.py" passed all 27 tests with it added. Windows build 26100, Core i7-13700, Python 3.14.3. OpenAI Codex (GPT-6) wrote and ran the synthetic tests. I did not regenerate the full AMD specification or run GPU workloads.

<!-- greyfinch-sync:ivall/xcl:comment:7188437186 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2674#issuecomment-7188437186). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-26T09:45:49Z. --- All 32 possible combinations of the five instruction flags produced the expected integer (0 through 31) on `72e160e05d343783f97836f627b154aa3e03b12f`. I used one XML instruction per mask and compared the entire Rust file across compact mixed-case flags, padded UTF-8 and padded UTF-16. Main `b49be1836844` produced zero for every padded mask. Combining this head with #2612 at `5efcf08de944` kept all 32 masks and rejected an RDNA 3 input before writing over the output. The [regression test](https://github.com/RavenCurseBurg/xcl/commit/cea1229d28c2c5700567d0e0d175fcba6fe9bb4a) runs through the generator CLI. `python -B -m unittest discover -s scripts -p "test_*.py"` passed all 27 tests with it added. Windows build 26100, Core i7-13700, Python 3.14.3. OpenAI Codex (GPT-6) wrote and ran the synthetic tests. I did not regenerate the full AMD specification or run GPU workloads.
github-actions[bot] commented 2026-12-01 02:33:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-12-01T02:33: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:7298748261 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2674#issuecomment-7298748261). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-12-01T02:33: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:39:26 +00:00 (Migrated from github.com)

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


Triage (#1607) – head 72e160e

No open or merged PR makes the same change. #1504 and #2612 also edit scripts/gen_rdna2.py, but both keep (fl.findtext(tag) or "FALSE").upper() without .strip(). The synthetic spec is valid for the generator, and the expected flags: 11 matches bits 0, 1 and 3.
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:7305606904 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2674#issuecomment-7305606904). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T08:39:26Z. --- **Triage (#1607)** – head 72e160e No open or merged PR makes the same change. #1504 and #2612 also edit `scripts/gen_rdna2.py`, but both keep `(fl.findtext(tag) or "FALSE").upper()` without `.strip()`. The synthetic spec is valid for the generator, and the expected `flags: 11` matches bits 0, 1 and 3. 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:01:19 +00:00 (Migrated from github.com)

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


merge-check
base: 1c8b551475
head: 72e160e05d
merge: clean (git merge --no-edit onto 1c8b5514, git diff --check clean; scripts/gen_rdna2.py and scripts/test_rdna2_instruction_flags.py, +52/-1)
build: not run (Tier 0 Python generator script diff; no Rust code changed)
tests: python -m unittest -v scripts/test_rdna2_instruction_flags.py -> 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 (+52/-1). Adding .strip() before .upper() == "TRUE" in scripts/gen_rdna2.py:65 prevents XML whitespace inside InstructionFlags elements from silently zeroing instruction flag bits. The synthetic XML test confirms byte-identical output (flags: 11 for bits 0, 1, 3) with whitespace-padded mixed-case tags. 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:7340254320 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2674#issuecomment-7340254320). Originally posted by [Decodere](https://github.com/Decodere) on 2026-12-02T09:01:19Z. --- merge-check base: 1c8b551475e1e7bfe48f94448492a4c3544a2e0f head: 72e160e05d343783f97836f627b154aa3e03b12f merge: clean (`git merge --no-edit` onto `1c8b5514`, `git diff --check` clean; `scripts/gen_rdna2.py` and `scripts/test_rdna2_instruction_flags.py`, +52/-1) build: not run (Tier 0 Python generator script diff; no Rust code changed) tests: `python -m unittest -v scripts/test_rdna2_instruction_flags.py` -> 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 (+52/-1). Adding `.strip()` before `.upper() == "TRUE"` in `scripts/gen_rdna2.py:65` prevents XML whitespace inside `InstructionFlags` elements from silently zeroing instruction flag bits. The synthetic XML test confirms byte-identical output (`flags: 11` for bits 0, 1, 3) with whitespace-padded mixed-case tags. 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)
stijn-boer commented 2026-12-02 18:32:06 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by stijn-boer on 2026-12-02T18:32:06Z.


merge-check
base: c53e969602
head: 72e160e05d
verdict: safe to merge

Windows — RDNA2 instruction-flag generator check on 72e160e

Clean merge onto main (merge commit 8589121788caf08509f8504b95cc23e1dd48923a). git diff --check was clean.

Setup

Windows 10 21H2 build 19044.6332. This Tier 0 check exercises the generator with synthetic XML.

Tested

python scripts/test_rdna2_instruction_flags.py — 1 passed, 0 failed, 0 skipped. The test verifies byte-identical Rust output for compact and whitespace-padded flag values, with flags: 11 on the synthetic branch instruction.

Diff review

Read the full diff. The generator strips surrounding whitespace before case normalization, and the synthetic fixture checks the emitted flag word. The diff changes only the generator and its test.

Not tested

A production ISA regeneration, the Rust suite, GPU execution, and retail smoke. The targeted check covers this script-only diff.

AI use

Codex (GPT-6) merged the PR, reviewed the diff, ran the script test, and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7354749012 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2674#issuecomment-7354749012). Originally posted by [stijn-boer](https://github.com/stijn-boer) on 2026-12-02T18:32:06Z. --- merge-check base: c53e96960265a82477a9c98677afb0402e98d486 head: 72e160e05d343783f97836f627b154aa3e03b12f verdict: safe to merge **Windows — RDNA2 instruction-flag generator check on `72e160e`** Clean merge onto `main` (merge commit `8589121788caf08509f8504b95cc23e1dd48923a`). `git diff --check` was clean. **Setup** Windows 10 21H2 build 19044.6332. This Tier 0 check exercises the generator with synthetic XML. **Tested** `python scripts/test_rdna2_instruction_flags.py` — 1 passed, 0 failed, 0 skipped. The test verifies byte-identical Rust output for compact and whitespace-padded flag values, with `flags: 11` on the synthetic branch instruction. **Diff review** Read the full diff. The generator strips surrounding whitespace before case normalization, and the synthetic fixture checks the emitted flag word. The diff changes only the generator and its test. **Not tested** A production ISA regeneration, the Rust suite, GPU execution, and retail smoke. The targeted check covers this script-only diff. **AI use** Codex (GPT-6) merged the PR, reviewed the diff, ran the script test, and drafted this report.
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!2664
No description provided.