Ahead-Of-Time Compilation
The overhead of Just-In-Time (JIT) compilation at runtime can be avoided by using Ahead-Of-Time (AOT) compilation. With AOT compilation, the binary contains the assembly code of the platform that was selected at compile time and the SPIR-V intermediate code. The advantage of AOT compilation is that the code does not need to JIT compiled from SPIR-V during execution if it is run on the platform specified during compile time, which makes the code run faster. If the application is run on a platform other than what was specified during compile time, the embedded SPIR-V will be used and JIT compiled at runtime.
When compiling in AOT mode for an Intel® GPU, you need to add an extra compiler option (-Xs) to indicate the specific GPU target.
AOT Compiler Options for SYCL
Xe-HPC (PVC) platform
icpx -fsycl -fsycl-targets=spir64_gen -Xs "-device pvc" source.c
Xe 2-HPG (BMG) platform
icpx -fsycl -fsycl-targets=spir64_gen -Xs "-device bmg" source.c
AOT Compiler Options for OpenMP
Xe-HPC (PVC) platform
icx -fiopenmp -fopenmp-targets=spir64_gen -Xs "-device pvc" source.c
Xe 2-HPG (BMG) platform
icx -fiopenmp -fopenmp-targets=spir64_gen -Xs "-device bmg" source.c
Notes
The compiler options shown above can also be used when compiling OpenMP Fortran programs in AOT mode (using ifx).
In JIT-mode, the Intel® Graphics Compiler knows the type of the hardware and will adjust automatically. The extra -revision_id option is only needed for AOT mode.