[llvm-dev] Clang 5.0 support for armv8 64 bit with neon and auto vectorization

993 views
Skip to first unread message

Haider Zeeshan (CC/ESM1) via llvm-dev

unread,
Feb 3, 2017, 4:13:24 AM2/3/17
to llvm...@lists.llvm.org

Hi there,

 

I am Software product developer at Robert Bosch, Germany.

 

We are using armv8 64bit targets for our development. We have the need to do the cross compiling for our target on windows. I have compiled clang 5.0 from the vcs git. I have tried compiling the code with following options set:

 

clang.exe -target armv8 -fslp-vectorize-aggressive  -mfpu=neon -mfloat-abi=hard -c test.cpp

 

As you can see in the options, we require neon feature as well as auto vectorizations on armv8 (64 bit). Can you tell me that is it true that clang supports neon and auto vectorizations with 64bit arm v8 architecture? 

 

This setting says that neon is not in support, Can you explain why? As of my understanding, arm v8 is a 64 bit architecture!

clang.exe -target arm64 -fslp-vectorize-aggressive  -mfpu=neon -mfloat-abi=hard -c test.cpp

 

 

Mit freundlichen Grüßen / Best regards

Zeeshan Haider

 

Chassis Systems Control, Engineering Software Coordination, Software Mainstream Management, Methods Group 1 (CC/ESM1)

Robert Bosch GmbH | Postfach 16 61 | 71226 Leonberg | GERMANY | www.bosch.com

Tel. +49(711)811-47379 | Fax +49(711)811-0 | Zeeshan...@de.bosch.com

 

Sitz: Stuttgart, Registergericht: Amtsgericht Stuttgart, HRB 14000;

Aufsichtsratsvorsitzender: Franz Fehrenbach; Geschäftsführung: Dr. Volkmar Denner,

Dr. Stefan Asenkerschbaumer, Dr. Rolf Bulander, Dr. Stefan Hartung, Dr. Markus Heyn, Dr. Dirk Hoheisel,

Christoph Kübel, Uwe Raschke, Dr. Werner Struth, Peter Tyroller

 

Peter Smith via llvm-dev

unread,
Feb 3, 2017, 5:02:08 AM2/3/17
to Haider Zeeshan (CC/ESM1), llvm...@lists.llvm.org
Hello Haider,

I'll have to make this quick as I need to leave the office to get on a
train. I hope my colleagues will be able to correct anything I've got
wrong.

I suggest taking a look at the set of command line options supported
by the aarch64 target. The armv8 target can mean m-profile without
ARM, r-profile or a-profile, floating point or neon is not uniform
across these targets.

For -target=aarch64 simd and hard precision floating point are the
default and assumed option, there is also no ABI support for
soft-floating point so the command line options are redundant. I
suggest just removing -mfpu and -mfloat-abi and you'll get the results
you want.

The -march and -mcpu options can give you some extra control, for
example --target=aarch64 -march=armv8-a+simd+fp.

Peter

On 3 February 2017 at 08:48, Haider Zeeshan (CC/ESM1) via llvm-dev

> _______________________________________________
> LLVM Developers mailing list
> llvm...@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

Tim Northover via llvm-dev

unread,
Feb 3, 2017, 10:02:00 AM2/3/17
to Haider Zeeshan (CC/ESM1), llvm...@lists.llvm.org
On 3 February 2017 at 00:48, Haider Zeeshan (CC/ESM1) via llvm-dev

<llvm...@lists.llvm.org> wrote:
> clang.exe -target armv8 -fslp-vectorize-aggressive -mfpu=neon
> -mfloat-abi=hard -c test.cpp

Peter's advice is good (-mfpu and -mfloat-abi aren't needed). But also
note that "-target armv8" actually targets 32-bit ARM (v8 CPUs usually
support both modes).

You probably want to specify a full triple for the target, maybe
"-target aarch64-linux-gnu", otherwise the OS part might default to
Windows since that's where you're running. Clang doesnn't support
Windows on AArch64.

Cheers.

Tim.

Haider Zeeshan (CC/ESM1) via llvm-dev

unread,
Feb 3, 2017, 10:13:19 AM2/3/17
to Tim Northover, llvm...@lists.llvm.org
Thanks Peter and Tim.

Being that said, can I be sure that for 64 bit arm architectures (e.g. arm cortex A57) the neon feature and auto-vectorization is supported as default by clang 5.0?

Because for us these two features are deal breaking for compiler evaluation.

Mit freundlichen Grüßen / Best regards

Zeeshan Haider

Chassis Systems Control, Engineering Software Coordination, Software Mainstream Management, Methods Group 1 (CC/ESM1)
Robert Bosch GmbH | Postfach 16 61 | 71226 Leonberg | GERMANY | www.bosch.com
Tel. +49(711)811-47379 | Fax +49(711)811-0 | Zeeshan...@de.bosch.com

Sitz: Stuttgart, Registergericht: Amtsgericht Stuttgart, HRB 14000;
Aufsichtsratsvorsitzender: Franz Fehrenbach; Geschäftsführung: Dr. Volkmar Denner,
Dr. Stefan Asenkerschbaumer, Dr. Rolf Bulander, Dr. Stefan Hartung, Dr. Markus Heyn, Dr. Dirk Hoheisel,
Christoph Kübel, Uwe Raschke, Dr. Werner Struth, Peter Tyroller


Tim Northover via llvm-dev

unread,
Feb 3, 2017, 12:05:32 PM2/3/17
to Haider Zeeshan (CC/ESM1), llvm...@lists.llvm.org
Hi Haider,

On 3 February 2017 at 07:13, Haider Zeeshan (CC/ESM1)


<Zeeshan...@de.bosch.com> wrote:
> Being that said, can I be sure that for 64 bit arm architectures (e.g. arm cortex A57) the neon feature and auto-vectorization is supported as default by clang 5.0?

Yes, unless something has gone horribly wrong they will be. The
obvious quick test would be to compile something trivial like

void foo(float *arr) {
for (int i = 0; i < 128; ++i)
arr[i] += 1;
}

and look at the output.

Haider Zeeshan (CC/ESM1) via llvm-dev

unread,
Feb 3, 2017, 12:15:19 PM2/3/17
to Tim Northover, llvm...@lists.llvm.org
One more thing, setting up clang 5,0 on windows, I have issues compiling libcxx project.

Is it supported to be built with Visual studio or MinGW make files?

Mit freundlichen Grüßen / Best regards

Zeeshan Haider
CC/ESM1

Tel. +49(711)811-47379



-----Original Message-----
From: Tim Northover [mailto:t.p.no...@gmail.com]
Sent: Freitag, 3. Februar 2017 18:05
To: Haider Zeeshan (CC/ESM1) <Zeeshan...@de.bosch.com>
Cc: llvm...@lists.llvm.org
Subject: Re: [llvm-dev] Clang 5.0 support for armv8 64 bit with neon and auto vectorization

Renato Golin via llvm-dev

unread,
Feb 3, 2017, 3:03:29 PM2/3/17
to Haider Zeeshan (CC/ESM1), LLVM Dev, Marshall Clow
Adding some people that know about libcxx and/or windows on arm. 

Cheers, 
Renato 

Eric Fiselier via llvm-dev

unread,
Feb 4, 2017, 8:52:35 PM2/4/17
to Renato Golin, LLVM Dev, Marshall Clow, Haider Zeeshan (CC/ESM1)
Windows support for libc++ is very immature, and I would recommend disabling it on Windows. Work started on the port
only about a month ago and there are still a bunch of bugs and unimplemented features.

Unfortunately building on Windows requires Clang since MSVC doesn't provide `#include_next`
which is needed by libc++.

Is it supported to be built with Visual studio or MinGW make files?

I've only ever targeted Ninja on Windows but I assume CMake would
be able to target other generators as well. (Assuming Visual Studio build files allow using Clang). 

/Eric

Saleem Abdulrasool via llvm-dev

unread,
Feb 5, 2017, 12:33:32 AM2/5/17
to Eric Fiselier, LLVM Dev, Marshall Clow, Haider Zeeshan (CC/ESM1)
On Sat, Feb 4, 2017 at 5:52 PM, Eric Fiselier <er...@efcs.ca> wrote:
Windows support for libc++ is very immature, and I would recommend disabling it on Windows. Work started on the port
only about a month ago and there are still a bunch of bugs and unimplemented features.

Unfortunately building on Windows requires Clang since MSVC doesn't provide `#include_next`
which is needed by libc++.

Is it supported to be built with Visual studio or MinGW make files?

I've only ever targeted Ninja on Windows but I assume CMake would
be able to target other generators as well. (Assuming Visual Studio build files allow using Clang). 

I only used ninja for the original port when cross-compiling on Linux to Windows, but used `cmake --build .` on Windows.



--
Saleem Abdulrasool
compnerd (at) compnerd (dot) org

Saleem Abdulrasool via llvm-dev

unread,
Feb 5, 2017, 12:36:21 AM2/5/17
to Renato Golin, LLVM Dev, Marshall Clow, Haider Zeeshan (CC/ESM1)
On Fri, Feb 3, 2017 at 12:03 PM, Renato Golin <renato...@linaro.org> wrote:
Adding some people that know about libcxx and/or windows on arm. 

Note that if you are trying to use Windows on ARM port, I've not tested C++ support with MS ABI, onlly the itanium ABI has been tested (there are known limitations for the C++ MS ABI on Windows ARM).  Furthermore, we do not currently have the ability to generate .pdata/.xdata which means that unwinding does not work nor would exceptions (unless you use SjLj exceptions, but that means that interop with the native libraries is not possible).

I've not done the port for Windows ARM64 yet either (due to lack of such a device).

Haider Zeeshan (CC/ESM1) via llvm-dev

unread,
Feb 7, 2017, 8:47:22 AM2/7/17
to Saleem Abdulrasool, Renato Golin, LLVM Dev, Marshall Clow

Hi Saleem,

 

I would require cross compiled libcxx for the arm target. I have idea to cross compile it on Linux machine and use static libraries (eg. libcxx.a) in linking on windows with clang.

 

I am not sure it would work but I can try. Compiling libcxx on windows is a pain as far as I have tried.

 

@all: Do you think I can go with cross compiled standard c++ lib from gcc on windows with clang? I have no idea that gcc compiled binaries can be linked with clang compiler? I think that is possible as the backend of clang compiler is from gcc?

 

 

Mit freundlichen Grüßen / Best regards

Zeeshan Haider
CC/ESM1

Tel.
+49(711)811-47379

Renato Golin via llvm-dev

unread,
Feb 7, 2017, 9:47:58 AM2/7/17
to Haider Zeeshan (CC/ESM1), LLVM Dev, Marshall Clow
On 7 February 2017 at 13:47, Haider Zeeshan (CC/ESM1)

<Zeeshan...@de.bosch.com> wrote:
> @all: Do you think I can go with cross compiled standard c++ lib from gcc on
> windows with clang? I have no idea that gcc compiled binaries can be linked
> with clang compiler? I think that is possible as the backend of clang
> compiler is from gcc?

Yup, stdlibc++ works fine on ARM Linux. If you have them already
laying around, it'll avoid some extra work.

Or you can get the pre-release RC1 Clang+LLVM 4.0 image for ARM, which
already has libc++ / libc++abi and libunwind built in, though, as
shared libraries only.

http://llvm.org/pre-releases/4.0.0/

cheers,
--renato

Reply all
Reply to author
Forward
0 new messages