[all-commits] [llvm/llvm-project] b7c8c4: [Clang] Introduce `--offload-link` option to perfo...

Joseph Huber via All-commits all-commits at lists.llvm.org
Wed May 25 13:31:09 PDT 2022


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

  Changed paths:
    M clang/docs/ClangCommandLineReference.rst
    M clang/include/clang/Driver/Options.td
    M clang/lib/Driver/Driver.cpp
    M clang/test/Driver/cuda-openmp-driver.cu

  Log Message:
  -----------
  [Clang] Introduce `--offload-link` option to perform offload device linking

The new driver uses an augmented linker wrapper to perform the device
linking phase, but to the user looks like a regular linker invocation.
Contrary to the old driver, the new driver contains all the information
necessary to produce a linked device image in the host object itself.
Currently, we infer the usage of the device linker by the user
specifying an offloading toolchain, e.g. (--offload-arch=...) or
(-fopenmp-targets=...), but this shouldn't be strictly necessary.
This patch introduces a new option `--offload-link` to tell
 the driver to use the offloading linker instead. So a compilation flow
 can now look like this,

```
clang foo.cu --offload-new-driver -fgpu-rdc --offload-arch=sm_70 -c
clang foo.o --offload-link -lcudart
```

I was considering if this could be merged into the `-fuse-ld` option,
but because the device linker wraps over the users linker it would
conflict with that. In the future it's possible to merge this into `lld`
completely or `gold` via a plugin and we would use this option to
enable the device linking feature. Let me know what you think for this.

Reviewed By: tra

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




More information about the All-commits mailing list