Skip to content

vsimd: add missing #[inline(always)] to unified::max - #79

Merged
Nugine merged 1 commit into
Nugine:mainfrom
lxl66566:fix-inline
Aug 30, 2026
Merged

vsimd: add missing #[inline(always)] to unified::max#79
Nugine merged 1 commit into
Nugine:mainfrom
lxl66566:fix-inline

Conversation

@lxl66566

Copy link
Copy Markdown
Contributor

unified::max was the only function in unified.rs missing #[inline(always)]. LLVM does not reliably inline it in downstream generic contexts.

In unicode-simd's is_utf32le (AVX2 path), the per-32B-chunk call to vsimd::unified::max::<AVX2, u32, V256> was not inlined when the downstream crate is built with global -C target-feature=+avx2: the hot loop issues an indirect call per chunk, with the 32-byte vector args/result spilled through the stack.

Benchmark on AMD Zen 4, unicode_simd::is_utf32le on 64 KiB, -C target-feature=+sse4.1,+avx2

before after
8.098 µs 427.8 ns

Signed-off-by: lxl66566 <lxl66566@gmail.com>
@Nugine
Nugine merged commit dff9585 into Nugine:main Aug 30, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants