Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do Android programs make use of NEON SIMD?

Tags:

android

neon

I've been learning up a little on the cpu features and stumbled upon NEON.

From what I've read, it looks like NEON requires specific programming to use this, but is this completely true, or do the cpus that have this feature still find ways to untilize it and speed media processes for some applications even though there is not specific code for it?

like image 529
Tam Avatar asked Jul 17 '12 02:07

Tam


1 Answers

There are a number of ways to make use of the NEON instructions. Some of them are:

  • Libraries. It is a good chance that your memcpy is handcrafted using NEON. Music/video playback libs in the API are using NEON and/or GPU for acceleration. Aso, there are third-pary libs that use it. FastCV from Qualcomm is a good example
  • Compiler-issued instructions. Some compilers, when provided with the correct options will issue NEON instructions. Most compilers will use neon for float operations, but not vectorize them. They will use the unit as a single-data unit, just because it is fast and convenient. There are some vectorization capabilities in GCC and ARM compiler, but they are really limited in scope and results.
  • Hand-coded C with intrinsics http://gcc.gnu.org/onlinedocs/gcc/ARM-NEON-Intrinsics.html It is probably the best way to get started in the NEON world.
  • Hand-coded assembler. This seems to be the best, if you want to achieve max performance. It also requires a good deal of effort and CS knowledge.

  • Last but not least, you can use NEON by just downloading apps that use it. Your favourite music player and your camera app put the NEON unit in your smartphone to good use.

Conclusion: NEON has a lot of usages, but it is only used if the code specifically contains NEON instructions. More technically, as @pst said, it must be targeted by a piece of code.

like image 157
Sam Avatar answered Sep 29 '22 09:09

Sam