Shaders: decode the VOP3 interpolation forms (attr63.w is no literal) #70
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/uiliannn--VItoriaBr--gone-20261201!70
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-70"
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?
@lcg007xd-c on GitHub · 2026-11-25 21:34 UTC · original
lcg007xd-c:fix/vop3-interp-decode→main· +83 −2 · 5 files · 2 commits · openWhat
The VOP3 interpolation instructions put an attribute and its channel in the first source field, not an operand code. That covers
v_interp_p1ll_f16,v_interp_p1lv_f16,v_interp_p2_f16, and the 64-bit encodings ofv_interp_p1/p2/mov_f32.attr63.wencodes as0xFF, and the decoder's length rule read that as "a 32-bit literal follows". The instruction then swallowed the next dword, and everything after it decoded out of step.llvm-mcreads all of them as two dwords. For these opcodes, the first source no longer counts toward a literal.VOP3 0x200–0x202 also get their names:
v_interp_p1_f32,v_interp_p2_f32andv_interp_mov_f32, LLVM's_e64forms. Before, they decoded with no name. Each takes two sources, andv_interp_mov_f32's parameter prints asp10/p20/p0, as in VINTRP. The input pass only understands the VINTRP pair, so translation refuses these VOP3 forms with an error instead of misreading them. A test pins that.Upstream has an open PR for the same length bug (Marvisak/VIctory#2515). This is an independent fix on VItoriaBr's decoder.
Tests
vop3_interpolation_attributes_are_not_literalschecks six encodings fromllvm-mc -triple=amdgcn -mcpu=gfx1030: the three f32_e64forms withattr31.w, and the three f16 forms withattr63.w. Each must decode as one two-dword instruction with LLVM's operands (without the_e64suffix). With the length change reverted, the test fails.vop3_encoded_f32_interpolation_is_refusedchecks that a VOP3-encoded p1/p2 pair decodes with its names and thatio::raiserefuses it.--target x86_64-pc-windows-msvc) pass locally.Not tested: Windows runtime, GPU, and the game. Real shaders have fewer than 33 attributes, so
attr63.wshould not appear in practice. The length bug matters for disassembly and for decoding data or garbage as code.Note: the Windows
checkjob fails on current main for an unrelated reason (5668b8b, missingLayout::bytes_from), which #64 fixes.🤖 Generated with Claude Code
@lmouz823-lang on GitHub · 2026-11-28 06:11 UTC · original
I can take native Windows decoder validation at exact head
aed8519e0807f2fa6d7f748130d59e5443816b4e. This follows the interpolation cases recorded among the #87 fixture disagreements. I will run the existing decoding/refusal regressions and check concatenated instruction-stream alignment, attribute fields and genuine literal controls. Any focused additional regression will include a targeted negative control and fresh restored-source runs, with explicit LLVM/GPU/game limits. AI-assisted with Codex.@lmouz823-lang on GitHub · 2026-11-28 06:21 UTC · original
Native Windows decoding and input-pass validation completed for exact head
aed8519e0807f2fa6d7f748130d59e5443816b4e. Both original regressions each execute exactly one test and pass. The original GFX10 group passes 13/13, and the input-pass group passes 6/6.I added one 48-line test-only stream regression using the six interpolation pairs from this PR's existing SP3 test. Each interpolation follows a real
s_nop, so it starts at byte offset 4. A normalv_fma_f32with a real src2 literal follows it, then another nop and the end instruction. The test checks offsets0,4,12,24,28, lengths1,2,3,1,1, the full ordinary-literal instruction words, and the decoded interpolation attribute index/channel/high flag. The f32 pairs use attr31.w and the f16 pairs attr63.w. These synthetic encodings and the ordinary VOP3 literal control come from the existing repository tests. Localllvm-mcassembly was outside this validation.A temporary negative control incorrectly restricts the interpolation length exception to
offset == 0. The original 13 GFX10 tests and all six input-pass tests still pass. The new exact test fails with exit 101 on the non-leadingv_interp_p1ll_f16, which is wrongly read as three dwords. The following FMA is then split into instructions at offsets 16 and 20 instead of remaining a three-dword instruction at offset 12.After restoring the implementation, I cleaned only the isolated shader package target and confirmed an actual 11.97-second compilation. The final GFX10 group passes 14/14 and the input-pass group 6/6. The original two exact regressions and the new exact regression each execute one test and pass. The f32 input-pass regression continues to require refusal of the named VOP3 forms, preserving the explicit unsupported path. Removing the added function reproduces the complete head source after newline normalization.
On Windows 11 build 26200, Rust 1.98.1 MSVC, default test profile and an isolated target, package Clippy with
--all-targets -- -D warnings, whole-file rustfmt on both original and finalgfx10/mod.rs, andgit diff --checkpass. The rustfmt check usesskip_children=trueto check this file. Asset policy reports 196 files ok.The selected GFX10 and input-pass groups have zero failed or ignored tests and no runtime skip diagnostics. Scope is decoding, field/text metadata and the existing input-pass refusal checks. A live LLVM comparison, GPU/DXIL execution, game behavior, other platforms and the remaining shader/workspace suites remain unverified.
Reproduce the final checks after applying the attached patch.
AI assistance from Codex covered the regression, execution and this report.
Stream alignment regression against this head
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.