Comments (14)
step1:
sed -i 's|-march=armv6 -mfpu=vfp|-march=armv7-a -mfpu=neon|' CMakeLists.txt
step2:
add cmake option: -DXNNPACK_ENABLE_ARM_BF16=OFF
successfully built now, but don't know if the right way.
from xnnpack.
Manage to get the repro steps down to:
android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi21 -Iinclude -Isrc -O1 -march=armv8.2-a+bf16 -mfpu=neon-fp-armv8 src/bf16-gemm/gen/bf16-gemm-6x8c2-minmax-neonbf16-bfdot-lane-ld128.c
Note that -O1
, -O2
, -O3
fails, but -O0
is fine.
taking a closer look
from xnnpack.
add cmake option: -DXNNPACK_ENABLE_ARM_BF16=OFF
is the easiest way, it doesn't include the problematic c file.
@georgthegreat if you are getting blocked, that's probably the easiest way.
from xnnpack.
https://godbolt.org/z/656PqT6o1
I think it is a clang bug, 16.0.0 fixes it.
from xnnpack.
I found that I can workaround the bug with changing:
const uint32x4_t va0c01 = vdupq_lane_u32(vreinterpret_u32_bf16(vget_low_bf16(va0)), 0);
to
const uint32x4_t va0c01 = vdupq_lane_u32(vget_low_u32(vreinterpretq_u32_bf16(va0)), 0);
just the ordering of interpret and get_low.
from xnnpack.
vout0x0123 = vreinterpret_bf16_u16(vext_u16(vreinterpret_u16_bf16(vout0x0123), vreinterpret_u16_bf16(vout0x0123), 2));
is still a problem though
I think i can change it to vout0x0123 = vdup_lane_bf16(vout0x0123, 2);
from xnnpack.
Hm, looks like we don't test building of these microkernels: https://github.com/google/XNNPACK/blob/master/scripts/build-android-armv7.sh#L59
We might also need to update the ndk version we are testing with: https://github.com/google/XNNPACK/blob/master/.github/workflows/build.yml#LL172C28-L172C28
from xnnpack.
Hm, looks like we don't test building of these microkernels:
There is even a comment about this specific issue:
# BF16 instructions cause ICE in Android NDK compiler
from xnnpack.
I think the easiest fix is for you to add this compile flag when building XNNPACK -DXNNPACK_ENABLE_ARM_BF16=OFF
, until the ndk ships a newer version of clang.
from xnnpack.
Yep, this is what I did for now.
from xnnpack.
NDK maintainers claim that canary builds with clang16 can compile this code.
I think there is nothing to be done from xnnpack side, so this may be closed if there is no workaround / nobody wants to search for it.
from xnnpack.
As I read the posts above there are two possible workarounds, either could be implemented in XNNPACK.
Just waiting for some future NDK where some future Clang will be fixed, is I think an insufficient response.
from xnnpack.
The recommended work-around is to disable ARM BF16 extensions using either -DXNNPACK_ENABLE_ARM_BF16=OFF
option (for CMake) or --define xnn_enable_arm_bf16=false
option (for Bazel).
from xnnpack.
Using tensorflow 2.13.0-rc1 and -DXNNPACK_ENABLE_ARM_BF16=OFF
cmake -DCMAKE_TOOLCHAIN_FILE=../android-ndk-r25c/build/cmake/android.toolchain.cmake -DANDROID_ABI=armeabi-v7a -DTFLITE_ENABLE_XNNPACK=ON -DXNNPACK_ENABLE_ARM_BF16=OFF ../tensorflow_src/tensorflow/lite
cmake --build . -j
Does not workaround the issue.
And we should not expect it to because this is defined as the default behavior https://github.com/google/XNNPACK/blob/master/scripts/build-android-armv7.sh#L59 and we know the default fails to build.
Not clear why it was suggested as a workaround.
I've been trying to get some attention paid to this for 3.5 months #4348
Please implement a fix.
It seems reasonable to suggest that: the relationship between the code and the build tools is everywhere and always the responsibility of the programmer responsible for the code.
from xnnpack.
Related Issues (20)
- Xnnpack still builds with `+dotprod` and `+fp16` with `-DXNNPACK_ENABLE_ARM_DOTPROD=OFF -DXNNPACK_ENABLE_ARM_FP16_SCALAR=OFF -DXNNPACK_ENABLE_ARM_FP16_VECTOR=OFF` HOT 10
- Is running TEST(CONVERT_NC_F16_QD8, unit_batch) failed because it does not support armv7a ? HOT 1
- Why is Signal 7 reporting an error on the armv7a platform TEST (F16_VCMUL_NEONFP16ARITH_U8, batch_lt_8) ? HOT 3
- A segment error occurred while running test case static-reshape-test on the armv7a platform HOT 1
- ARMv7 (with NEON) can not support on Linux but only support ARMv7 (with NEON) on Android HOT 3
- Enable HEXAGON to build XNNPack
- Work with the gvisor team on this
- scripts/build-android-armv7.sh fails with NDK 21
- `xnn_weights_cache_provider` look_up doesn't work? HOT 2
- How can I parallelize the execution of this benchmark? (https://github.com/google/XNNPACK/blob/master/bench/spmm-benchmark.h) HOT 1
- cmake build failure with XNNPACK_BUILD_TESTS=ON and XNNPACK_LIBRARY_TYPE=shared
- test/sigmoid_nc_test fails on Hexagon simulator HOT 1
- Load-from-misaligned-address failures on Hexagon simulator HOT 3
- XNNPACK tests that use mmap() fail on Hexagon devices
- Default condition missing for xnnpack_aggregate_library HOT 1
- unsupported instruction `vpdpbusd' HOT 3
- tests for vbinary f16_vsqrdiffc_test are missing a bazel build target
- Add benchmarks for vbinary microkernels
- Possible null pointer dereference in logging
- Dynamic shape support follow-up HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xnnpack.