startup: print the VINTRP interp_mov selector and refuse p10/p20 #1919
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1926"
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 roansystemlabs on 2026-11-24T21:30:37Z.
Fixes #1890.
Change
This is the change proposed in #1890 and claimed in https://github.com/R0Y00/Xbox2Windows/issues/1890#issuecomment-7143338619. It touches the VINTRP branch of
tools/disasm_rdna2.py,op_v_interp_mov_f32intools/startup/gfx2hlsl.py, the checks intests/rdna2_tools_check.pyandtests/startup_flat_param_check.py, and two docs paragraphs.v_interp_mov_f32_e32printed its selector field as a VGPR (v0,v1,v2). It now printsp10,p20orp0, as LLVM does and as the VOP3 (_e64) spelling already did. Any other value of the field (LLVM printsinvalid_param_<n>, and llvm-mc accepts no such selector) becomes a four-bytev_interp_mov_f32_e32_unsupportedrecord, so the next instruction keeps its offset. The ISA reads only VSRC[1:0] (RDNA 2 ISA, 30 November 2020: Table 53, "For OP==v_interp_mov_f32: 0=P10, 1=P20, 2=P0", printed page 93; Table 93, "VDST = (P0, P10 or P20 selected by VSRC[1:0])", page 269; the archived copy linked in #669, SHA-25622aec03f2706dba2e148ffde1f3a25d5cdd42c71a96f95240aeb48d995d44795), so 4-255 would alias on hardware; no assembler emits them and LLVM printsinvalid_param_<n>, so they are refused rather than masked. The VOP3 spelling already refused src1 >= 3 the same way.v_interp_p1_f32_e32andv_interp_p2_f32_e32keep their VGPR operand in the same field.op_v_interp_mov_f32read every selector as the flat P0 copy. It now lowers onlyp0, in both encodings, and refusesp10(P1 - P0) andp20(P2 - P0) with the selector in the reason, e.g.v_interp_mov_f32 parameter selector p10: only p0 is lowered. Lowering them would need per-vertex attribute values (GetAttributeAtVertex, SM 6.1), which the FXC path does not have, so they are not translated.clamp,mul:2, ...) are left to #1778, which is still open; this change does not touch them.Interaction with #1778. Its plain-form control
encode_vop3a(VOP3A_INTERP_MOV, 1, [0, 0])sets src1 = 0, which isp10;p0is src1 = 2 (noted on #1778). With both changes merged that control raisesUnsupported: v_interp_mov_f32 parameter selector p10: only p0 is lowered. On this branch merged with #1778 at00479dc9, with[0, 2]in that control and in the clamp control next to it, all 17 of its checks pass, andtests/startup_flat_param_check.pystill passes. #1778 already conflicts withmainintools/startup/gfx2hlsl.py(next tosmem_modsfrom #1881) and inCMakeLists.txt; this branch adds no conflict of its own there. Whichever lands second needs the one-line fixture change; if #1778 lands first, I will rebase on it, make that change here and rerun the checks.Verification
Commit
91f6bf69, rebased ontomainat6d0a7885. Windows 11 Home build 26200, MSVC 19.44 (VS 2022 Build Tools,vcvars64 -vcvars_ver=14.44), Ninja, DXC from Windows SDK 10.0.26100.0, Python 3.12, D3D12 debug layer enabled.p0lowered in both encodings to the same pixel stage as before;p10,p20refused in both encodings with the selector in the reason; selector 3 refused00000001,00000002,7fc00001,80000001; FXC float4 control fails as expected (00000000,00000000,7fc00001,00000000);debug_errors=0 debug_warnings=03/3 passed in each of the four runs on
91f6bf69, no capability skips.ctest --preset dev/release --no-tests=error -R '^rdna2_tools_check$'passed on91f6bf69.ctest --preset dev --no-tests=error -R '^startup_'on the same change one base earlier (8ca8a421ona6514901;mainthen changedtools/startup/gfx2hlsl.pyagain, outside this handler): 276 tests, 272 passed and 4 skipped by their skip return code (startup_view_heap_warp,startup_gamesave_submit_system,startup_gamesave_read_async_system,startup_logical_view_warp), 485 s. The threestartup_gfx2hlsl_bit_alu_*tests in that set read their inputs withp0and pass.Decoder against LLVM 15.0.7, reported separately from the GPU runs. Locally I have LLVM 15.0.7 as the clang 15 integrated assembler,
llvm-objdump,llvm-objcopyandLLVM-C.dll, not a standalonellvm-mc; a small wrapper turnsllvm-mc -show-encodinginto clang 15 +llvm-objdump15 for thebinarymode below.llvm-objdump -d --mcpu=gfx101315.0.7 on a source-built object withp10,p20,p0in both encodings, the four e32 golden vectors,clampon e64, the p1/p2 forms and three invalid e32 selectors (3, 128, 255 as.long): the decoder prints the same text for all 14 valid instructions and an unsupported record for the threeinvalid_param_<n>words (0 mismatches). Onmainthe same comparison gives 10 mismatches: every e32v_interp_mov_f32printed a VGPR.llvm-objdump: every VINTRPvsrcvalue 0-255 for the three ops,p0over every attribute and channel, and the e64 form with src1 0-7 over four attributes, 1057 words. On this branch 0 mismatches (784 identical texts, 273 words refused by both); onmain512 (259 printing a VGPR for the selector, 253invalid_param_<n>words not refused).tests/rdna2_tools_check.py: e32 golden vectors (p10,p20,p0,attr63.w), an LLVM round trip of those vectors (assembled bytes, LLVM-C disassembly and decoder text all equal), and selectors 3, 128 and 255 as four-byte unsupported records followed bys_endpgm.tests/startup_flat_param_check.py: the first read of the pixel stage is replaced with each selector in both encodings (six source lines, words checked by thebinarymode with llvm-mc). The decoded text must be the source line;p0must give the same pixel stage HLSL as the unmodified fixture;p10andp20must raiseUnsupportedwith the selector name; a VINTRP selector of 3 must be refused.Fail-first, each on a copy of the tree:
gfx2hlslguard removed:startup_flat_param_check.pyfails withtranslated v_interp_mov_f32_e32 v0, p10, attr0.x as ['v0 = i.fparam0.x;']; all six selector lines then translate to the flat copy.startup_flat_param_check.pyfails at the fixture itself, because the e32p0prints asv2and is refused.main'stools/: both files fail the same way.Also run:
tests/docs_links_check.py,tests/bidi_controls_check.py,git diff --check: all pass.git merge-treeof8ca8a421(ona6514901) against the 79 open PRs (of 103) that touch any of the six files: no conflict thatmaindoes not already have. Searching the added lines of those PRs forv_interp_mov, VINTRP words andp10/p20, only #1778 uses a selector other thanp0.Evidence and follow-up
The fixtures are original, written for these tests in LLVM 15 spelling and assembled from source; MIT, like the repository. No game files, dumps or captured shaders.
Not covered:
rdna2_tools_check.pywith LLVM andstartup_flat_param_check.py binary) was not run on a fork; locally the assembler was clang 15 and-show-encodingcame fromllvm-objdump15.p10/p20(per-vertex attributes on an SM 6.1 path) is not attempted here.Checklist
docs/startup-runtime.md,docs/experiments.md).AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T21:49:45Z.
Review: COMMENTED
Review of head
91f6bf69ee(startup: print the VINTRP interp_mov selector and refuse p10/p20).Commands run locally on the PR head, with results:
git merge-tree --write-tree --name-only origin/main HEAD: clean, no conflicts.gh pr checks 1926: Linux Python checks, gfx1013 fixtures and Windows build/test pass. The /O2 job and the chart publish job are skipped.git diff --check origin/main...HEAD: clean.python3 tests/bidi_controls_check.py: pass.python3 tests/docs_links_check.py: pass.python3 tests/rdna2_tools_check.py: OK, with 19 tests skipped on this host (the llvm-mc cases did not run here).python3 tests/startup_flat_param_check.py: pass.Mutation (reverted with
git checkout -- .after each):tools/startup/gfx2hlsl.py, I disabled theops[1] != 'p0'refusal.startup_flat_param_check.pyfailed:v_interp_mov_f32_e32 v0, p10, attr0.xwas lowered asi.fparam0.x. Killed.tools/disasm_rdna2.py, I changedvsrc >= len(VINTRP_MOV_PARAMS)to>.rdna2_tools_check.pyfailed (1 error). Killed.Reading of the diff: the decoder change, the refusal in the translator and the docs agree with each other. An out-of-range selector becomes a 4-byte
_unsupportedrecord, so the decoder stays in sync. Thev_interp_mov_f32_e32name is unchanged for valid selectors, sotools/pixel_cb_read.pyandtools/scan_unsupported_shaders.pystill match it.Findings:
tests/rdna2_tools_check.pyskips 19 tests here, so the llvm-mc cross-check of the new selector words depends on the CI runner having llvm-mc. CI passes, so this is only a note.tools/pixel_cb_read.py:24listsv_interp_mov_f32_e32but not the newv_interp_mov_f32_e32_unsupportedrecord. This is harmless as long as a shader with an invalid selector is rejected earlier. It is not checked in this PR.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T21:51:24Z.
Ran both checks, broke the change three ways, and verified the e64 claim you only asserted
Windows 11 build 26300.9974, device-free:
Mutations, each reverted and re-run:
v{vsrc}again instead of the selector namerdna2_tools_checkvsrc >= len(VINTRP_MOV_PARAMS)refusal disabledrdna2_tools_checkif ops[1] != 'p0':inop_v_interp_mov_f32disabledstartup_flat_param_checkThe golden vectors are the right construction:
000006c8,01050ac8,020a0ec8say nothing about the decoder's internals,and the LLVM round trip is guarded by
LLVM_LIBso it skips instead of passing vacuously.The one claim without a test: e64 with an out-of-range selector
The description says "the VOP3 spelling already refused src1 >= 3 the same way", but the added tests only cover the e32 path.
I checked it on your branch by taking the golden e64 word
010002d6(v_interp_mov_f32_e64 v1, p10, attr0.x) and setting theselector field:
So the claim holds: out-of-range selectors become an 8-byte unsupported record, and the next instruction keeps its offset — the
same shape as your 4-byte e32 case. Two notes:
v_interp_mov_f32_e64 word with modifier bits that gfx1013 llvm-mc rejects. For theselector case the cause is the parameter field, not modifier bits; a reader debugging a real selector 216 will chase the wrong
thing. Worth making the comment generic, or emitting the selector in it as the e32 path does.
test_vintrp_interp_mov_selector_out_of_range_is_refusedwould pin it. Right now it is true but untested on this branch.Verdict
Reviewed. The decoder change is narrow, the scc of the p1/p2 forms is preserved (their
020004c8case), and the translatorrefusal carries the selector in the reason. Mergeable as is; the two notes above are about what a later reader will trip on.
Notes