vermicelli: correct AVX-512 nvermicelli tail scan masking bug#378
Open
byeonguk-jeong wants to merge 1 commit intoVectorCamp:developfrom
Open
vermicelli: correct AVX-512 nvermicelli tail scan masking bug#378byeonguk-jeong wants to merge 1 commit intoVectorCamp:developfrom
byeonguk-jeong wants to merge 1 commit intoVectorCamp:developfrom
Conversation
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 (VectorCamp#251)") Signed-off-by: Byeonguk Jeong <jungbu2855@gmail.com>
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