Lower v_interp_p1ll_f16 and v_interp_p2_f16 in the pixel stage #2045

Merged
Ybucaille merged 10 commits from upstream-pr/2052 into main 2026-11-25 06:11:14 +00:00
Ybucaille commented 2026-11-24 23:39:57 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-24T23:39:57Z.


Refs #1996 (item C)

Summary

tools/startup/gfx2hlsl.py refused v_interp_p1ll_f16 and v_interp_p2_f16 (VOP3, gfx10 encoding) in the pixel stage. This lowers the plain pair and refuses everything the fixture does not cover.

Semantics and sources

  • LLVM 15 VOP3Instructions.td: V_INTERP_P1LL_F16 is [f32, f32, i32], V_INTERP_P2_F16 is [f16, f32, i32, f32]. VOPInstructions.td VOP3Interp_gfx10: attr = Inst{37-32}, attrchan = Inst{39-38}, high = Inst{40}. IntrinsicsAMDGPU.td int_amdgcn_interp_p1_f16 / int_amdgcn_interp_p2_f16: "high selects whether high or low 16-bits are loaded from LDS".
  • Mesa 22.3 aco_instruction_selection.cpp, emit_interp_instr: v_interp_p1ll_f16 (coordinate i) into a v1, then v_interp_p2_f16 (coordinate j, p1 as third source) into a v2b.
  • p1ll: f32 = P0 + I * P10 from one binary16 half of the attribute channel. p2: P1 + J * P20, converted to binary16 into the low half of the destination.
  • The vertex stage exports binary16 pairs with exp ... compr, which gfx2hlsl already splits into four float channels. Half h of channel c is therefore float channel 2 * c + h of the parameter. The rasterizer interpolates, as for v_interp_p1_f32 / v_interp_p2_f32: p1ll records its destination, p2 emits (vD & 0xffff0000u) | f32tof16(i.paramN.<channel>).

v_interp_p1ll_f16 emits nothing because the rasterizer already interpolates; the expression emitted for v_interp_p2_f16 reads i.paramN as an already-interpolated value, so the two instructions do not compose into arithmetic in the output.

Refused (precisely)

Barycentrics: only the PERSP_CENTER entry pair (I in the first VGPR, J in the second; v0, v1 without hardware inputs, v2, v3 when PERSP_SAMPLE is also enabled, refused when PERSP_CENTER is not enabled), and only if no instruction of the program writes either register (a clobbered or swapped pair is refused). The existing f32 path ignores the operand and the SPI inputs are item E of #1996, so this reuses ps_hw_inputs and adds nothing else.

Omitted p1ll result: refused if anything other than the matching p2 reads its destination (between the pair, or after a p2 that wrote another register), if a branch or branch target lies between p1ll and p2 (p2 reachable without the p1ll), or on a backward branch. Upper 16 bits of the p2 destination: no source found (LLVM 15 VOP3Instructions.td types the result as f16 and states no high-half behaviour; no LLVM or Mesa tree here), so every read of them is refused; only a plain v_cvt_f32_f16 reading the low half consumes the result.

clamp, mul:/div: output modifiers, neg/abs and non-VGPR sources, channels z and w, high that differs between the pair, a p2 whose third source is not the matching p1ll result (also after an overwrite), an attribute that the vertex stage does not export with compr or that is also read as f32. v_interp_p1lv_f16 stays refused.

Files

tools/startup/gfx2hlsl.py, new tests/startup_gfx2hlsl_interp_f16_check.py, CMakeLists.txt (controls, warp, hardware tests), .github/workflows/windows.yml (binary and file list), docs/experiments.md.

Reproduce and results (Linux, Python 3.14, llvm-mc 23.1.5)

./out/pe-env/bin/python -B tests/startup_gfx2hlsl_interp_f16_check.py            # controls ok
./out/pe-env/bin/python -B tests/startup_gfx2hlsl_interp_f16_check.py binary /usr/bin/llvm-mc   # fixture words match llvm-mc
  • Varying triangle: without a device, the translated words equal the ISA arithmetic (p1ll then p2 over three different vertex pairs) at six barycentric points. The draw still uses the constant triangle and was not rerun.
  • Fixture: source-built vertex/pixel pair (constants 1.5, -2.0, 0.5, 3.0 as compr pairs). Translated words 3fc00000,c0000000,3f000000,40400000 equal the ISA-layout reference.
  • Negative controls: lowering removed -> Unsupported: v_interp_p1ll_f16; high inverted on the whole pair -> words swapped within each channel (c0000000,3fc00000,40400000,3f000000); every refusal above raises with its reason. On origin/main the check fails with Unsupported: v_interp_p1ll_f16.
  • Loop over all 24 tests/startup_gfx2hlsl_*_check.py, startup_translator_check.py, startup_flat_param_check.py, docs_links_check.py, rdna2_tools_check.py (no LLVM_LIB): all pass. git diff --check clean.
  • Not run here: draw (needs D3D12) and compile (the host DXC aborts with an LLVM assertion on any pixel shader with an input struct, existing translations included). Windows verification of startup_gfx2hlsl_interp_f16_warp / _hardware is needed.

Open points

  • Upper 16 bits of the p2 destination: unknown on gfx10, so their consumers are refused (not modelled).
  • The 2 * c + h mapping follows from the compr export layout used by gfx2hlsl; it was not checked against hardware output.
  • f32tof16 rounding vs the hardware mode register (round to nearest even by default) is not covered by the fixture's exactly representable values.
  • llvm-mc newer than 15 encodes the unused p1ll src2 as 128; binary clears the field before comparing.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6593671379 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2052). Originally posted by [Ybucaille](https://github.com/Ybucaille) on 2026-11-24T23:39:57Z. --- Refs #1996 (item C) ## Summary `tools/startup/gfx2hlsl.py` refused `v_interp_p1ll_f16` and `v_interp_p2_f16` (VOP3, gfx10 encoding) in the pixel stage. This lowers the plain pair and refuses everything the fixture does not cover. ## Semantics and sources - LLVM 15 `VOP3Instructions.td`: `V_INTERP_P1LL_F16` is `[f32, f32, i32]`, `V_INTERP_P2_F16` is `[f16, f32, i32, f32]`. `VOPInstructions.td` `VOP3Interp_gfx10`: attr = `Inst{37-32}`, attrchan = `Inst{39-38}`, high = `Inst{40}`. `IntrinsicsAMDGPU.td` `int_amdgcn_interp_p1_f16` / `int_amdgcn_interp_p2_f16`: "high selects whether high or low 16-bits are loaded from LDS". - Mesa 22.3 `aco_instruction_selection.cpp`, `emit_interp_instr`: `v_interp_p1ll_f16` (coordinate i) into a `v1`, then `v_interp_p2_f16` (coordinate j, p1 as third source) into a `v2b`. - p1ll: f32 = P0 + I * P10 from one binary16 half of the attribute channel. p2: P1 + J * P20, converted to binary16 into the low half of the destination. - The vertex stage exports binary16 pairs with `exp ... compr`, which gfx2hlsl already splits into four float channels. Half `h` of channel `c` is therefore float channel `2 * c + h` of the parameter. The rasterizer interpolates, as for `v_interp_p1_f32` / `v_interp_p2_f32`: p1ll records its destination, p2 emits `(vD & 0xffff0000u) | f32tof16(i.paramN.<channel>)`. `v_interp_p1ll_f16` emits nothing because the rasterizer already interpolates; the expression emitted for `v_interp_p2_f16` reads `i.paramN` as an already-interpolated value, so the two instructions do not compose into arithmetic in the output. ## Refused (precisely) Barycentrics: only the PERSP_CENTER entry pair (I in the first VGPR, J in the second; v0, v1 without hardware inputs, v2, v3 when PERSP_SAMPLE is also enabled, refused when PERSP_CENTER is not enabled), and only if no instruction of the program writes either register (a clobbered or swapped pair is refused). The existing f32 path ignores the operand and the SPI inputs are item E of #1996, so this reuses `ps_hw_inputs` and adds nothing else. Omitted p1ll result: refused if anything other than the matching p2 reads its destination (between the pair, or after a p2 that wrote another register), if a branch or branch target lies between p1ll and p2 (p2 reachable without the p1ll), or on a backward branch. Upper 16 bits of the p2 destination: no source found (LLVM 15 `VOP3Instructions.td` types the result as f16 and states no high-half behaviour; no LLVM or Mesa tree here), so every read of them is refused; only a plain `v_cvt_f32_f16` reading the low half consumes the result. `clamp`, `mul:`/`div:` output modifiers, neg/abs and non-VGPR sources, channels z and w, `high` that differs between the pair, a p2 whose third source is not the matching p1ll result (also after an overwrite), an attribute that the vertex stage does not export with `compr` or that is also read as f32. `v_interp_p1lv_f16` stays refused. ## Files `tools/startup/gfx2hlsl.py`, new `tests/startup_gfx2hlsl_interp_f16_check.py`, `CMakeLists.txt` (controls, warp, hardware tests), `.github/workflows/windows.yml` (binary and file list), `docs/experiments.md`. ## Reproduce and results (Linux, Python 3.14, llvm-mc 23.1.5) ``` ./out/pe-env/bin/python -B tests/startup_gfx2hlsl_interp_f16_check.py # controls ok ./out/pe-env/bin/python -B tests/startup_gfx2hlsl_interp_f16_check.py binary /usr/bin/llvm-mc # fixture words match llvm-mc ``` - Varying triangle: without a device, the translated words equal the ISA arithmetic (p1ll then p2 over three different vertex pairs) at six barycentric points. The draw still uses the constant triangle and was not rerun. - Fixture: source-built vertex/pixel pair (constants 1.5, -2.0, 0.5, 3.0 as `compr` pairs). Translated words `3fc00000,c0000000,3f000000,40400000` equal the ISA-layout reference. - Negative controls: lowering removed -> `Unsupported: v_interp_p1ll_f16`; high inverted on the whole pair -> words swapped within each channel (`c0000000,3fc00000,40400000,3f000000`); every refusal above raises with its reason. On `origin/main` the check fails with `Unsupported: v_interp_p1ll_f16`. - Loop over all 24 `tests/startup_gfx2hlsl_*_check.py`, `startup_translator_check.py`, `startup_flat_param_check.py`, `docs_links_check.py`, `rdna2_tools_check.py` (no LLVM_LIB): all pass. `git diff --check` clean. - Not run here: `draw` (needs D3D12) and `compile` (the host DXC aborts with an LLVM assertion on any pixel shader with an input struct, existing translations included). Windows verification of `startup_gfx2hlsl_interp_f16_warp` / `_hardware` is needed. ## Open points - Upper 16 bits of the p2 destination: unknown on gfx10, so their consumers are refused (not modelled). - The `2 * c + h` mapping follows from the `compr` export layout used by gfx2hlsl; it was not checked against hardware output. - `f32tof16` rounding vs the hardware mode register (round to nearest even by default) is not covered by the fixture's exactly representable values. - llvm-mc newer than 15 encodes the unused p1ll src2 as 128; `binary` clears the field before comparing. AI-assisted.
R0Y00 commented 2026-11-25 01:01:20 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T00:11:04Z.

Review: CHANGES_REQUESTED


The constant-triangle case passed independently on WARP and RTX 4060 Laptop, and swapping the halves changed all four expected words. The current matcher accepts two cases outside what that establishes:

  • P1 and P2 accept any plain VGPR as the barycentric operand, then ignore its value and use the desktop interpolant. Please require the supported entry barycentric pair and prove those registers still hold the entry values. Include a clobbered or swapped input as a refusal control and a varying triangle as a positive control.
  • P1 emits no write, so another consumer of its destination can read stale data. P2 can also preserve the high half of the stale destination when it aliases P1. Please restrict the omitted P1 result to the matched P2 use on all supported paths and either establish the observable upper-half behavior or refuse consumers of bits that are not modeled. Include an intervening read and a branch that reaches P2 without the matching P1.

The current constant triangle checks packed-half selection, so preserve it while adding those cases.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6049522601 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2052#pullrequestreview-6049522601). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T00:11:04Z. **Review:** CHANGES_REQUESTED --- The constant-triangle case passed independently on WARP and RTX 4060 Laptop, and swapping the halves changed all four expected words. The current matcher accepts two cases outside what that establishes: - P1 and P2 accept any plain VGPR as the barycentric operand, then ignore its value and use the desktop interpolant. Please require the supported entry barycentric pair and prove those registers still hold the entry values. Include a clobbered or swapped input as a refusal control and a varying triangle as a positive control. - P1 emits no write, so another consumer of its destination can read stale data. P2 can also preserve the high half of the stale destination when it aliases P1. Please restrict the omitted P1 result to the matched P2 use on all supported paths and either establish the observable upper-half behavior or refuse consumers of bits that are not modeled. Include an intervening read and a branch that reaches P2 without the matching P1. The current constant triangle checks packed-half selection, so preserve it while adding those cases.
ChazY11 commented 2026-11-25 01:01:58 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T23:46:32Z.


Five mutations caught — and one input shape that escapes as AttributeError instead of Unsupported

out/pe-env/Scripts/python.exe -B tests/startup_gfx2hlsl_interp_f16_check.py
controls ok      exit 0
mutation result
the float-channel mapping 2 * chan + high → chan + high caught
p2 stops preserving the destination's upper half caught
channels z/w allowed caught
the p1→p2 continuation check dropped caught
arbitrary modifiers accepted caught

The first is the one that encodes the whole attrN.x = (param.x, param.y) splitting rule, and it is pinned — good.

The defect: an attribute reference without a channel component crashes the translator

interp_f16 does

m = re.fullmatch(r'attr(\d+)\.([xyzw])', ops[2])
chan = 'xyzw'.index(m.group(2))

with no check that m matched. The VGPR-operands loop just before it covers ops[0], ops[1] and ops[3:], not ops[2], so nothing has validated
this token yet. Measured with a probe Stage:

v_interp_p1ll_f16 v5, v6, attr0.x      -> lines=[]                      (fine)
v_interp_p1ll_f16 v5, v6, attr0        -> AttributeError ESCAPED: 'NoneType' object has no attribute 'group'
v_interp_p1ll_f16 v5, v6, attr0.z      -> Unsupported: ... only the x and y channels
v_interp_p1ll_f16 v5, v6, attr99.y     -> lines=[]                      (no bounds check)
v_interp_p1ll_f16 s5, v6, attr0.x      -> Unsupported: ... only plain VGPRs

The traceback ends inside Stage.one → lower, so this is not a test-only path: any shader whose assembly spells the attribute without a component
turns a refusal into a crash of the translator, and the refusal census never records it. The rest of the file's contract is "refuse with
Unsupported, never raise", which is what the try around lower is for in the other handlers.

One-line fix in the shape the file already uses:

m = re.fullmatch(r'attr(\d+)\.([xyzw])', ops[2])
if not m:
    raise Unsupported('%s interpolant %s: expected attrN.x/.y/.z/.w' % (op, ops[2]))

attr99.y is a separate, smaller question: it is accepted here and only fails later if the vertex stage did not export that parameter. If the later
check covers it, ignore this; if not, the bound belongs here too, because attrN beyond the export count means the translator invented a channel.

What I did not check

The claim that the rasterizer performs the interpolation, so v_interp_p1ll_f16 can emit nothing. That is a modelling decision I cannot test without a
draw; the fixture asserts the emptiness, not the reason. Worth saying in the description that the emitted p2 expression reads i.paramN as an
already-interpolated value, because a reader who expects the two instructions to compose into arithmetic will look for it and not find it.

Notes

  • AI-assisted review.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147780343 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2052#issuecomment-7147780343). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T23:46:32Z. --- ## Five mutations caught — and one input shape that escapes as `AttributeError` instead of `Unsupported` ```powershell out/pe-env/Scripts/python.exe -B tests/startup_gfx2hlsl_interp_f16_check.py controls ok exit 0 ``` | mutation | result | |---|---| | the float-channel mapping `2 * chan + high` → `chan + high` | **caught** | | p2 stops preserving the destination's upper half | **caught** | | channels z/w allowed | **caught** | | the p1→p2 continuation check dropped | **caught** | | arbitrary modifiers accepted | **caught** | The first is the one that encodes the whole `attrN.x = (param.x, param.y)` splitting rule, and it is pinned — good. ## The defect: an attribute reference without a channel component crashes the translator `interp_f16` does ```python m = re.fullmatch(r'attr(\d+)\.([xyzw])', ops[2]) chan = 'xyzw'.index(m.group(2)) ``` with no check that `m` matched. The VGPR-operands loop just before it covers `ops[0], ops[1]` and `ops[3:]`, not `ops[2]`, so nothing has validated this token yet. Measured with a probe Stage: ```text v_interp_p1ll_f16 v5, v6, attr0.x -> lines=[] (fine) v_interp_p1ll_f16 v5, v6, attr0 -> AttributeError ESCAPED: 'NoneType' object has no attribute 'group' v_interp_p1ll_f16 v5, v6, attr0.z -> Unsupported: ... only the x and y channels v_interp_p1ll_f16 v5, v6, attr99.y -> lines=[] (no bounds check) v_interp_p1ll_f16 s5, v6, attr0.x -> Unsupported: ... only plain VGPRs ``` The traceback ends inside `Stage.one` → `lower`, so this is not a test-only path: any shader whose assembly spells the attribute without a component turns a refusal into a crash of the translator, and the refusal census never records it. The rest of the file's contract is "refuse with `Unsupported`, never raise", which is what the `try` around `lower` is for in the other handlers. One-line fix in the shape the file already uses: ```python m = re.fullmatch(r'attr(\d+)\.([xyzw])', ops[2]) if not m: raise Unsupported('%s interpolant %s: expected attrN.x/.y/.z/.w' % (op, ops[2])) ``` `attr99.y` is a separate, smaller question: it is accepted here and only fails later if the vertex stage did not export that parameter. If the later check covers it, ignore this; if not, the bound belongs here too, because `attrN` beyond the export count means the translator invented a channel. ## What I did not check The claim that the rasterizer performs the interpolation, so `v_interp_p1ll_f16` can emit nothing. That is a modelling decision I cannot test without a draw; the fixture asserts the emptiness, not the reason. Worth saying in the description that the emitted `p2` expression reads `i.paramN` as an already-interpolated value, because a reader who expects the two instructions to compose into arithmetic will look for it and not find it. ## Notes - AI-assisted review.
ChazY11 commented 2026-11-25 01:01:58 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T23:47:37Z.


Correction to the severity in my comment above: the census does record it, as internal error

I wrote that "the refusal census never records it". That is wrong, and the actual behaviour is worth being precise about, because it decides how bad
this is.

Stage.translate (line 572–583) already wraps every handler:

try:
    term = self.one(name, asm)
except Unsupported as reason:
    if refusals is None:
        raise
    refusals.append((str(reason), self.kind))
    continue
except Exception as error:
    if refusals is None:
        raise
    refusals.append((handler_error(name, error, refusals), self.kind))
    continue

So the two paths are:

path behaviour
refusals is None (a single-shader translation) raises AttributeError — a traceback instead of a refusal
refusals list (the census, --refusals=DIR) recorded as internal error in v_interp_p1ll_f16: AttributeError

Measured on the branch:

refusals=False -> raised AttributeError: 'NoneType' object has no attribute 'group'
refusals=True  -> raised AttributeError: ...            (direct one() call)
handler_error with a non-empty list -> 'internal error in v_interp_p1ll_f16: AttributeError'
handler_error with an empty list    -> 'translator crash in v_interp_p1ll_f16: AttributeError'

Why it still matters, stated correctly

  • The entry says internal error, not unsupported. That is the project's own marker for "the translator broke", and #1723's census counts
    refusals to find missing lowerings — a handler bug in that list inflates the census with an entry nobody can act on, and hides the fact that the
    operand shape was simply malformed.
  • The single-shader path has no such wrapper, so translate() on a request containing this spelling exits with a traceback rather than a refusal
    line, which is a worse outcome than the old "unsupported instruction" it replaces.

So the fix is still the same one line — check m before .group — but I should not have described the effect as the census silently losing the
record. It records it, mislabelled.

Also worth knowing: the same shape existed before this PR

On main, v_interp_p1ll_f16 has no handler at all (op_v_interp_p1ll_f16 is absent), so the old behaviour was a clean Unsupported. This PR
introduces the handler and the crash together, which is why the fix belongs in this PR rather than in a follow-up.

Notes

  • AI-assisted, self-corrected after reading Stage.translate instead of assuming the refusal path.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147800446 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2052#issuecomment-7147800446). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T23:47:37Z. --- ## Correction to the severity in my comment above: the census does record it, as `internal error` I wrote that "the refusal census never records it". That is wrong, and the actual behaviour is worth being precise about, because it decides how bad this is. `Stage.translate` (line 572–583) already wraps every handler: ```python try: term = self.one(name, asm) except Unsupported as reason: if refusals is None: raise refusals.append((str(reason), self.kind)) continue except Exception as error: if refusals is None: raise refusals.append((handler_error(name, error, refusals), self.kind)) continue ``` So the two paths are: | path | behaviour | |---|---| | `refusals is None` (a single-shader translation) | **raises `AttributeError`** — a traceback instead of a refusal | | `refusals` list (the census, `--refusals=DIR`) | recorded as `internal error in v_interp_p1ll_f16: AttributeError` | Measured on the branch: ```text refusals=False -> raised AttributeError: 'NoneType' object has no attribute 'group' refusals=True -> raised AttributeError: ... (direct one() call) handler_error with a non-empty list -> 'internal error in v_interp_p1ll_f16: AttributeError' handler_error with an empty list -> 'translator crash in v_interp_p1ll_f16: AttributeError' ``` ## Why it still matters, stated correctly - The entry says **`internal error`**, not `unsupported`. That is the project's own marker for "the translator broke", and `#1723`'s census counts refusals to find missing lowerings — a handler bug in that list inflates the census with an entry nobody can act on, and hides the fact that the operand shape was simply malformed. - The single-shader path has no such wrapper, so `translate()` on a request containing this spelling exits with a traceback rather than a refusal line, which is a worse outcome than the old "unsupported instruction" it replaces. So the fix is still the same one line — check `m` before `.group` — but I should not have described the effect as the census silently losing the record. It records it, mislabelled. ## Also worth knowing: the same shape existed before this PR On `main`, `v_interp_p1ll_f16` has no handler at all (`op_v_interp_p1ll_f16` is absent), so the old behaviour was a clean `Unsupported`. This PR introduces the handler and the crash together, which is why the fix belongs in this PR rather than in a follow-up. ## Notes - AI-assisted, self-corrected after reading `Stage.translate` instead of assuming the refusal path.
Ybucaille commented 2026-11-25 01:01:59 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-24T23:51:57Z.


Thanks for the review.

Fixed in 21ad43ae: an interpolant without a channel (attr0) now raises Unsupported ("expected attrN.x/.y/.z/.w") instead of escaping as an AttributeError. The check has controls for both v_interp_p1ll_f16 and v_interp_p2_f16.

On attr99.y: no bound is added in interp_f16. An attribute the vertex stage does not export is already refused later in the pipeline with Unsupported; a new control moves the pair to attr5 and shows the refusal. (attr99 itself is not encodable, the field is 6 bits.)

The description now says that v_interp_p1ll_f16 emits nothing because the rasterizer already interpolates, and that the p2 expression reads i.paramN as an already-interpolated value.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147880744 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2052#issuecomment-7147880744). Originally posted by [Ybucaille](https://github.com/Ybucaille) on 2026-11-24T23:51:57Z. --- Thanks for the review. Fixed in 21ad43ae: an interpolant without a channel (`attr0`) now raises `Unsupported` ("expected attrN.x/.y/.z/.w") instead of escaping as an `AttributeError`. The check has controls for both `v_interp_p1ll_f16` and `v_interp_p2_f16`. On `attr99.y`: no bound is added in `interp_f16`. An attribute the vertex stage does not export is already refused later in the pipeline with `Unsupported`; a new control moves the pair to `attr5` and shows the refusal. (`attr99` itself is not encodable, the field is 6 bits.) The description now says that `v_interp_p1ll_f16` emits nothing because the rasterizer already interpolates, and that the `p2` expression reads `i.paramN` as an already-interpolated value. AI-assisted.
Its3rr0rsWRLD commented 2026-11-25 01:02:00 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Its3rr0rsWRLD on 2026-11-24T23:59:36Z.


Windows run of the _warp / _hardware draws for #2052, tested at head 21ad43aea0a03dfaabdb1bed565b4e8951b6c56e ("Refuse attribute operands without a channel in interp_f16"), detached checkout of pull/2052/head.

Environment

  • Windows 11 26H2, build 26300.9974
  • Hardware adapter: NVIDIA GeForce RTX 4070 Ti, driver 32.0.16.1088 (vendor 10de, device 2782)
  • WARP: Microsoft Basic Render Driver, d3d10warp.dll 10.0.26100.9818
  • D3D12 debug layer: enabled in both draws (debug_layer=enabled)
  • DXC 10.0.26100.0 (Windows SDK), MSVC release preset, built target: offscreen_check

Command

cmake --preset release
ninja -C out\build\release -j 4 offscreen_check
ctest --preset release --no-tests=error -R startup_gfx2hlsl_interp_f16 --output-on-failure

Results

Test Result
startup_gfx2hlsl_interp_f16_controls pass
startup_gfx2hlsl_interp_f16_warp pass
startup_gfx2hlsl_interp_f16_hardware pass
  • Both draws read back 3fc00000,c0000000,3f000000,40400000 from the translated pair, with debug_errors=0 debug_warnings=0 on WARP and on the RTX 4070 Ti.
  • The high-half-inverted negative control read c0000000,3fc00000,40400000,3f000000 and failed as expected on both adapters.
  • All refusal controls printed in the controls run (including the new "without a channel" ones) reported controls ok.

Not run: the binary mode of tests/startup_gfx2hlsl_interp_f16_check.py (llvm-mc fixture comparison) needs llvm-mc, which is not available on this Windows machine, so it was not exercised here.

Run by Claude (AI-assisted).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7148018238 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2052#issuecomment-7148018238). Originally posted by [Its3rr0rsWRLD](https://github.com/Its3rr0rsWRLD) on 2026-11-24T23:59:36Z. --- Windows run of the `_warp` / `_hardware` draws for #2052, tested at head `21ad43aea0a03dfaabdb1bed565b4e8951b6c56e` ("Refuse attribute operands without a channel in interp_f16"), detached checkout of `pull/2052/head`. **Environment** - Windows 11 26H2, build 26300.9974 - Hardware adapter: NVIDIA GeForce RTX 4070 Ti, driver 32.0.16.1088 (vendor 10de, device 2782) - WARP: Microsoft Basic Render Driver, d3d10warp.dll 10.0.26100.9818 - D3D12 debug layer: enabled in both draws (`debug_layer=enabled`) - DXC 10.0.26100.0 (Windows SDK), MSVC release preset, built target: `offscreen_check` **Command** ``` cmake --preset release ninja -C out\build\release -j 4 offscreen_check ctest --preset release --no-tests=error -R startup_gfx2hlsl_interp_f16 --output-on-failure ``` **Results** | Test | Result | |---|---| | `startup_gfx2hlsl_interp_f16_controls` | pass | | `startup_gfx2hlsl_interp_f16_warp` | pass | | `startup_gfx2hlsl_interp_f16_hardware` | pass | - Both draws read back `3fc00000,c0000000,3f000000,40400000` from the translated pair, with `debug_errors=0 debug_warnings=0` on WARP and on the RTX 4070 Ti. - The high-half-inverted negative control read `c0000000,3fc00000,40400000,3f000000` and failed as expected on both adapters. - All refusal controls printed in the controls run (including the new "without a channel" ones) reported `controls ok`. **Not run:** the `binary` mode of `tests/startup_gfx2hlsl_interp_f16_check.py` (llvm-mc fixture comparison) needs llvm-mc, which is not available on this Windows machine, so it was not exercised here. Run by Claude (AI-assisted).
Ybucaille commented 2026-11-25 01:02:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-25T00:05:35Z.


Windows run by 3rr0r (thanks!) on the current head (21ad43ae):

  • startup_gfx2hlsl_interp_f16_hardware: passes on an RTX 4070 Ti (driver 32.0.16.1088).
  • startup_gfx2hlsl_interp_f16_warp: passes on WARP.
  • Both read back the expected values with the D3D12 debug layer on, zero errors or warnings.
  • The negative control fails as intended, and the refusal checks pass, including the new attr0 controls.
  • Not run there: the binary llvm-mc comparison (tool not installed on that machine); it passes on Linux with llvm-mc.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7148129850 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2052#issuecomment-7148129850). Originally posted by [Ybucaille](https://github.com/Ybucaille) on 2026-11-25T00:05:35Z. --- Windows run by 3rr0r (thanks!) on the current head (21ad43ae): - `startup_gfx2hlsl_interp_f16_hardware`: passes on an RTX 4070 Ti (driver 32.0.16.1088). - `startup_gfx2hlsl_interp_f16_warp`: passes on WARP. - Both read back the expected values with the D3D12 debug layer on, zero errors or warnings. - The negative control fails as intended, and the refusal checks pass, including the new `attr0` controls. - Not run there: the `binary` llvm-mc comparison (tool not installed on that machine); it passes on Linux with llvm-mc. AI-assisted.
Ybucaille commented 2026-11-25 01:02:04 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-25T00:21:13Z.


Thanks for the review. Addressed in f3638e76.

Barycentric operand. Both instructions now accept only the PERSP_CENTER entry pair: I in the first register and J in the second (v0, v1 when the pixel inputs are not given, as before; the pair moves to v2, v3 when PERSP_SAMPLE is also enabled, and the pair is refused when PERSP_CENTER is not enabled). It reuses the ps_hw_inputs layout already in Pipeline; the f32 path ignores the operand and the SPI inputs are item E of #1996, so nothing new is added there. A program that writes either register anywhere is refused, so the registers still hold the entry values at every use. Refusal controls: I clobbered, J clobbered, I and J swapped, one operand on v2 / v0, PERSP_CENTER at v2, v3, PERSP_CENTER not enabled. Positive controls: unrelated reads and writes accepted; a varying triangle (three different binary16 pairs) at six barycentric points gives translated words equal to the ISA arithmetic (p1ll then p2).

Omitted p1ll result. It is allowed only when the p2 is the sole reader of its destination: a read between the pair is refused, a read after a p2 that wrote another register is refused, and a branch or branch target between p1ll and p2 (p2 reachable without its p1ll) is refused, as is any backward branch. Controls for each.

Upper half of the p2 result. I found no source for the gfx10 behaviour (LLVM 15 types the result as f16 and states nothing about the high half), so any read of those 16 bits is refused; only a plain v_cvt_f32_f16 of the low half consumes the result. Controls: a shift and an export of the destination.

Each new control fails on the previous code and on a version with the corresponding check removed. Linux results: the check (controls and binary /usr/bin/llvm-mc), all startup_gfx2hlsl_*_check.py, startup_translator_check.py, startup_flat_param_check.py, docs_links_check.py pass; git diff --check is clean. The draws were not rerun and need to be rerun under Windows (startup_gfx2hlsl_interp_f16_warp / _hardware); the draw still uses the constant triangle, the varying triangle is checked on the CPU only.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7148419876 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2052#issuecomment-7148419876). Originally posted by [Ybucaille](https://github.com/Ybucaille) on 2026-11-25T00:21:13Z. --- Thanks for the review. Addressed in f3638e76. **Barycentric operand.** Both instructions now accept only the PERSP_CENTER entry pair: I in the first register and J in the second (v0, v1 when the pixel inputs are not given, as before; the pair moves to v2, v3 when PERSP_SAMPLE is also enabled, and the pair is refused when PERSP_CENTER is not enabled). It reuses the `ps_hw_inputs` layout already in `Pipeline`; the f32 path ignores the operand and the SPI inputs are item E of #1996, so nothing new is added there. A program that writes either register anywhere is refused, so the registers still hold the entry values at every use. Refusal controls: I clobbered, J clobbered, I and J swapped, one operand on v2 / v0, PERSP_CENTER at v2, v3, PERSP_CENTER not enabled. Positive controls: unrelated reads and writes accepted; a varying triangle (three different binary16 pairs) at six barycentric points gives translated words equal to the ISA arithmetic (p1ll then p2). **Omitted p1ll result.** It is allowed only when the p2 is the sole reader of its destination: a read between the pair is refused, a read after a p2 that wrote another register is refused, and a branch or branch target between p1ll and p2 (p2 reachable without its p1ll) is refused, as is any backward branch. Controls for each. **Upper half of the p2 result.** I found no source for the gfx10 behaviour (LLVM 15 types the result as f16 and states nothing about the high half), so any read of those 16 bits is refused; only a plain `v_cvt_f32_f16` of the low half consumes the result. Controls: a shift and an export of the destination. Each new control fails on the previous code and on a version with the corresponding check removed. Linux results: the check (controls and `binary /usr/bin/llvm-mc`), all `startup_gfx2hlsl_*_check.py`, `startup_translator_check.py`, `startup_flat_param_check.py`, `docs_links_check.py` pass; `git diff --check` is clean. The draws were not rerun and need to be rerun under Windows (`startup_gfx2hlsl_interp_f16_warp` / `_hardware`); the draw still uses the constant triangle, the varying triangle is checked on the CPU only. AI-assisted.
denn0x commented 2026-11-25 01:02:05 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-25T00:26:40Z.


Thanks. I ran this on the head (21ad43ae). The controls pass: python -B tests/startup_gfx2hlsl_interp_f16_check.py prints controls ok, and startup_image_sample_l_check.py, startup_image_3d_check.py and startup_translator_check.py still pass. Two findings, one of them a wrong translation.

1. op_sel bit 3 on v_interp_p2_f16 is silently ignored.

  • Mesa ACO emits v_interp_p2_hi_f16 as v_interp_p2_f16 with opsel = 0x8 (aco_assembler.cpp: VOP3 word 0, bits 14:11, so bit 14). The 16-bit result then goes to the HIGH half of vD and the low half is kept.

  • disasm_rdna2.py does not print that bit (I did not check LLVM 15's disassembler), so the operand list is identical to the plain form.

  • Reproduction. In the PR's own PS_WORDS, set bit 14 of word 0 of the second instruction:

    hi = patch(PS_WORDS, 1, w0=1 << 14)   # v_interp_p2_f16 v4, v1, attr0.x, v4 with op_sel 0x8
    
    • The decoded line is unchanged.
    • The translation is the same text as without the bit, v4 = (v4 & 0xffff0000u) | f32tof16(i.param0.x);.
    • The hardware would leave v4's low half alone and write the high half.
  • This form occurs in practice. In an aggregate scan of a private corpus it appears in about 5 % of the pixel programs that use the pair.

  • Suggested fix. Read the bit from the instruction word and either lower it as the high-half write ((vD & 0xffffu) | (f32tof16(x) << 16)) or refuse any op_sel other than 0. Add a control with the bit set.

2. Only compr vertex exports are accepted, which is narrower than the programs that use the pair.

  • In the same aggregate scan, every program pair that uses v_interp_p1ll_f16 exports the attribute as a plain 32-bit word: the vertex stage packs the halves into the word itself and exports without compr. I found no compr param export at all among them.
  • About a third of them also read attrN.z / .w.
  • Your own control "attribute not exported with compr" shows that a plain export is refused. So, judging from the export flags, the lowering would refuse all of these pairs. That is correctly refused, but it does not reach them yet. (In my local sweep most of them stop earlier in the vertex stage, so I could not observe the refusal itself.)
  • The general form. For a plain export, half h of 32-bit channel c is f16tof32(word_c >> 16 * h). The vertex stage can export those halves as two extra interpolated float4 copies, the pixel stage reads the matching copy, and compr becomes the special case.
  • I tried a second, independent implementation of that form on your compr fixture, and it got it wrong. That makes your fixture a useful control for whoever generalises this: the plain and compr cases need different mappings.

Neither point affects your controls. Both need a fixture: (1) an op_sel 0x8 instruction, and (2) a plain export of packed halves (for example built with v_cvt_pkrtz_f16_f32), including channel z.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7148515784 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2052#issuecomment-7148515784). Originally posted by [denn0x](https://github.com/denn0x) on 2026-11-25T00:26:40Z. --- Thanks. I ran this on the head (21ad43ae). The controls pass: `python -B tests/startup_gfx2hlsl_interp_f16_check.py` prints `controls ok`, and `startup_image_sample_l_check.py`, `startup_image_3d_check.py` and `startup_translator_check.py` still pass. Two findings, one of them a wrong translation. **1. `op_sel` bit 3 on `v_interp_p2_f16` is silently ignored.** - Mesa ACO emits `v_interp_p2_hi_f16` as `v_interp_p2_f16` with `opsel = 0x8` (`aco_assembler.cpp`: VOP3 word 0, bits 14:11, so bit 14). The 16-bit result then goes to the HIGH half of vD and the low half is kept. - `disasm_rdna2.py` does not print that bit (I did not check LLVM 15's disassembler), so the operand list is identical to the plain form. - **Reproduction.** In the PR's own `PS_WORDS`, set bit 14 of word 0 of the second instruction: ```python hi = patch(PS_WORDS, 1, w0=1 << 14) # v_interp_p2_f16 v4, v1, attr0.x, v4 with op_sel 0x8 ``` - The decoded line is unchanged. - The translation is the same text as without the bit, `v4 = (v4 & 0xffff0000u) | f32tof16(i.param0.x);`. - The hardware would leave v4's low half alone and write the high half. - This form occurs in practice. In an aggregate scan of a private corpus it appears in about 5 % of the pixel programs that use the pair. - **Suggested fix.** Read the bit from the instruction word and either lower it as the high-half write (`(vD & 0xffffu) | (f32tof16(x) << 16)`) or refuse any `op_sel` other than 0. Add a control with the bit set. **2. Only `compr` vertex exports are accepted, which is narrower than the programs that use the pair.** - In the same aggregate scan, every program pair that uses `v_interp_p1ll_f16` exports the attribute as a plain 32-bit word: the vertex stage packs the halves into the word itself and exports without `compr`. I found no `compr` param export at all among them. - About a third of them also read `attrN.z` / `.w`. - Your own control "attribute not exported with compr" shows that a plain export is refused. So, judging from the export flags, the lowering would refuse all of these pairs. That is correctly refused, but it does not reach them yet. (In my local sweep most of them stop earlier in the vertex stage, so I could not observe the refusal itself.) - **The general form.** For a plain export, half h of 32-bit channel c is `f16tof32(word_c >> 16 * h)`. The vertex stage can export those halves as two extra interpolated float4 copies, the pixel stage reads the matching copy, and `compr` becomes the special case. - I tried a second, independent implementation of that form on your `compr` fixture, and it got it wrong. That makes your fixture a useful control for whoever generalises this: the plain and `compr` cases need different mappings. Neither point affects your controls. Both need a fixture: (1) an `op_sel` 0x8 instruction, and (2) a plain export of packed halves (for example built with `v_cvt_pkrtz_f16_f32`), including channel z.
Ybucaille commented 2026-11-25 01:02:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-25T00:33:28Z.


Thanks for the careful review, @denn0x.

1. op_sel on v_interp_p2_f16. Reproduced on f3638e76: with bit 14 of word 0 set, the translation was the same text as the plain form. Fixed in 877b27d0 by refusing it: any op_sel bit (word 0 bits 11-14) on v_interp_p1ll_f16 or v_interp_p2_f16 is now Unsupported. I chose the refusal over the high-half write because this PR already refuses any read of the upper 16 bits of the p2 result, so a p2_hi result could not be consumed yet. high is unaffected: it is the attribute half, in bit 8 of the second dword, and the fixture still translates. I also checked the other VOP3 fields of both words. Clamp and omod were already refused, abs and neg were too (as non-plain-VGPR operands), and op_sel was the only bit that was silently ignored. Controls: the four op_sel bits on each instruction (8 refusals). On the previous code the first of them is translated.

2. Plain 32-bit exports. Agreed, and thanks for the scan. We'll take the general form as a follow-up PR once this one lands: halves of a plain exported channel passed as extra interpolated copies, channels z and w included, with a fixture that packs them using v_cvt_pkrtz_f16_f32. The compr fixture stays as a control, since the two cases need different mappings.

Linux: the interp_f16 check (controls ok), all startup_gfx2hlsl_*_check.py, startup_translator_check.py, startup_flat_param_check.py and docs_links_check.py pass. git diff --check is clean. The commit only adds refusals and leaves the drawn fixture unchanged, so a Windows draw run on f3638e76 still applies to 877b27d0.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7148633401 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2052#issuecomment-7148633401). Originally posted by [Ybucaille](https://github.com/Ybucaille) on 2026-11-25T00:33:28Z. --- Thanks for the careful review, @denn0x. **1. `op_sel` on `v_interp_p2_f16`.** Reproduced on f3638e76: with bit 14 of word 0 set, the translation was the same text as the plain form. Fixed in 877b27d0 by refusing it: any `op_sel` bit (word 0 bits 11-14) on `v_interp_p1ll_f16` or `v_interp_p2_f16` is now `Unsupported`. I chose the refusal over the high-half write because this PR already refuses any read of the upper 16 bits of the p2 result, so a `p2_hi` result could not be consumed yet. `high` is unaffected: it is the attribute half, in bit 8 of the second dword, and the fixture still translates. I also checked the other VOP3 fields of both words. Clamp and omod were already refused, abs and neg were too (as non-plain-VGPR operands), and `op_sel` was the only bit that was silently ignored. Controls: the four `op_sel` bits on each instruction (8 refusals). On the previous code the first of them is translated. **2. Plain 32-bit exports.** Agreed, and thanks for the scan. We'll take the general form as a follow-up PR once this one lands: halves of a plain exported channel passed as extra interpolated copies, channels z and w included, with a fixture that packs them using `v_cvt_pkrtz_f16_f32`. The `compr` fixture stays as a control, since the two cases need different mappings. Linux: the interp_f16 check (`controls ok`), all `startup_gfx2hlsl_*_check.py`, `startup_translator_check.py`, `startup_flat_param_check.py` and `docs_links_check.py` pass. `git diff --check` is clean. The commit only adds refusals and leaves the drawn fixture unchanged, so a Windows draw run on f3638e76 still applies to 877b27d0. AI-assisted.
tedin7 commented 2026-11-25 02:01:33 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:01:13Z.

Review: COMMENTED


Review of head 877b27d03bf79a04a4a136b2517501ebe7b7feed (comment only, no approval).

Verdict: no blocking issue found in the Linux-side logic. Windows WARP/hardware proof was not run by me.

Commands executed locally (worktree of the PR head):

  • git diff --stat origin/main...HEAD: 5 files, +606/-1.
  • python3 tests/startup_gfx2hlsl_interp_f16_check.py: pass (controls, refusal cases all refuse as expected).
  • python3 tests/docs_links_check.py: pass (18 files, 391 links).
  • python3 tests/bidi_controls_check.py: pass.
  • git diff --check origin/main...HEAD: clean.
  • gh pr checks 2052: no checks reported on the branch; mergeable state is UNKNOWN. Please confirm CI ran before Ready.

Mutations (reverted afterwards with git checkout -- .):

  • Invert the half select (2 * chan + (1 - high)): test fails (translated words swapped). Killed.
  • Change the preserved-half mask 0xffff0000u to 0x0000ffffu in p2: test fails, but with a KeyError: 'v4' crash, not a value assertion. Killed, though not by a semantic check.

Findings:

  • P1: none.
  • P2: tools/startup/gfx2hlsl.py op_v_interp_p1ll_f16 and op_v_interp_p2_f16 each call interp_f16_scan(), which walks the whole instruction list. That is O(n) per interp instruction, so O(n*k) per shader. It is fine for small pixel shaders. Consider caching the scan result once per Stage.
  • P2: the op_sel guard in check_encoding masks 0x7800 of word 0. The comment says v_interp_p2_hi_f16 (op_sel bit 3) is refused. Good. Please add one fixture that sets each of the four op_sel bits, if not already covered, so a mask edit is killed.
  • nit: docs/experiments.md says "the upper half of the destination kept", while the scan refuses every reader of that half. The text is accurate but could say that explicitly, so nobody relies on the kept half.
  • nit: the second mutation above dies by crash. An assertion on the emitted expression text would be a clearer guard.

Clean-room and title: the title is neutral. Sources cited are public ISA/LLVM/Mesa docs. Nothing proprietary seen.

Windows proof: not run by me. Before Ready, the author should show the startup_gfx2hlsl_interp_f16_warp and _hardware results on Win2025 in the PR body.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6050505308 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2052#pullrequestreview-6050505308). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T02:01:13Z. **Review:** COMMENTED --- Review of head `877b27d03bf79a04a4a136b2517501ebe7b7feed` (comment only, no approval). Verdict: no blocking issue found in the Linux-side logic. Windows WARP/hardware proof was not run by me. Commands executed locally (worktree of the PR head): - `git diff --stat origin/main...HEAD`: 5 files, +606/-1. - `python3 tests/startup_gfx2hlsl_interp_f16_check.py`: pass (controls, refusal cases all refuse as expected). - `python3 tests/docs_links_check.py`: pass (18 files, 391 links). - `python3 tests/bidi_controls_check.py`: pass. - `git diff --check origin/main...HEAD`: clean. - `gh pr checks 2052`: no checks reported on the branch; mergeable state is UNKNOWN. Please confirm CI ran before Ready. Mutations (reverted afterwards with `git checkout -- .`): - Invert the half select (`2 * chan + (1 - high)`): test fails (translated words swapped). Killed. - Change the preserved-half mask `0xffff0000u` to `0x0000ffffu` in p2: test fails, but with a `KeyError: 'v4'` crash, not a value assertion. Killed, though not by a semantic check. Findings: - P1: none. - P2: `tools/startup/gfx2hlsl.py` `op_v_interp_p1ll_f16` and `op_v_interp_p2_f16` each call `interp_f16_scan()`, which walks the whole instruction list. That is O(n) per interp instruction, so O(n*k) per shader. It is fine for small pixel shaders. Consider caching the scan result once per Stage. - P2: the op_sel guard in `check_encoding` masks `0x7800` of word 0. The comment says `v_interp_p2_hi_f16` (op_sel bit 3) is refused. Good. Please add one fixture that sets each of the four op_sel bits, if not already covered, so a mask edit is killed. - nit: `docs/experiments.md` says "the upper half of the destination kept", while the scan refuses every reader of that half. The text is accurate but could say that explicitly, so nobody relies on the kept half. - nit: the second mutation above dies by crash. An assertion on the emitted expression text would be a clearer guard. Clean-room and title: the title is neutral. Sources cited are public ISA/LLVM/Mesa docs. Nothing proprietary seen. Windows proof: not run by me. Before Ready, the author should show the `startup_gfx2hlsl_interp_f16_warp` and `_hardware` results on Win2025 in the PR body. AI-assisted; commands listed were executed locally.
rasptum commented 2026-11-25 02:02:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by rasptum on 2026-11-25T01:44:46Z.


### Independent Windows rerun at 877b27d0

Measured on a physical machine, not CI. This is the head alone (877b27d03bf79a04a4a136b2517501ebe7b7feed, branch startup/interp-f16-pixel), because the branch currently conflicts with main in tools/startup/gfx2hlsl.py: a local git merge origin/main stops at that file, so there is no clean merge commit to test. The worktree was verified clean (git diff --stat empty) before the run, so no conflict markers were present.

Command

ctest --preset dev --no-tests=error -R "^startup_(gfx2hlsl_cvt_pk_u8|gfx2hlsl_interp_f16)_(controls|warp|hardware)$" --output-on-failure

Result: 3/3 passed, 0 failed, no skips

Test Result Time
startup_gfx2hlsl_interp_f16_controls Passed 0.37 s
startup_gfx2hlsl_interp_f16_warp Passed 0.57 s
startup_gfx2hlsl_interp_f16_hardware Passed 1.17 s

Environment, copied from the draw runs themselves:

WARP:

backend=warp debug_layer=enabled
adapter=Microsoft Basic Render Driver vendor=1414 device=008c
driver=10.0.19041.5794

Hardware:

backend=hardware debug_layer=enabled
adapter=NVIDIA GeForce RTX 3060 vendor=10de device=2503
driver=32.0.15.9636

Host: Windows 10 Pro 22H2, build 19045.6466; MSVC x64 Debug (dev preset); DXC 1.7.2308.16 (Windows SDK 10.0.26100.0).

Notes

  • The debug layer was available and enabled on both adapters and the test reported no debug-layer errors. No leg returned 77, so all three are passes rather than capability skips.
  • --no-tests=error matched exactly the three expected names; the cvt_pk_u8 half of the filter belongs to a different branch and is not registered here.
  • The conflict is the only blocker I hit: tools/startup/gfx2hlsl.py merges "CONFLICT (content)" against main, so this head needs a rebase before it can land. That is a mergeability statement, not a test failure.
  • Not covered by this run: the /O2 (release) configuration. The workflow skips build-and-test-release on pull requests (if: github.event_name != 'pull_request'), so nothing has exercised this change at /O2.
  • What this establishes: the v_interp_p1ll_f16 / v_interp_p2_f16 lowering and its drawn pixel output agree with the fixture's expected words on WARP and on the RTX 3060 at this head. It says nothing about other forms or about title startup.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7149906369 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2052#issuecomment-7149906369). Originally posted by [rasptum](https://github.com/rasptum) on 2026-11-25T01:44:46Z. --- ### Independent Windows rerun at `877b27d0` Measured on a physical machine, not CI. This is the head alone (`877b27d03bf79a04a4a136b2517501ebe7b7feed`, branch `startup/interp-f16-pixel`), because the branch currently conflicts with `main` in `tools/startup/gfx2hlsl.py`: a local `git merge origin/main` stops at that file, so there is no clean merge commit to test. The worktree was verified clean (`git diff --stat` empty) before the run, so no conflict markers were present. **Command** ``` ctest --preset dev --no-tests=error -R "^startup_(gfx2hlsl_cvt_pk_u8|gfx2hlsl_interp_f16)_(controls|warp|hardware)$" --output-on-failure ``` **Result: 3/3 passed, 0 failed, no skips** | Test | Result | Time | | --- | --- | --- | | `startup_gfx2hlsl_interp_f16_controls` | Passed | 0.37 s | | `startup_gfx2hlsl_interp_f16_warp` | Passed | 0.57 s | | `startup_gfx2hlsl_interp_f16_hardware` | Passed | 1.17 s | **Environment**, copied from the draw runs themselves: WARP: ``` backend=warp debug_layer=enabled adapter=Microsoft Basic Render Driver vendor=1414 device=008c driver=10.0.19041.5794 ``` Hardware: ``` backend=hardware debug_layer=enabled adapter=NVIDIA GeForce RTX 3060 vendor=10de device=2503 driver=32.0.15.9636 ``` Host: Windows 10 Pro 22H2, build 19045.6466; MSVC x64 Debug (`dev` preset); DXC 1.7.2308.16 (Windows SDK 10.0.26100.0). **Notes** - The debug layer was available and enabled on both adapters and the test reported no debug-layer errors. No leg returned 77, so all three are passes rather than capability skips. - `--no-tests=error` matched exactly the three expected names; the `cvt_pk_u8` half of the filter belongs to a different branch and is not registered here. - The conflict is the only blocker I hit: `tools/startup/gfx2hlsl.py` merges "CONFLICT (content)" against `main`, so this head needs a rebase before it can land. That is a mergeability statement, not a test failure. - Not covered by this run: the `/O2` (release) configuration. The workflow skips `build-and-test-release` on pull requests (`if: github.event_name != 'pull_request'`), so nothing has exercised this change at `/O2`. - What this establishes: the `v_interp_p1ll_f16` / `v_interp_p2_f16` lowering and its drawn pixel output agree with the fixture's expected words on WARP and on the RTX 3060 at this head. It says nothing about other forms or about title startup.
tedin7 commented 2026-11-25 03:00:51 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:15:27Z.

Review: COMMENTED


Review of head c536250ce3a7088282034480235864a2d256fc1e (Lower v_interp_p1ll_f16 / v_interp_p2_f16 in the pixel stage).

Scope: tools/startup/gfx2hlsl.py (+173), new tests/startup_gfx2hlsl_interp_f16_check.py, CMake/CI/docs wiring.

Commands executed locally (worktree at this head):

  • git diff --stat origin/main...HEAD: 6 files, +607 / -1
  • python3 tests/startup_gfx2hlsl_interp_f16_check.py: ends with controls ok, all refusal cases print as expected
  • python3 tests/startup_gfx2hlsl_export_mask_check.py: 0 failed
  • python3 tests/docs_links_check.py: self-test passed, 399 links ok
  • python3 tests/bidi_controls_check.py: no bidirectional controls
  • git diff --check origin/main...HEAD: clean
  • gh pr checks: Linux Python checks pass, gfx1013 fixtures pass; "Build and test on Windows" was still pending when I looked.

Mutations (each reverted with git checkout -- .):

  1. interp_f16 returns 2 * chan instead of 2 * chan + high: killed (translated words assertion fails).
  2. Disable the "reads the upper 16 bits of the p2 result" refusal in interp_f16_scan: killed (test exits 1).

Findings:

  • P1: none.
  • P2: none.
  • Nit: interp_f16_scan is re-run on every p1ll/p2 statement, so it is O(n * pairs) over the program. Fine for current shader sizes; consider caching if programs grow.
  • Nit: the check_encoding op_sel mask 0x7800 and the comment that high-half behaviour is "not established by a source" are conservative and correct as refusals. A short note in docs/experiments.md on what evidence would lift the refusal would help the next person.

Semantics: the pair is gated on PERSP_CENTER I/J being untouched, p1ll having no reader before its p2, no backward branches, and only a plain v_cvt_f32_f16 consuming the low half. Attributes are only accepted when the vertex stage exports them with compr. This matches the stated ISA model and refuses anything it cannot prove.

Not run: Windows 2025 WARP readback. I did not request it, since the PR's own Windows CI job was still pending. Please confirm that job is green before marking this ready. Clean-room and neutral title look fine.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6050675458 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2052#pullrequestreview-6050675458). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T02:15:27Z. **Review:** COMMENTED --- Review of head `c536250ce3a7088282034480235864a2d256fc1e` (Lower v_interp_p1ll_f16 / v_interp_p2_f16 in the pixel stage). Scope: `tools/startup/gfx2hlsl.py` (+173), new `tests/startup_gfx2hlsl_interp_f16_check.py`, CMake/CI/docs wiring. Commands executed locally (worktree at this head): - `git diff --stat origin/main...HEAD`: 6 files, +607 / -1 - `python3 tests/startup_gfx2hlsl_interp_f16_check.py`: ends with `controls ok`, all refusal cases print as expected - `python3 tests/startup_gfx2hlsl_export_mask_check.py`: `0 failed` - `python3 tests/docs_links_check.py`: self-test passed, 399 links ok - `python3 tests/bidi_controls_check.py`: no bidirectional controls - `git diff --check origin/main...HEAD`: clean - `gh pr checks`: Linux Python checks pass, gfx1013 fixtures pass; "Build and test on Windows" was still pending when I looked. Mutations (each reverted with `git checkout -- .`): 1. `interp_f16` returns `2 * chan` instead of `2 * chan + high`: killed (translated words assertion fails). 2. Disable the "reads the upper 16 bits of the p2 result" refusal in `interp_f16_scan`: killed (test exits 1). Findings: - P1: none. - P2: none. - Nit: `interp_f16_scan` is re-run on every p1ll/p2 statement, so it is O(n * pairs) over the program. Fine for current shader sizes; consider caching if programs grow. - Nit: the `check_encoding` op_sel mask `0x7800` and the comment that high-half behaviour is "not established by a source" are conservative and correct as refusals. A short note in `docs/experiments.md` on what evidence would lift the refusal would help the next person. Semantics: the pair is gated on PERSP_CENTER I/J being untouched, p1ll having no reader before its p2, no backward branches, and only a plain `v_cvt_f32_f16` consuming the low half. Attributes are only accepted when the vertex stage exports them with compr. This matches the stated ISA model and refuses anything it cannot prove. Not run: Windows 2025 WARP readback. I did not request it, since the PR's own Windows CI job was still pending. Please confirm that job is green before marking this ready. Clean-room and neutral title look fine. AI-assisted; commands listed were executed locally.
rasptum commented 2026-11-25 03:01:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by rasptum on 2026-11-25T02:16:59Z.


### Independent Windows rerun at c536250c (post-rebase)

Re-ran on the rebased head. This time origin/main 0e7df7ab merged cleanly (no conflict), so the tree under test is merge commit 84a87a78938064c2bc775e9e547f7c00052f0ee5. Everything below supersedes the 877b27d0 run, which could only be tested as a bare head because the branch conflicted in tools/startup/gfx2hlsl.py.

Command

ctest --preset dev --no-tests=error -R "^startup_(gfx2hlsl_cvt_pk_u8|gfx2hlsl_interp_f16)_(controls|warp|hardware)$" --output-on-failure

Result: 3/3 passed, 0 failed, no skips

Test Result Time
startup_gfx2hlsl_interp_f16_controls Passed 0.26 s
startup_gfx2hlsl_interp_f16_warp Passed 0.65 s
startup_gfx2hlsl_interp_f16_hardware Passed 1.00 s

Environment, copied from the draw runs themselves:

WARP:

backend=warp debug_layer=enabled
adapter=Microsoft Basic Render Driver vendor=1414 device=008c
driver=10.0.19041.5794

Hardware:

backend=hardware debug_layer=enabled
adapter=NVIDIA GeForce RTX 3060 vendor=10de device=2503
driver=32.0.15.9636

Host: Windows 10 Pro 22H2, build 19045.6466; MSVC x64 Debug (dev preset); DXC 1.7.2308.16 (Windows SDK 10.0.26100.0).

Notes

  • The merge is clean now: git merge origin/main reported no conflicts and the worktree had no tracked modifications before the run, so the tests ran against the real merge result rather than a hand-resolved tree.
  • Debug layer available and enabled on both adapters, no debug-layer errors reported. No leg returned 77, so these are passes, not capability skips.
  • Still not covered: the /O2 (release) configuration. build-and-test-release stays gated on github.event_name != 'pull_request', so the release build has not seen this head either.
  • What this establishes: at c536250c, the v_interp_p1ll_f16 / v_interp_p2_f16 lowering and the pixel its fixture draws agree with the expected words on WARP and on the RTX 3060. It does not cover other forms or title startup.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7150530506 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2052#issuecomment-7150530506). Originally posted by [rasptum](https://github.com/rasptum) on 2026-11-25T02:16:59Z. --- ### Independent Windows rerun at `c536250c` (post-rebase) Re-ran on the rebased head. This time `origin/main` `0e7df7ab` merged cleanly (no conflict), so the tree under test is merge commit `84a87a78938064c2bc775e9e547f7c00052f0ee5`. Everything below supersedes the `877b27d0` run, which could only be tested as a bare head because the branch conflicted in `tools/startup/gfx2hlsl.py`. **Command** ``` ctest --preset dev --no-tests=error -R "^startup_(gfx2hlsl_cvt_pk_u8|gfx2hlsl_interp_f16)_(controls|warp|hardware)$" --output-on-failure ``` **Result: 3/3 passed, 0 failed, no skips** | Test | Result | Time | | --- | --- | --- | | `startup_gfx2hlsl_interp_f16_controls` | Passed | 0.26 s | | `startup_gfx2hlsl_interp_f16_warp` | Passed | 0.65 s | | `startup_gfx2hlsl_interp_f16_hardware` | Passed | 1.00 s | **Environment**, copied from the draw runs themselves: WARP: ``` backend=warp debug_layer=enabled adapter=Microsoft Basic Render Driver vendor=1414 device=008c driver=10.0.19041.5794 ``` Hardware: ``` backend=hardware debug_layer=enabled adapter=NVIDIA GeForce RTX 3060 vendor=10de device=2503 driver=32.0.15.9636 ``` Host: Windows 10 Pro 22H2, build 19045.6466; MSVC x64 Debug (`dev` preset); DXC 1.7.2308.16 (Windows SDK 10.0.26100.0). **Notes** - The merge is clean now: `git merge origin/main` reported no conflicts and the worktree had no tracked modifications before the run, so the tests ran against the real merge result rather than a hand-resolved tree. - Debug layer available and enabled on both adapters, no debug-layer errors reported. No leg returned 77, so these are passes, not capability skips. - Still not covered: the `/O2` (release) configuration. `build-and-test-release` stays gated on `github.event_name != 'pull_request'`, so the release build has not seen this head either. - What this establishes: at `c536250c`, the `v_interp_p1ll_f16` / `v_interp_p2_f16` lowering and the pixel its fixture draws agree with the expected words on WARP and on the RTX 3060. It does not cover other forms or title startup.
tedin7 commented 2026-11-25 05:04:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T04:09:17Z.

Review: COMMENTED


Re-review of head b1eabb4e5f3d470d8f63172225532ab4fdc1ddd6 (previous reviews were on earlier heads).

Verdict: no P1, no P2 found. Comment only, not an approval.

Checked:

  • Mergeable. CI on this head: Linux checks pass, gfx1013 fixtures pass, Windows build and test pass (the /O2 job and chart publish were skipped).
  • Title is neutral. Scope matches the title: gfx2hlsl.py, one new test, CTest and workflow wiring, docs line.
  • check_encoding refuses op_sel (w0 & 0x7800) for both opcodes, and the high attribute half (w1[8]) stays allowed. Reasoning in the comment is consistent.
  • interp_f16 / interp_f16_pair: only plain VGPRs, only attrN.x/.y (compr export fills x/y only), and only the PERSP_CENTER entry pair. persp_center_vgpr is computed as 2 when PERSP_SAMPLE is also enabled, else 0, and None when PERSP_CENTER is off. That matches the SPI input order.
  • interp_f16_scan runs once per Stage. It refuses backward branches, branches between p1ll and p2, a p1ll result read before p2 or after p2 wrote elsewhere, any read of the p2 upper half other than a plain v_cvt_f32_f16, and any write to the I/J entry registers (including v_swap_b32). Conservative, no fixed-point, which is acceptable here.
  • Pipeline cross-check: an f16 attribute must be read only as f16 and exported with compr by the vertex stage (compr_params).

Commands run locally in the review worktree at this head:

  • python3 tests/startup_gfx2hlsl_interp_f16_check.py -> all refusal and translation controls ok
  • python3 tests/startup_gfx2hlsl_export_mask_check.py -> export mask checks: 0 failed
  • python3 tests/docs_links_check.py -> self-test passed, 18 Markdown files, 405 links
  • python3 tests/bidi_controls_check.py -> self-test passed, 1481 files, no bidirectional controls
  • git diff --check origin/main...HEAD -> clean

Mutations (each restored with git checkout -- .):

  1. Swapped the half index (idx ^ 1) in the emitted i.paramN.<chan> -> killed (translated words mismatch).
  2. Disabled the stale-register check (if r in stale) -> killed (p1ll result read after p2 wrote elsewhere was translated).
  3. Loosened the channel guard (chan > 1 to chan > 2) -> killed (IndexError in the test run).

Notes (nits, non-blocking):

  • nit: the upper half of the p2 destination is emitted as preserved ((vN & 0xffff0000u) | f32tof16(...)), and is safe only because the scan refuses every consumer. This is documented in the code. If hardware behaviour for the high half is later established, the refusal can be lifted; the last commit documents exactly what would lift it.
  • nit: the scan return-on-malformed-pair path (return) leaves interp_scanned False, so the scan can re-run per instruction. It is harmless because that program is refused anyway.

Not run: a Windows WARP/hardware draw on this head. The new startup_gfx2hlsl_interp_f16_warp / _hardware CTests are wired in and the CI Windows job passed, but I did not queue the Windows VM from this review.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6051732476 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2052#pullrequestreview-6051732476). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T04:09:17Z. **Review:** COMMENTED --- Re-review of head `b1eabb4e5f3d470d8f63172225532ab4fdc1ddd6` (previous reviews were on earlier heads). **Verdict: no P1, no P2 found. Comment only, not an approval.** Checked: - Mergeable. CI on this head: Linux checks pass, gfx1013 fixtures pass, Windows build and test pass (the /O2 job and chart publish were skipped). - Title is neutral. Scope matches the title: `gfx2hlsl.py`, one new test, CTest and workflow wiring, docs line. - `check_encoding` refuses op_sel (`w0 & 0x7800`) for both opcodes, and the `high` attribute half (w1[8]) stays allowed. Reasoning in the comment is consistent. - `interp_f16` / `interp_f16_pair`: only plain VGPRs, only attrN.x/.y (compr export fills x/y only), and only the PERSP_CENTER entry pair. `persp_center_vgpr` is computed as 2 when PERSP_SAMPLE is also enabled, else 0, and None when PERSP_CENTER is off. That matches the SPI input order. - `interp_f16_scan` runs once per Stage. It refuses backward branches, branches between p1ll and p2, a p1ll result read before p2 or after p2 wrote elsewhere, any read of the p2 upper half other than a plain `v_cvt_f32_f16`, and any write to the I/J entry registers (including `v_swap_b32`). Conservative, no fixed-point, which is acceptable here. - Pipeline cross-check: an f16 attribute must be read only as f16 and exported with compr by the vertex stage (`compr_params`). Commands run locally in the review worktree at this head: - `python3 tests/startup_gfx2hlsl_interp_f16_check.py` -> all refusal and translation controls ok - `python3 tests/startup_gfx2hlsl_export_mask_check.py` -> `export mask checks: 0 failed` - `python3 tests/docs_links_check.py` -> self-test passed, 18 Markdown files, 405 links - `python3 tests/bidi_controls_check.py` -> self-test passed, 1481 files, no bidirectional controls - `git diff --check origin/main...HEAD` -> clean Mutations (each restored with `git checkout -- .`): 1. Swapped the half index (`idx ^ 1`) in the emitted `i.paramN.<chan>` -> killed (translated words mismatch). 2. Disabled the stale-register check (`if r in stale`) -> killed (`p1ll result read after p2 wrote elsewhere was translated`). 3. Loosened the channel guard (`chan > 1` to `chan > 2`) -> killed (IndexError in the test run). Notes (nits, non-blocking): - nit: the upper half of the p2 destination is emitted as preserved (`(vN & 0xffff0000u) | f32tof16(...)`), and is safe only because the scan refuses every consumer. This is documented in the code. If hardware behaviour for the high half is later established, the refusal can be lifted; the last commit documents exactly what would lift it. - nit: the scan return-on-malformed-pair path (`return`) leaves `interp_scanned` False, so the scan can re-run per instruction. It is harmless because that program is refused anyway. Not run: a Windows WARP/hardware draw on this head. The new `startup_gfx2hlsl_interp_f16_warp` / `_hardware` CTests are wired in and the CI Windows job passed, but I did not queue the Windows VM from this review. AI-assisted; commands listed were executed locally.
Ybucaille commented 2026-11-25 05:04:56 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-25T04:05:32Z.


Thanks for the review, @tedin7. Merged main (4b9490ac) into the branch (conflicts in CMakeLists.txt, docs/experiments.md and tools/startup/gfx2hlsl.py, both sides kept), then two commits for your nits. New head b1eabb4e.

  • Scan cost (565e1a05): interp_f16_scan now runs once per Stage and caches its result (a class default, so probes built without __init__ still work). The check counts the calls: one full scan for the whole program.
  • op_sel mask 0x7800: the check already refuses each of bits 11 to 14 separately, on both v_interp_p1ll_f16 and v_interp_p2_f16, so I added nothing there.
  • High half of the p2 destination: the check now also asserts that the emitted pixel HLSL keeps the upper half with & 0xffff0000u) | f32tof16(. I tried the mutation (mask removed from the lowering): the check fails.
  • Docs (b1eabb4e): docs/experiments.md now says what would lift the two refusals: a source stating the gfx10 behaviour of op_sel and of the upper 16 bits of the v_interp_p2_f16 destination, or a draw on RDNA hardware comparing both halves.

Re-run locally on the new head: startup_gfx2hlsl_interp_f16_check.py (controls ok), export_mask, translator, image_sample_l, image_3d, docs_links, bidi_controls and every other tests/startup_gfx2hlsl_*_check.py: all exit 0. git diff --check origin/main...HEAD is clean.

Not covered: the /O2 (release) configuration, which the workflow skips on pull requests.

@tedin7, if your Windows server frees up, could you run the draws on b1eabb4e?

ctest --preset dev --no-tests=error -R "^startup_gfx2hlsl_interp_f16_(controls|warp|hardware)$" --output-on-failure

@R0Y00, your three points from the 00:11 review were addressed in f3638e76 and 877b27d0; rasptum's Windows run at c536250c passed on WARP and RTX 3060.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7152520849 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2052#issuecomment-7152520849). Originally posted by [Ybucaille](https://github.com/Ybucaille) on 2026-11-25T04:05:32Z. --- Thanks for the review, @tedin7. Merged `main` (`4b9490ac`) into the branch (conflicts in `CMakeLists.txt`, `docs/experiments.md` and `tools/startup/gfx2hlsl.py`, both sides kept), then two commits for your nits. New head `b1eabb4e`. - **Scan cost** (565e1a05): `interp_f16_scan` now runs once per `Stage` and caches its result (a class default, so probes built without `__init__` still work). The check counts the calls: one full scan for the whole program. - **`op_sel` mask `0x7800`**: the check already refuses each of bits 11 to 14 separately, on both `v_interp_p1ll_f16` and `v_interp_p2_f16`, so I added nothing there. - **High half of the p2 destination**: the check now also asserts that the emitted pixel HLSL keeps the upper half with `& 0xffff0000u) | f32tof16(`. I tried the mutation (mask removed from the lowering): the check fails. - **Docs** (b1eabb4e): `docs/experiments.md` now says what would lift the two refusals: a source stating the gfx10 behaviour of `op_sel` and of the upper 16 bits of the `v_interp_p2_f16` destination, or a draw on RDNA hardware comparing both halves. Re-run locally on the new head: `startup_gfx2hlsl_interp_f16_check.py` (`controls ok`), `export_mask`, `translator`, `image_sample_l`, `image_3d`, `docs_links`, `bidi_controls` and every other `tests/startup_gfx2hlsl_*_check.py`: all exit 0. `git diff --check origin/main...HEAD` is clean. Not covered: the `/O2` (release) configuration, which the workflow skips on pull requests. @tedin7, if your Windows server frees up, could you run the draws on `b1eabb4e`? ``` ctest --preset dev --no-tests=error -R "^startup_gfx2hlsl_interp_f16_(controls|warp|hardware)$" --output-on-failure ``` @R0Y00, your three points from the 00:11 review were addressed in f3638e76 and 877b27d0; rasptum's Windows run at `c536250c` passed on WARP and RTX 3060.
tedin7 commented 2026-11-25 06:01:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T05:20:42Z.

Review: COMMENTED


Re-review of head bdd8c7dd6dfc52f50cfbd48dc5cb340c4bd8269c (merge of main on top of b1eabb4e).

State: MERGEABLE, not draft. CI on this head: Linux Python checks pass, gfx1013 fixtures pass, Windows build and test pass (the /O2 job and the chart job are skipped). Title is neutral.

Commands run locally on the head

  • git diff --stat origin/main...HEAD: 6 files, +630/-1
  • python3 tests/startup_gfx2hlsl_interp_f16_check.py: all controls ok, every refusal case prints its reason (p1ll read between the pair, read after p2 wrote elsewhere, upper half read by a shift, upper half exported, branch into p2)
  • python3 tests/startup_gfx2hlsl_export_mask_check.py: export mask checks: 0 failed
  • python3 tests/docs_links_check.py: self-test passed, 18 files, 407 links
  • python3 tests/bidi_controls_check.py: no bidirectional controls in 1489 files
  • git diff --check origin/main...HEAD: clean

Mutations of the new logic (each reverted with git checkout -- .)

  • Removed the chan > 1 refusal: the test fails (IndexError on the z channel fixture). Killed, though by a crash and not a clean assertion.
  • Removed the "exported with compr by the vertex stage" condition: killed (AssertionError ... pixel stage reads attributes [5] the vertex stage does not export).
  • Disabled the p2-source-equals-p1ll-result check in op_v_interp_p2_f16: survives. This is an equivalent mutant: interp_f16_scan (run first) enforces the same pairing. Not a problem, just redundant.

Findings

  • P1: none.
  • P2: none.
  • nit tools/startup/gfx2hlsl.py (interp_f16, chan > 1 branch): the refusal for channels z/w is only reached when the regex matches; the test for it fails by an IndexError once removed, so a one-line assertion on the refusal text would make that control fail cleanly.
  • nit tools/startup/gfx2hlsl.py (interp_f16_scan): the store-opcode prefix tuple is written twice (scan loop and I/J loop); a module constant would keep them in step.
  • Scope note: the Windows draw tests (startup_gfx2hlsl_interp_f16_warp / _hardware) are registered in CMake and in windows.yml; I did not run them on the Windows VM, since the merge since the last reviewed head only brought in main. The Windows CI job on this head passes.

The refusals (op_sel, upper-half readers, non-entry I/J, branches between p1ll and p2) are conservative and documented in docs/experiments.md with what evidence would lift them. No clean-room concerns seen in the diff.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6052237702 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2052#pullrequestreview-6052237702). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T05:20:42Z. **Review:** COMMENTED --- Re-review of head `bdd8c7dd6dfc52f50cfbd48dc5cb340c4bd8269c` (merge of main on top of `b1eabb4e`). **State**: MERGEABLE, not draft. CI on this head: Linux Python checks pass, gfx1013 fixtures pass, Windows build and test pass (the `/O2` job and the chart job are skipped). Title is neutral. **Commands run locally on the head** - `git diff --stat origin/main...HEAD`: 6 files, +630/-1 - `python3 tests/startup_gfx2hlsl_interp_f16_check.py`: all controls ok, every refusal case prints its reason (p1ll read between the pair, read after p2 wrote elsewhere, upper half read by a shift, upper half exported, branch into p2) - `python3 tests/startup_gfx2hlsl_export_mask_check.py`: `export mask checks: 0 failed` - `python3 tests/docs_links_check.py`: self-test passed, 18 files, 407 links - `python3 tests/bidi_controls_check.py`: no bidirectional controls in 1489 files - `git diff --check origin/main...HEAD`: clean **Mutations of the new logic (each reverted with `git checkout -- .`)** - Removed the `chan > 1` refusal: the test fails (IndexError on the z channel fixture). Killed, though by a crash and not a clean assertion. - Removed the "exported with compr by the vertex stage" condition: killed (`AssertionError ... pixel stage reads attributes [5] the vertex stage does not export`). - Disabled the p2-source-equals-p1ll-result check in `op_v_interp_p2_f16`: survives. This is an equivalent mutant: `interp_f16_scan` (run first) enforces the same pairing. Not a problem, just redundant. **Findings** - P1: none. - P2: none. - nit `tools/startup/gfx2hlsl.py` (`interp_f16`, `chan > 1` branch): the refusal for channels z/w is only reached when the regex matches; the test for it fails by an IndexError once removed, so a one-line assertion on the refusal text would make that control fail cleanly. - nit `tools/startup/gfx2hlsl.py` (`interp_f16_scan`): the store-opcode prefix tuple is written twice (scan loop and I/J loop); a module constant would keep them in step. - Scope note: the Windows draw tests (`startup_gfx2hlsl_interp_f16_warp` / `_hardware`) are registered in CMake and in `windows.yml`; I did not run them on the Windows VM, since the merge since the last reviewed head only brought in main. The Windows CI job on this head passes. The refusals (op_sel, upper-half readers, non-entry I/J, branches between p1ll and p2) are conservative and documented in `docs/experiments.md` with what evidence would lift them. No clean-room concerns seen in the diff. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 06:01:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T05:59:37Z.

Review: COMMENTED


Re-review of head 7463165dc502039c286703b9a90aa4507bab2b19 (Linux only; no Windows run).

Commands executed locally

  • git diff --stat origin/main...HEAD: 6 files, +635/-1 (gfx2hlsl.py, new interp_f16 check, CMake, windows.yml, docs, export-mask check).
  • python3 tests/startup_gfx2hlsl_interp_f16_check.py: all "accepted" and "refused" controls pass, ends controls ok.
  • python3 tests/startup_gfx2hlsl_export_mask_check.py: export mask checks: 0 failed.
  • python3 tests/docs_links_check.py: passed (407 links). python3 tests/bidi_controls_check.py: passed.
  • git diff --check origin/main...HEAD: clean.
  • Mutations of the new logic, each reverted with git checkout -- .:
    1. Pixel attribute check in Pipeline neutralised (if False:): the test fails ("attribute not exported by the vertex stage"). Killed.
    2. high_undefined upper-half refusal in interp_f16_scan neutralised: "upper half read by a shift was translated". Killed.
    3. Channel bound chan > 1 widened to chan > 3: "attribute channel z crashed instead of being refused: IndexError". Killed.

Findings

  • P1: none in the lowering. The scan is conservative (any doubt is a refusal), and the last commit's INTERP_STORE_PREFIXES fixes the false "write" on store opcodes.
  • P2: the PR is not mergeable (CONFLICTING). A local git merge origin/main conflicts in tools/startup/gfx2hlsl.py at the block just after QUAD_SWAPS (~line 456). It is add/add: this PR's INTERP_STORE_PREFIXES against main's VOP3B_SDST / destinations() / writes_exec(). Keep both. Then check that interp_f16_scan still treats the store opcodes correctly. It could also use main's destinations(), which already handles the VOP3b SGPR destination, so the "written" set should not count that SGPR operand as a VGPR write.
  • P2: gh pr checks reports no checks on the branch, so no CI result exists for this head. The draw WARP tests (startup_gfx2hlsl_interp_f16_*) were not run by me. Please attach a Windows WARP run of the merged head after the rebase.
  • Nit: interp_f16_scan is about 90 lines with deep nesting. Splitting the pending/stale tracking from the I/J write check would make it easier to review.

Clean-room and title look fine. Other than the conflict, the tests exercise real refusals and the mutations were killed.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6052577504 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2052#pullrequestreview-6052577504). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T05:59:37Z. **Review:** COMMENTED --- Re-review of head `7463165dc502039c286703b9a90aa4507bab2b19` (Linux only; no Windows run). **Commands executed locally** - `git diff --stat origin/main...HEAD`: 6 files, +635/-1 (gfx2hlsl.py, new interp_f16 check, CMake, windows.yml, docs, export-mask check). - `python3 tests/startup_gfx2hlsl_interp_f16_check.py`: all "accepted" and "refused" controls pass, ends `controls ok`. - `python3 tests/startup_gfx2hlsl_export_mask_check.py`: `export mask checks: 0 failed`. - `python3 tests/docs_links_check.py`: passed (407 links). `python3 tests/bidi_controls_check.py`: passed. - `git diff --check origin/main...HEAD`: clean. - Mutations of the new logic, each reverted with `git checkout -- .`: 1. Pixel attribute check in `Pipeline` neutralised (`if False:`): the test fails ("attribute not exported by the vertex stage"). Killed. 2. `high_undefined` upper-half refusal in `interp_f16_scan` neutralised: "upper half read by a shift was translated". Killed. 3. Channel bound `chan > 1` widened to `chan > 3`: "attribute channel z crashed instead of being refused: IndexError". Killed. **Findings** - P1: none in the lowering. The scan is conservative (any doubt is a refusal), and the last commit's `INTERP_STORE_PREFIXES` fixes the false "write" on store opcodes. - P2: the PR is not mergeable (`CONFLICTING`). A local `git merge origin/main` conflicts in `tools/startup/gfx2hlsl.py` at the block just after `QUAD_SWAPS` (~line 456). It is add/add: this PR's `INTERP_STORE_PREFIXES` against main's `VOP3B_SDST` / `destinations()` / `writes_exec()`. Keep both. Then check that `interp_f16_scan` still treats the store opcodes correctly. It could also use main's `destinations()`, which already handles the VOP3b SGPR destination, so the "written" set should not count that SGPR operand as a VGPR write. - P2: `gh pr checks` reports no checks on the branch, so no CI result exists for this head. The `draw` WARP tests (`startup_gfx2hlsl_interp_f16_*`) were not run by me. Please attach a Windows WARP run of the merged head after the rebase. - Nit: `interp_f16_scan` is about 90 lines with deep nesting. Splitting the pending/stale tracking from the I/J write check would make it easier to review. Clean-room and title look fine. Other than the conflict, the tests exercise real refusals and the mutations were killed. AI-assisted; commands listed were executed locally.
Ybucaille commented 2026-11-25 06:01:36 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-25T05:16:36Z.


Merged main again (13 new commits, conflicts in Stage class defaults and set_v with the new low16_only_v tracking, both sides kept). New head bdd8c7dd, mergeable; all tests/startup_gfx2hlsl_*_check.py and startup_translator_check.py pass locally. @tedin7, please use bdd8c7dd rather than b1eabb4e for the Windows draws.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7153614973 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2052#issuecomment-7153614973). Originally posted by [Ybucaille](https://github.com/Ybucaille) on 2026-11-25T05:16:36Z. --- Merged `main` again (13 new commits, conflicts in `Stage` class defaults and `set_v` with the new `low16_only_v` tracking, both sides kept). New head `bdd8c7dd`, mergeable; all `tests/startup_gfx2hlsl_*_check.py` and `startup_translator_check.py` pass locally. @tedin7, please use `bdd8c7dd` rather than `b1eabb4e` for the Windows draws.
Ybucaille commented 2026-11-25 06:01:40 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-25T05:54:54Z.


Thanks @tedin7. Both nits done in 7463165d:

  • the store opcode prefixes are one module constant, INTERP_STORE_PREFIXES, shared by the scan and the I/J check;
  • refused() now turns any other exception into an AssertionError naming the case, so removing the chan > 1 refusal fails with attribute channel z crashed instead of being refused: IndexError(...) (mutation tried, then reverted).

Agreed on the p2-source check: it duplicates what interp_f16_scan already enforces; I kept it as a local guard for the handler. All startup_gfx2hlsl_* checks pass locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7154259823 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2052#issuecomment-7154259823). Originally posted by [Ybucaille](https://github.com/Ybucaille) on 2026-11-25T05:54:54Z. --- Thanks @tedin7. Both nits done in 7463165d: - the store opcode prefixes are one module constant, `INTERP_STORE_PREFIXES`, shared by the scan and the I/J check; - `refused()` now turns any other exception into an `AssertionError` naming the case, so removing the `chan > 1` refusal fails with `attribute channel z crashed instead of being refused: IndexError(...)` (mutation tried, then reverted). Agreed on the p2-source check: it duplicates what `interp_f16_scan` already enforces; I kept it as a local guard for the handler. All `startup_gfx2hlsl_*` checks pass locally.
upstream-sync closed this pull request 2026-11-25 07:00:47 +00:00
R0Y00 commented 2026-11-25 07:00:47 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T06:08:37Z.

Review: APPROVED


The I/J and unmatched-P1 findings are resolved. I merged current main into the branch, kept the two independent register trackers, and added a refusal when a branch can skip the full-width conversion and expose the unknown high half. I reran the translation and refusal checks, the six-point varying CPU comparison, and the constant-triangle and inverted-half draws on WARP and RTX 4060 Laptop. The updated head still needs its own required CI.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6052653070 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2052#pullrequestreview-6052653070). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T06:08:37Z. **Review:** APPROVED --- The I/J and unmatched-P1 findings are resolved. I merged current main into the branch, kept the two independent register trackers, and added a refusal when a branch can skip the full-width conversion and expose the unknown high half. I reran the translation and refusal checks, the six-point varying CPU comparison, and the constant-triangle and inverted-half draws on WARP and RTX 4060 Laptop. The updated head still needs its own required CI.
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
R0Y00/Xbox2Windows!2045
No description provided.