Fix unreachable constant-mask load_masked kernels (sse2, neon)#1376
Open
DiamonDinoia wants to merge 1 commit into
Open
Fix unreachable constant-mask load_masked kernels (sse2, neon)#1376DiamonDinoia wants to merge 1 commit into
DiamonDinoia wants to merge 1 commit into
Conversation
f56f450 to
2a5c611
Compare
The sse2 and neon constant-mask load_masked kernels were unreachable: they lacked the convert<T> overload parameter the dispatcher passes, so calls fell through to the runtime-mask path. Add the parameter and fix the mask conditions, which used ambiguous count-based tests (e.g. countr_one()==2 also matches 0b1011, silently dropping a lane). Add batch_bool_constant::is_prefix/is_suffix shape predicates plus prefix()/ suffix() returning the set-run length (or size+1 when the mask is not that shape, keeping == exact). The sse2 kernels now dispatch on these instead of raw bit patterns, so each condition reads as the lane shape it handles. avx_128 delegates prefix/upper-half masks to sse2: those lower to plain moves (vmovss/movlps/…) which store-forward, whereas vmaskmov never does on Intel and its stores are microcoded on AMD. Tests cover the shape predicates including off-by-one boundaries (size-1 vs the size+1 sentinel) and near-full mask patterns through the load/store kernels.
2a5c611 to
96866bc
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.
The public dispatch in xsimd_batch.hpp calls
kernel::load_masked(mem, mask, convert{}, mode, A{}), but the sse2 (integral/float/double) and neon constant-mask overloads were declared without the convert parameter, so overload resolution always fell through to the generic common kernel, which round-trips partial loads through a zeroed stack buffer.