Mryange opened a new pull request, #69173:
URL: https://github.com/apache/doris/pull/69173
### What problem does this PR solve?
Issue Number: N/A
Problem Summary:
Root cause: `simd::contain_one` and `simd::contain_zero` have x86 SIMD
implementations but fall back to byte-by-byte scans on ARM. Repeated null-map
checks in nullable expressions can therefore become a substantial CPU cost.
Add AArch64 NEON paths that scan 16 bytes at a time using unsigned
maximum/minimum reductions. Preserve early exit, arbitrary nonzero-byte
semantics, and the scalar tail without reading beyond the input. Add tests for
empty inputs, unaligned buffers, vector boundaries, high-bit bytes, and
protected-page boundaries.
Existing end-to-end measurements on a Neoverse-N2 ARM machine (Release,
identical compiler flags, one scanner, batch_size=8160, caches disabled) showed:
| Workload | Scalar median (ms) | NEON median (ms) | Speedup |
| --- | ---: | ---: | ---: |
| Numeric long CASE, COUNT(expr) | 7622.997 | 4553.192 | 1.67x |
| Nullable CASE, 256 unmatched branches | 7105.330 | 3949.980 | 1.80x |
| String input with numeric WHEN, COUNT(*) | 6636.324 | 3364.838 | 1.97x |
| Explicit string WHEN keys | 10947.321 | 7930.656 | 1.38x |
Each median uses ten hot runs after one warmup. The comparison used the same
experimental source baseline with its simple-CASE optimization disabled in both
variants; that optimization is excluded from this PR. Across 11 workloads,
scalar/NEON/StarRocks results matched in all 363 samples. Short-branch
workloads did not consistently improve; the two-branch case was 5.5% slower in
this run. No x86 performance claim is made.
### Release note
Improve ARM performance of byte scans used by nullable expressions.
### Check List (For Author)
- Test
- [ ] Regression test
- [x] Unit Test
- [x] Manual test (details below)
- [ ] No need to test or manual test.
Existing ARM validation: compiled the actual `bits_test.cpp` against the
actual header as a standalone GoogleTest binary; all 8 tests passed, including
both new tests. ARM Release BE/FE builds and the SQL comparisons above passed
on the experimental baseline. Production disassembly confirmed NEON reductions.
The transferred header and test file are byte-identical to those validated
files. This target checkout was not rebuilt; the full BE UT harness and Groovy
regression suites were not run. clang-format 16, `git diff --check`, and
`build-support/check-build-hygiene.sh` passed locally.
- Behavior changed:
- [x] No.
- [ ] Yes.
- Does this need documentation?
- [x] No.
- [ ] Yes.
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]