shader: read constant operands of v_pk_fmac_f16 #117

Merged
Olima34 merged 1 commit from upstream-pr/117 into main 2026-11-26 18:09:23 +00:00
Olima34 commented 2026-11-26 17:18:43 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-26T17:18:43Z.


One of the #4 shapes: v_pk_fmac_f16 constant (2 refusals in the latest story-load run).

What. v_pk_fmac_f16 (VOP2, no op_sel) with a constant source was refused ("a constant operand of v_pk_fmac_f16"). fmac_half now reads the operand through the existing f16_operand, as the VOP3P path (packed_src) already does. The constant is the 32-bit value its two halves come from:

  • an inline float constant: its f16 in the low half, 0 in the high one;
  • an integer inline constant: its sign-extended 32 bits;
  • a literal: its own two halves.

Source. AMD's ISA text does not say this. LLVM's assembler does: llvm-mc -mcpu=gfx1030 encodes 0x3c00 as the inline 1.0 but needs a literal for 0x3c003c00, and encodes 0xffffffff as -1 but 0xffff as a literal. Written up in docs/native-host.md.

Tests.

  • packed_fmac_takes_constant_operands (gfx_refusal): inline float, inline integer and literal sources translate. Refused without the change.
  • packed_fmac_reads_constant_halves (valu_tests, Windows GPU/WARP): checks the values, an inline 1.0 multiplying the low halves alone and a literal giving each half its own factor.

victory-shader tests, Windows clippy and cargo xtask policy pass.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6631806761 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/117). Originally posted by [Olima34](https://github.com/Olima34) on 2026-11-26T17:18:43Z. --- One of the #4 shapes: `v_pk_fmac_f16` constant (2 refusals in the latest story-load run). **What.** `v_pk_fmac_f16` (VOP2, no `op_sel`) with a constant source was refused ("a constant operand of v_pk_fmac_f16"). `fmac_half` now reads the operand through the existing `f16_operand`, as the VOP3P path (`packed_src`) already does. The constant is the 32-bit value its two halves come from: - an inline float constant: its f16 in the low half, 0 in the high one; - an integer inline constant: its sign-extended 32 bits; - a literal: its own two halves. **Source.** AMD's ISA text does not say this. LLVM's assembler does: `llvm-mc -mcpu=gfx1030` encodes `0x3c00` as the inline `1.0` but needs a literal for `0x3c003c00`, and encodes `0xffffffff` as `-1` but `0xffff` as a literal. Written up in docs/native-host.md. **Tests.** - `packed_fmac_takes_constant_operands` (gfx_refusal): inline float, inline integer and literal sources translate. Refused without the change. - `packed_fmac_reads_constant_halves` (valu_tests, Windows GPU/WARP): checks the values, an inline 1.0 multiplying the low halves alone and a literal giving each half its own factor. victory-shader tests, Windows clippy and `cargo xtask policy` pass.
LakshanSivakumar commented 2026-11-26 18:09:48 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T18:09:48Z.


Merged, thanks. Constant operands of v_pk_fmac_f16 now translate, with a GPU value test.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7200125756 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/117#issuecomment-7200125756). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T18:09:48Z. --- Merged, thanks. Constant operands of `v_pk_fmac_f16` now translate, with a GPU value test.
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
LakshanSivakumar/Native-Victory-macOS!117
No description provided.