Skip to content

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

Merged
tedin7 merged 1 commit into
R0Y00:mainfrom
RenzoWit35:tooling/scan-assembly-bom-labels
Nov 24, 2026
Merged

tedin7 merged 1 commit into
R0Y00:mainfrom
RenzoWit35:tooling/scan-assembly-bom-labels

Conversation

@RenzoWit35

Copy link
Copy Markdown
Contributor

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.

…sembly parsing

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.

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
tedin7 merged commit 93e4753 into R0Y00:main Nov 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants