Fix VOPC classification and inline comments in scan_unsupported_shaders #228

Merged
alexander-src merged 1 commit from upstream-pr/231 into main 2026-11-21 19:12:11 +00:00
alexander-src commented 2026-11-21 18:49:29 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by alexander-src on 2026-11-21T18:49:29Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6532960778 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/231). Originally posted by [alexander-src](https://github.com/alexander-src) on 2026-11-21T18:49:29Z. --- ## 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.
upstream-sync closed this pull request 2026-11-24 06:41:55 +00:00
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!228
No description provided.