[clang] [Clang] Forward arguments to the device compiler better (PR #125957)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 5 16:07:00 PST 2025


jhuber6 wrote:

> What is the rule of propagation? It is not immediately clear to me
> 
> ```
> clang -fopenmp --offload-arch=gfx1030,sm_89 -Xarch_nvptx64 -O3 -foffload-lto
> ```
> 
> `-foffload-lto` is an argument to `-Xarch_nvptx64` instead of `clang`.

That's just an example, `-Xarch_nvptx64` will send that argument to the NVPTX toolchain which will then be forwarded to the embedded clang job to link the final image, i.e. you will get optimized LTO only for NVPTX and not for  GFX1030. This patch basically just forwards a set of approved options to the clang invocation inside of the linker wrapper.

https://github.com/llvm/llvm-project/pull/125957


More information about the cfe-commits mailing list