Commit af0b021
Fix Android ARM64 build for torchao lowbit kernels
Summary:
D95224222 added torchao ARM lowbit kernel dependencies to the ExecuTorch
llama runner for ARM64 builds, but the Buck targets had two issues that
prevented the Android ARM64 build from succeeding.
1. `std::aligned_alloc` is not available on Android API < 28.
Android's Bionic libc only added `aligned_alloc` in API 28 (Android 9 Pie).
The NDK's libc++ declares `using ::aligned_alloc _LIBCPP_USING_IF_EXISTS`
which silently becomes unresolved when targeting API < 28 (the default
`app_platform` is android-21). This caused a compile error in
`shared_kernels/internal/memory.h`. Fixed by using `posix_memalign` (which
is available since API 16) as a fallback when `__ANDROID_API__ < 28`.
2. The aarch64 `linear` kernels use ARM dot product intrinsics (`vdotq_s32`)
which require the `+dotprod` architecture feature. The CMake build already
passed `-march=armv8.4-a+dotprod`, but the Buck targets were missing this
flag for Android builds. Fixed by adding `-march=armv8.2-a+dotprod` to
`fbandroid_compiler_flags` in both the `aarch64/linear` target and the
`op_linear_8bit_act_xbit_weight_executorch` target.
Reviewed By: tanvirislam-meta
Differential Revision: D958328601 parent 5e79e5e commit af0b021
1 file changed
Lines changed: 8 additions & 0 deletions
File tree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
22 | 29 | | |
| 30 | + | |
23 | 31 | | |
24 | 32 | | |
25 | 33 | | |
| |||
0 commit comments