[PATCH] D109144: [SPIR-V] Add SPIR-V triple architecture and clang target info

Alexey Bader via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 6 10:17:09 PDT 2021


bader added a comment.

In D109144#3042247 <https://reviews.llvm.org/D109144#3042247>, @Anastasia wrote:

> 1. Implementing SPIR-V target as SPIR target.  @bader do you suggest that we add `spirv` triple to clang and map it into SPIR taget or do you suggest something different?

What I have in mind is to continue using SPIR target for now (until SPIR-V back-end is added).
For instance, SYCL compiler emits code for SPIR target and code format is configured via flag.

`-emit-llvm` changes output file format for regular C++ compilation flow:

  clang++ a.cpp -c -o a.o                      # object format by default 
  clang++ a.cpp -c -emit-llvm -o a.bc          # LLVM IR format with `-emit-llvm`

Similar approach for HIP device compilation flow:

  clang++ -target spir -x hip a.cpp -cuda-device-only -o a.spv                 # SPIR-V format by default
  clang++ -target spir -x hip a.cpp -cuda-device-only -emit-llvm -o a.bc       # LLVM IR (aka SPIR) format with `-emit-llvm` if needed

I think this was proposed in RFC. @linjamaki, am I right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109144



More information about the cfe-commits mailing list