Repository navigation
Reinterpret arrays in fallback split and combine instead of copy_from_slice - #446
Merged
Merged
Conversation
LaurenzV
marked this pull request as draft
November 24, 2026 18:33
…_slice At opt-level = "z", LLVM keeps the copy_from_slice calls in the fallback's split and combine as copies through aligned stack slots. Every operation on a vector wider than 128 bits goes through them, so those operations end up several times larger and slower than at opt-level = 3. Reinterpreting the arrays with checked_transmute_copy lets LLVM keep the values in locals at both levels.
LaurenzV
force-pushed
the
fallback-split-combine
branch
from
November 24, 2026 18:36
b1adebd to
a2b7038
Compare
copy_from_slicecopy_from_slice
LaurenzV
marked this pull request as ready for review
November 24, 2026 18:39
Shnatsel
approved these changes
Nov 24, 2026
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.
I'm currently trying to integrate
filtraintoresvg, which builds on top offearless_simd. The problem we have observed is that when building withopt-levelz(which optimizes for size), we are seeing some slowdowns and more importantly, a very large increase in binary size on the scalar WASM build.The problem seems to arise from the 256-bit and 512-bit ops, which use the split and combine approach. Apparently, using
copy_from_slicehere fails to properly optimize the memory copies away for this optimization level, hence the large binary size bloat and also worse performance. Using our existingchecked_transmute_copyhelper seems to fix it. Unfortunately scalar WASM builds are still important for resvg, so this is probably a blocker.Here you can see the differences in binary size and also performance.
mainis current resvg main,stockis the filtra integration with fearless_simd 1.2, andnewis with this branch: