[OpenMP] Make `-fopenmp-target=` use the `nvptx-arch` tool
authorJoseph Huber <jhuber6@vols.utk.edu>
Fri, 13 Jan 2023 18:36:09 +0000 (12:36 -0600)
committerJoseph Huber <jhuber6@vols.utk.edu>
Fri, 13 Jan 2023 22:52:06 +0000 (16:52 -0600)
commit52b9a3974244183806ba862e161670d79885443a
tree76236a7671bd6d6d571915d8eff4c604166a9db7
parent488bea797e167e6bf5ddab5f7eea78031b575ba0
[OpenMP] Make `-fopenmp-target=` use the `nvptx-arch` tool

Previously, if the user did not provide an architecture when using
`-fopenmp-targets=nvptx64` we used the value from
`CLANG_OPENMP_DEFAULT_NVPTX_ARCH` which is defined at compile time. This
isn't ideal because it means that the default is set when the LLVM
compiler it built. Instead this patch uses the `nvptx-arch` tool to
query it at runtime. This matches the existing behaviour of the AMDGPU
toolchain with its `amdgpu-arch` tool.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D141708
clang/lib/Driver/ToolChains/Cuda.cpp
clang/test/Driver/openmp-system-arch.c