Neon Simd For All...


zodttd

Solving your premature emulation since the Tapwave
Joined
Dec 2, 2005
Messages
1,167
Website
www.zodttd.com
Want NEON instructions used in your apps built with GCC?
First read to try to understand a bit about what you're doing. It's for X86 but applies to NEON as well:
http://advogato.org/article/871.html

Then use these cflags in your compiler:
-march=armv7-a -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -O2 -ftree-vectorize -ftree-vectorizer-verbose=5 -ffast-math

-O3 could probably be used as well, but for this example, -O2 will suffice.

-ftree-vectorizer-verbose=5 will output debugging information as to whats stopping things from using NEON instructions. Fix these "notes" it outputs and you will start to see NEON get used more and more. :)
The verbose level can be changed as well, more importantly raised.

Just a tidbit to start things off I suppose. :)
 
zodttd said:
Just a tidbit to start things off I suppose. :)

Yep, a nice start. However in the end, you have no choice: assembly language ;)
 
Last edited by a moderator:
For the most part, it seems true. Getting loops to be optimized with NEON is quite a pain via GCC. Very little seems to get optimized just by adding such cflags due to various reasons outlined by the output when using the verbose flag.
 
Have you tried the experimental llvm arm backend? I'm a bit curious how (and if) it performs.
 
zodttd said:
Just a tidbit to start things off I suppose. :)
I would love to see the output of dmesg.
 
Last edited by a moderator:
Laurent said:
How does that relate to NEON? :p
As string to substring, hopefully without "disabled" suffix :)
 
Last edited by a moderator:
Is there anything else besides those compiler flags like compiler intrinsics (for NEON)? What is a realistic approach to make SIMD avaible to coders like me (who won't do any ASM at all)? ASM Macros? Hand optimzed lib for most common tasks (Matrix and Vector operations)?
 
synkro said:
Is there anything else besides those compiler flags like compiler intrinsics (for NEON)? What is a realistic approach to make SIMD avaible to coders like me (who won't do any ASM at all)? ASM Macros? Hand optimzed lib for most common tasks (Matrix and Vector operations)?
For intrinsics: http://gcc.gnu.org/onlinedocs/gcc/ARM-NEON-Intrinsics.html
 
Last edited by a moderator:
You might be interested in this which has recently been posted to the Beagle board mailing list:

QUOTE

Hi,

I spent the last few weeks testing different compilers and here's the
summary:

gcc 4.2.1: lacks armv7 and NEON support
gcc csl 2007q3 (4.2.1 based): working armv7 and working NEON

gcc 4.2.2: lacks armv7 and NEON support
gcc csl 2008q1 (4.2.3 based): working armv7, broken NEON[1]

gcc 4.3.0: working armv7, broken NEON[2]

So if you want to use NEON properly (-mpfu=neon -ftree-vectorize -
mfloat-abi=softfp) you should get the 2007q3 toolchain.

I'm keeping my eyes out for the pending gcc 4.3.1 release, since the
vectorizer is rumoured to work a lot better compared to 4.2.x
versions.

regards,

Koen
 
Squidge said:
QUOTE

gcc 4.3.0: working armv7, broken NEON[2]

So if you want to use NEON properly (-mpfu=neon -ftree-vectorize -
mfloat-abi=softfp) you should get the 2007q3 toolchain.

I'm keeping my eyes out for the pending gcc 4.3.1 release, since the
vectorizer is rumoured to work a lot better compared to 4.2.x
versions.

Two things to note:
- CSL will fix their compiler for the Fall release
- gcc 4.3.1 will probably have no fix for NEON since no ARM file has been updated since 4.3.0 and no bug is filed against NEON.

So 2007q3 looks like the only viable choice for the coming months :(
 
Last edited by a moderator:
Laurent said:
So 2007q3 looks like the only viable choice for the coming months :(
Apart from an email I got from TI in January:

"We've had some reports of bugs in the kernel using 2007q3, but I know q1
works. The q3 issues will probably be cleaned up in an upcoming
release. There isn't an official release for the board you have yet,
but the first one will come out using the q1 tools."

However, I don't think 2007q1 supports NEON?
 
Last edited by a moderator:
Hi! Just checking back on the state of pandora dev. Is NEON SIMD intrinsics supported by current compilers by now?
 
Back
Top