Skip to content

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

Done

Description

@roansystemlabs

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.

Activity

  1. roansystemlabs commented on Nov 24, 2026

    @roansystemlabs
    ContributorAuthor

    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.

  2. added a commit that references this issue on Nov 24, 2026
    91f6bf6
  3. added a commit that references this issue on Nov 25, 2026
    9114b0a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions