[PATCH] D145591: [clang][HIP][OpenMP] Add warning if mixed HIP / OpenMP offloading

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 9 13:21:01 PST 2023


yaxunl added a comment.

In D145591#4182351 <https://reviews.llvm.org/D145591#4182351>, @tra wrote:

> In D145591#4182168 <https://reviews.llvm.org/D145591#4182168>, @yaxunl wrote:
>
>> -x hip and -fopenmp has been a valid combination. -fopenmp with -x hip allows non-offloading OpenMP directives in host code in HIP. It just ignores the offloading directives.
>
> That brings me back to the earlier question -- what do we currently do when target directives are encountered when we compile a C++ source w/ OpenMP enabled and why HIP shold be handled differently.
>
> If a warning makes sense for target directives with offloading disabled, that warning would be equally applicable to C/C++/CUDA & HIP. If that's not the case, what am I missing?

OpenMP offloading directives (e.g. "omp target") create implicit GPU kernels which require OpenMP toolchain to create offloading actions to support them. For C/C++ programs, OpenMP toolchain can create offloading actions to support the OpenMP offloading directives. For HIP programs, HIP toolchain can only do offloading for HIP, not for OpenMP, therefore the OpenMP offloading directives are ignored. However, the other OpenMP directives e.g. "omp parallel for" works on CPU without offloading toolchain support. Currently, the clang driver and OpenMP/HIP runtime are not ready to support both HIP and OpenMP offloading at the same time.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145591/new/

https://reviews.llvm.org/D145591



More information about the cfe-commits mailing list