Skip to content

the clang compiler does not support '-march=armv8.2-a+bf16' when build xnnpack for android #6924

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

Closed
feifeicoder opened this issue Nov 18, 2024 · 5 comments
Labels
module: android Issues related to Android code, build, and execution module: xnnpack Issues related to xnnpack delegation and the code under backends/xnnpack/

Comments

@feifeicoder
Copy link

Follow the tutorial to build xnnpack runtime lib for android with NDK r19 and meet such errors:

[ 91%] Building C object backends/xnnpack/third-party/XNNPACK/CMakeFiles/microkernels-all.dir/src/bf16-gemm/gen/bf16-gemm-1x4c8-minmax-neonbf16-bfmlal.c.o
[ 91%] Building C object backends/xnnpack/third-party/XNNPACK/CMakeFiles/microkernels-all.dir/src/bf16-gemm/gen/bf16-gemm-1x4c8-minmax-neonbf16-bfdot.c.o
[ 91%] Building C object backends/xnnpack/third-party/XNNPACK/CMakeFiles/microkernels-all.dir/src/bf16-gemm/gen/bf16-gemm-1x8c2-minmax-neonbf16-bfdot-lane-ld128.c.o
clang: error: the clang compiler does not support '-march=armv8.2-a+bf16'
gmake[2]: *** [backends/xnnpack/third-party/XNNPACK/CMakeFiles/microkernels-all.dir/build.make:43241: backends/xnnpack/third-party/XNNPACK/CMakeFiles/microkernels-all.dir/src/bf16-gemm/gen/bf16-gemm-1x4c8-minmax-neonbf16-bfmlal.c.o] Error 1

@metascroy metascroy added module: xnnpack Issues related to xnnpack delegation and the code under backends/xnnpack/ module: android Issues related to Android code, build, and execution labels Nov 18, 2024
@agunapal
Copy link

Getting the same error

[ 92%] Building C object backends/xnnpack/third-party/XNNPACK/CMakeFiles/microkernels-all.dir/src/bf16-gemm/gen/bf16-gemm-1x4c8-minmax-neonbf16-bfdot.c.o
[ 92%] Building C object backends/xnnpack/third-party/XNNPACK/CMakeFiles/microkernels-all.dir/src/bf16-gemm/gen/bf16-gemm-2x4c8-minmax-neonbf16-bfmlal.c.o
[ 92%] Building C object backends/xnnpack/third-party/XNNPACK/CMakeFiles/microkernels-all.dir/src/bf16-gemm/gen/bf16-gemm-1x4c8-minmax-neonbf16-bfmlal.c.o
[ 92%] Building C object backends/xnnpack/third-party/XNNPACK/CMakeFiles/microkernels-all.dir/src/bf16-gemm/gen/bf16-gemm-2x4c8-minmax-neonbf16-bfdot.c.o
[ 92%] Building C object backends/xnnpack/third-party/XNNPACK/CMakeFiles/microkernels-all.dir/src/bf16-gemm/gen/bf16-gemm-1x8c2-minmax-neonbf16-bfdot-lane-ld128.c.o
clang: error: the clang compiler does not support '-march=armv8.2-a+bf16'
make[2]: *** [backends/xnnpack/third-party/XNNPACK/CMakeFiles/microkernels-all.dir/src/bf16-gemm/gen/bf16-gemm-2x4c8-minmax-neonbf16-bfmlal.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
clang: error: the clang compiler does not support '-march=armv8.2-a+bf16'

@metascroy
Copy link
Contributor

@digantdesai do you know a work around for this issue with clang?

@metascroy
Copy link
Contributor

It looks like a similar issue was filed in XNNPACK and the suggested solution was to disable bf16 with -DXNNPACK_ENABLE_ARM_BF16=OFF (google/XNNPACK#3618). I guess using GCC might also work, but maybe there's a better option with clang

@agunapal
Copy link

Thanks! That works

@digantdesai
Copy link
Contributor

Thanks @metascroy for the suggestion.

Yeah I guess the right way would be to check (by tracking minimum_supported_version for clang in this case) if the compiler supports, this and enable only when it does. AndXNNPACK_ENABLE_ARM_BF16=OFF is just a static version of that.

That said BF16 was enabled by LLVM a while ago (2020?), and is the reason to enable by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: android Issues related to Android code, build, and execution module: xnnpack Issues related to xnnpack delegation and the code under backends/xnnpack/
Projects
None yet
Development

No branches or pull requests

4 participants