Shaders: honor op_sel, omod and clamp on v_interp_p2_f16 #1696
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!1696
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1696/head"
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?
@Calvix2k on GitHub · 2026-11-24 20:49 UTC · original
Calvix2k:codex/shader-interp-p2-f16-029→main· +161 −14 · 2 files · 1 commits · merged 2026-11-25 00:23 UTCAddresses
VIC-BT-029from audit #1242.Summary
v_interp_p2_f16is a VOP3 instruction withop_sel[3](destination half),omodandclamp, but the lowering always wrote the low half vialow_halfand dropped the modifiers.write_half, which honorsop_sel[3]and the SDWA destination word while keeping the untouched half.omod(mul:2, mul:4, div:2) is applied first, thenclamp, in f32 around a singlelegacyF32ToF16conversion — the same orderwrite_fuses for f32 results.Test
interpolated_f16_writes_the_op_sel_half_with_modifiersbuilds a synthetic pixel shader (v_interp_p1_f32+v_interp_p2_f16+mrt0export), dumps the emitted DXIL withdxc -dumpbinand checks:shl i32), the low-half form keeps the destination's high half;omodemits the multiply by 2.0 andclampemitsdx.op.unary.f32opcode 7;Against
lower.rsfrommainthe test fails on the high-half assertion.Validation
cargo test -p victory-shader --locked -- --test-threads=1 --skip emit::valu_tests --skip emit::waterfall_tests— passed (103 tests, 1 ignored).cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings— passed.cargo xtask policy— passed (154 files).Note: the DXIL check pins the emitted operations; numeric behavior of f16 clamp follows the crate's existing 16-bit float convention (saturate via DXIL
fSat).github-bot referenced this pull request2026-11-26 05:17:24 +00:00
@Calvix2k on GitHub · 2026-11-24 22:05 UTC · original
Rebased onto upstream
70564ae; the only conflict was the test module (upstream added its own pixel-shader helpers, this PR adds the DXIL dump check). Resolution keeps both.cargo check -p victory-shader --tests --lockedpasses on the resolved tree.Full test/clippy validation is deferred because the local disk filled during the rebase batch; CI will run it. No code change beyond the rebase.
@upipibi on GitHub · 2026-11-24 22:52 UTC · original
NVIDIA run: RTX 3070 8 GB, driver 616.56, Windows 11, debug,
e29391f(onmain70564ae).interpolated_f16_writes_the_op_sel_half_with_modifierspasses on the hardware adapter.AI-assisted (Claude Code). Synthetic tests only.