Compile Your C/C++ and SYCL* Code Across Diverse Architectures

Top 3 C++ Compiling Advantages of using Intel’s LLVM-based Compiler 

Get the Latest on All Things CODE

author-image

By

Story at a Glance 

  • For present-day programmers, the Intel® oneAPI DPC++/C++ Compiler provides a comprehensive, cross-architecture build solution to compile ISO C/C++ standard applications with support for the latest generation SYCL* and OpenMP* accelerated compute frameworks. 
  • Using industry-leading Intel® compiler technology helps you achieve high performance combined with standards compliance, driven by the proven experience of Intel’s long compiler track record and contributions to the LLVM Compiler Infrastructure Project ecosystem.  
  • C++ compiling using the Intel oneAPI DPC++/C++ Compiler lets you realize the full potential of your hardware by taking advantage of oneAPI libraries such as oneDPL and oneTBB.  
  • The Intel compiler supports Windows*, Linux*, and macOS* host operation systems on Intel® architecture (IA) and x86 platforms, and it enables offload compute acceleration with code reusability across diverse hardware including CPUs, GPUs, and FPGAs. 
  • This blog will delve into three advantages of the oneAPI DPC++/C++ Compiler: 
    1. Flexible performance optimization   
    2. Industry standards support   
    3. Ability to leverage LLVM Technology   

Flexible Performance Optimization 

The oneAPI DPC++/C++ Compiler performs C/C++ code compilation targeting x86 CPUs and accelerator architectures. The SYCL device queue makes it possible for device availability to be checked at runtime and the same GPU or accelerator offload code to be dynamically dispatched to different GPU devices, including third-party vendor GPUs, based on their availability, without requiring recompilation.   

Figure 1. SYCL/C++ code compilation by oneAPI DPC++/C++ Compiler
Figure 1. SYCL/C++ code compilation by oneAPI DPC++/C++ Compiler 


It allows custom tuning of performance and workload distribution across the compute platform. Here are six ways:  

  1. The powerful vectorizer takes advantage of the latest Intel® Advanced Vector Extension register and instruction sets, introducing SIMD parallelism through automatic loop unrolling.  
  2. A variety of pragmas and directives lets you configure and guide these types of optimizations.  
  3. You can trigger prefetching of data or code to aid with latency issues on memory-bound workloads. 
  4. The full set of Clang* compiler driver options and optimizations are available for tweaking optimization levels, math accuracy, and data type usage.  
  5. Combining this with the latest in x86 processor optimizations from Intel’s large compiler developer organization leads to a unique value proposition for highly performant code generation.  
  6. Using accelerator offload or distributed compute dispatch models such as SYCL, OpenMP, and MPI, you can define which code segments should get offloaded to a target device or assigned to a specific node.  

In short, the oneAPI DPC++/C++ Compiler not only is a first-class modern compiler, but  also offers quite a bit more with its integrated SYCL and OpenMP support. 

Industry Standards Support 

oneAPI DPC++/C++ Compiler has been designed with the latest industry standards in mind, including SYCL and C++17 that allow you to use features such as generic lambda expressions. Its standards compliance, support for the latest standards, and compatibility of its oneDPL and SYCL extensions with the standard, together, ensure portability. It conforms to the newest standards for accelerator offload, including SYCL, C++20, and OpenMP 5.0 and 5.1. Additionally, it can work together with any oneAPI specification-compliant accelerator runtime based on OpenCL.

The complete list of supported Intel-specific pragmas and Intel-supported pragmas compatible with other common C/C++ compilers is included in the documentation. This eases code migration from other toolchains. These can be used to instruct the compiler for a variety of specialized tasks such as splitting a loop or offloading computations to different hardware. Some of the supported pragmas may provide more optimizations for IA than do non-Intel ones. 

→ Visit this link for more information on the compiler-supported pragmas. 

Leverage LLVM Technology 

The new Intel compiler, available since 2020, has adopted the open-source LLVM compiling technology, in contrast to the proprietary compiler frontend and optimization engine on which the Intel® C++ Compiler Classic was based.  

Being a part of the LLVM open-source community allows the new DPC++/C++ compiler to benefit from all the innovations brought by the community. In addition to that, the advanced knowledge and technology of Intel compiler optimizations become available to the wider community, and the open multi-hardware approach can be easily adopted for software development.  

If you enjoyed the previous generation compiler and its optimizations, we would like to recommend to you to advance to the oneAPI DPC++/C++ Compiler that has added SYCL support for CPUs, GPUs, and FPGAs as well as ongoing support for the latest OpenMP standards for GPU offload. However, it is still compatible with the CPU-based workflows compiled by the traditional compiler.   

With its move to the LLVM framework, the oneAPI DPC++/C++ Compiler also is able take advantage of its comprehensive error reporting, LLVM sanitizers, and enhanced optimization reports moving forward.  

Let’s go Ahead and Give it a Go 

We hope that this blog gave you an informative overview of the LLVM-based compiler powered by oneAPI and piqued your interest into exploring it more. Get started with oneAPI DPC++/C++ Compiler and have an optimized compiling of your code through a standard, cross-platform unified programming model. 

We also encourage you to dig into other AI, HPC, and Rendering tools in Intel’s oneAPI-powered software portfolio. 

Useful Resources 

Here are some detailed resources for you to explore the oneAPI DPC++/C++ Compiler: 

Get The Software  

You can install DPC++/C++ Compiler as a part of Intel® oneAPI Base Toolkit, Intel® oneAPI HPC Toolkit or Intel® oneAPI IoT Toolkit. You can also download standalone version of the compiler or test it across Intel® CPUs and GPUs on the Intel® Developer Cloud platform. 

Acknowledgement 

We would like to thank Chandan Damannagari for his contribution to this blog.