shader: cover SOP1 and SOP2 scalar bit-search, bit-count, sign-extension and arithmetic operations #1282

Merged
agilesh08 merged 1 commit from upstream-pr/1289 into main 2026-11-24 07:04:20 +00:00
agilesh08 commented 2026-11-24 06:54:46 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by agilesh08 on 2026-11-24T06:54:46Z.


Change

Covers 20 RDNA2 scalar ALU operations across the SOP1 and SOP2 encoding families in static verification controls (check_controls), disassembler fixtures, and reference form-coverage assertions:

  • 15 SOP1 operations: bit-count operations (s_bcnt0_i32_b32, s_bcnt0_i32_b64, s_bcnt1_i32_b32, s_bcnt1_i32_b64), first-bit search operations (s_ff0_i32_b32, s_ff0_i32_b64, s_ff1_i32_b32, s_ff1_i32_b64), leading-bit search operations (s_flbit_i32, s_flbit_i32_b32, s_flbit_i32_b64, s_flbit_i32_i64), sign-extension operations (s_sext_i32_i8, s_sext_i32_i16), and absolute value (s_abs_i32).
  • 5 SOP2 operations: 16-bit packing operations (s_pack_ll_b32_b16, s_pack_lh_b32_b16, s_pack_hh_b32_b16) and 32-bit high-half multiplications (s_mul_hi_i32, s_mul_hi_u32).

Adds negative boundary controls in tests/pixel_aot_check.py verifying that invalid register classes (vector destinations), misaligned SGPR pairs (s[45:46]), and unsupported operand configurations raise ValueError. Adds disassembler test vectors for s_flbit_i32 (001782be) and s_flbit_i32_i64 (001882be) in tests/rdna2_tools_check.py. Asserts coverage in tests/form_coverage_check.py against both gfx1013.tsv and rdna2.tsv, and documents the suite with reproduction commands in docs/experiments.md.

Verification

Ran all 37 platform-independent checks with Python 3.12:

python -B tests/script_state_check.py
python -B tests/resource_root_check.py
python -B tests/bcpack_check.py
python -B tests/bcpack_symbols_check.py
python -B tests/bc7_blocks_check.py
python -B tests/bc7_tiles_check.py
python -B tests/gfx10_texture_roundtrip_check.py
python -B tests/texture_bc_volume_check.py
python -B tests/form_coverage_check.py
python -B tests/resource_ranges_check.py
python -B tests/ttpf_batch_export_check.py
python -B tests/awc_metadata_check.py
python -B tests/sgd5_effects_check.py
python -B tests/dxcontainer_part_offsets_check.py
python -B tests/layout_chunks_check.py
python -B tests/dependency_paths_check.py
python -B tests/pe_package_preflight_check.py
python -B tests/pe_package_ordinal_plan_check.py
python -B tests/compat_report_check.py
python -B tests/intake/paths_check.py
python -B tests/intake/routing_check.py
python -B tests/intake/import_forms_check.py
python -B tests/shader_probe_check.py
python -B tests/shader_census_check.py
python -B tests/shader_corpus_report_check.py
python -B tests/dxil_retarget_check.py
python -B tests/rdna2_tools_check.py
python -B tests/pso_readiness_check.py
python -B tests/xmem_attribute_scan_check.py
python -B tests/xgameruntime_table_check.py
python -B tests/docs_links_check.py
python -B tests/bidi_controls_check.py
python -B tests/gpu_report_format_check.py
python -B tests/hardware_reports_check.py
python -B tests/rectlist_topology_check.py
python -B tests/startup_sampler_heap_check.py
python -B tests/startup_image_3d_check.py

Observed result: ALL 37 CHECKS PASSED SUCCESSFULLY! (including 133 tests in rdna2_tools_check.py, 0 link errors across 16 docs, 0 bidirectional controls across 1,072 files).
Verified clean merge against upstream/main (3303f2a1): git merge-tree --write-tree upstream/main HEAD exited 0.
Whitespace check passed with 0 errors: git -c core.whitespace=cr-at-eol diff --check upstream/main.

Evidence and follow-up

The static controls in check_controls exercise synthetic programs lowering each scalar opcode through the pipeline. Negative controls assert that vector destinations, misaligned scalar pairs, and invalid operand shapes are refused. tests/form_coverage_check.py asserts that without the accepted spellings, none of these forms count toward coverage.

This patch expands scalar coverage in docs/coverage/gfx1013.tsv and docs/coverage/rdna2.tsv. Full GPU draw verification for these operations is already wired in check_scalar_bit_count_draw, check_scalar_first_bit_draw, check_scalar_leading_bit_draw, check_sext_draw, check_scalar_pack_draw, and check_scalar_mul_hi_draw.

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.

Assisted by AI.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6576388191 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1289). Originally posted by [agilesh08](https://github.com/agilesh08) on 2026-11-24T06:54:46Z. --- ## Change Covers 20 RDNA2 scalar ALU operations across the SOP1 and SOP2 encoding families in static verification controls (`check_controls`), disassembler fixtures, and reference form-coverage assertions: - **15 SOP1 operations:** bit-count operations (`s_bcnt0_i32_b32`, `s_bcnt0_i32_b64`, `s_bcnt1_i32_b32`, `s_bcnt1_i32_b64`), first-bit search operations (`s_ff0_i32_b32`, `s_ff0_i32_b64`, `s_ff1_i32_b32`, `s_ff1_i32_b64`), leading-bit search operations (`s_flbit_i32`, `s_flbit_i32_b32`, `s_flbit_i32_b64`, `s_flbit_i32_i64`), sign-extension operations (`s_sext_i32_i8`, `s_sext_i32_i16`), and absolute value (`s_abs_i32`). - **5 SOP2 operations:** 16-bit packing operations (`s_pack_ll_b32_b16`, `s_pack_lh_b32_b16`, `s_pack_hh_b32_b16`) and 32-bit high-half multiplications (`s_mul_hi_i32`, `s_mul_hi_u32`). Adds negative boundary controls in `tests/pixel_aot_check.py` verifying that invalid register classes (vector destinations), misaligned SGPR pairs (`s[45:46]`), and unsupported operand configurations raise `ValueError`. Adds disassembler test vectors for `s_flbit_i32` (`001782be`) and `s_flbit_i32_i64` (`001882be`) in `tests/rdna2_tools_check.py`. Asserts coverage in `tests/form_coverage_check.py` against both `gfx1013.tsv` and `rdna2.tsv`, and documents the suite with reproduction commands in `docs/experiments.md`. ## Verification Ran all 37 platform-independent checks with Python 3.12: ```powershell python -B tests/script_state_check.py python -B tests/resource_root_check.py python -B tests/bcpack_check.py python -B tests/bcpack_symbols_check.py python -B tests/bc7_blocks_check.py python -B tests/bc7_tiles_check.py python -B tests/gfx10_texture_roundtrip_check.py python -B tests/texture_bc_volume_check.py python -B tests/form_coverage_check.py python -B tests/resource_ranges_check.py python -B tests/ttpf_batch_export_check.py python -B tests/awc_metadata_check.py python -B tests/sgd5_effects_check.py python -B tests/dxcontainer_part_offsets_check.py python -B tests/layout_chunks_check.py python -B tests/dependency_paths_check.py python -B tests/pe_package_preflight_check.py python -B tests/pe_package_ordinal_plan_check.py python -B tests/compat_report_check.py python -B tests/intake/paths_check.py python -B tests/intake/routing_check.py python -B tests/intake/import_forms_check.py python -B tests/shader_probe_check.py python -B tests/shader_census_check.py python -B tests/shader_corpus_report_check.py python -B tests/dxil_retarget_check.py python -B tests/rdna2_tools_check.py python -B tests/pso_readiness_check.py python -B tests/xmem_attribute_scan_check.py python -B tests/xgameruntime_table_check.py python -B tests/docs_links_check.py python -B tests/bidi_controls_check.py python -B tests/gpu_report_format_check.py python -B tests/hardware_reports_check.py python -B tests/rectlist_topology_check.py python -B tests/startup_sampler_heap_check.py python -B tests/startup_image_3d_check.py ``` Observed result: `ALL 37 CHECKS PASSED SUCCESSFULLY!` (including 133 tests in `rdna2_tools_check.py`, 0 link errors across 16 docs, 0 bidirectional controls across 1,072 files). Verified clean merge against `upstream/main` (`3303f2a1`): `git merge-tree --write-tree upstream/main HEAD` exited 0. Whitespace check passed with 0 errors: `git -c core.whitespace=cr-at-eol diff --check upstream/main`. ## Evidence and follow-up The static controls in `check_controls` exercise synthetic programs lowering each scalar opcode through the pipeline. Negative controls assert that vector destinations, misaligned scalar pairs, and invalid operand shapes are refused. `tests/form_coverage_check.py` asserts that without the accepted spellings, none of these forms count toward coverage. This patch expands scalar coverage in `docs/coverage/gfx1013.tsv` and `docs/coverage/rdna2.tsv`. Full GPU draw verification for these operations is already wired in `check_scalar_bit_count_draw`, `check_scalar_first_bit_draw`, `check_scalar_leading_bit_draw`, `check_sext_draw`, `check_scalar_pack_draw`, and `check_scalar_mul_hi_draw`. ## 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. Assisted by AI.
upstream-sync closed this pull request 2026-11-24 07:07:40 +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!1282
No description provided.