[all-commits] [llvm/llvm-project] 8477a0: [OpenMP] Allow compiling multiple target architect...

Joseph Huber via All-commits all-commits at lists.llvm.org
Fri May 6 13:57:35 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8477a0d769a0b877f14e3ec3fde576b6a3b173ce
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2022-05-06 (Fri, 06 May 2022)

  Changed paths:
    M clang/lib/Driver/Driver.cpp
    M clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
    M clang/lib/Driver/ToolChains/Cuda.cpp
    M clang/test/Driver/amdgpu-openmp-toolchain-new.c
    M clang/test/Driver/openmp-offload-gpu-new.c

  Log Message:
  [OpenMP] Allow compiling multiple target architectures with OpenMP

This patch adds support for OpenMP to use the `--offload-arch` and
`--no-offload-arch` options. Traditionally, OpenMP has only supported
compiling for a single architecture via the `-Xopenmp-target` option.
Now we can pass in a bound architecture and use that if given, otherwise
we default to the value of the `-march` option as before.

Note that this only applies the basic support, the OpenMP target runtime
does not yet know how to choose between multiple architectures.
Additionally other parts of the offloading toolchain (e.g. LTO) require
the `-march` option, these should be worked out later.

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D124721

  Commit: 509b631f84e97e717a675a6ef60ae4728bb11551
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2022-05-06 (Fri, 06 May 2022)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticDriverKinds.td
    M clang/include/clang/Driver/Driver.h
    M clang/lib/Driver/Driver.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    A clang/test/Driver/openmp-offload-infer.c

  Log Message:
  [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

Compare: https://github.com/llvm/llvm-project/compare/a8308020ac2f...509b631f84e9

More information about the All-commits mailing list