Skip to content

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

Closed
stan495 wants to merge 1 commit into
R0Y00:mainfrom
stan495:startup/v-fma-mix-f32
Closed

stan495 wants to merge 1 commit into
R0Y00:mainfrom
stan495:startup/v-fma-mix-f32

Conversation

@stan495

@stan495 stan495 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

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 7092683)
  • 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

stan495 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

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 stan495 closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant