You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our app, we don't write vectorized code by hand, instead we're relying on compiler autovectorization. In legacy NDK we used GCC's Graphite and now when we switched to latest NDK r20, I've noticed that Polly, LLVM's alternative to GCC Graphite, isn't enabled in NDK toolchains.
Simple way to check if it's enabled:
$ ./aarch64-linux-android21-clang -mllvm -polly -xc -c - -o test.o < /dev/null
clang (LLVM option parsing): Unknown command line argument '-polly'. Try: 'clang (LLVM option parsing) -help'
clang (LLVM option parsing): Did you mean '-color'?
$ echo $?
1
When on Clang 8 from LLVM's APT repository it doesn't show an error:
Our app is crossplatform, so testing Polly on Linux ARM machine is resulted performance boost around 10%. Is there any bugs on Android so it's not available?
This is just something that we have not had time to evaluate or test in the context of Android. It is something we can look into for future releases, but I can't commit to a specific release yet.
Actually, I have my own research with Polly on Android as part of study of how I can use thirdparty Android NDK compiler, for example, Clang/LLVM from Ubuntu repositories, apt.llvm.org or self-built, but that set up to use NDK's sysroots.
Also, being a fan of hardfloat ABI, I also set compiler to use sysroot from older NDK with uncut hardfloat ABI support. This doesn't apply to the topic, but still was a nice try.
I did ran tests and benchmarks to ensure that this way of hack didn't generated worse code than NDK's toolchain.
So, here is results:
Toolchain
Avg FPS
NDK Clang ARMv7
77 FPS
Host Clang softfp
77 FPS
Host Clang hardfp
75.8 FPS
Host Clang softfp Polly
85 FPS
Host Clang hardfp Polly
89 FPS
NDK Clang AArch64
100 FPS
Host Clang AArch64 Polly
102 FPS
We just ended up with renderer performance on AArch64, but for ARMv7 devices that half of our audience still uses it's given a nice performance boost.
Yeah, I missed that the build configuration wasn't actually picked up. We need to explicitly build polly (actually "Polly") and then bundle the necessary libraries to make this work. Let's move this to r23 instead.
Activity
stephenhines commentedon Oct 11, 2019
This is just something that we have not had time to evaluate or test in the context of Android. It is something we can look into for future releases, but I can't commit to a specific release yet.
a1batross commentedon Oct 11, 2019
@stephenhines thanks for answer!
Actually, I have my own research with Polly on Android as part of study of how I can use thirdparty Android NDK compiler, for example, Clang/LLVM from Ubuntu repositories, apt.llvm.org or self-built, but that set up to use NDK's sysroots.
Also, being a fan of hardfloat ABI, I also set compiler to use sysroot from older NDK with uncut hardfloat ABI support. This doesn't apply to the topic, but still was a nice try.
I did ran tests and benchmarks to ensure that this way of hack didn't generated worse code than NDK's toolchain.
So, here is results:
We just ended up with renderer performance on AArch64, but for ARMv7 devices that half of our audience still uses it's given a nice performance boost.
stephenhines commentedon Mar 19, 2020
https://android-review.googlesource.com/c/toolchain/llvm_android/+/1261718 enables this for our toolchain. We'll be marking Polly support as experimental in an upcoming release of the NDK.
DanAlbert commentedon Mar 19, 2020
I think that change missed the train for the r22 compiler, so triaging to r23. @stephenhines please correct me/move it if that's wrong.
stephenhines commentedon Apr 14, 2020
This actually will make it for R22, since we need to take Yabin's update as well.
DanAlbert commentedon Jun 25, 2020
@stephenhines
Seems this wasn't actually enabled? @nickdesaulniers as well because he was interested in using this.
stephenhines commentedon Jun 25, 2020
Yeah, I missed that the build configuration wasn't actually picked up. We need to explicitly build polly (actually "Polly") and then bundle the necessary libraries to make this work. Let's move this to r23 instead.
DanAlbert commentedon Jun 25, 2020
Bummer. https://android-review.googlesource.com/c/platform/ndk/+/1350665 fixes the changelog.
https://android-review.googlesource.com/c/platform/ndk/+/1350664 adds a test that we should submit when this gets added.
11 remaining items
Add support for NDK r23.
Add support for NDK r23.
Add support for NDK r23.
Add support for NDK r23.
Add support for NDK r23.
Add support for NDK r23.
Add support for NDK r23.
Add support for NDK r23.
Add support for NDK r23.
Add support for NDK r23.
Add support for NDK r23.
Add support for NDK r23.
Add support for NDK r23.
[build] Add support for NDK r23. (#6073)