Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Channels ▼


Retrieving Detailed Information About Your Intel Multicore CPU Features with Intel IPP

Does the underlying CPU have Nehalem microarchitecture? Does the CPU support Intel Advanced Vector Extensions, also known as AVX? Does the CPU support Streaming SIMD Extensions 4.2, also known as SSE 4.2? When you have to write optimized code that tries to take full advantage of the underlying hardware, you definitely require accurate answers to those questions. If you use Intel Integrated Performance Primitives, also known as IPP, simple calls to one or two of its software functions can provide you with all the answers.

As a disclaimer, I must say there are other ways of retrieving detailed information about your Intel multicore CPU features. However, after I discovered two functions in IPP that provide most of the information I usually need, I started to use both the ippGetCpuType and ippGetCpuFeatures functions by calling them in any programming language in which I needed detailed information about the CPU. Just as an example, because IPP includes C# wrappers, it is really easy to call ippGetCpuType in C#.

One of the key advantages of both the ippGetCpuType and ippGetCpuFeatures functions is that they are always updated with the latest Intel microarchitectures and SIMD instruction sets. Whenever there is a new version of IPP, you will usually find that there these functions return new values to identify the newest Intel CPU features available at that moment. This way, you don't need to worry about low-level calls to detect specific CPU features. Instead, you just have to worry about creating optimized code to take full advantage of the new features.

The ippGetCpuType function, declared in ippcore.h, returns an appropriate IppCpuType value according to the detected CPU. This function returns just one type of processor and doesn't return the sum of many features. For example, if the computer or device has a CPU with Intel AVX support, it will return IppCpuType.ippCpuAVX. However, Intel CPUs that include support for Intel AVX also support both Intel SSE 4.2 and SSE 4.1, among other SIMD instruction sets. If the computer or device has an old Clarksfield mobile Intel Core i7 CPU with support for SSE 4.2, ippGetCpuType will return IppCpuType.ippCpuSSE42.

When you need more information about the CPU features, you usually think of the CPUID instruction for the x86 family. You can spend a few weeks reading the detailed Intel Processor Identification and the CPUID instruction. However, it is easier to take advantage of the ippGetCpuFeatures function that makes it simple to retrieve the most important CPU features returned by the CPUID instruction without adding unnecessary complexity or assembly code to your application. With a simple call to ippGetCpuFeatures, you can apply bitwise and operators to the features mask and detect which specific features the CPU provides. This way, you can easily determine whether the CPU provides support to many instruction sets, such as SSE 4.1, SSE 4.2, AES, and AVX, and you can determine the individual support for each of these instruction sets.

In addition, it is possible to detect operating system support for AVX. The mask value ippCUPID_AVX (256) determines AVX support at the CPU level and the mask value ippAVX_ENABLEDBYOS (512) specifies that the operating system supports Intel AVX. If the returned features mask includes ippCUPID_AVX but doesn't include ippAVX_ENABLEDBYOS, you won't be able to take advantage of Intel AVX because the operating system doesn't have the necessary support, even when the CPU is ready to work with the instruction set. You can read about operating system support for AVX in "Windows 7 and Windows Server 2008 R2 Service Pack 1 Bring AVX Support."

Intel IPP is a commercial product, but you can download a free trial version from http://software.intel.com/en-us/intel-ipp/.

If you want to dive deeper into both the ippGetCpuType and ippGetCpuFeatures functions, you can read the detailed documentation for their related enums, masks, parameters, and return values.

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.