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

Manually merged
github merged 1 commit from gh-pr/1986/head into gh-pr/1986/base 2026-11-26 23:47:52 +00:00
Owner

@⁠RenzoWit35 on GitHub · 2026-11-24 22:36 UTC · original
RenzoWit35:tooling/scan-assembly-bom-labels → main · +16 −2 · 2 files · 1 commits · merged 2026-11-24 22:45 UTC

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.

**@⁠RenzoWit35** on GitHub · 2026-11-24 22:36 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1986) `RenzoWit35:tooling/scan-assembly-bom-labels` → `main` · +16 −2 · 2 files · 1 commits · merged 2026-11-24 22:45 UTC ## 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.
parse_assembly_file kept a UTF-8 BOM on the first line (so a file written by
Windows PowerShell 5 reported '\ufeffs_endpgm' as an unknown opcode) and kept
llc-style labels with a trailing comment such as 'pixel: ; @pixel' as opcodes.
Open with utf-8-sig and test for a bare label after stripping the comment,
using the same comment rule as extract_opcode.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:47:49 +00:00
github manually merged commit 24e5a1714f into gh-pr/1986/base 2026-11-26 23:47:52 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 22:45 UTC · original · reviewed

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.

**@⁠tedin7** on GitHub · 2026-11-24 22:45 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1986#pullrequestreview-6048576937) · **reviewed** 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.
This discussion has been locked. Commenting is limited to contributors.
No description provided.