Intel® oneAPI DPC++/C++ Compiler Developer Guide and Reference

ID 767253
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

fimf-domain-exclusion, Qimf-domain-exclusion

Indicates the input arguments domain on which math functions must provide correct results.

Syntax

Linux:

-fimf-domain-exclusion=classlist[:funclist]

Windows:

/Qimf-domain-exclusion:classlist[:funclist]

Arguments

classlist

Is one of the following:

  • One or more of the following floating-point value classes you can exclude from the function domain without affecting the correctness of your program. The supported class names are:

    extremes

    This class is for values which do not lie within the usual domain of arguments for a given function.

    nans

    This means "x=Nan".

    infinities

    This means "x=infinities".

    denormals

    This means "x=denormal".

    zeros

    This means "x=0".

    Each classlist element corresponds to a power of two. The exclusion attribute is the logical or of the associated powers of two (that is, a bitmask).

    The following shows the current mapping from classlist mnemonics to numerical values:

    extremes

    1

    nans

    2

    infinities

    4

    denormals

    8

    zeros

    16

    none

    0

    all

    31

    common

    15

    other combinations

    bitwise OR of the used values

    You must specify the integer value that corresponds to the class that you want to exclude.

    Note that on excluded values, unexpected results may occur.

  • One of the following short-hand tokens:

    none

    This means that none of the supported classes are excluded from the domain. To indicate this token, specify 0, as in -fimf-domain-exclusion=0 (or /Qimf-domain-exclusion:0).

    all

    This means that all of the supported classes are excluded from the domain. To indicate this token, specify 31, as in -fimf-domain-exclusion=31 (or /Qimf-domain-exclusion:31).

    common

    This is the same as specifying extremes,nans,infinities,denormals. To indicate this token, specify 15 (1 + 2+ 4 + 8), as in -fimf-domain-exclusion=15 (or /Qimf-domain-exclusion:15)

funclist

Is an optional list of one or more math library functions to which the attribute should be applied. If you specify more than one function, they must be separated with commas.

Precision-specific variants like sin and sinf are considered different functions, so you would need to use -fimf-domain-exclusion=4:sin,sinf (or /Qimf-domain-exclusion:4:sin,sinf) to specify infinities for both the single-precision and double-precision sine functions.

You also can specify the symbol /f to denote single-precision divides, symbol / to denote double-precision divides, symbol /l to denote extended-precision divides, and symbol /q to denote quad-precision divides. For example, you can specify:

-fimf-domain-exclusion=4 or /Qimf-domain-exclusion:4

-fimf-domain-exclusion=5:/,powf or /Qimf-domain-exclusion:5:/,powf

-fimf-domain-exclusion=23:log,logf,/,sin,cosf or /Qimf-domain-exclusion:23:log,logf,/,sin,cosf

If you don't specify argument funclist, the domain restrictions apply to all math library functions.

Default

Zero ("0")

The compiler uses default heuristics when calling math library functions.

Description

This option indicates the input arguments domain on which math functions must provide correct results. It specifies that your program will function correctly if the functions specified in funclist do not produce standard conforming results on the number classes.

This option can affect runtime performance and the accuracy of results. As more classes are excluded, faster code sequences can be used.

If you need to define the accuracy for a math function of a certain precision, specify the function name of the precision that you need. For example, if you want double precision, you can specify :sin; if you want single precision, you can specify :sinf, as in -fimf-domain-exclusion=denormals:sin or /Qimf-domain-exclusion:denormals:sin, or -fimf-domain-exclusion=extremes:sqrtf or /Qimf-domain-exclusion:extremes:sqrtf.

If you do not specify any function names, then the setting applies to all functions (and to all precisions). However, as soon as you specify an individual function name, the setting applies only to the function of corresponding precision. So, for example, sinf applies only to the single-precision sine function, sin applies only to the double-precision sine function, sinl applies only to the extended-precision sine function, etc.

NOTE:

Many routines in libraries LIBM (Math Library) and SVML (Short Vector Math Library) are more highly optimized for Intel® microprocessors than for non-Intel microprocessors.

NOTE:

This option only applies to host compilation. When offloading is enabled, it does not impact device-specific compilation.

Product and Performance Information

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.

Notice revision #20201201

IDE Equivalent

None

Alternate Options

None

Example

Consider the following single-precision sequence for function exp2f:

Operation: y = exp2f(x)
Accuracy: 1.014 ulp
Instructions: 4 (2 without fix-up)

The following shows the 2-instruction sequence without the fix-up:

vcvtfxpntps2dq  zmm1 {k1}, zmm0, 0x50      // zmm1 <-- rndToInt(2^24 * x)
vexp223ps       zmm1 {k1}, zmm1            // zmm1 <-- exp2(x)

However, the above 2-instruction sequence will not correctly process NaNs. To process Nans correctly, the following fix-up must be included following the above instruction sequence:

vpxord          zmm2, zmm2, zmm2             // zmm2 <-- 0
vfixupnanps     zmm1 {k1}, zmm0, zmm2 {aaaa} // zmm1 <-- QNaN(x) if x is NaN <F>

If the vfixupnanps instruction is not included, the sequence correctly processes any arguments except NaN values. For example, the following options generate the 2-instruction sequence:

-fimf-domain-exclusion=2:exp2f      <- NaNs are excluded (2 corresponds to NaNs)
-fimf-domain-exclusion=6:exp2f      <- NaNs and infinities are excluded (4 corresponds to infinities; 2 + 4 = 6)
-fimf-domain-exclusion=7:exp2f      <- NaNs, infinities, and extremes are excluded (1 corresponds to extremes; 2 + 4 + 1 = 7)
-fimf-domain-exclusion=15:exp2f     <- NaNs, infinities, extremes, and denormals are excluded (8 corresponds to denormals;  2 + 4 + 1 + 8=15)

If the vfixupnanps instruction is included, the sequence correctly processes any arguments including NaN values. For example, the following options generate the 4-instruction sequence:

-fimf-domain-exclusion=1:exp2f      <- only extremes are excluded (1 corresponds to extremes)
-fimf-domain-exclusion=4:exp2f      <- only infinities are excluded (4 corresponds to infinities)
-fimf-domain-exclusion=8:exp2f      <- only denormals are excluded (8 corresponds to denormals)
-fimf-domain-exclusion=13:exp2f     <- only extremes, infinities and denormals are excluded (1 + 4 + 8 = 13)