perf: AVX2 8888 load/store + f32x16 save specializations#175
Open
bhark wants to merge 1 commit into
Open
Conversation
Collaborator
|
Looks good, but I would avoid direct SIMD intrinsics calls and |
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
AVX2 specializations for these primitives:
lowp::load_8888/lowp::store_8888(these are the bulk ofsource_over_rbga)lowp::load_8highp::load_8888/highp::store_8888f32x16::save_to_u16x16Gated on
feature = "simd", target_feature = "avx2". So SSe2/SSE4.1/AVX, Neon WASM-SIMD etc. are unchanged.Why
These primitives, on AVX2, can collapse a long scalar shuffle into a handful of instrinsics. This means
lowp::source_over_rgbadrops from ~350 to about 50 instructions.Results
blend::destination_atopgradients::two_stops_linear_padblend::source_overfill::rectgradients::three_stops_linear_evenhairline::aablend::clear,fill::opaque(don't hit specialized paths)I found no regressions anywhere.
Notes
Some nuances to this:
lowp::store_8888AVX2 ORs channels instead of truncating withas u8. Shouldn't be an issue, unless something produces channel values > 255 in lowp, in which case AVX2 would surface a visual artifact instead of truncating silently.src/wide/i32x8_t.rs/u32x8_t.rspatterns-Ctarget-cpu=haswell,-Ctarget-feature=+avx2ortarget-cpu=native.