Skip to content

armeabi-v7a assembler error #59970

@RobertFlatt

Description

@RobertFlatt
Click to expand!

Issue Type

Bug

Have you reproduced the bug with TF nightly?

No

Source

source

Tensorflow Version

v2.12.0-rc1

Custom Code

No

OS Platform and Distribution

Ubuntu 22.04

Mobile device

N/A

Python version

N/A

Bazel version

Using CMake

GCC/Compiler version

Clang, NDK 25b

CUDA/cuDNN version

No response

GPU model and memory

No response

Current Behaviour?

Building tensorflow lite (v2.12.0-rc1) for Android armeabi-v7a using CMake and NDK 25b, I get the following invalid assembly code error:

tflite-runtime/tensorflow/lite/tools/pip_package/gen/tflite_pip/python3/cmake_build/xnnpack/src/xnnpack/math.h:311:13: error: invalid output constraint \'=t\' in asm\n      : [i] "=t" (i)

The cause is here (a more recent freeze) https://github.com/google/XNNPACK/blob/test_515720556/src/xnnpack/math.h#L332

Android arm64-v8a builds and runs without error. With an earlier tensorflow lite version (v2.8.0) both armeabi-v7a and arm64-v8a built and ran without error.

As I read it '=t' is documented as a valid constraint for "ARM family", but the assembler thinks this is not the case.
https://gcc.gnu.org/onlinedocs/gcc/Simple-Constraints.html#Simple-Constraints
https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html#Machine-Constraints

Support at XNNPACK said a compiler flag -mfpu=vfp is required to enable the assembly code google/XNNPACK#4348 (comment) , and that the flag was set. Then suggested without reference that this was a Clang bug, and did not offer a workaround.

Further investigation suggested Clang was not the issue google/XNNPACK#4348 (comment)

The CMake build script covers eight conditions for various arm 32 bit devices. Only two of these (both -march=armv6) set the required flag. The -mfpu=vfp flag is not set for -march=armv7-a, which I suspect is the cause of this issue. https://github.com/google/XNNPACK/blob/master/CMakeLists.txt#L546-L553

XNNPACK support responded, but we did not communicate successfully (as shown by google/XNNPACK#4348 (comment) and google/XNNPACK#4348 (comment)) ; and we did not get a resolution. Since tflite depends on XNNPACK, I look for resolution here. Thank you.



### Standalone code to reproduce the issue

```shell
This is a build issue, no extra code.

Relevant log output

tflite-runtime/tensorflow/lite/tools/pip_package/gen/tflite_pip/python3/cmake_build/xnnpack/src/xnnpack/math.h:311:13: error: invalid output constraint \'=t\' in asm\n      : [i] "=t" (i)

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions