New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libandroidaudioplugin.so causes freezes at Preset extension on plugins with -fvectorize in -O2 optimization flag
#194
Comments
context: #194 It would disable some optimizations in libandroidaudioplugin.so...
|
I added the workaround ^, but would leave this issue open until we figure out how to get some repro code or have this issue fixed somehow. |
|
Thanks to this SO thread https://stackoverflow.com/questions/15548023/clang-optimization-levels I could figure out it is |
-O2 optimization flag-fvectorize in -O2 optimization flag
|
It is most likely a regression in NDK 24.0.8215888. 23.2.8568313 runs fine with This experiment requires the following changes:
Switching only between r23 and r24 shows the difference. |
Build and install to mavenLocal with: `./gradlew publishToMavenLocal` (no `build` this time, as it will fail at aapinstrumentsample) Build and run `aapinstumentsample` on Android Studio (any version; I used Jellyfish) Select the only one item in the list and tap "Start" -> "-- Presets --" with ndk r23 (as indicated in gradle/libs.versions.toml), it shows the items. with ndk r24 the UI freezes.
-fvectorize in -O2 optimization flag-fvectorize in -O2 optimization flag
|
It is reproducible without aap-juce; aapinstrumentsample, when AAP dependencies are resolved from mavenLocal instead of |
|
According to As long as I look at git history for |
|
Thanks to this SO thread https://stackoverflow.com/questions/44635314/how-to-compile-with-different-compile-options-for-different-files-in-cmake I could narrow down the trigger source file to just one file: e375f03 |
|
^ was enough only for aapinstrumentsample, not enough for aap-juce plugins (at least on aap-juce-hera)... |
With this change, most of libandroidaudioplugin.so code are still optimized just like -O2.
|
Actually just de-optimizing |
…as #pragma. It seems we can specify -fvectorize without conditionally applying to the sources, now that we have general vectorization avoidance in cmidi2.h (which seemed to be the occurrence point of this issue). I thought we could simply go back to -O2, but such a build results in the same UI freeze problem, so I leave it as -O1 + a bunch of optimization options.
|
It is now shrunk to only two functions in This would be good enough to give a bug report to the NDK team. I did good job by myself enough. |
Current libandroidaudioplugin.so in androidaudioplugin.aar seems to cause problem when it is built with the default AGP/NDK setup for the release build (CMAKE_BUILD_TYPE=RelWithDebInfo, where CMAKE_CXX_FLAGS is initialized as
-O2 -g -DNDEBUG). With the default build, aap-juce-hera, for example, does not let us get presets on either aap-juce-simple-host or aaphostsample.The problem here is, interestingly,
-O2.Adding this
externalNativeBuildblock fixes the problem i.e. changing the optimization flag from-O2to-O1(in other words, changing the snippet below from-O1to-O2brings back the problem):It is similar to #174, but unlike that issue which was basically due to our faulty code, it is only about optimization differences that seems more likely the compiler issue.
The text was updated successfully, but these errors were encountered: