gfx2hlsl: allow component-wise float VALU ops from proven uniform sources for v_readfirstlane_b32 #3789

Merged
Holastor merged 2 commits from upstream-pr/3789 into main 2026-12-02 01:56:56 +00:00
Holastor commented 2026-12-01 22:34:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-12-01T22:34:48Z.


Summary

Extends UNIFORM_VALU in tools/startup/gfx2hlsl.py to cover component-wise single-precision float conversions, arithmetic, transcendental, and clamp/min/max instructions (v_cvt_f32_i32, v_add_f32, v_sub_f32, v_subrev_f32, v_fmamk_f32, v_mad_f32, v_madak_f32, v_madmk_f32, v_rcp_iflag_f32, v_rsq_f32, v_sqrt_f32, v_exp_f32, v_floor_f32, v_trunc_f32, v_fract_f32, v_rndne_f32, v_sin_f32, v_cos_f32, v_min_f32, v_max_f32, v_min3_f32, v_max3_f32) when all source operands are proven uniform under an active EXEC mask.

  • Preserves existing EXEC provenance, source/output modifier (abs/neg/clamp/mul/div), and uniform_expr checks.
  • Intentionally excludes 2-operand read-modify-write accumulators (v_fmac_f32, v_mac_f32) that implicitly read dst.
  • On a local dry-run over 509 refused shaders, 6 programs cleared every v_readfirstlane_b32 site completely and advanced to later checks, while larger .c67 programs advanced past their initial uniform float chains to downstream non-uniform/wave-read sites.

Verification

  • python -B tests/startup_gfx2hlsl_readfirstlane_uniform_check.py (0 failed; added positive tests for v_cvt_f32_i32, v_add_f32 / v_sub_f32 with neg/clamp, and v_mad_f32 + v_floor_f32, plus negative controls for v_fmac_f32_e32 and varying v_add_f32)
  • python -B tests/startup_compute_readfirstlane_check.py (passed)
  • python -B tests/startup_gfx2hlsl_readfirstlane_recompute_check.py (0 failed)
  • python -B tests/startup_gfx2hlsl_readfirstlane_load_recompute_check.py (0 failed)
  • python -B tests/docs_links_check.py and python -B tests/bidi_controls_check.py (passed)
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5595839455 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3789). Originally posted by [Holastor](https://github.com/Holastor) on 2026-12-01T22:34:48Z. --- ## Summary Extends `UNIFORM_VALU` in `tools/startup/gfx2hlsl.py` to cover component-wise single-precision float conversions, arithmetic, transcendental, and clamp/min/max instructions (`v_cvt_f32_i32`, `v_add_f32`, `v_sub_f32`, `v_subrev_f32`, `v_fmamk_f32`, `v_mad_f32`, `v_madak_f32`, `v_madmk_f32`, `v_rcp_iflag_f32`, `v_rsq_f32`, `v_sqrt_f32`, `v_exp_f32`, `v_floor_f32`, `v_trunc_f32`, `v_fract_f32`, `v_rndne_f32`, `v_sin_f32`, `v_cos_f32`, `v_min_f32`, `v_max_f32`, `v_min3_f32`, `v_max3_f32`) when all source operands are proven uniform under an active `EXEC` mask. - Preserves existing `EXEC` provenance, source/output modifier (`abs`/`neg`/`clamp`/`mul`/`div`), and `uniform_expr` checks. - Intentionally excludes 2-operand read-modify-write accumulators (`v_fmac_f32`, `v_mac_f32`) that implicitly read `dst`. - On a local dry-run over 509 refused shaders, 6 programs cleared every `v_readfirstlane_b32` site completely and advanced to later checks, while larger `.c67` programs advanced past their initial uniform float chains to downstream non-uniform/wave-read sites. ## Verification - `python -B tests/startup_gfx2hlsl_readfirstlane_uniform_check.py` (0 failed; added positive tests for `v_cvt_f32_i32`, `v_add_f32` / `v_sub_f32` with `neg`/`clamp`, and `v_mad_f32` + `v_floor_f32`, plus negative controls for `v_fmac_f32_e32` and varying `v_add_f32`) - `python -B tests/startup_compute_readfirstlane_check.py` (passed) - `python -B tests/startup_gfx2hlsl_readfirstlane_recompute_check.py` (0 failed) - `python -B tests/startup_gfx2hlsl_readfirstlane_load_recompute_check.py` (0 failed) - `python -B tests/docs_links_check.py` and `python -B tests/bidi_controls_check.py` (passed)
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!3789
No description provided.