tra added a comment.

> 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.

Yup. Whether we want to perform device link or not is orthogonal to those 
options.

> This patch introduces a new option -dl 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 -dl -lcudart

It's an essential feature, as we do want to be able to produce libraries with 
host object files, but with fully linked GPU executables.
Naming, as usual, is hard. I would prefer a more explicit `--offload-link` 
which would be in line with other --offload* options we have by now. 
`-dl` is cryptic for uninitiated and is uncomfortably close to commonly used 
`-ldl`. If it gets mistyped as `-ld`, it would lead to a legitimate but 
unrelated error about missing `libd`. Or it might silently succeed linking with 
`libd` without actually doing any device linking.

> I was considering if this could be merged into the -fuse-ld option,
> but becuse 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. Let me know what you think for this.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126398/new/

https://reviews.llvm.org/D126398

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to