[PATCH] D126398: [Clang] Introduce `-dl` option to perform offload device linking
Artem Belevich via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 25 11:08:24 PDT 2022
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
More information about the cfe-commits
mailing list