How to call Intel® AVX based code with Intel® IPP version 6.1

Intel® AVX optimized code is available in the 64-bit version of the Intel® IPP 6.1 library.
Intel® IPP library version 7.0 contains both 32 and 64 bits versions of Intel® AVX code.

Intel® Advanced Vector Extensions (Intel® AVX) is a 256-bit SIMD instruction set designed to provide even higher performance for applications that are floating-point intensive. The first implementation of Intel® AVX optimized code was provided in Intel® IPP library version 6.1 update 1. Within the 6.1 and 7.0 versions of the IPP library, approximately 270 functions have been hand-optimized with new Intel® AVX instructions. Please, see the list of these functions in Intel® IPP Functions Optimized for Intel® Advanced Vector Extensions (Intel® AVX) article.

We have received many requests asking “how to call AVX code into IPP 6.1 and all latest updates of this version.”
So, the main purpose of this article is to tell how to do this.

First, please make sure you have right hardware and OS, which support Intel® AVX code.

ippGetCpuFeatures() provides information regarding the features of the processor used in your computer system. Alternatively, ippGetCpuType() detects the processor type in your system. A return value of ippCpuAVX means your processor supports the Intel AVX instruction set. These functions are declared in ippcore.h.

Mask the value returned by ippGetCpuFeatures() with ippCPUID_AVX (0x0100) to determine if the Intel AVX SIMD instructions are supported by your processor (ippGetCpuFeatures() & ippCPUID_AVX is TRUE).

Additionally, to determine if your operating system also supports the Intel AVX instructions, mask the returned value from ippGetCpuFeatures() with ippAVX_ENABLEDBYOS (0x0200).

256

ippCPUID_AVX

The processor supports Intel® Advanced Vector Extensions (Intel® AVX) instruction set 8
512

ippAVX_ENABLEDBYOS

The operating system supports Intel® AVX 9

Please notes, the AVX require both processor and OS supported.  The AVX code may not enabled if only the processor type is  matched.  

Second, Before calling the first IPP function, you have to make 2 successive calls of the following functions one after another :

ippEnableCpu(ippCpuAVX);
ippInit();

In the case of if you call only one of these functions, the AVX code is not be enabled.

These calls are needed as for static and as well as for dynamic linking modes with dispatching.

Also, it should be noted that in the case you need to create Single-Processor executable to run your application on AVX-based CPU only (aka Static Linking for One Processor), then you can do the following steps:

1. Add the files ipp*merged.lib to your project and its source tree.
2. Create the header file which contains the list of functions for AVX dispatching ( in the current implementation, IPP doesn’t       contain such list of functions for AVX dispatching) :
Go to the <IPPROOT>\tools\staticlib\ directory and create a new header file by copying, say, ipp_y8.h to ipp_e9.h and then     edit this new ipp_e9.h file by replacing all “y8” prefixes by “e9” into the name of the functions. Please, pay attention that       this list of functions has to be aligned with the list of functions pointed in Intel® IPP Functions Optimized for Intel®         Advanced Vector Extensions (Intel® AVX) article.
3. ipp_e9.h header file must be included before the other Intel IPP header files.
4. Add the file ipp\lib\ippcorel.lib to your project and its source tree.
5. Include Intel IPP header file(s) as normal, after the above conversion header.
6. Call Intel IPP functions normally from your application.

PS:
Starting version 7.0 AVX code is supported in the usual way - nothing special should be done in the case of dynamic linking (corresponding functions will be called through IPP dispatching mechanism); for the static linking, before calling any IPP function – call ippInit().


More information about Intel® AVX is available at:
http://software.intel.com/en-us/avx/ .
http://software.intel.com/en-us/articles/intel-avx-optimization-in-intel-mkl-v103/
http://software.intel.com/en-us/articles/how-to-compile-for-intel-avx/




Optimization Notice

The Intel® Integrated Performance Primitives (Intel® IPP) library contains functions that are more highly optimized for Intel microprocessors than for other microprocessors. While the functions in the Intel® IPP library offer optimizations for both Intel and Intel-compatible microprocessors, depending on your code and other factors, you will likely get extra performance on Intel microprocessors.

While the paragraph above describes the basic optimization approach for the Intel® IPP library as a whole, the library may or may not be optimized to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include Intel® Streaming SIMD Extensions 2 (Intel® SSE2), Intel® Streaming SIMD Extensions 3 (Intel® SSE3), and Supplemental Streaming SIMD Extensions 3 (Intel® SSSE3) instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors.

Intel recommends that you evaluate other library products to determine which best meets your requirements.

Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.