[OpenMP] Try to Infer target triples using the offloading architecture
authorJoseph Huber <jhuber6@vols.utk.edu>
Thu, 5 May 2022 22:09:55 +0000 (18:09 -0400)
committerJoseph Huber <jhuber6@vols.utk.edu>
Fri, 6 May 2022 20:57:18 +0000 (16:57 -0400)
commit509b631f84e97e717a675a6ef60ae4728bb11551
treed98ad2c13f9c2ce8e9bed6e81ae7caf96b815ae9
parent8477a0d769a0b877f14e3ec3fde576b6a3b173ce
[OpenMP] Try to Infer target triples using the offloading architecture

Currently we require the `-fopenmp-targets=` option to specify the
triple to use for the offloading toolchains, and the `-Xopenmp-target=`
option to specify architectures to a specific toolchain. The changes
made in D124721 allowed us to use `--offload-arch=` to specify multiple
target architectures. However, this can become combersome with many
different architectures. This patch introduces functinality that
attempts to deduce the target triple and architectures from the
offloading action. Currently we will deduce known GPU architectures when
only `-fopenmp` is specified.

This required a bit of a hack to cache the deduced architectures,
without this we would've just thrown an error when we tried to look up
the architecture again when generating the job. Normally we require the
user to manually specify the toolchain arguments, but here they would
confict unless we overrode them.

Depends on: D124721

Reviewed By: saiislam

Differential Revision: https://reviews.llvm.org/D125050
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/include/clang/Driver/Driver.h
clang/lib/Driver/Driver.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/openmp-offload-infer.c [new file with mode: 0644]