https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118694
--- Comment #9 from Tobias Burnus <burnus at gcc dot gnu.org> ---
STATUS:
* 'target teams' handles the target part differently, depending whether
a 'teams' follows or not. Thus, the host (launching the offload kernel)
has to know whether a 'teams' follows or not.
* If the metadirective is placed after 'target' and inserts the 'teams'
depending a 'device' context selector, this becomes a runtime property.
If, e.g. only 'arch(nvptx)' uses 'teams', the runtime has to start the
host fallback and amdgcn without teams but nvptx with teams; thus,
there is a runtime dependency even if on the device side it can be
resolved at compile time.
On the user side, the best is to replace:
omp target
omp metadirective when(device=... : teams)
// block
by
omp metadirective when(target_device=... : target teams
// block
such that at runtime the target_device kind is checked for.
On the compiler side, GCC could print a better error message - possibly
suggesting the change above - or if this becomes an important issue, GCC could
also implement this handling change.