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

Michael Halkenhäuser via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 9 01:56:32 PST 2023


mhalk added a comment.

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

> How is this different from compiling a C++ file with opemnp directives in it? AFAICT neither clang nor gcc issue anywarnings: https://godbolt.org/z/5Me3dnTdr
>
> What makes the warnings necessary for HIP?

When using HIP target offloading it will "take precedence" over OpenMP target offloading.
That is, there is a use case which compiles "successfully" / without warning but will not execute code within OpenMP target directives.

For example: when using `-x hip -fopenmp --offload-arch=...` (+ other reasonable parameters) a HIP program with OpenMP target directives will compile without warning / error.
But only host-related OpenMP code will be executed properly.

Another hint that HIP and OpenMP target offloading do not work concurrently ATM is that when compiling with `-x hip --fopenmp-targets=...` clang will throw an error.

Hence, we want to signal this issue to users, whorun into problems and then have to debug their programs to find out about this.
AFAIK this issue can be alleviated by refactoring / splitting up your code, then linking it back togehter -- but you have to know about this.


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