The Intel® C++ Compiler provides a CPU-dispatching feature that enables users to provide different implementations of their functionality. The CPU-dispatching mechanism checks the target architecture and then selects the best implementation at runtime. However, the mechanism has two related potential limitations:
- Users cannot control the selected code path when they have a particular reason to do so; this can be decided only by the CPU-dispatching mechanism at runtime according to the target platform.
- Users cannot test their different implementations on the same machine.
The CPU-Spoofing feature addresses these limitations.
The CPU-Spoofing feature does not add any command-line options. Instead, the user must set a new environment variable, INTEL_ISA_DISABLE, before running their application.
The user can set the environment variable as follows (Linux example):
$ export INTEL_ISA_DISABLE=features
featuresis a comma-separated list of features such as
The feature names are those used with the
Setting the environment variable causes the named features not to be visible on the host even if the CPUID reports that it has them onboard. This has the following implications:
- If the user disables a CPU feature (for example, _FEATURE_SSE2) usingexport INTEL_ISA_DISABLE=sse2, then_may_i_use_cpu_feature(_FEATURE_SSE2)will return false; however, there will be no impact on other features for_may_i_use_cpu_feature.
- The CPU-dispatching mechanism will be affected; that is, dispatching will not take paths that require features disabled via INTEL_ISA_DISABLE.
- Libraries that use libirc for their CPU dispatching (such as mkl and libimf/libsvml) will be affected by INTEL_ISA_DISABLE in the same way.
- CPU-Spoofing has no architecture restrictions. Users can set the environment variable effectively on all our current architectures.
- CPU-Spoofing has no default setting (such as OFF or ON). The feature is triggered by the INTEL_ISA_DISABLE environment variable, so if users do not set that variable before running their application, everything works normally (with no CPU spoofing). Also, if users specify invalid feature names within the environment variable's value, those names will be ignored.
- There is no IDE equivalent for the CPU-Spoofing feature.
- The value of environment variableINTEL_ISA_DISABLEis a feature list string comprising feature names separated by commas. The feature names are those used with the-moption.
- Users must setINTEL_ISA_DISABLEbefore running their application.
- Usersmust notdisable any feature that is requested by the-xoption. For example, if you compile withtarget-xcore-avx2and then disablefma(which is required by avx2) via theINTEL_ISA_DISABLEenvironment variable, a runtime error will occur indicating that the CPU is not supported.