fix: correct SVE accelerator bugs in shufti, truffle, and noodle#377
Open
byeonguk-jeong wants to merge 3 commits intoVectorCamp:developfrom
Open
fix: correct SVE accelerator bugs in shufti, truffle, and noodle#377byeonguk-jeong wants to merge 3 commits intoVectorCamp:developfrom
byeonguk-jeong wants to merge 3 commits intoVectorCamp:developfrom
Conversation
doubleMatched() in shufti_sve.hpp used svptrue_b8() for the final comparison instead of the caller-provided predicate pg. When called from dshuftiOnce() with a partial predicate (buffer shorter than SVE vector length), inactive lanes loaded as zero could satisfy the match condition, producing false positive matches. Changed the return statement to use pg for both svnot_z and svcmpeq, ensuring inactive lanes are excluded from match results. Added 5 unit tests covering short/variable-length buffers with null-byte pair patterns and mixed single/double-byte patterns to catch regressions. Fixes: 60b2112 ("Use SVE for double shufti") Signed-off-by: Byeonguk Jeong <jungbu2855@gmail.com>
Fix a bug in rtruffleExecSVE where the tail processing for short buffers used svwhilele_b8 instead of svwhilelt_b8. svwhilele_b8(0, N) activates lanes 0..N (N+1 lanes), reading one byte past the buffer end. The forward path (truffleExecSVE) already correctly uses svwhilelt_b8, which activates lanes 0..N-1 (N lanes). Add 26 new unit tests for the truffle accelerator covering: - Compile roundtrip: character ranges, empty class, same-nibble chars - Forward exec: single byte buffers, high byte (>=0x80) matching, same-nibble non-match, NUL char, dot (all chars), buffer-end match, varying lengths (1-130), alignment sweep, multi-char classes, all 256 single-char classes, 0x7F/0x80 boundary - Reverse exec: single byte, high byte, NUL, buffer-start match, varying lengths, large buffer (4K), alignment sweep, all 256 single-char classes, multiple matches, boundary chars Fixes: c67076c ("Add truffle SVE implementation") Signed-off-by: Byeonguk Jeong <jungbu2855@gmail.com>
- Change return type from hwlmcb_rv_t to hwlm_error_t to match the actual return type of checkMatched() and singleCheckMatched() - Fix scanDouble short-path condition: use (e - d) instead of scan_len which could be stale after adjusting d for history - Fix formatting: add space after 'if' keyword Fixes: 0ba1cbb ("Add SVE2 support for noodle") Fixes: b233221 ("Remove possibly undefined behaviour from Noodle.") 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.
Summary
Fix three bugs affecting SVE/SVE2 accelerator code paths, with regression tests for truffle.
Bug Fixes
shufti-double: false positive on vector boundary
Use predicate mask to prevent false positives when scanning double shufti across vector boundaries.
truffle: off-by-one in rtruffleExecSVE tail
Fix off-by-one error in reverse truffle SVE tail processing. Includes comprehensive unit tests covering forward/reverse edge cases, varying lengths, alignment sweep, high-byte characters, and NUL matching.
noodle SVE: incorrect return types and scan length
hwlmcb_rv_ttohwlm_error_tto match actual function signatures.scanDoubleshort-path condition to use(e - d)instead ofscan_len, which could be stale after adjustingdfor history.ifkeyword.Commits
Files Changed
@AhnLab-OSS @AhnLab-OSSG