startup: lower v_fma_mix_f32 and op_sel on v_fma_mix in gfx2hlsl #2431

Closed
github-bot wants to merge 1 commit from gh-pr/2431/head into gh-pr/2431/base
Owner

@⁠stan495 on GitHub · 2026-11-25 16:33 UTC · original
stan495:startup/v-fma-mix-f32 → main · +214 −15 · 5 files · 1 commits · closed without merging

Summary

Lower _fma_mix_f32 and add op_sel half-selection support across _fma_mix_f32, _fma_mixlo_f16, and _fma_mixhi_f16 in ools/startup/gfx2hlsl.py.

  • ** ools/startup/gfx2hlsl.py**:
    • Add INLINE_F16 and refactor Stage.mix(ops, mods, dest_mode) to support 'f32', 'lo', and 'hi' destinations (op_v_fma_mix_f32, op_v_fma_mixlo_f16, op_v_fma_mixhi_f16).
    • Parse both op_sel:[...] and op_sel_hi:[...] (plus clamp), rejecting duplicate or unknown modifiers and high-half op_sel bits when op_sel_hi is not set.
    • For op_sel_hi=1 (f16) operands, extract the selected half (>> 16 when op_sel=1, else low 16 bits with low16_only=True) and widen via 16tof32(...) before applying |abs| and -/
      eg(...) modifiers (matching ools/pixel_aot.py).
    • For _fma_mix_f32, emit via set_vf (honoring clamp and clearing low16_only on full 32-bit write); preserve untouched halves and low16_only semantics on mixlo/mixhi_f16.
  • ** ests/startup_gfx2hlsl_fma_mix_check.py**:
    • Pure-Python controls covering _fma_mix_f32, _fma_mixlo_f16, _fma_mixhi_f16, op_sel + op_sel_hi, bs/
      eg widening order, inline f16 constants, -0, odd-d16 low16 tracking (op_sel=0 accepted, op_sel=1 refused), invalid modifiers/operands, and a negative control removing op_v_fma_mix_f32.
  • CMakeLists.txt, .github/workflows/windows.yml, AGENTS.md: Register startup_gfx2hlsl_fma_mix_check.py.

Verification

  • Commit: d4dddc32 (based on upstream/main 7092683a)
  • Commands & Results:
    • python -B tests/startup_gfx2hlsl_fma_mix_check.py -> PASS
    • python -B tests/startup_image_load_d16_check.py -> PASS
    • python -B tests/startup_gfx2hlsl_handler_arity_check.py -> PASS
    • python -B tests/startup_gfx2hlsl_operand_count_check.py -> PASS
    • python -B tests/docs_links_check.py -> PASS (19 Markdown files, 464 links)
    • python -B tests/bidi_controls_check.py -> PASS (1723 tracked files)
**@⁠stan495** on GitHub · 2026-11-25 16:33 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2431) `stan495:startup/v-fma-mix-f32` → `main` · +214 −15 · 5 files · 1 commits · closed without merging ## Summary Lower _fma_mix_f32 and add op_sel half-selection support across _fma_mix_f32, _fma_mixlo_f16, and _fma_mixhi_f16 in ools/startup/gfx2hlsl.py. - ** ools/startup/gfx2hlsl.py**: - Add INLINE_F16 and refactor Stage.mix(ops, mods, dest_mode) to support 'f32', 'lo', and 'hi' destinations (op_v_fma_mix_f32, op_v_fma_mixlo_f16, op_v_fma_mixhi_f16). - Parse both op_sel:[...] and op_sel_hi:[...] (plus clamp), rejecting duplicate or unknown modifiers and high-half op_sel bits when op_sel_hi is not set. - For op_sel_hi=1 (f16) operands, extract the selected half (>> 16 when op_sel=1, else low 16 bits with low16_only=True) and widen via 16tof32(...) *before* applying |abs| and -/ eg(...) modifiers (matching ools/pixel_aot.py). - For _fma_mix_f32, emit via set_vf (honoring clamp and clearing low16_only on full 32-bit write); preserve untouched halves and low16_only semantics on mixlo/mixhi_f16. - ** ests/startup_gfx2hlsl_fma_mix_check.py**: - Pure-Python controls covering _fma_mix_f32, _fma_mixlo_f16, _fma_mixhi_f16, op_sel + op_sel_hi, bs/ eg widening order, inline f16 constants, -0, odd-d16 low16 tracking (op_sel=0 accepted, op_sel=1 refused), invalid modifiers/operands, and a negative control removing op_v_fma_mix_f32. - **CMakeLists.txt, .github/workflows/windows.yml, AGENTS.md**: Register startup_gfx2hlsl_fma_mix_check.py. ## Verification - **Commit**: `d4dddc32` (based on upstream/main 7092683a) - **Commands & Results**: - `python -B tests/startup_gfx2hlsl_fma_mix_check.py` -> PASS - `python -B tests/startup_image_load_d16_check.py` -> PASS - `python -B tests/startup_gfx2hlsl_handler_arity_check.py` -> PASS - `python -B tests/startup_gfx2hlsl_operand_count_check.py` -> PASS - `python -B tests/docs_links_check.py` -> PASS (19 Markdown files, 464 links) - `python -B tests/bidi_controls_check.py` -> PASS (1723 tracked files)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:51:30 +00:00
github-bot closed this pull request 2026-11-27 00:51:30 +00:00
Author
Owner

@⁠stan495 on GitHub · 2026-11-25 16:43 UTC · original

Closing in favor of #2055 (which already covers v_fma_mix_f32 + op_sel with WARP/hardware dispatch readbacks and handles negated inline/literal edge cases).

**@⁠stan495** on GitHub · 2026-11-25 16:43 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2431#issuecomment-7168443679) Closing in favor of #2055 (which already covers v_fma_mix_f32 + op_sel with WARP/hardware dispatch readbacks and handles negated inline/literal edge cases).

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.