Shaders: saturate clamped 24-bit multiply and multiply-add #2926
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!2926
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2926"
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?
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 00:16 UTC · original
andrewpozdnakov7-jpg:codex2/mul24-clamp→main· +151 −33 · 3 files · 1 commits · openSummary
Lower the
clampforms ofv_mul_i32_i24,v_mul_u32_u24,v_mad_i32_i24, andv_mad_u32_u24. Saturate the complete product or multiply-add to the signed or unsigned 32-bit range. The unclamped forms still wrap.Only the clamped path computes a high word. Splitting each 24-bit operand into 16 low bits and 8 high bits keeps each partial product and intermediate sum in i32. For MAD, the carry and sign extension from the addend complete the high word before saturation. This needs only 32-bit DXIL integer operations. The forms are listed with
clampin the GFX1030 assembly reference, and integer saturation is described in section 6.5 of the RDNA 2 ISA.Verification
63bcca4, the same fixture is refused atv_mul_i32_i24withinteger output modifiers. On the patch, all 96 signed/unsigned MUL/MAD input and mode combinations match an exact wide-integer reference on app-local WARP SM 6.6 with DXIL validation.@Marvisak on GitHub · 2026-11-26 04:24 UTC · original
Automated triage for the maintainers.
Merge candidate. Adds the
clampforms ofv_mul_{i,u}32_{i,u}24andv_mad_{i,u}32_{i,u}24, which main refused inwrite_i, inemit/lower/mul24.rs, leaving the unclamped forms unchanged.clamp_mul24checks out: the 16/8-bit split keeps partial products within 32 bits,middle_hifloors correctly for signed forms, the MAD carry and addend sign extension give the exact high word, and saturation is right. The test compares against an exact i64 reference, and the RDNA2 ISA integer-clamp rule is cited.CI: passing.
Generated by Claude Code
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.