Developer Reference for Intel® Integrated Performance Primitives 2018

GetCacheParams

Retrieves cache type, level, and size.

Syntax

IppStatus ippGetCacheParams(IppCache** ppCacheInfo);

Include Files

ippcore.h

Parameters

ppCacheInfo

Pointer to an array of structures describing CPU cache, which are defined in ipptypes.h:
typedef struct {
int type;
int level;
int size
} IppCache;

where

  • type can have the following values:

    0

    NULL - no more caches

    1

    Data cache

    2

    Instruction cache

    3

    Unified cache

  • level starts with 1

  • size is in bytes

Description

The ippGetCacheParams function retrieves the following cache parameters for the CPU on which it is executed: type of cache (instruction, data, unified), cache level in cache hierarchy, and cache size, in bytes. The function is based on function #4 of the CPUID instruction, and therefore works only for the CPUs that support this function. For old and non-Intel CPUs that do not support this CPUID extension, the function returns the ippStsCpuNotSupportedErr status. It means that cache parameters cannot be obtained with the ippGetCacheParams function and you should use other methods based on a particular CPU specification.

Optimization Notice

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and 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. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error condition when the ppCacheInfo pointer is NULL.

ippStsNotSupportedCpu

Indicates that the processor is not supported.

Example

GetL2CacheSize.c