Fix VOPC classification and inline comments in scan_unsupported_shaders #231

Manually merged
github merged 1 commit from gh-pr/231/head into gh-pr/231/base 2026-11-26 21:36:05 +00:00
Owner

@⁠alexander-src on GitHub · 2026-11-21 18:49 UTC · original
alexander-src:fix/shader-scanner-vopc-comments → main · +32 −6 · 2 files · 1 commits · merged 2026-11-21 19:12 UTC

Change

Fix three analysis bugs in tools/scan_unsupported_shaders.py:

  • Check op.startswith("v_cmp") before the _f16/_f32/_f64/_u32/_i32 type-suffix check in classify_isa_category() so real RDNA 2 compare opcodes (such as v_cmp_lt_f32 and v_cmp_eq_u32) are classified as VOPC (Vector Compare) instead of falling into the VOP / VALU branch and leaving VOPC unreachable.
  • Strip inline // comments consistently in extract_opcode(), is_instruction_supported(), and analyze_shader_instructions() (matching parse_assembly_file() and LLVM AMDGPU disassembly syntax) instead of only splitting on ; and #.
  • Increment total inside analyze_shader_instructions() only for non-empty instruction lines after comment stripping so blank and comment-only lines are not counted in total_instructions, supported_instructions, and support_percentage.
  • Add test_vopc_classification and test_inline_slash_comments_and_blank_lines to tests/rdna2_tools_check.py.

Verification

Run on Linux x86_64 (python3 3.14) against main e8895ad:

  • python3 -B tests/rdna2_tools_check.py -> Ran 19 tests in 0.125s : OK (skipped=1) (test_llvm_comparison skipped because LLVM_LIB is unset; all 18 non-LLVM tests passed).
  • Negative control against main:tools/scan_unsupported_shaders.py: both new tests failed (v_cmp_lt_f32 classified as VOP / VALU, is_instruction_supported("s_endpgm // shader exit") returned False, and blank/comment lines inflated total_instructions).
  • Not run locally: Windows build-and-test job and Ubuntu llvm-15 job (missing Windows host and llvm-15 locally; covered by CI).

Evidence and follow-up

All new test inputs in tests/rdna2_tools_check.py are synthetic assembly lines authored inline under the repository's MIT license. No game files or external dumps were used.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted: yes.

**@⁠alexander-src** on GitHub · 2026-11-21 18:49 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/231) `alexander-src:fix/shader-scanner-vopc-comments` → `main` · +32 −6 · 2 files · 1 commits · merged 2026-11-21 19:12 UTC ## Change Fix three analysis bugs in `tools/scan_unsupported_shaders.py`: - Check `op.startswith("v_cmp")` before the `_f16`/`_f32`/`_f64`/`_u32`/`_i32` type-suffix check in `classify_isa_category()` so real RDNA 2 compare opcodes (such as `v_cmp_lt_f32` and `v_cmp_eq_u32`) are classified as `VOPC (Vector Compare)` instead of falling into the `VOP / VALU` branch and leaving `VOPC` unreachable. - Strip inline `//` comments consistently in `extract_opcode()`, `is_instruction_supported()`, and `analyze_shader_instructions()` (matching `parse_assembly_file()` and LLVM AMDGPU disassembly syntax) instead of only splitting on `;` and `#`. - Increment `total` inside `analyze_shader_instructions()` only for non-empty instruction lines after comment stripping so blank and comment-only lines are not counted in `total_instructions`, `supported_instructions`, and `support_percentage`. - Add `test_vopc_classification` and `test_inline_slash_comments_and_blank_lines` to `tests/rdna2_tools_check.py`. ## Verification Run on Linux x86_64 (`python3 3.14`) against `main` `e8895ad`: - `python3 -B tests/rdna2_tools_check.py` -> `Ran 19 tests in 0.125s : OK (skipped=1)` (`test_llvm_comparison` skipped because `LLVM_LIB` is unset; all 18 non-LLVM tests passed). - Negative control against `main:tools/scan_unsupported_shaders.py`: both new tests failed (`v_cmp_lt_f32` classified as `VOP / VALU`, `is_instruction_supported("s_endpgm // shader exit")` returned `False`, and blank/comment lines inflated `total_instructions`). - Not run locally: Windows `build-and-test` job and Ubuntu `llvm-15` job (missing Windows host and `llvm-15` locally; covered by CI). ## Evidence and follow-up All new test inputs in `tests/rdna2_tools_check.py` are synthetic assembly lines authored inline under the repository's MIT license. No game files or external dumps were used. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted: yes.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:36:03 +00:00
github manually merged commit c7659e6c1c into gh-pr/231/base 2026-11-26 21:36:05 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.