shader: lower 6 RDNA2 integer dot-product instructions without INT64 #1694
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!1694
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1694/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?
@geiyiliyabumo on GitHub · 2026-11-24 20:48 UTC · original
geiyiliyabumo:fix/shader-dot-products→main· +208 −1 · 2 files · 1 commits · closed without mergingSummary
crates/victory-shader/src/emit/lower.rs(Lower::dot_int):v_dot4c_i32_i8(0x00d, reading oldvdstalready supplied byir.rs).v_dot2_i32_i16(0x014),v_dot2_u32_u16(0x015),v_dot4_i32_i8(0x016),v_dot4_u32_u8(0x017),v_dot8_u32_u4(0x019).INT64(0x8000) nor native 16-bit (0x40000) feature flags inSFI0.op_sel/op_sel_hihalf selection ondot2, exact signed/unsignedCLAMPsaturation (includingi16x2+2^31andu16x2double-carry saturation), and wraparound whenclampis clear.v_dot2_f32_f16/v_dot2c_f32_f16).Verification
cargo test -p victory-shader --lib valu_tests: PASS on both AMD Radeon RX 9060 XT (D3D12 hardware) and Microsoft Basic Render Driver (WARP) (v_dot4c_i32_i8_reads_old_destination_and_wraps,vop3p_integer_dots_clamp_or_wrap_the_full_sum,vop3p_integer_dot2_selects_each_source_half, asserting bothINT64and native 16-bitSFI0flags are clear).cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: pass (154 files).AI-assisted; synthetic tests only, no game files.
@adamdotpy on GitHub · 2026-11-24 21:36 UTC · original
Reviewed head
da18cb8locally (isolated worktree, fresh CARGO_TARGET_DIR, real GPU dispatch, ~90s for the dot tests).What it does: lowers the six RDNA2 integer dot products —
v_dot2_{i32_i16,u32_u16},v_dot4c_i32_i8/v_dot4_i32_i8,v_dot4_u32_u8,v_dot8_u32_u4— in pure 32-bit DXIL via a shareddot_int: per-lane BFE/SDWA-style extraction (select_bits, opsel picks each 16-bit half), i32 products summed withBin::Add, accumulator read from the old destination for the 2-source VOP2 forms and from src2 for the VOP3P/cforms. Clamp: signed saturates with sign-based overflow detection, with the width-16 special case that a dot of exactly +2^31 has bit pattern 0x80000000 and must count as positive (handled by an unsignedIUGT(dot, i32::MIN)test); unsigned saturates to u32::MAX using the carry fromadd_sub_carry, tracked at the second 16-bit lane where a carry is possible.Verified locally:
cargo test -p victory-shader --lib dot -- --nocapture— all 3 new tests pass on hardware: the 11-case x 5-ops x clamp on/off sweep against an i64 reference (including +2^31-before-add, opposite-signed products, unsigned carry, accumulator-only carry), the VOP2 dst-as-accumulator wrap test, and the opsel half-selection test.build_dot_csalso asserts SFI0 has neither INT64 nor NATIVE_16BIT_OPS, so the lowering provably needs no 64-bit ops.cargo test -p victory-shader --lib --locked— 123 passed / 0 failed / 1 ignoredcargo clippy -p victory-shader --all-targets --all-features --locked— cleancargo build --release -p victory --locked— okmain@ffe310e:lower.rssame 3 pre-existing hunks (shifted),valu_tests.rs0 — no new fmt hunksFindings, ranked:
LGTM.
@upipibi on GitHub · 2026-11-24 22:52 UTC · original
NVIDIA run: RTX 3070 8 GB, driver 616.56, Windows 11, debug, at the PR head
da18cb8.v_dot4c_i32_i8_reads_old_destination_and_wraps,vop3p_integer_dots_clamp_or_wrap_the_full_sumandvop3p_integer_dot2_selects_each_source_half: 3 passed.It is based on
ffe310eand GitHub shows conflicts withmain70564ae, so this is the head as it stands, not a merge.AI-assisted (Claude Code). Synthetic tests only.
@Marvisak on GitHub · 2026-11-25 01:24 UTC · original
Automated triage for the maintainers. Closing because another open pull request covers the same change.
See #1292. The six integer dot products of #1292 in one helper. Its v_dot4_i32_i8/v_dot4c_i32_i8 arms ignore op_sel, which main's (added today for the upscaler's shaders, lower.rs:5371-5428) handle; the other four are not used by the title.
If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
@Marvisak on GitHub · 2026-11-25 01:34 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
Pull request closed