[clang] Add SPIRV support to HIPAMD toolchain (PR #75357)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 3 05:46:52 PST 2024


jhuber6 wrote:

> 
> How about using `--offload=<target>` which can take a target triple? E.g.
> 
>     * `--offload=spirv64-amd` or something like that: pick HIPAMD tool chain.
> 
>     * `--offload=spirv64`: pick HIPSPV tool chain.
> 
> 
> And also remove this [limitation](https://github.com/llvm/llvm-project/blob/5fc712c4bbe84e6cbaa1f7d2a0300f613f11b0c3/clang/lib/Driver/Driver.cpp#L3130-L3136) if you want `--offload` to work along with `--offload-arch`.
> 
> Or alternatively allow multiple `--offload` options, deprecate `--offload-arch` and use `--offload` instead. For convenience and easy transition, options like `--offload=<processor>` could be allowed where the `<processor>` is treated as an alias for an offload target (E.g. `--offload=gfx900` could imply `--offload=amdgcn-amd-amdhsa:gfx900` or something like that).

I've been planning to improve `--offload` at some point. When using the OpenMP toolchain we have `-fopenmp-target=amdgcn-amd-amdhsa,nvptx64-nvidia-cuda` for example, which will just active those toolchains and default to whatever `nvptx-arch` and `amdgpu-arch` spit out. We can most likely use similar logic if needed. The OpenMP solution to target specific arguments is `-Xopenmp-target=amdgcn-amd-amdhsa -march=`, though that's not necessarily the best solution.

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


More information about the cfe-commits mailing list