startup: gfx2hlsl translates v_interp_mov_f32 p10/p20 as the flat P0 value #1883

Closed
opened 2026-11-24 20:18:09 +00:00 by roansystemlabs · 1 comment
roansystemlabs commented 2026-11-24 20:18:09 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-24T20:18:09Z.


Problem

op_v_interp_mov_f32 in tools/startup/gfx2hlsl.py reads only the attribute operand. The parameter selector is never read, so p10 (P1 - P0) and p20 (P2 - P0) are translated as the flat P0 copy, with no refusal:

v_interp_mov_f32_e64 v1, p10, attr0.x   -> v1 = i.fparam0.x;
v_interp_mov_f32_e64 v1, p20, attr0.x   -> v1 = i.fparam0.x;
v_interp_mov_f32_e64 v1, p0,  attr0.x   -> v1 = i.fparam0.x;

The VINTRP (e32) form has the same result, and the shared decoder also prints its selector as a VGPR (v_interp_mov_f32_e32 v1, v0, attr0.x for p10, v2 for p0), where LLVM prints p10/p20/p0.

Reproduced on main at 3041aab1 by decoding the words and calling Stage.one() (translation only, no draw). The words follow the layout of the gfx10_asm_vop3.s vectors already in tests/rdna2_tools_check.py.

The output modifiers on the same handler (clamp, mul:2, ...) are handled by #1778; this issue is only about the selector, which is an operand, so a modifier-list guard does not see it.

Proposal

  • Decoder: print the VINTRP selector as LLVM does (p10, p20, p0) and report other values as an unsupported encoding.
  • gfx2hlsl: accept only p0; refuse p10/p20 by name in both encodings. Lowering them would need per-vertex attribute values (GetAttributeAtVertex, SM 6.1), which the FXC path does not have.

Verification

Source-built gfx1013 fixture (LLVM 15 llvm-mc) with p0, p10 and p20 in both encodings: the decoder output matches llvm-objdump, p0 still translates to the flat copy, p10/p20 are refused with the selector in the reason. Fail-first: removing the guard turns the refusal checks red. startup_flat_param_* stays green on WARP and hardware.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6590598395 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1890). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-24T20:18:09Z. --- ## Problem `op_v_interp_mov_f32` in `tools/startup/gfx2hlsl.py` reads only the attribute operand. The parameter selector is never read, so `p10` (P1 - P0) and `p20` (P2 - P0) are translated as the flat P0 copy, with no refusal: v_interp_mov_f32_e64 v1, p10, attr0.x -> v1 = i.fparam0.x; v_interp_mov_f32_e64 v1, p20, attr0.x -> v1 = i.fparam0.x; v_interp_mov_f32_e64 v1, p0, attr0.x -> v1 = i.fparam0.x; The VINTRP (e32) form has the same result, and the shared decoder also prints its selector as a VGPR (`v_interp_mov_f32_e32 v1, v0, attr0.x` for p10, `v2` for p0), where LLVM prints `p10`/`p20`/`p0`. Reproduced on `main` at `3041aab1` by decoding the words and calling `Stage.one()` (translation only, no draw). The words follow the layout of the gfx10_asm_vop3.s vectors already in `tests/rdna2_tools_check.py`. The output modifiers on the same handler (`clamp`, `mul:2`, ...) are handled by #1778; this issue is only about the selector, which is an operand, so a modifier-list guard does not see it. ## Proposal - Decoder: print the VINTRP selector as LLVM does (`p10`, `p20`, `p0`) and report other values as an unsupported encoding. - gfx2hlsl: accept only `p0`; refuse `p10`/`p20` by name in both encodings. Lowering them would need per-vertex attribute values (`GetAttributeAtVertex`, SM 6.1), which the FXC path does not have. ## Verification Source-built gfx1013 fixture (LLVM 15 `llvm-mc`) with `p0`, `p10` and `p20` in both encodings: the decoder output matches `llvm-objdump`, `p0` still translates to the flat copy, `p10`/`p20` are refused with the selector in the reason. Fail-first: removing the guard turns the refusal checks red. `startup_flat_param_*` stays green on WARP and hardware. AI-assisted.
roansystemlabs commented 2026-11-24 21:01:21 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-24T20:18:23Z.


I'll take this as a focused PR: print the VINTRP v_interp_mov_f32 selector as LLVM does in tools/disasm_rdna2.py, and in tools/startup/gfx2hlsl.py accept only p0, refusing p10/p20 by name in both encodings rather than lowering them (no per-vertex attribute access on the FXC path). Output modifiers stay with #1778; I'll rebase on it once it lands, and the plain-form control there will need p0 (src1 = 2) instead of src1 = 0, which is p10.

Verification: a source-built gfx1013 fixture (LLVM 15) with all three selectors in both encodings, decoder output compared with llvm-objdump, p0 unchanged, p10/p20 refused, a fail-first run with the guard removed, and startup_flat_param_* re-run on WARP and RTX 3070.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7143338619 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1890#issuecomment-7143338619). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-24T20:18:23Z. --- I'll take this as a focused PR: print the VINTRP `v_interp_mov_f32` selector as LLVM does in `tools/disasm_rdna2.py`, and in `tools/startup/gfx2hlsl.py` accept only `p0`, refusing `p10`/`p20` by name in both encodings rather than lowering them (no per-vertex attribute access on the FXC path). Output modifiers stay with #1778; I'll rebase on it once it lands, and the plain-form control there will need `p0` (src1 = 2) instead of src1 = 0, which is `p10`. Verification: a source-built gfx1013 fixture (LLVM 15) with all three selectors in both encodings, decoder output compared with `llvm-objdump`, `p0` unchanged, `p10`/`p20` refused, a fail-first run with the guard removed, and `startup_flat_param_*` re-run on WARP and RTX 3070. AI-assisted.
Sign in to join this conversation.
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#1883
No description provided.