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

ID 767253
Date 9/08/2022
Public

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

Document Table of Contents

Other Considerations

There are some notable differences between the Intel® oneAPI DPC++/C++ Compiler and the Microsoft* Compiler. Consider the following as you begin compiling your code with the Intel® oneAPI DPC++/C++ Compiler.

Set the Environment

The compiler installation provides a batch file, setvars.bat, that sets the proper environment for the Intel® oneAPI DPC++/C++ Compiler. For information on running setvars.bat, see Specifying the Location of Compiler Components.

Use Optimization

The Intel® oneAPI DPC++/C++ Compiler is an optimizing compiler that begins with the assumption that you want improved performance from your application when it is executed on Intel® architecture. Consequently, certain optimizations, such as option O2, are part of the default invocation of the compiler. By default, Microsoft turns off optimization, which is the equivalent of compiling with options Od or O0. Other forms of the O[n] option compare as follows:

Option

Intel® oneAPI DPC++/C++ Compiler

Microsoft Compiler

/Od

Turns off all optimization. Same as O0.

Default. Turns off all optimization.

/O1

Decreases code size with some increase in speed.

Optimizes code for minimum size.

/O2

Default. Favors speed optimization with some increase in code size. Intrinsics, loop unrolling, and inlining are performed.

Optimizes code for maximum speed.

/O3

Enables -O2 optimizations plus more aggressive optimizations, such as prefetching, scalar replacement, and loop and memory access transformations.

Not supported.

Modify Your Configuration

The Intel® oneAPI DPC++/C++ Compiler lets you maintain configuration and response files that are part of compilation. Options stored in the configuration file apply to every compilation, while options stored in response files apply only where they are added on the command line. If you have several options in your makefile that apply to every build, you may find it easier to move these options to the configuration file (..\bin\icx.cfg).

In a multi-user, networked environment, options listed in the icx.cfg file are generally intended for everyone who uses the compiler. If you need a separate configuration, you can use the ICXCFG environment variable to specify the name and location of your own .cfg file, such as \my_code\my_config.cfg. Anytime you instruct the compiler to use a different configuration file, the icx.cfg system configuration file is ignored.

Use the Intel Libraries

The Intel® oneAPI DPC++/C++ Compiler supplies additional libraries that contain optimized implementations of many commonly used functions. Some of these functions are implemented using CPU dispatch. This means that different code may be executed when run on different processors.

Supplied libraries include the Intel® oneAPI DPC++/C++ Compiler (libm), the Short Vector Math Library (svml_disp), libirc, as well as others. These libraries are linked in by default when the compiler sees that references to them have been generated. Some library functions, such as sin or memset, may not require a call to the library, since the compiler may inline the code for the function.

Intel® oneAPI DPC++/C++ Compiler Math Library (libm)

With the Intel® oneAPI DPC++/C++ Compiler, the math library, libm, is linked by default when calling math functions that require the library. Some functions, such as sin, may not require a call to the library, since the compiler already knows how to compute the sin function. The math library also includes some functions not found in the standard math library.

NOTE:

You cannot make calls to the math library with the Microsoft Compiler.

Many routines in the libimf library are more optimized for Intel® microprocessors than for non-Intel microprocessors.

Short Vector Math Library (svml_disp)

When vectorization is in progress, the compiler may translate some calls to the libm math library functions into calls to svml_disp functions. These functions implement the same basic operations as the math library, but operate on short vectors of operands. This results in greater efficiency. In some cases, the svml_disp functions are slightly less precise than the equivalent libm functions.

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

libirc

libirc contains optimized implementations of some commonly used string and memory functions. For example, it contains functions that are optimized versions of memcpy and memset. The compiler will automatically generate calls to these functions when it sees calls to memcpy and memset. The compiler may also transform loops that are equivalent to memcpy or memset into calls to these functions.

Many routines in the libirc library are more optimized for Intel® microprocessors than for non-Intel microprocessors.

Product and Performance Information

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

Notice revision #20201201