Add saturating add/sub intrinsics to RISC-V vector backend#9185
Open
rajeshgangam wants to merge 1 commit into
Open
Add saturating add/sub intrinsics to RISC-V vector backend#9185rajeshgangam wants to merge 1 commit into
rajeshgangam wants to merge 1 commit into
Conversation
Map Halide's saturating_add and saturating_sub operations to RVV instructions vsadd/vsaddu and vssub/vssubu respectively. These are commonly used in image processing for clamped arithmetic and were missing from the RISC-V intrinsic tables. Fixes halide#9184
4458ff3 to
d156545
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
saturating_addto RVVvsadd.vv/vsaddu.vvinstructionssaturating_subto RVVvssub.vv/vssubu.vvinstructionssimd_op_check_riscvtest casesThese are the most commonly used missing operations for image processing workloads (clamped arithmetic). They fit the existing
RISCVIntrinsictable pattern with zero infrastructure changes — just 4 new table entries per signedness.Fixes #9184
Test plan
simd_op_check_riscvchecks forvsadd.vv,vsaddu.vv,vssub.vv,vssubu.vvinstruction patterns in generated assemblyCo-authored-by: Claude Opus 4.6 noreply@anthropic.com