16

I got compilation error:

unrecognized command line option '-mfpu=neon'*
when tried to compile with -mfpu=neon flag. Actually, any 'mfpu' options I tried failed. However in documentation this flag is mentioned, so it should be valid

What is wrong with this key? How could I tell compiler to use NEON?

Linaro GNU aarch64 linux tools 4.8 are used.

Thanks.

shizhen
  • 12,251
  • 9
  • 52
  • 88
user3124812
  • 1,861
  • 3
  • 18
  • 39
  • 1
    Where in the documentation is it mentioned? [I don't see it there](https://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/AArch64-Options.html#AArch64-Options) (but I do see the relevant SIMD feature option...) – Notlikethat Apr 24 '15 at 15:13
  • @Notlikethat See https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html – Severin Pappadeux Apr 24 '15 at 15:15
  • @SeverinPappadeux That's for the ARM backend, not the AArch64 one. Referring to the `-fpu` option [here](https://gcc.gnu.org/onlinedocs/gcc/RS_002f6000-and-PowerPC-Options.html) would be just as relevant as that ;) – Notlikethat Apr 24 '15 at 15:17
  • @Notlikethat good catch, no such option for AArch64 – Severin Pappadeux Apr 24 '15 at 15:24
  • @Notlikethat , Yes, it's. I looked in ARM-options as well. If you add your answer like answer not comment, I'll mark it as right. So you'll get credentials for help. Thanks a lot :) – user3124812 Apr 25 '15 at 11:53

2 Answers2

29

Advanced SIMD (aka NEON) is mandatory for AArch64, so no command line option is needed to instruct the compiler to use NEON.

If you want to enable auto vectorization optimisations so that the compiler automatically uses NEON instructions, then compile with -O3 or -O2 -ftree-vectorize.

The AArch64 and ARM backends are completely separate in gcc. The ARM back end only targets the traditional 32 bit ARM instructions sets (ARM, Thumb, Thumb-2). This is in contrast to the situation with x86, where the 32 bit and 64 bit code generation is combined into a single GCC back end.

Oak Bytes
  • 4,649
  • 4
  • 36
  • 53
Charles Baylis
  • 851
  • 7
  • 8
1

Go to file /tensorflow/contrib/lite/kernels/internal/BUILD, delete -mfpu=neon and you are good to go. from:

NEON_FLAGS_IF_APPLICABLE = select({
    ":arm": [
        "-O3",
        "-mfpu=neon",
    ],

to:

NEON_FLAGS_IF_APPLICABLE = select({
    ":arm": [
        "-O3",

    ],