Shaders: honor op_sel[3], clamp, and omod on v_interp_p2_f16 #1338
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1338
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1338"
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?
@AscilCH on GitHub · 2026-11-24 17:33 UTC · original
AscilCH:fix/v-interp-p2-f16-opsel-and-clamp→main· +295 −6 · 2 files · 1 commits · openBug
In
crates/victory-shader/src/emit/lower.rs,Lower::interp()loweredv_interp_p2_f16(VOP3 0x35a) viaself.low_half(), unconditionally writing the convertedf16to bits[15:0]and ignoring VOP3op_sel[3](high destination half),clamp, andomod.On RDNA2 (GFX10.3),
v_interp_p2_f16usesop_sel[3]to select whether the result is written tovdst[15:0]orvdst[31:16]while preserving the untouched half, and supportsomod(*2,*4,/2) andclamp([0.0, 1.0]) on the interpolated result before converting tof16.Reproduction (Before Fix)
With a synthetic RDNA2 VS+PS draw lowered to DXIL and executed on hardware (NVIDIA RTX 3050 6GB Laptop GPU, Windows 11) and WARP:
Fix
v.omodandv.clampinLower::interp()beforelegacyF32ToF16, and returnself.write_half(inst, r, None)soop_sel[3]places the 16-bit result into the chosen half while preserving the other half.emit::valu_tests::v_interp_p2_f16_respects_opsel_and_clampcovering low-half (op_sel[3]=0), high-half (op_sel[3]=1preserving low half),clamp, andomod(mul:2/div:2).Verification
Tested on Windows 11, NVIDIA RTX 3050 6GB Laptop GPU, WARP, and Windows SDK
dxil.dll:rustfmt --edition 2024 --checkonvalu_tests.rs: cleancargo xtask policy:154 files okcargo clippy --workspace --all-targets --locked -- -D warnings: cleancargo clippy --workspace --all-targets --all-features --locked -- -D warnings: cleancargo test -p victory-shader --locked -- v_interp_p2_f16_respects_opsel_and_clamp --nocapture --test-threads=1: passed (hardware + WARP +dxil.dll)VICTORY_WARP=1 cargo test -p victory-shader --locked -- --test-threads=1:121 passed, 0 failed, 1 ignored@Marvisak on GitHub · 2026-11-25 01:23 UTC · original
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:crates/victory-shader/src/emit/lower.rs,crates/victory-shader/src/emit/valu_tests.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
@sinan-cmyk on GitHub · 2026-11-25 01:48 UTC · original
Offline measurement on a retail dump, and the shader tests on Ada
Result: no count change against
main.Offline. I merged head
e2dc6baontomainffe310e(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 21,724 onmain, 21,724 with this PR.No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on
main. The count shows that the change rejects nothing. It does not show whether the output is right.Tests: with the same merge,
cargo test --locked -p victory-shader --libpassed 121, failed 0. The bitcode benchmark is ignored, as onmain, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, withVICTORY_WARPunset.No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
@Headache3318 on GitHub · 2026-11-25 02:00 UTC · original
Tested on Linux (Arch, kernel 7.3.5, 3× RTX 4090 driver 620.73.04), Rust 1.98.1 (pinned). PR head
e2dc6baapplied cleanly onto currentmainccfb029.cargo test -p victory-shader --locked: 96 passed, 0 failed, 1 ignored. All tests pass. The newv_interp_p2_f16_respects_opsel_and_clamptest is GPU-specific (requires dxil.dll/WARP) and is skipped on Linux.cargo clippy -p victory-shader --all-targets -- -D warnings: 2 errors (vs 4 on main). The PR net-reduces clippy errors by fixing unused imports.Not tested: Windows MSVC build, the title itself. AI-assisted.
@Dathinel on GitHub · 2026-11-25 02:19 UTC · original
I tested the draw fixture from
e2dc6baonmain@940d32fwith the lowering from #1696. A test-only rebase worked with one change to the synthetic pixel shader input signature.With the original fixture, pixel shader emission stopped before the draw at offset 128 with
a packed input half no element holds. The fixture setsfp16: true, pack2: true, but its ISG1 declaresTEXCOORDas float32. Main’s packed-half lookup uses the element’s parsed component type. In the test’sps_isg1, changing the second element’s component type from3to6(float16, little-endian u32 at byte 56) was sufficient. The shader instructions and expected pixels stayed the same.All 16 pixels matched on both the RTX 3050 Laptop and WARP (Windows/MSVC). Two independent controls on hardware show what the test catches: disabling only
clampchanged pixel 0’s alpha from 1 to 0.5, and disabling onlyomodchanged blue from 0.5 to 0.25. Restoring main passed on both backends again.To reproduce, append
v_interp_p2_f16_respects_opsel_and_clampfrom this PR to main’svalu_tests.rsand run the following before and after changing the fixture field:AI-assisted. Synthetic draw only.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.