perf: AVX2 gather for PixmapRef::gather#176
Open
bhark wants to merge 1 commit into
Open
Conversation
Collaborator
|
Looks good, but again, we should wrap it nicely in |
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.
This PR is part of a series linked to #174.
What
Replaces 8 scalar pixel loads in
PixmapRef::gatherwith_mm256_i32gather_epi32(on AVX2). Again gated onfeature = "simd", target_feature = "avx2", meaning SSE2/SSE4.1/AVX, Neon etc. are unchanged.Why
Image sampling takes a hard hit from
gather, because bicubic patterns make 16 sample calls per pix batch, each loading 8 pixels. One AVX2 gather replaces 8 dependent scalar loads.Results
patterns::hq(bicubic)patterns::lq(bilinear)patterns::plain(nearest)fill::rect,hairline,blend::destination_over(don't hit gather)No regressions. A bunch of unrelated benches landed at ~1.1x, probably just noise/variance.
Notes
_mm256_i32gather_epi32does no bounds check; callers camp indices to[0, w*h]so the invariant holdssrc/wide/i32x8_t.rs/u32x8_t.rs-Ctarget-cpu=haswell,-Ctarget-feature=+avx2ortarget-cpu=native