[clang] [AMDGPU] Use the AMDGPUToolChain when targeting C/C++ directly (PR #99687)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 7 07:03:29 PDT 2024


jhuber6 wrote:

> I feel choosing toolchain based on input files does not solve all the use cases.
> 
> You may want to handle the object files, bitcodes, or assembly files differently by using different toolchains, e.g. you may want to choose rocm toolchain or amdgpu toolchain or HIPAMD toolchain to hand the object file, even though it has the same extension. Although you could introduce -x for different object type, e.g. cl_obj, cxx_obj, or hip_obj, but that is quite cubbersome.
> 
> I am wondering whether we should introduce a clang option which allows us to directly choose a toolchain.

I think the main difference here is in the compile phase, which wants to load the ROCm libraries. They're probably identical after that point since the only differences exist inside the `addClangTargetOptions`, so after `clang` it should be just feeding it through the pipeline / ld.lld.

It's an inconvenience for me that targeting C++ is held hostage by OpenCL so if I ever do `--target=amdgcn-amd-amdhsa` I get errors about not finding the ROCm libraries even though we shouldn't use them by default here.

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


More information about the cfe-commits mailing list