vermicelli: correct AVX-512 nvermicelli tail scan masking bug#378
Merged
markos merged 1 commit intoVectorCamp:developfrom Apr 6, 2026
Merged
vermicelli: correct AVX-512 nvermicelli tail scan masking bug#378markos merged 1 commit intoVectorCamp:developfrom
markos merged 1 commit intoVectorCamp:developfrom
Conversation
|
You mention that it fixes #251 but that one never touched this particular function. Anyway, could you please refactor this PR against develop as well? |
In nvermicelliExecReal, the tail path loads a vector from (buf_end - S) so the unprocessed tail bytes sit at the END of the vector (high offsets). However, first_zero_match_inverted<64> applies a mask selecting only the FIRST 'len' bytes (low offsets), which means it re-checks the already-scanned overlap region and completely misses the actual tail bytes. This only affects AVX-512 (S=64) because the 16-byte and 32-byte specializations of first_zero_match_inverted mark 'len' as UNUSED and always check the full vector. Fix by passing S instead of (buf_end - d) as the length, so the full vector is checked. The overlap bytes are guaranteed to already match, so no false positives are possible, and the existing (rv < buf_end) guard prevents out-of-range results. Fixes: d6fe28a ("added refactored vermicelli_simd.cpp implementation") Signed-off-by: Byeonguk Jeong <jungbu2855@gmail.com>
18cd976 to
b613711
Compare
Author
Oh... I don't remeber why I mentioned that commit. It might be a mistake. The commit log has modified also. Thanks for pointing out that. |
markos
approved these changes
Apr 6, 2026
markos
left a comment
There was a problem hiding this comment.
The remaining tests failed for different reasons. Looks good, thank you for your contribution!
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.
In nvermicelliExecReal, the tail path loads a vector from (buf_end - S) so the unprocessed tail bytes sit at the END of the vector (high offsets). However, first_zero_match_inverted<64> applies a mask selecting only the FIRST 'len' bytes (low offsets), which means it re-checks the already-scanned overlap region and completely misses the actual tail bytes.
This only affects AVX-512 (S=64) because the 16-byte and 32-byte specializations of first_zero_match_inverted mark 'len' as UNUSED and always check the full vector.
Fix by passing S instead of (buf_end - d) as the length, so the full vector is checked. The overlap bytes are guaranteed to already match, so no false positives are possible, and the existing (rv < buf_end) guard prevents out-of-range results.
Fixes: 87d8b35 ("Feature/refactor fdr (#251)")
@AhnLab-OSS @AhnLab-OSSG