NVIDIA Looking To Add OpenACC 3.3 Support To Upstream LLVM Clang
Erich Keane with NVIDIA laid out their initial plans for how they hope to upstream OpenACC 3.3 offload support within Clang. OpenACC is the parallel computing standard developed by NVIDIA with PGI and Cray for C / C++ / Fortran. For several years the US Department of Energy and others have worked on CLACC for supporting OpenACC with Clang and LLVM as well as "Flacc" as a Fortran OpenACC implementation for Flang. This NVIDIA-led implementation though would be different. There is also some code sharing that can take place with LLVM's OpenMP code.
As for NVIDIA's OpenACC implementation strategy for Clang:
"Short term, we are going to start the Clang effort by implementing Parsing and Semantic Analysis of the directives, enabled by the -fopenacc flag, chosen for GCC compatibility. We will also implement a temporary flag to control the __OPENACC macro override (to be removed when we have a complete implementation), which will permit existing programs to be compiled with Clang to leverage our semantic analysis checking.
We believe this to be the best way to start for a few reasons. First, it permits us to make necessary progress while the Flang design and engineering of the shared components continues, so that we can help guide that effort, and start using the infrastructure and implementation when it is mature. We believe this will shorten the time required to develop OpenACC in Clang.
Second, it permits us to implement the OpenACC semantic analysis rules to the standard, such that Clang can be used to validate existing programs, thus becoming more immediately useful. This is possible because OpenACC directives are treated as advanced hints to the compiler, so ignoring them is a compliant implementation model, though we obviously intend to add the offload analysis as soon as it is available to do so.
We intend to leverage the existing tests from the NVHPC product, and development will follow the LLVM convention for lit tests, as well as use the lit tests written for CLACC."
NVIDIA says they are committed to this upstream OpenACC support in LLVM/Clang:
"NVIDIA as a company is dedicated to the success of OpenACC, as should be clear from our participation in the OpenACC standardization efforts and our commitment to implementing OpenACC in Flang, and is equally as committed to proliferating its use in multiple compilers. We intend to continue development and support of OpenACC in Flang and Clang in perpetuity via funding multiple compiler engineering developers. We are committed to this support.
While we don’t yet have an implementation, we intend to do said implementation completely ‘upstream’ in Clang, where it is subject to extensive review and validation by the code owners and other contributors. Additionally, as the Attributes Code Owner (and primary reviewer as additional contributors start helping), I intend to ensure that every bit of code contributed meets or exceeds the LLVM and Clang coding standards and levels of quality."
Those wanting to learn more about NVIDIA's OpenACC offloading hopes/plans for LLVM/Clang can find their request for comments on it via the LLVM Discourse.