Add binary shader scanning and stage progress dashboard to RDNA 2 scanner #238

Merged
Holastor merged 2 commits from upstream-pr/241 into main 2026-11-21 20:55:23 +00:00
Holastor commented 2026-11-21 18:59:42 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-21T18:59:42Z.


Summary

Enhances tools/scan_unsupported_shaders.py with standalone binary shader intake and visual stage progress reporting:

  • Direct .bin disassembly support using native disasm_rdna2 without requiring an external libLLVM dependency.
  • Pipeline stage detection (pixel, compute, vertex, other) based on directory structure and symbol naming (detect_shader_stage).
  • AnyPS5-style visual progress dashboard generation (PROGRESS.md and progress.json) featuring ASCII coverage bars, ISA subsystem breakdowns, and high-impact missing opcode blocker rankings (Shaders Blocked, Blocker Impact %).
  • Added unit tests covering stage detection, binary shader intake, and dashboard generation in tests/rdna2_tools_check.py.

Evidence

Ran automated RDNA 2 tooling test suite on Windows:

python -B tests/rdna2_tools_check.py

Observed output:

..s............
----------------------------------------------------------------------
Ran 15 tests in 1.454s

OK (skipped=1)

Also verified pure-Python checks across repository:

python -B tests/bcpack_check.py
python -B tests/dxcontainer_part_offsets_check.py
python -B tests/layout_chunks_check.py
python -B tests/resource_ranges_check.py
python -B tests/script_state_check.py
python -B tests/intake/paths_check.py

Observed output: all 6 test suites passed (0 errors, 0 failures).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6533085861 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/241). Originally posted by [Holastor](https://github.com/Holastor) on 2026-11-21T18:59:42Z. --- ## Summary Enhances `tools/scan_unsupported_shaders.py` with standalone binary shader intake and visual stage progress reporting: - Direct `.bin` disassembly support using native `disasm_rdna2` without requiring an external `libLLVM` dependency. - Pipeline stage detection (`pixel`, `compute`, `vertex`, `other`) based on directory structure and symbol naming (`detect_shader_stage`). - AnyPS5-style visual progress dashboard generation (`PROGRESS.md` and `progress.json`) featuring ASCII coverage bars, ISA subsystem breakdowns, and high-impact missing opcode blocker rankings (`Shaders Blocked`, `Blocker Impact %`). - Added unit tests covering stage detection, binary shader intake, and dashboard generation in `tests/rdna2_tools_check.py`. ## Evidence Ran automated RDNA 2 tooling test suite on Windows: ```powershell python -B tests/rdna2_tools_check.py ``` Observed output: ```text ..s............ ---------------------------------------------------------------------- Ran 15 tests in 1.454s OK (skipped=1) ``` Also verified pure-Python checks across repository: ```powershell python -B tests/bcpack_check.py python -B tests/dxcontainer_part_offsets_check.py python -B tests/layout_chunks_check.py python -B tests/resource_ranges_check.py python -B tests/script_state_check.py python -B tests/intake/paths_check.py ``` Observed output: all 6 test suites passed (0 errors, 0 failures).
upstream-sync closed this pull request 2026-11-24 06:41:58 +00:00
R0Y00 commented 2026-11-24 06:47:53 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T19:14:44Z.


The current head conflicts in tools/scan_unsupported_shaders.py after #231. Please preserve the VOPC classification, inline // handling and instruction-only denominator alongside the binary intake changes, then rerun python -B tests/rdna2_tools_check.py.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7067874939 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/241#issuecomment-7067874939). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-21T19:14:44Z. --- The current head conflicts in `tools/scan_unsupported_shaders.py` after #231. Please preserve the VOPC classification, inline `//` handling and instruction-only denominator alongside the binary intake changes, then rerun `python -B tests/rdna2_tools_check.py`.
Holastor commented 2026-11-24 06:47:54 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-21T19:23:53Z.


@R0Y00 Rebased onto current upstream/main (1485f17) and resolved conflicts cleanly in tools/scan_unsupported_shaders.py:

  • Preserved VOPC classification (v_cmp* categorized as "VOPC (Vector Compare)" before any _f16/_f32 VALU check).
  • Preserved inline // handling (re.split(r"//|[;#]", line)[0].strip()) across opcode extraction, comment stripping, and pattern matching.
  • Preserved instruction-only denominator (total counter increments strictly for non-empty instruction lines excluding blank lines and comments).
  • Preserved standalone binary intake via disasm_rdna2 and visual pipeline stage breakdown dashboard.
  • Ensured terminal progress bar encoding safety across CP1252 / Windows console environments.

Verified test suite:

python -B tests/rdna2_tools_check.py

Output:

..s...................
----------------------------------------------------------------------
Ran 22 tests in 2.605s

OK (skipped=1)

Also ran all pure-Python check fixtures:

  • tests/bcpack_check.py (8 tests OK)
  • tests/dxcontainer_part_offsets_check.py (7 tests OK)
  • tests/layout_chunks_check.py (summary OK)
  • tests/resource_ranges_check.py (5 tests OK)
  • tests/script_state_check.py (13 tests OK)
  • tests/intake/paths_check.py (OK)
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7067991304 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/241#issuecomment-7067991304). Originally posted by [Holastor](https://github.com/Holastor) on 2026-11-21T19:23:53Z. --- @R0Y00 Rebased onto current `upstream/main` (`1485f17`) and resolved conflicts cleanly in `tools/scan_unsupported_shaders.py`: - Preserved VOPC classification (`v_cmp*` categorized as `"VOPC (Vector Compare)"` before any `_f16`/`_f32` VALU check). - Preserved inline `//` handling (`re.split(r"//|[;#]", line)[0].strip()`) across opcode extraction, comment stripping, and pattern matching. - Preserved instruction-only denominator (`total` counter increments strictly for non-empty instruction lines excluding blank lines and comments). - Preserved standalone binary intake via `disasm_rdna2` and visual pipeline stage breakdown dashboard. - Ensured terminal progress bar encoding safety across CP1252 / Windows console environments. Verified test suite: ```powershell python -B tests/rdna2_tools_check.py ``` Output: ```text ..s................... ---------------------------------------------------------------------- Ran 22 tests in 2.605s OK (skipped=1) ``` Also ran all pure-Python check fixtures: - `tests/bcpack_check.py` (8 tests OK) - `tests/dxcontainer_part_offsets_check.py` (7 tests OK) - `tests/layout_chunks_check.py` (summary OK) - `tests/resource_ranges_check.py` (5 tests OK) - `tests/script_state_check.py` (13 tests OK) - `tests/intake/paths_check.py` (OK)
R0Y00 commented 2026-11-24 06:47:56 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T19:57:38Z.


disassemble_binary_shader catches every exception and returns [], and the .bin caller only appends a result when that list is nonempty. A decoder failure therefore drops the input from the dashboard denominator and can make the remaining files look fully covered. Please retain a failed-input record (or fail the scan with the path and diagnostic), and add a mixed good/bad binary test that accounts for both inputs.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7068401826 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/241#issuecomment-7068401826). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-21T19:57:38Z. --- `disassemble_binary_shader` catches every exception and returns `[]`, and the `.bin` caller only appends a result when that list is nonempty. A decoder failure therefore drops the input from the dashboard denominator and can make the remaining files look fully covered. Please retain a failed-input record (or fail the scan with the path and diagnostic), and add a mixed good/bad binary test that accounts for both inputs.
Holastor commented 2026-11-24 06:47:58 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-21T20:16:16Z.


@R0Y00
Updated in 04030eb:

  • disassemble_binary_shader now propagates decoder errors / raises ValueError on empty or undecodable data rather than silently swallowing exceptions into [].
  • scan_directory_or_files captures decoder/IO failures and retains a failed-input analysis record (make_failed_shader_record) containing the file path and specific diagnostic in lower_error. This prevents decoder failures from being dropped from the scan denominator.
  • generate_progress_dashboard and report generators now account for zero-instruction / failed decode records in the completely unsupported count and denominator calculation.
  • Added test_disassemble_binary_shader_error verifying disassemble_binary_shader raises on invalid input.
  • Added test_mixed_binary_shader_scanning in tests/rdna2_tools_check.py scanning a directory containing both valid and corrupt/empty .bin inputs, asserting:
    • Both inputs are preserved in len(results) == 2 and in the dashboard's total_shaders.
    • The failed binary record has lower_status == "decode_failed" with the diagnostic.
    • The overall coverage percentage correctly reflects the failed shader in the denominator.

Test suite run:

python -B tests/rdna2_tools_check.py

Output:

..s.....................
----------------------------------------------------------------------
Ran 24 tests in 2.611s

OK (skipped=1)

Also re-verified pure-Python checks across repository:

  • tests/form_coverage_check.py (passed)
  • tests/bcpack_check.py (8 tests OK)
  • tests/dxcontainer_part_offsets_check.py (7 tests OK)
  • tests/layout_chunks_check.py (summary OK)
  • tests/resource_ranges_check.py (5 tests OK)
  • tests/script_state_check.py (13 tests OK)
  • tests/intake/paths_check.py (OK)
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7068629610 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/241#issuecomment-7068629610). Originally posted by [Holastor](https://github.com/Holastor) on 2026-11-21T20:16:16Z. --- @R0Y00 Updated in `04030eb`: - `disassemble_binary_shader` now propagates decoder errors / raises `ValueError` on empty or undecodable data rather than silently swallowing exceptions into `[]`. - `scan_directory_or_files` captures decoder/IO failures and retains a failed-input analysis record (`make_failed_shader_record`) containing the file path and specific diagnostic in `lower_error`. This prevents decoder failures from being dropped from the scan denominator. - `generate_progress_dashboard` and report generators now account for zero-instruction / failed decode records in the completely unsupported count and denominator calculation. - Added `test_disassemble_binary_shader_error` verifying `disassemble_binary_shader` raises on invalid input. - Added `test_mixed_binary_shader_scanning` in `tests/rdna2_tools_check.py` scanning a directory containing both valid and corrupt/empty `.bin` inputs, asserting: - Both inputs are preserved in `len(results) == 2` and in the dashboard's `total_shaders`. - The failed binary record has `lower_status == "decode_failed"` with the diagnostic. - The overall coverage percentage correctly reflects the failed shader in the denominator. Test suite run: ```powershell python -B tests/rdna2_tools_check.py ``` Output: ```text ..s..................... ---------------------------------------------------------------------- Ran 24 tests in 2.611s OK (skipped=1) ``` Also re-verified pure-Python checks across repository: - `tests/form_coverage_check.py` (passed) - `tests/bcpack_check.py` (8 tests OK) - `tests/dxcontainer_part_offsets_check.py` (7 tests OK) - `tests/layout_chunks_check.py` (summary OK) - `tests/resource_ranges_check.py` (5 tests OK) - `tests/script_state_check.py` (13 tests OK) - `tests/intake/paths_check.py` (OK)
R0Y00 commented 2026-11-24 06:47:58 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T20:25:57Z.


The failed binary now has its own record. The stacked #271 exposed a remaining test issue: coverage_percentage divides supported instructions by decoded instructions, and the empty input contributes zero instructions. Once all instructions in ps_good.bin are recognized, the percentage legitimately reaches 100 and assertLess(..., 100.0) fails. Please keep the instruction metric clearly labeled and test the file-level denominator separately (two inputs, one decode failure). Include a case where every decoded instruction is supported. Windows failure on the stacked PR

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7068747858 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/241#issuecomment-7068747858). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-21T20:25:57Z. --- The failed binary now has its own record. The stacked #271 exposed a remaining test issue: `coverage_percentage` divides supported instructions by decoded instructions, and the empty input contributes zero instructions. Once all instructions in `ps_good.bin` are recognized, the percentage legitimately reaches 100 and `assertLess(..., 100.0)` fails. Please keep the instruction metric clearly labeled and test the file-level denominator separately (two inputs, one decode failure). Include a case where every decoded instruction is supported. [Windows failure on the stacked PR](https://github.com/R0Y00/Xbox2Windows/actions/runs/44945230646/job/136970968553)
Holastor commented 2026-11-24 06:48:00 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-21T20:55:30Z.


@R0Y00 Updated in 57a07b0:
- Clearly labeled the instruction metric as Instruction Coverage / Total Decoded Instructions
(instruction_coverage_percentage) across PROGRESS.md, progress.json, and terminal summaries.
- Separated the file-level denominator assertion from instruction coverage in
test_mixed_binary_shader_scanning: includes a case where all decoded instructions are supported
(instruction_coverage_percentage == 100.0), while verifying the file-level denominator retains the decode
failure (total_shaders == 2, completely_unsupported == 1, 50% file-level blocked).
- Verified with python -B tests/rdna2_tools_check.py (26/26 passed) and full CI passes across all platforms

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7069105557 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/241#issuecomment-7069105557). Originally posted by [Holastor](https://github.com/Holastor) on 2026-11-21T20:55:30Z. --- @R0Y00 Updated in `57a07b0`: - Clearly labeled the instruction metric as `Instruction Coverage` / `Total Decoded Instructions` (`instruction_coverage_percentage`) across `PROGRESS.md`, `progress.json`, and terminal summaries. - Separated the file-level denominator assertion from instruction coverage in `test_mixed_binary_shader_scanning`: includes a case where all decoded instructions are supported (`instruction_coverage_percentage == 100.0`), while verifying the file-level denominator retains the decode failure (`total_shaders == 2`, `completely_unsupported == 1`, 50% file-level blocked). - Verified with `python -B tests/rdna2_tools_check.py` (26/26 passed) and full CI passes across all platforms
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!238
No description provided.