Ahead of Time (AOT) Compilation is a feature that is helpful in your development lifecycle 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:
Data Parallel C++ (DPC++) supports AOT compilation for the following targets: Intel® CPUs, Intel® Processor Graphics (Gen9 or above), and Intel® FPGA.
To use the AOT feature for targeting a GPU, you must have the OCLOC tool installed. Refer to the Intel® oneAPI Toolkit Installation Guide's section: Install OpenCL™ Offline Compiler (OCLOC) to install the tool on your operating system.
The supported options are:
Switch | Display Name |
---|---|
avx | Intel® Advanced Vector Extensions (Intel® AVX) |
avx2 | Intel® Advanced Vector Extensions 2 (Intel® AVX2) |
avx512 | Intel® Advanced Vector Extensions 512 (Intel® AVX-512) |
sse4.2 | Intel® Streaming SIMD Extensions 4.2 (Intel® SSE4.2) |
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:
The supported options are:
Switch | Display Name |
---|---|
skl | 6th generation Intel® Core™ Processor (Skylake with Intel® Processor Graphics Gen9) |
kbl | 7th generation Intel® Core™ Processor (Kaby Lake with Intel® Processor Graphics Gen9) |
cfl | 8th generation Intel® Core™ Processor (Coffee Lake with Intel® Processor Graphics Gen9) |
glk | Gemini Lake with Intel® Processor Graphics Gen9 |
icllp | 10th generation Intel® Core™ Processor (Ice Lake with Intel® Processor Graphics Gen11) |
tgllp | 11th generation Intel® Core™ Processor (Tiger Lake with Intel® Processor Graphics Gen12) |
dg1 | Intel® Iris® Xe MAX Graphics Family |
Gen9 | Intel® Processor Graphics Gen9 |
Gen11 | Intel® Processor Graphics Gen11 |
Gen12HP | Intel® Processor Graphics Gen12 (Higher Performance) |
Gen12LP | Intel® Processor Graphics Gen12 (Lower Power) |
To see all the device types, use the following command:
ocloc compile --help
If multiple target devices are listed, the Intel® oneAPI DPC++/C++ 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:
dpcpp -fsycl-targets=spir64_gen-unknown-unknown-sycldevice -Xs "-device skl" vector-add.cpp
dpcpp -fsycl-targets=spir64_gen-unknown-unknown-sycldevice -Xs "-device skl,icllp" vector-add.cpp
dpcpp -fsycl-targets=spir64_gen-unknown-unknown-sycldevice -Xs "-device *" vector-add.cpp
dpcpp /EHsc -fsycl-targets=spir64_gen-unknown-unknown-sycldevice -Xs "-device skl" vector-add.cpp
dpcpp /EHsc -fsycl-targets=spir64_gen-unknown-unknown-sycldevice -Xs "-device skl,icllp" vector-add.cpp
dpcpp /EHsc -fsycl-targets=spir64_gen-unknown-unknown-sycldevice -Xs "-device *" vector-add.cpp