Ahead of Time Compilation

Ahead of Time (AOT) Compilation is a feature that is helpful in your development life cycle or distribution time, when you know beforehand what your target device is going to be at application execution time. The AOT feature provides the following benefits:

Note

Precompiled code will not run on an unintended device. You must select the proper target device at runtime. The use of exception handling with an asynchronous exception handler is also recommended.

Data Parallel C++ (DPC++) supports AOT compilation for the following targets: Intel® CPUs, Intel® Processor Graphics (Gen9 or above), and Intel® FPGA.

Prerequisites

To use the AOT feature for targeting a GPU, you must have the OCLOC tool installed. Refer to the Intel® oneAPI Toolkit Installation Guide to install it on your operating system.

How to Use AOT for the Target Device (Intel® CPUs)

The supported options are:

Examples:

Building an Application with Multiple Source Files for CPU Targeting

Method 1: Compile your normal files (with no DPC++ kernels) first to create host objects. Then compile the file with the kernel code, and link it with the rest of the application in one command line.

Method 2: Compile the file with the kernel code first, and create a fat object. Then compile the rest of the files, and do the linking in one command line to create a fat executable:

Note

Currently, Method 2 only works on a HOST selector.

How to Use AOT for Intel® Integrated Graphics (Gen9 or Above)

The supported options are:

If multiple target devices are listed, the Intel® oneAPI DPC++ Compiler compiles for each of these targets and creates a fat-binary that contains all of the device binaries produced this way.

Examples of supported -device patterns: