-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Addressing the hard float ABI support removal from Android NDK #1215
Comments
Why do you want to remove ARMv7 branch? It is usable on Linux. |
I don't want to remove any branches, was it implicit in my reasoning? What I want is to address the removal of hard float ABI support in Android, which is arguably the most popular ARM platform nowadays. Currently, for OpenBLAS usage in ARMv7-a Android builds, I need to change to either develop or arm_soft_fp_abi branches and compile with TARGET=ARMV5 and ARM_SOFTFP_ABI=1 flags. Otherwise, I get the errors reported in #1168. |
"develop" as the name implies is a work in progress. What is really needed is someone to complete the task started by xianyi on the arm_soft_fp_abi branch - who knows, maybe he will find time to do it himself soon enough. If your code uses a mix of single and double precision calculations, using the non-optimized ARMV5 target would make it run slower than necessary (as you would miss out on what is already implemented through the soft_fp_abi branch). Also the ARMV5 target would imply different compiler options (see Makefile.arm) including ignoring the advanced SIMD instructions ("neon") available in ARMV7. I suspect the best course of action for you if you need a (temporary) solution now might be (your option no.2) to modify the KERNEL.ARMV7 file in kernel/arm so that it uses the generic C implementations found in KERNEL.ARMV5 for all the Dxxx,Cxxx or Zxxx variants of the Sxxx functions that were already modified for softfp. (As noted in #1168 it seems to be trivial to fix ddot by copying a line from what was changed in sdot, but I am unsure what needs to be done to make daxpy work which appears to be what your code tripped over after the fix to ddot. While saxpy and daxpy are implemented through the same .S file, xianyi's fix there is "#ifndef DOUBLE" and I haven't the froggiest idea how it would translate to the DOUBLE case) |
Thanks, will do. Would you like to have it as a temporary fix and a PR? How is testing in this case? |
I suppose it would be possible to use Makefile condition syntax in the KERNEL file so we could have both implementations in the same KERNEL.ARMV7 file with an "ifdef ARM_FLOAT_FP_ABI" to choose between them, so non-Android systems would not be impacted by the changes. Not sure about testing on the target hardware (except seeing that your program reports plausible results instead of crashing) as I think the usual implied "make test" run is suppressed when cross-compiling and the included test programs may not even be built by default in this case. ( I do not have any arm/android hardware with me at the moment to check this, but #922 could be related) |
I am getting around 30% speedup with the mixed ARMv7 implementation over the pure naive-C compiled with ARMv5 as target, so I guess it's... nice? I'd fetch the pure hard float benchmark if I were able to get timing correct, but int-to-double casts aren't working in this case, and statistics won't print correctly. |
PR #1226 addresses another issue in newer NDKs which is the GCC support removal. So, if anyone is willing to compile OpenBLAS for usage in their Android projects targeting ARMv7-a archs, I recommend the following procedures:
|
@akira-miasato I tried to merge your comments into the wiki at |
I used the following compilation commands (more details on PR #1226, with slightly different commands/mnemonics):
I didn't test with HOSTCC=gcc, as I didn't expect it to work. Older versions of clang, however, should work just fine. If you wish, I can test it all next week. In short, there should be instructions in the wiki for changing the HOSTCC to the host's clang, but everything else seems fine. If you wish to put more details, here is my listing:
|
HOSTCC builds some build system bits, but does not influence cross-build target at all. You can use any aged gcc/clang that your system has included. |
…DK r14b for armv7a Reference: https://android.googlesource.com/platform/ndk/+/ndk-release-r16/docs/UnifiedHeaders.md#supporting-unified-headers-in-your-build-system https://developer.android.com/ndk/guides/abis.html#v7a OpenMathLib/OpenBLAS#1215 https://github.com/xianyi/OpenBLAS/wiki/How-to-build-OpenBLAS-for-Android#building-openblas-without-fortran
Since the r12 release of the Android NDK, hard float ABIs are no longer supported. This problem was aggravated starting from the r15 version due to the removal of the libm_hard from the development kit.
From what I've gathered, the develop branch already addresses this issue by supporting the ARM_SOFTFP_ABI flag, recently incorporating changes for the arm_soft_fp_abi branch. However, there are still a number of issues such as #1168 and #1145 which show that defaulting to -mfloat-abi=hard flag can provoke a lot of confusion. Also, in #1168 it is highlighted that even though the ARM_SOFTFP_ABI flag is supported, real support is limited to single float operations.
Given this:
I'd be very grateful for any comments of people more involved with the project, since I am fairly new to all this cross-compilation stuff.
The text was updated successfully, but these errors were encountered: