IPP Dispatcher Control Functions - ipp*Init*() functions

Are you confused by the various ipp*Init*() functions? So was I. So I asked the Intel IPP engineering team for some clarification, and this is what I found.

The Intel® IPP Dispatcher

One of the most valuable features of the Intel IPP library is the instruction set "dispatcher" that is built into the library. This dispatcher automatically executes the optimal version of each IPP function at run time, to match your specific processor type and instruction set. In other words, each IPP function in the library actually consists of multiple "variations on a theme." These variations are functionally identical routines, where each is optimized for a specific class of SIMD instructions. Another way to think of this is that each IPP function has been "overloaded" to support the SSE instructions that are appropriate to the processor being used.

For more information on the SIMD instruction sets that the Intel IPP library has been optimized for see these IPP knowledge base articles:

Understanding CPU Optimized Code in the Intel IPP Library
Is There a Function to Detect the Processor Type?
Using IPP on AMD Processors

Initializing the Dispatcher

Before the dispatcher can work your application must initialize the Intel IPP library. Without proper initialization the dispatcher will default to calling the "lowest common denominator" for each of these overloaded functions within the library (aka the "px" and "mx" code in v6.1) *. In that case your 32-bit code will be calling C-optimized functions ("px" does not use MMX or SSE instructions, only standard IA-32 instructions) and your 64-bit code will be calling SSE2-optimized code ("mx" uses only Intel® 64 instructions and MMX through SSE2 instructions). If you fail to initialize the library your application may not achieve optimal performance on your processor.

If your Intel IPP application uses the standard distribution dynamic library this dispatcher initialization step is handled automatically, as part of the dynamic library initialization. However, if you are using one of the static libraries, or a custom dynamic library that does not initialize the Intel IPP library automatically, you must "manually initialize" the dispatcher to insure optimum performance of the IPP library with your application.

Dispatcher Control Functions

The Intel IPP documentation contains a "Dispatcher Control Functions" section inside the "Support Functions" chapter of the "Signal Processing" reference manual. The functions you will find in that manual (as of version 6.1 of the Intel IPP library) are listed below:

  • ippStaticInit (DEPRECATED) **
    Automatically initializes the static library to that which is most appropriate for the runtime processor.
  • ippInit
    Automatically initializes the static or dynamic library to that which is most appropriate for the runtime processor.
  • ippStaticInitCpu (DEPRECATED)
    Manually initialize the static library to use the specified SIMD optimizations, regardless of the runtime processor.
  • ippInitCpu
    Manually initialize the static or dynamic library to use the specified SIMD optimizations regardless of the runtime processor.
  • ippEnableCpu
    Enables automatic dispatching for processor simulators and some alpha silicon (used only in unusual cases.)

A little confusing, right. What are the differences? Which one should you use? Does it matter when or where I use them? Must I stop using the deprecated functions?

In general, you only need to make one initialization call to the Intel IPP library from your application: ippInit(). This call causes the dispatcher to analyze the CPU type your application is running on and determines which instruction set class is the best to use for optimal performance of the IPP library with your current run time processor. This call needs to be made before you make any other calls into the IPP library, so it should occur early in your application.

There are two exceptions to the above statements: the ippInitCpu() and ippEnableCpu() functions.

To force the dispatcher to use a specific SIMD instruction set (e.g., you want to always use the SSE2 instruction set) you can call ippInitCpu(), regardless of the actual processor type detected. Use ippInitCpu() as a replacement for ippInit(), since a subsequent call to ippInit() will undo your call to ippInitCpu(). This can be useful for comparing the performance of your application over multiple SSE instruction sets without having to maintain a large array of test systems.

Don't forget to check the return status of these init functions! Especially if you are trying to force usage of a specific SIMD instruction set with ippInitCpu(). Sometimes you may not be running on a compatible processor, the return status can help you resolve such an issue.

If you are using a processor simulator or some alpha silicon (a very rare situation for most developers) you may need to enable detection of the simulated processor. In this case you use the ippEnableCpu() function to insure that the dispatcher "sees" your simulator. For example, ippEnableCpu(ippCpuAVX) enables AVX as a "known architecture" type in the list searched for by the ippInit() function. ippEnableCpu() does not initialize the dispatcher, like ippInitCpu() does, but simply adds the specified architecture as an option to the table of SIMD instruction sets that the dispatcher will search for when you call ippInit().

Note: at the time this article was written Intel processors that support AVX were not yet commercially available.

As of version 6.1 of the Intel IPP library, ippEnableCpu() is only used in conjunction with the AVX instruction set (see /en-us/avx/ for more information about AVX) and only applies to the 64-bit version of the library (AVX support will be broader in future versions of the library). If you are not using AVX you can safely ignore the ippEnableCpu() function. For more information about AVX support in the IPP 6.1 library see this article.

Deprecated Init Functions

In the list above both ippStaticInit() and ippStaticInitCpu() have are marked as deprecated functions. You may have used these functions in the past; they have been replaced by ippInit() and ippInitCpu(), respectively. As of now these older functions continue to work, as originally intended, but will be removed from future versions of the library, in favor of the new functions. So it is best to start using the new functions now and discontinue use of these older functions.

What’s the difference between the older deprecated init functions and the new init functions? The older functions would return an error if you tried to use them with the dynamic link version of the library. That meant that you could not easily write code that could be linked either with the dynamic library or a static library. The new functions work with either the dynamic library or the static libraries. Also, the new init functions can be used for re-initialization of a dynamic library, which the old functions could not do, since they only applied to static editions of the Intel IPP library.

Automatic initialization still takes place in the dynamic library, so calling these init functions is redundant, but harmless. However, future versions of the library could require that these init calls get called explicitly, even with a dynamic link library, so it is a good idea to start using them now even if you only plan to use the dynamic form of the Intel IPP library.

Processor Architecture Table

The following table was copied from an Intel Compiler Pro options article describing some compiler architecture options. It contains a list of Intel processors showing which processors support which SIMD instructions. For the latest table please refer to the original article; it gets updated on a regular basis. Please note that the behavior of the Intel Compiler SIMD dispatcher described in that article does not apply to the Intel IPP library.

The Intel IPP library dispatching mechanism behaves differently than that found in the Intel Compiler products, and may also behave differently than other Intel library products.

AVX2

4th Generation Intel® Core™ Processors
Intel® Xeon® Processor E3 v3 Family

AVX

3rd Generation Intel® Core™ i7 Processors
3rd Generation Intel® Core™ i5 Processors
3rd Generation Intel® Core™ i3 Processors
Intel® Xeon® Processor E7 v2 Family
Intel® Xeon® Processor E5 v2 Family
Intel® Xeon® Processor E3 v2 Family3rd Generation Intel® Core™ i7 Processors

2nd Generation Intel® Core™ i7 Processors
2nd Generation Intel® Core™ i5 Processors
2nd Generation Intel® Core™ i3 Processors
Intel® Xeon® Processor E5 Family
Intel® Xeon® Processor E3 Family

SSE4.2

Intel® Core™ i7 processors
Intel® Core™ i5 processors
Intel® Core™ i3 processors
Intel® Xeon® 55XX series

SSE4.1
Intel® Xeon® 74XX series
Quad-Core Intel® Xeon 54XX, 33XX series
Dual-Core Intel® Xeon 52XX, 31XX series
Intel® Core™ 2 Extreme 9XXX series
Intel® Core™ 2 Quad 9XXX series
Intel® Core™ 2 Duo 8XXX series
Intel® Core™ 2 Duo E7200

SSSE3
Quad-Core Intel® Xeon® 73XX, 53XX, 32XX series
Dual-Core Intel® Xeon® 72XX, 53XX, 51XX, 30XX series
In tel® Core™ 2 Extreme 7XXX, 6XXX series
Intel® Core™ 2 Quad 6XXX series
Intel® Core™ 2 Duo 7XXX (except E7200), 6XXX, 5XXX, 4XXX series
Intel® Core™ 2 Solo 2XXX series
Intel® Pentium® dual-core processor E2XXX, T23XX series

SSE3
Dual-Core Intel® Xeon® 70XX, 71XX, 50XX Series
Dual-Core Intel® Xeon® processor (ULV and LV) 1.66, 2.0, 2.16
Dual-Core Intel® Xeon® 2.8
Intel® Xeon® processors with SSE3 instruction set support
Intel® Core™ Duo
Intel® Core™ Solo
Intel® Pentium® dual-core processor T21XX, T20XX series
Intel® Pentium® processor Extreme Edition
Intel® Pentium® D
Intel® Pentium® 4 processors with SSE3 instruction set support

SSE2
Intel® Xeon® processors
Intel® Pentium® 4 processors
Intel® Pentium® M

IA32
Intel® Pentium® III Processor
Intel® Pentium® II Processor
Intel® Pentium® Processor

since the Intel® IPP 8.2, the following domains are beginning the deprecation process, and we want to learn your feedback

**  Intel(R) IPP versions 6.0, 6.1, 7.0 and 7.1 are no longer supported. The current version of Intel(R) IPP is 8.2 which is  bundled with Intel Composer XE 2015.

Optimization Notice in English

Para obter informações mais completas sobre otimizações do compilador, consulte nosso aviso de otimização.