pixel_aot: lower integer-to-float conversions v_cvt_f32_u32 and v_cvt_f32_i32 #523

Merged
stan495 merged 1 commit from upstream-pr/529 into main 2026-11-22 11:17:45 +00:00
stan495 commented 2026-11-22 09:30:59 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-22T09:30:59Z.


Change

Translate RDNA 2/3 integer-to-float conversions v_cvt_f32_u32 and v_cvt_f32_i32 in tools/pixel_aot.py for both _e32 and _e64 encodings, along with unsuffixed assembler forms. Operands are converted through HLSL float(asuint(...)) and float(asint(...)).

Sources are integer bit patterns, so floating-point input modifiers (neg, abs) and float literals are rejected. The _e64 form lowers the clamp modifier to saturate(...).

Add scanner recognition in tools/scan_unsupported_shaders.py and tests/rdna2_tools_check.py. Add unit, literal, and D3D12 draw fixtures in tests/pixel_aot_check.py covering SGPR, VGPR, and literal immediate operands across positive and negative values.

Refs #360

Verification

Commit: 66a2b98

  1. Pure-Python platform-independent checks:
python -B tests/script_state_check.py
python -B tests/resource_root_check.py
python -B tests/bcpack_check.py
python -B tests/bc7_blocks_check.py
python -B tests/bc7_tiles_check.py
python -B tests/form_coverage_check.py
python -B tests/resource_ranges_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/intake/paths_check.py
python -B tests/shader_probe_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/docs_links_check.py
python -B tests/bidi_controls_check.py

Result: All passed.

  1. CTest hardware and WARP shader AOT suites:
ctest --preset dev -R '^pixel_aot_' -V

Result: 8/8 passed (100%).

  • Hardware adapter: AMD Radeon RX 7900 XTX (Vendor ID: 0x1002, Device ID: 0x744c), Driver 32.0.32029.2010, Windows 11 Build 26100, D3D12 Debug Layer enabled. Errors: 0, Warnings: 0, Max Absolute Error: 0.
  • Software adapter: Microsoft Basic Render Driver (Vendor ID: 0x1414, Device ID: 0x008c), Driver 10.0.26100.9711. Errors: 0, Warnings: 0, Max Absolute Error: 0.
  1. Form coverage check:
python -B tests/form_coverage_check.py

Result: form coverage checks passed (recorded v_cvt_f32_i32_e32, v_cvt_f32_i32_e64, v_cvt_f32_u32_e32, v_cvt_f32_u32_e64).

Evidence and follow-up

Fixtures are purely synthetic pixel shader assemblies under tests/pixel_aot_check.py submitted under the project's MIT License.

Negative controls verify that:

  • Floating-point input modifiers (-v, |v|, abs(v), -s, |s|, abs(s)), float literals (1.5), out-of-range 32-bit immediates, and SGPR destinations are rejected at translation time.
  • Reading SGPR before s_waitcnt lgkmcnt(0) or writing before s_waitcnt vmcnt(0) is rejected.
  • Mutating v_cvt_f32_i32 to v_cvt_f32_u32 or mutating signed literals on negative values produces a pixel_mismatch runtime assertion failure (exit code 1).
  • Dropping clamp on clamped _e64 conversions produces a pixel_mismatch runtime assertion failure (exit code 1).

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.

This change was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6540801569 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/529). Originally posted by [stan495](https://github.com/stan495) on 2026-11-22T09:30:59Z. --- ## Change Translate RDNA 2/3 integer-to-float conversions `v_cvt_f32_u32` and `v_cvt_f32_i32` in `tools/pixel_aot.py` for both `_e32` and `_e64` encodings, along with unsuffixed assembler forms. Operands are converted through HLSL `float(asuint(...))` and `float(asint(...))`. Sources are integer bit patterns, so floating-point input modifiers (`neg`, `abs`) and float literals are rejected. The `_e64` form lowers the `clamp` modifier to `saturate(...)`. Add scanner recognition in `tools/scan_unsupported_shaders.py` and `tests/rdna2_tools_check.py`. Add unit, literal, and D3D12 draw fixtures in `tests/pixel_aot_check.py` covering SGPR, VGPR, and literal immediate operands across positive and negative values. Refs #360 ## Verification Commit: `66a2b98` 1. Pure-Python platform-independent checks: ```bash python -B tests/script_state_check.py python -B tests/resource_root_check.py python -B tests/bcpack_check.py python -B tests/bc7_blocks_check.py python -B tests/bc7_tiles_check.py python -B tests/form_coverage_check.py python -B tests/resource_ranges_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/intake/paths_check.py python -B tests/shader_probe_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/docs_links_check.py python -B tests/bidi_controls_check.py ``` Result: All passed. 2. CTest hardware and WARP shader AOT suites: ```powershell ctest --preset dev -R '^pixel_aot_' -V ``` Result: 8/8 passed (100%). - Hardware adapter: AMD Radeon RX 7900 XTX (Vendor ID: `0x1002`, Device ID: `0x744c`), Driver `32.0.32029.2010`, Windows 11 Build 26100, D3D12 Debug Layer enabled. Errors: 0, Warnings: 0, Max Absolute Error: 0. - Software adapter: Microsoft Basic Render Driver (Vendor ID: `0x1414`, Device ID: `0x008c`), Driver `10.0.26100.9711`. Errors: 0, Warnings: 0, Max Absolute Error: 0. 3. Form coverage check: ```powershell python -B tests/form_coverage_check.py ``` Result: `form coverage checks passed` (recorded `v_cvt_f32_i32_e32`, `v_cvt_f32_i32_e64`, `v_cvt_f32_u32_e32`, `v_cvt_f32_u32_e64`). ## Evidence and follow-up Fixtures are purely synthetic pixel shader assemblies under `tests/pixel_aot_check.py` submitted under the project's MIT License. Negative controls verify that: - Floating-point input modifiers (`-v`, `|v|`, `abs(v)`, `-s`, `|s|`, `abs(s)`), float literals (`1.5`), out-of-range 32-bit immediates, and SGPR destinations are rejected at translation time. - Reading SGPR before `s_waitcnt lgkmcnt(0)` or writing before `s_waitcnt vmcnt(0)` is rejected. - Mutating `v_cvt_f32_i32` to `v_cvt_f32_u32` or mutating signed literals on negative values produces a `pixel_mismatch` runtime assertion failure (exit code 1). - Dropping `clamp` on clamped `_e64` conversions produces a `pixel_mismatch` runtime assertion failure (exit code 1). ## 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. This change was AI-assisted.
upstream-sync closed this pull request 2026-11-24 06:43:31 +00:00
R0Y00 commented 2026-11-24 06:48:29 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T10:00:14Z.


Thanks for the scanner coverage, literal cases, and negative controls. For #360, the agreed completion check observes the uncompressed f32 bits at the signed and unsigned endpoints and on both sides of 2^24, including ties to even. The current binary16 export cannot distinguish those rows.

Please change Fixes #360 to Refs #360. The bit-exact path is queued as #363 → #392 → #417, with e64/clamp following the e32 acceptances. Your scanner cases, distinctive literals and mutation checks are useful as a focused follow-up, or can be carried into the staged changes with your attribution. Please keep the checks that extend that coverage.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7077507411 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/529#issuecomment-7077507411). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-22T10:00:14Z. --- Thanks for the scanner coverage, literal cases, and negative controls. For #360, the agreed completion check observes the uncompressed f32 bits at the signed and unsigned endpoints and on both sides of 2^24, including ties to even. The current binary16 export cannot distinguish those rows. Please change Fixes #360 to Refs #360. The bit-exact path is queued as #363 → #392 → #417, with e64/clamp following the e32 acceptances. Your scanner cases, distinctive literals and mutation checks are useful as a focused follow-up, or can be carried into the staged changes with your attribution. Please keep the checks that extend that coverage.
stan495 commented 2026-11-24 06:48:29 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-22T10:03:08Z.


Thanks for the clear explanation and roadmap context!

I have updated the commit and PR description to Refs #360 instead of Fixes #360.

I've preserved all the extended checks, distinctive literals, e64/clamp handling, and mutation controls. Whether they land as this focused follow-up or are carried into the staged changes in the pipeline with attribution, either way sounds great to me. Thank you!

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7077539588 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/529#issuecomment-7077539588). Originally posted by [stan495](https://github.com/stan495) on 2026-11-22T10:03:08Z. --- Thanks for the clear explanation and roadmap context! I have updated the commit and PR description to `Refs #360` instead of `Fixes #360`. I've preserved all the extended checks, distinctive literals, e64/clamp handling, and mutation controls. Whether they land as this focused follow-up or are carried into the staged changes in the pipeline with attribution, either way sounds great to me. Thank you!
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!523
No description provided.