tooling: skip BOM and commented labels in scan_unsupported_shaders assembly parsing #1979

Merged
RenzoWit35 merged 1 commit from upstream-pr/1986 into main 2026-11-24 22:45:55 +00:00
RenzoWit35 commented 2026-11-24 22:36:53 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RenzoWit35 on 2026-11-24T22:36:53Z.


Change

parse_assembly_file in tools/scan_unsupported_shaders.py returned non-instruction text as instructions, which skews the support percentage and the missing-opcode ranking.

  • It opened the file as utf-8, so a UTF-8 BOM (written by Windows PowerShell 5 > / Out-File -Encoding utf8) stayed on the first line. A file EF BB BF + s_endpgm parsed to ['\ufeffs_endpgm'], reported as an unrecognized opcode (0% supported). It now opens with utf-8-sig (errors="replace" kept).
  • The label filter missed LLVM/llc-style labels with a trailing comment (pixel: ; @pixel, .LBB0_1: ; %bb.1), which were counted as opcodes pixel: / .LBB0_1:. The filter now strips the comment first, using the same rule as extract_opcode (//, ;, #), and skips the line if the remaining code is a bare label. Real instructions are still appended unchanged, so s_endpgm ; done: is kept.

Verification

Environment: Windows 11, Python 3.14.5.

  • python -B tests/rdna2_tools_check.py: after the change Ran 153 tests ... OK (skipped=19), new test included; the new test is test_parse_assembly_file_skips_bom_and_commented_labels, next to the existing scan test with the bare pixel: label.
  • Negative control: with tools/scan_unsupported_shaders.py restored to origin/main, the file gives FAILED (failures=1, skipped=19), first mismatch ['\ufeffs_endpgm'] vs ['s_endpgm'].

Not run: other test files, Linux/macOS.

Evidence and follow-up

Rebased on current main. Open PRs #1923, #1680, #1670, #1644, #1612, #1584, #1466, #713 and #528 touch this file's opcode tables; gh pr diff greps show none touches parse_assembly_file. No issue is linked.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6592799674 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1986). Originally posted by [RenzoWit35](https://github.com/RenzoWit35) on 2026-11-24T22:36:53Z. --- ## Change `parse_assembly_file` in `tools/scan_unsupported_shaders.py` returned non-instruction text as instructions, which skews the support percentage and the missing-opcode ranking. - It opened the file as `utf-8`, so a UTF-8 BOM (written by Windows PowerShell 5 `>` / `Out-File -Encoding utf8`) stayed on the first line. A file `EF BB BF` + `s_endpgm` parsed to `['\ufeffs_endpgm']`, reported as an unrecognized opcode (0% supported). It now opens with `utf-8-sig` (`errors="replace"` kept). - The label filter missed LLVM/llc-style labels with a trailing comment (`pixel: ; @pixel`, `.LBB0_1: ; %bb.1`), which were counted as opcodes `pixel:` / `.LBB0_1:`. The filter now strips the comment first, using the same rule as `extract_opcode` (`//`, `;`, `#`), and skips the line if the remaining code is a bare label. Real instructions are still appended unchanged, so `s_endpgm ; done:` is kept. ## Verification Environment: Windows 11, Python 3.14.5. - `python -B tests/rdna2_tools_check.py`: after the change `Ran 153 tests ... OK (skipped=19)`, new test included; the new test is `test_parse_assembly_file_skips_bom_and_commented_labels`, next to the existing scan test with the bare `pixel:` label. - Negative control: with `tools/scan_unsupported_shaders.py` restored to `origin/main`, the file gives `FAILED (failures=1, skipped=19)`, first mismatch `['\ufeffs_endpgm']` vs `['s_endpgm']`. Not run: other test files, Linux/macOS. ## Evidence and follow-up Rebased on current `main`. Open PRs #1923, #1680, #1670, #1644, #1612, #1584, #1466, #713 and #528 touch this file's opcode tables; `gh pr diff` greps show none touches `parse_assembly_file`. No issue is linked. AI-assisted.
upstream-sync closed this pull request 2026-11-24 23:03:26 +00:00
tedin7 commented 2026-11-24 23:03:27 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T22:45:03Z.

Review: COMMENTED


Review of head 24e5a1714f3bad5a0d7405a5d5a2f9b2120d587c.

Diff: tools/scan_unsupported_shaders.py (parse_assembly_file reads with utf-8-sig, and a label line is now recognized after stripping //, ;, # comments) plus one test in tests/rdna2_tools_check.py. No CMake changes, clean-room.

Commands executed locally:

  • python3 -I tests/rdna2_tools_check.py -k test_parse_assembly_file_skips: PASS
  • python3 tests/docs_links_check.py: PASS (18 files, 387 links)
  • python3 tests/bidi_controls_check.py: PASS
  • git diff --check origin/main...HEAD: clean
  • python3 x2w_pipe.py win2025 1986 --wait 900: Debug 80/80 and Release /O2 80/80 passed
  • gh pr checks 1986: Linux, Windows and gfx1013 fixtures all pass; no merge conflicts with main

Mutations (both killed by the new test, then reverted):

  1. utf-8-sig back to utf-8: the BOM assertion fails.
  2. Label check back to stripped.endswith(":"): the commented-label assertion fails.

P1: 0. P2: 0.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6048576937 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1986#pullrequestreview-6048576937). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T22:45:03Z. **Review:** COMMENTED --- Review of head `24e5a1714f3bad5a0d7405a5d5a2f9b2120d587c`. Diff: `tools/scan_unsupported_shaders.py` (`parse_assembly_file` reads with `utf-8-sig`, and a label line is now recognized after stripping `//`, `;`, `#` comments) plus one test in `tests/rdna2_tools_check.py`. No CMake changes, clean-room. Commands executed locally: - `python3 -I tests/rdna2_tools_check.py -k test_parse_assembly_file_skips`: PASS - `python3 tests/docs_links_check.py`: PASS (18 files, 387 links) - `python3 tests/bidi_controls_check.py`: PASS - `git diff --check origin/main...HEAD`: clean - `python3 x2w_pipe.py win2025 1986 --wait 900`: Debug 80/80 and Release /O2 80/80 passed - `gh pr checks 1986`: Linux, Windows and gfx1013 fixtures all pass; no merge conflicts with main Mutations (both killed by the new test, then reverted): 1. `utf-8-sig` back to `utf-8`: the BOM assertion fails. 2. Label check back to `stripped.endswith(":")`: the commented-label assertion fails. P1: 0. P2: 0. AI-assisted; commands listed were executed locally.
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
R0Y00/Xbox2Windows!1979
No description provided.