An Introduction to GCC Compiler Intrinsics in Vector Processing
Finally, here are some performance tips.
First, get a recent compiler and use the best code generation options. (Check the info pages that come with your compiler for things like the -mcpu option.)
Second, profile your code. Humans are bad at guessing where the bottlenecks are. Fix the bottlenecks, not other parts.
Third, get the most work you can from each vector operation by using the vector with the narrowest type elements that your data will fit into. Get the most work you can in each time slice by having enough work that you keep your vector hardware busy. Take big bites of data. If your vector hardware can handle a lot of vectors at the same time, use them. However, exceeding the number of vector registers you have available will slow things down. (Check your processor's documentation.)
Fourth, don't re-invent the wheel. Intel, Freescale and ARM all offer libraries and code samples to help you get the most from their processors. These include Intel's Integrated Performance Primitives, Freescale's libmotovec and ARM's OpenMAX.
In summary, GCC offers intrinsics that allow you to get more from your processor without the work of going all the way to assembly. We have covered basic types and some of the vector math functions. When you use intrinsics, make sure you test thoroughly. Test for speed and correctness against a scalar version of your code. Different features of each processor and how well they operate means that this is a wide open field. The more effort you put into it, the more you will get out.
The GCC include files that map intrinsics to compiler built-ins (eg arm_neon.h) and the GCC info pages that explain those built-ins:http://gcc.gnu.org/onlinedocs/gcc/Target-Builtins.html
Integrated Performance Primitives
Freescale AltiVec Libs for Linux
AltiVec TM Technology Programming Interface Manual
Ian Ollmann's Altivec Tutorial
RealView Compilation Tools Compiler Reference Guide (especially Appendix E)
RealView Compilation Tools Assembler Guide (esp chapter 5)
Intel C++ Intrinsics Reference
|Chemistry on the Desktop||Mar 23, 2017|
|Five HPC Cost Considerations to Maximize ROI||Mar 23, 2017|
|Two Ways GDPR Will Change Your Data Storage Solution||Mar 22, 2017|
|Android Candy: That App Is for the Birds!||Mar 22, 2017|
|Hodge Podge||Mar 21, 2017|
|William Rothwell and Nick Garner's Certified Ethical Hacker Complete Video Course (Pearson IT Certification)||Mar 20, 2017|
- Two Ways GDPR Will Change Your Data Storage Solution
- Hodge Podge
- William Rothwell and Nick Garner's Certified Ethical Hacker Complete Video Course (Pearson IT Certification)
- Preseeding Full Disk Encryption
- Returning Values from Bash Functions
- Android Candy: That App Is for the Birds!
- Flash ROMs with a Raspberry Pi
- Minifree Ltd.'s GNU+Linux Computers
- Two Factors Are Better Than One
- GRUB Boot from ISO