[Enhancement]Add arm neon adaptation for lots of SIMD functions
Why I'm doing: Current Starrocks does not support SIMD functions on arm, which leads to a loss in performance.
What I'm doing: Apating the AVX2KI library provided by huawei kunpeng (https://www.hikunpeng.com/zh/developer/boostkit/library/system?subtab=AVX2KI), lots of SIMD functions is implemented on arm.
Fixes #issue
What type of PR is this:
- [ ] BugFix
- [ ] Feature
- [x] Enhancement
- [ ] Refactor
- [ ] UT
- [ ] Doc
- [ ] Tool
Does this PR entail a change in behavior?
- [ ] Yes, this PR will result in a change in behavior.
- [x] No, this PR will not result in a change in behavior.
If yes, please specify the type of change:
- [ ] Interface/UI changes: syntax, type conversion, expression evaluation, display information
- [ ] Parameter changes: default values, similar parameters but with different default values
- [ ] Policy changes: use new policy to replace old one, functionality automatically enabled
- [ ] Feature removed
- [x] Miscellaneous: upgrade & downgrade compatibility, etc.
Checklist:
- [ ] I have added test cases for my bug fix or my new feature
- [ ] This pr needs user documentation (for new or modified features or behaviors)
- [ ] I have added documentation for my new feature or new function
- [ ] This is a backport pr
Bugfix cherry-pick branch check:
- [x] I have checked the version labels which the pr will be auto-backported to the target branch
- [ ] 3.2
- [ ] 3.1
- [ ] 3.0
- [ ] 2.5
@1153710405 it's been a while, how's this going on?
@1153710405 it's been a while, how's this going on?
I was involved in another emergency project before, and will go on this PR this week.
@1153710405 is this PR ready for review?
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
No data about Duplication
Generally it works on armv8 based platform. I shall double check whether it works on centos 7 and ubuntu.
Sent from Mail for Windows
From: Kevin Cai Sent: 2024年3月25日 10:30 To: StarRocks/starrocks Cc: 1153710405; Mention Subject: Re: [StarRocks/starrocks] [Enhancement]Add arm neon adaptation forlots of SIMD functions (PR #40569)
@kevincai commented on this pull request.
In thirdparty/build-thirdparty.sh:
@@ -1239,6 +1239,20 @@ build_clucene() { fi }
+# avx2ki +build_avx2ki() {
- check_if_source_exist $AVX2KI_SOURCE
- cd $TP_SOURCE_DIR/$AVX2KI_SOURCE
- rpm2cpio boostkit-ksl-2.0.0-1.aarch64.rpm | cpio -id which platform will this library for, can it work on both centos7 and ubuntu22.04? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
@kevincai I have successfully built this branch, but the inspection pipeline still failed on the info job. How should I solve it?
@kevincai I have successfully built this branch, but the inspection pipeline still failed on the info job. How should I solve it?
approve the ci pipeline running. wait for the result, also there are new changes to thirdparty, you may want to rebase to latest main branch and retry again.
@kevincai I encounter a new link error related to curl when linking to starrocks_be. Is it related to the newest changes to thirdparty?
/usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-psl.o): in function Curl_pl_destroy': ./curl-8.4.0/lib/psl.c:43: undefined reference to psl_free'
/usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-psl.o): in function Curl_pl_use': ./curl-8.4.0/lib/psl.c:81: undefined reference to psl_latest'
/usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-psl.o): in function Curl_pl_destroy': ./curl-8.4.0/lib/psl.c:43: undefined reference to psl_free'
/usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-psl.o): in function Curl_pl_use': ./curl-8.4.0/lib/psl.c:90: undefined reference to psl_builtin'
/usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-version.o): in function cul_version': ./curl-8.4.0/lib/version.c:214: undefined reference to psl_get_version'
/usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-cookie.o): in function Cur_cookie_add': ./curl-8.4.0/lib/cookie.c:1036: undefined reference to psl_is_cookie_domain_acceptable'
collect2: error: ld returned 1 exit status
@kevincai I encounter a new link error related to curl when linking to starrocks_be. Is it related to the newest changes to thirdparty?
/usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-psl.o): in function
Curl_pl_destroy': ./curl-8.4.0/lib/psl.c:43: undefined reference topsl_free' /usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-psl.o): in functionCurl_pl_use': ./curl-8.4.0/lib/psl.c:81: undefined reference topsl_latest' /usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-psl.o): in functionCurl_pl_destroy': ./curl-8.4.0/lib/psl.c:43: undefined reference topsl_free' /usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-psl.o): in functionCurl_pl_use': ./curl-8.4.0/lib/psl.c:90: undefined reference topsl_builtin' /usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-version.o): in functioncul_version': ./curl-8.4.0/lib/version.c:214: undefined reference topsl_get_version' /usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-cookie.o): in functionCur_cookie_add': ./curl-8.4.0/lib/cookie.c:1036: undefined reference topsl_is_cookie_domain_acceptable' collect2: error: ld returned 1 exit status
did you have system-wide curl library installed?
@kevincai I encounter a new link error related to curl when linking to starrocks_be. Is it related to the newest changes to thirdparty? /usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-psl.o): in function
Curl_pl_destroy': ./curl-8.4.0/lib/psl.c:43: undefined reference topsl_free' /usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-psl.o): in functionCurl_pl_use': ./curl-8.4.0/lib/psl.c:81: undefined reference topsl_latest' /usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-psl.o): in functionCurl_pl_destroy': ./curl-8.4.0/lib/psl.c:43: undefined reference topsl_free' /usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-psl.o): in functionCurl_pl_use': ./curl-8.4.0/lib/psl.c:90: undefined reference topsl_builtin' /usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-version.o): in functioncul_version': ./curl-8.4.0/lib/version.c:214: undefined reference topsl_get_version' /usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-cookie.o): in functionCur_cookie_add': ./curl-8.4.0/lib/cookie.c:1036: undefined reference topsl_is_cookie_domain_acceptable' collect2: error: ld returned 1 exit statusdid you have system-wide curl library installed?
No. I can still successfully build this branch in the morning, and there are no any other changes to the system after that.
@kevincai I encounter a new link error related to curl when linking to starrocks_be. Is it related to the newest changes to thirdparty? /usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-psl.o): in function
Curl_pl_destroy': ./curl-8.4.0/lib/psl.c:43: undefined reference topsl_free' /usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-psl.o): in functionCurl_pl_use': ./curl-8.4.0/lib/psl.c:81: undefined reference topsl_latest' /usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-psl.o): in functionCurl_pl_destroy': ./curl-8.4.0/lib/psl.c:43: undefined reference topsl_free' /usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-psl.o): in functionCurl_pl_use': ./curl-8.4.0/lib/psl.c:90: undefined reference topsl_builtin' /usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-version.o): in functioncul_version': ./curl-8.4.0/lib/version.c:214: undefined reference topsl_get_version' /usr/bin/ld: /home/hqs/starrocks/starrocks-arm_neon-adaptation-patch/thirdparty/installed/lib/libcurl.a(libcurl_la-cookie.o): in functionCur_cookie_add': ./curl-8.4.0/lib/cookie.c:1036: undefined reference topsl_is_cookie_domain_acceptable' collect2: error: ld returned 1 exit statusdid you have system-wide curl library installed?
I add --without-libpsl in the ldflags of curl and this problem is solved. But I still havn't figured out how this problem is triggered, especially when I can still succeed to build the day before.
@kevincai It seems that the pipeline failed in Thirdparty Update due to permission denied when executing build-thirdparty.sh. How can it be solved?
@mergifyio rebase
rebase
❌ Base branch update has failed
Git reported the following error:
Rebasing (1/25)
Auto-merging thirdparty/vars-aarch64.sh
CONFLICT (content): Merge conflict in thirdparty/vars-aarch64.sh
error: could not apply 17a846d48... Download avx2ki for arm_neon-adaptation
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
Could not apply 17a846d48... Download avx2ki for arm_neon-adaptation
@kevincai The pipeline failed at codecov/project/be-total. What is the problem and how should I solve it?
**license/cla ** Pending — Contributor License Agreement is not signed yet.
should be fine for that check. it is still optional.
@kevincai The pipeline failed at codecov/project/be-total. What is the problem and how should I solve it? shall check how to fix the
CLAitem @1153710405
@kevincai I update again to solve the conflict with vars-aarch64.sh. Besides, how should I get two approving reviews?
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
No data about Duplication
[FE Incremental Coverage Report]
:white_check_mark: pass : 0 / 0 (0%)
[BE Incremental Coverage Report]
:white_check_mark: pass : 1 / 1 (100.00%)
file detail
| path | covered_line | new_line | coverage | not_covered_line_detail | |
|---|---|---|---|---|---|
| :large_blue_circle: | be/src/exec/arrow_to_starrocks_converter.cpp | 1 | 1 | 100.00% | [] |
@kevincai @imay Hello, is this PR ready to be merged?
Is there a stable reproducible case, I need to confirm the real performance improvement.
Any performance for SSB/TPC-H/TPC-DS 100G - 1000G scenarios. For operations like move_mask ARM performance is poor. We have adapted the NEON instruction set in our hotspot code, and in gravtion tests it is already doing as well as the X86 platform. So I wouldn't recommend merging into this patch without further significant improvements.
These hotspot codes are highly inline, and using .so calls breaks the inline and may introduce performance degradation
https://github.com/StarRocks/starrocks/issues/46174
simde might be an alternative solution to do this.