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

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 6 11:18:14 PDT 2021


Anastasia added a comment.

In D109144#3045883 <https://reviews.llvm.org/D109144#3045883>, @bader wrote:

> 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?

I would find it slightly confusing that the target `spir` will produce SPIR-V binary, but the confusion can be improved with some good docs although probably not resolved completely. Do you then suggest that we add SPIR-V triple and target for the SPIR-V backend once it is available in LLVM tree?

I believe we are not too far from enabling initial support of SPIR-V backend in LLVM so I thought the goal was to add SPIR-V target asap that can be used universally for both the translator and the backend...


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