Lower v_interp_p1ll_f16 and v_interp_p2_f16 in the pixel stage #2045
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2052"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-24T23:39:57Z.
Refs #1996 (item C)
Summary
tools/startup/gfx2hlsl.pyrefusedv_interp_p1ll_f16andv_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
VOP3Instructions.td:V_INTERP_P1LL_F16is[f32, f32, i32],V_INTERP_P2_F16is[f16, f32, i32, f32].VOPInstructions.tdVOP3Interp_gfx10: attr =Inst{37-32}, attrchan =Inst{39-38}, high =Inst{40}.IntrinsicsAMDGPU.tdint_amdgcn_interp_p1_f16/int_amdgcn_interp_p2_f16: "high selects whether high or low 16-bits are loaded from LDS".aco_instruction_selection.cpp,emit_interp_instr:v_interp_p1ll_f16(coordinate i) into av1, thenv_interp_p2_f16(coordinate j, p1 as third source) into av2b.exp ... compr, which gfx2hlsl already splits into four float channels. Halfhof channelcis therefore float channel2 * c + hof the parameter. The rasterizer interpolates, as forv_interp_p1_f32/v_interp_p2_f32: p1ll records its destination, p2 emits(vD & 0xffff0000u) | f32tof16(i.paramN.<channel>).v_interp_p1ll_f16emits nothing because the rasterizer already interpolates; the expression emitted forv_interp_p2_f16readsi.paramNas 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_inputsand 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.tdtypes 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 plainv_cvt_f32_f16reading the low half consumes the result.clamp,mul:/div:output modifiers, neg/abs and non-VGPR sources, channels z and w,highthat 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 withcompror that is also read as f32.v_interp_p1lv_f16stays refused.Files
tools/startup/gfx2hlsl.py, newtests/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)
comprpairs). Translated words3fc00000,c0000000,3f000000,40400000equal the ISA-layout reference.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. Onorigin/mainthe check fails withUnsupported: v_interp_p1ll_f16.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 --checkclean.draw(needs D3D12) andcompile(the host DXC aborts with an LLVM assertion on any pixel shader with an input struct, existing translations included). Windows verification ofstartup_gfx2hlsl_interp_f16_warp/_hardwareis needed.Open points
2 * c + hmapping follows from thecomprexport layout used by gfx2hlsl; it was not checked against hardware output.f32tof16rounding vs the hardware mode register (round to nearest even by default) is not covered by the fixture's exactly representable values.binaryclears the field before comparing.AI-assisted.
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:
The current constant triangle checks packed-half selection, so preserve it while adding those cases.
Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T23:46:32Z.
Five mutations caught — and one input shape that escapes as
AttributeErrorinstead ofUnsupported2 * chan + high→chan + highThe 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_f16doeswith no check that
mmatched. The VGPR-operands loop just before it coversops[0], ops[1]andops[3:], notops[2], so nothing has validatedthis token yet. Measured with a probe Stage:
The traceback ends inside
Stage.one→lower, so this is not a test-only path: any shader whose assembly spells the attribute without a componentturns 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 thetryaroundloweris for in the other handlers.One-line fix in the shape the file already uses:
attr99.yis a separate, smaller question: it is accepted here and only fails later if the vertex stage did not export that parameter. If the latercheck covers it, ignore this; if not, the bound belongs here too, because
attrNbeyond 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_f16can emit nothing. That is a modelling decision I cannot test without adraw; the fixture asserts the emptiness, not the reason. Worth saying in the description that the emitted
p2expression readsi.paramNas analready-interpolated value, because a reader who expects the two instructions to compose into arithmetic will look for it and not find it.
Notes
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 errorI 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:So the two paths are:
refusals is None(a single-shader translation)AttributeError— a traceback instead of a refusalrefusalslist (the census,--refusals=DIR)internal error in v_interp_p1ll_f16: AttributeErrorMeasured on the branch:
Why it still matters, stated correctly
internal error, notunsupported. That is the project's own marker for "the translator broke", and#1723's census countsrefusals 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.
translate()on a request containing this spelling exits with a traceback rather than a refusalline, which is a worse outcome than the old "unsupported instruction" it replaces.
So the fix is still the same one line — check
mbefore.group— but I should not have described the effect as the census silently losing therecord. It records it, mislabelled.
Also worth knowing: the same shape existed before this PR
On
main,v_interp_p1ll_f16has no handler at all (op_v_interp_p1ll_f16is absent), so the old behaviour was a cleanUnsupported. This PRintroduces the handler and the crash together, which is why the fix belongs in this PR rather than in a follow-up.
Notes
Stage.translateinstead of assuming the refusal path.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 raisesUnsupported("expected attrN.x/.y/.z/.w") instead of escaping as anAttributeError. The check has controls for bothv_interp_p1ll_f16andv_interp_p2_f16.On
attr99.y: no bound is added ininterp_f16. An attribute the vertex stage does not export is already refused later in the pipeline withUnsupported; a new control moves the pair toattr5and shows the refusal. (attr99itself is not encodable, the field is 6 bits.)The description now says that
v_interp_p1ll_f16emits nothing because the rasterizer already interpolates, and that thep2expression readsi.paramNas an already-interpolated value.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by Its3rr0rsWRLD on 2026-11-24T23:59:36Z.
Windows run of the
_warp/_hardwaredraws for #2052, tested at head21ad43aea0a03dfaabdb1bed565b4e8951b6c56e("Refuse attribute operands without a channel in interp_f16"), detached checkout ofpull/2052/head.Environment
debug_layer=enabled)offscreen_checkCommand
Results
startup_gfx2hlsl_interp_f16_controlsstartup_gfx2hlsl_interp_f16_warpstartup_gfx2hlsl_interp_f16_hardware3fc00000,c0000000,3f000000,40400000from the translated pair, withdebug_errors=0 debug_warnings=0on WARP and on the RTX 4070 Ti.c0000000,3fc00000,40400000,3f000000and failed as expected on both adapters.controls ok.Not run: the
binarymode oftests/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).
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.attr0controls.binaryllvm-mc comparison (tool not installed on that machine); it passes on Linux with llvm-mc.AI-assisted.
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_inputslayout already inPipeline; 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_f16of 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), allstartup_gfx2hlsl_*_check.py,startup_translator_check.py,startup_flat_param_check.py,docs_links_check.pypass;git diff --checkis 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.
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.pyprintscontrols ok, andstartup_image_sample_l_check.py,startup_image_3d_check.pyandstartup_translator_check.pystill pass. Two findings, one of them a wrong translation.1.
op_selbit 3 onv_interp_p2_f16is silently ignored.Mesa ACO emits
v_interp_p2_hi_f16asv_interp_p2_f16withopsel = 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.pydoes 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:v4 = (v4 & 0xffff0000u) | f32tof16(i.param0.x);.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 anyop_selother than 0. Add a control with the bit set.2. Only
comprvertex exports are accepted, which is narrower than the programs that use the pair.v_interp_p1ll_f16exports the attribute as a plain 32-bit word: the vertex stage packs the halves into the word itself and exports withoutcompr. I found nocomprparam export at all among them.attrN.z/.w.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, andcomprbecomes the special case.comprfixture, and it got it wrong. That makes your fixture a useful control for whoever generalises this: the plain andcomprcases need different mappings.Neither point affects your controls. Both need a fixture: (1) an
op_sel0x8 instruction, and (2) a plain export of packed halves (for example built withv_cvt_pkrtz_f16_f32), including channel z.Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-25T00:33:28Z.
Thanks for the careful review, @denn0x.
1.
op_selonv_interp_p2_f16. Reproduced onf3638e76: with bit 14 of word 0 set, the translation was the same text as the plain form. Fixed in877b27d0by refusing it: anyop_selbit (word 0 bits 11-14) onv_interp_p1ll_f16orv_interp_p2_f16is nowUnsupported. 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 ap2_hiresult could not be consumed yet.highis 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), andop_selwas the only bit that was silently ignored. Controls: the fourop_selbits 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. Thecomprfixture stays as a control, since the two cases need different mappings.Linux: the interp_f16 check (
controls ok), allstartup_gfx2hlsl_*_check.py,startup_translator_check.py,startup_flat_param_check.pyanddocs_links_check.pypass.git diff --checkis clean. The commit only adds refusals and leaves the drawn fixture unchanged, so a Windows draw run onf3638e76still applies to877b27d0.AI-assisted.
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 -- .):2 * chan + (1 - high)): test fails (translated words swapped). Killed.0xffff0000uto0x0000ffffuin p2: test fails, but with aKeyError: 'v4'crash, not a value assertion. Killed, though not by a semantic check.Findings:
tools/startup/gfx2hlsl.pyop_v_interp_p1ll_f16andop_v_interp_p2_f16each callinterp_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.check_encodingmasks0x7800of word 0. The comment saysv_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.docs/experiments.mdsays "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.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_warpand_hardwareresults on Win2025 in the PR body.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by rasptum on 2026-11-25T01:44:46Z.
### Independent Windows rerun at
877b27d0Measured on a physical machine, not CI. This is the head alone (
877b27d03bf79a04a4a136b2517501ebe7b7feed, branchstartup/interp-f16-pixel), because the branch currently conflicts withmainintools/startup/gfx2hlsl.py: a localgit merge origin/mainstops at that file, so there is no clean merge commit to test. The worktree was verified clean (git diff --statempty) before the run, so no conflict markers were present.Command
Result: 3/3 passed, 0 failed, no skips
startup_gfx2hlsl_interp_f16_controlsstartup_gfx2hlsl_interp_f16_warpstartup_gfx2hlsl_interp_f16_hardwareEnvironment, copied from the draw runs themselves:
WARP:
Hardware:
Host: Windows 10 Pro 22H2, build 19045.6466; MSVC x64 Debug (
devpreset); DXC 1.7.2308.16 (Windows SDK 10.0.26100.0).Notes
--no-tests=errormatched exactly the three expected names; thecvt_pk_u8half of the filter belongs to a different branch and is not registered here.tools/startup/gfx2hlsl.pymerges "CONFLICT (content)" againstmain, so this head needs a rebase before it can land. That is a mergeability statement, not a test failure./O2(release) configuration. The workflow skipsbuild-and-test-releaseon pull requests (if: github.event_name != 'pull_request'), so nothing has exercised this change at/O2.v_interp_p1ll_f16/v_interp_p2_f16lowering 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.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), newtests/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 / -1python3 tests/startup_gfx2hlsl_interp_f16_check.py: ends withcontrols ok, all refusal cases print as expectedpython3 tests/startup_gfx2hlsl_export_mask_check.py:0 failedpython3 tests/docs_links_check.py: self-test passed, 399 links okpython3 tests/bidi_controls_check.py: no bidirectional controlsgit diff --check origin/main...HEAD: cleangh 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 -- .):interp_f16returns2 * chaninstead of2 * chan + high: killed (translated words assertion fails).interp_f16_scan: killed (test exits 1).Findings:
interp_f16_scanis 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.check_encodingop_sel mask0x7800and the comment that high-half behaviour is "not established by a source" are conservative and correct as refusals. A short note indocs/experiments.mdon 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_f16consuming 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.
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/main0e7df7abmerged cleanly (no conflict), so the tree under test is merge commit84a87a78938064c2bc775e9e547f7c00052f0ee5. Everything below supersedes the877b27d0run, which could only be tested as a bare head because the branch conflicted intools/startup/gfx2hlsl.py.Command
Result: 3/3 passed, 0 failed, no skips
startup_gfx2hlsl_interp_f16_controlsstartup_gfx2hlsl_interp_f16_warpstartup_gfx2hlsl_interp_f16_hardwareEnvironment, copied from the draw runs themselves:
WARP:
Hardware:
Host: Windows 10 Pro 22H2, build 19045.6466; MSVC x64 Debug (
devpreset); DXC 1.7.2308.16 (Windows SDK 10.0.26100.0).Notes
git merge origin/mainreported 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./O2(release) configuration.build-and-test-releasestays gated ongithub.event_name != 'pull_request', so the release build has not seen this head either.c536250c, thev_interp_p1ll_f16/v_interp_p2_f16lowering 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.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:
gfx2hlsl.py, one new test, CTest and workflow wiring, docs line.check_encodingrefuses op_sel (w0 & 0x7800) for both opcodes, and thehighattribute 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_vgpris 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_scanruns 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 plainv_cvt_f32_f16, and any write to the I/J entry registers (includingv_swap_b32). Conservative, no fixed-point, which is acceptable here.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 okpython3 tests/startup_gfx2hlsl_export_mask_check.py->export mask checks: 0 failedpython3 tests/docs_links_check.py-> self-test passed, 18 Markdown files, 405 linkspython3 tests/bidi_controls_check.py-> self-test passed, 1481 files, no bidirectional controlsgit diff --check origin/main...HEAD-> cleanMutations (each restored with
git checkout -- .):idx ^ 1) in the emittedi.paramN.<chan>-> killed (translated words mismatch).if r in stale) -> killed (p1ll result read after p2 wrote elsewhere was translated).chan > 1tochan > 2) -> killed (IndexError in the test run).Notes (nits, non-blocking):
(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.return) leavesinterp_scannedFalse, 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/_hardwareCTests 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.
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 inCMakeLists.txt,docs/experiments.mdandtools/startup/gfx2hlsl.py, both sides kept), then two commits for your nits. New headb1eabb4e.565e1a05):interp_f16_scannow runs once perStageand 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_selmask0x7800: the check already refuses each of bits 11 to 14 separately, on bothv_interp_p1ll_f16andv_interp_p2_f16, so I added nothing there.& 0xffff0000u) | f32tof16(. I tried the mutation (mask removed from the lowering): the check fails.b1eabb4e):docs/experiments.mdnow says what would lift the two refusals: a source stating the gfx10 behaviour ofop_seland of the upper 16 bits of thev_interp_p2_f16destination, 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_controlsand every othertests/startup_gfx2hlsl_*_check.py: all exit 0.git diff --check origin/main...HEADis 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?@R0Y00, your three points from the 00:11 review were addressed in
f3638e76and877b27d0; rasptum's Windows run atc536250cpassed on WARP and RTX 3060.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 ofb1eabb4e).State: MERGEABLE, not draft. CI on this head: Linux Python checks pass, gfx1013 fixtures pass, Windows build and test pass (the
/O2job and the chart job are skipped). Title is neutral.Commands run locally on the head
git diff --stat origin/main...HEAD: 6 files, +630/-1python3 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 failedpython3 tests/docs_links_check.py: self-test passed, 18 files, 407 linkspython3 tests/bidi_controls_check.py: no bidirectional controls in 1489 filesgit diff --check origin/main...HEAD: cleanMutations of the new logic (each reverted with
git checkout -- .)chan > 1refusal: the test fails (IndexError on the z channel fixture). Killed, though by a crash and not a clean assertion.AssertionError ... pixel stage reads attributes [5] the vertex stage does not export).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
tools/startup/gfx2hlsl.py(interp_f16,chan > 1branch): 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.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.startup_gfx2hlsl_interp_f16_warp/_hardware) are registered in CMake and inwindows.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.mdwith what evidence would lift them. No clean-room concerns seen in the diff.AI-assisted; commands listed were executed locally.
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, endscontrols 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.git checkout -- .:Pipelineneutralised (if False:): the test fails ("attribute not exported by the vertex stage"). Killed.high_undefinedupper-half refusal ininterp_f16_scanneutralised: "upper half read by a shift was translated". Killed.chan > 1widened tochan > 3: "attribute channel z crashed instead of being refused: IndexError". Killed.Findings
INTERP_STORE_PREFIXESfixes the false "write" on store opcodes.CONFLICTING). A localgit merge origin/mainconflicts intools/startup/gfx2hlsl.pyat the block just afterQUAD_SWAPS(~line 456). It is add/add: this PR'sINTERP_STORE_PREFIXESagainst main'sVOP3B_SDST/destinations()/writes_exec(). Keep both. Then check thatinterp_f16_scanstill treats the store opcodes correctly. It could also use main'sdestinations(), which already handles the VOP3b SGPR destination, so the "written" set should not count that SGPR operand as a VGPR write.gh pr checksreports no checks on the branch, so no CI result exists for this head. ThedrawWARP tests (startup_gfx2hlsl_interp_f16_*) were not run by me. Please attach a Windows WARP run of the merged head after the rebase.interp_f16_scanis 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.
Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-25T05:16:36Z.
Merged
mainagain (13 new commits, conflicts inStageclass defaults andset_vwith the newlow16_only_vtracking, both sides kept). New headbdd8c7dd, mergeable; alltests/startup_gfx2hlsl_*_check.pyandstartup_translator_check.pypass locally. @tedin7, please usebdd8c7ddrather thanb1eabb4efor the Windows draws.Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-25T05:54:54Z.
Thanks @tedin7. Both nits done in
7463165d:INTERP_STORE_PREFIXES, shared by the scan and the I/J check;refused()now turns any other exception into anAssertionErrornaming the case, so removing thechan > 1refusal fails withattribute channel z crashed instead of being refused: IndexError(...)(mutation tried, then reverted).Agreed on the p2-source check: it duplicates what
interp_f16_scanalready enforces; I kept it as a local guard for the handler. Allstartup_gfx2hlsl_*checks pass locally.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.