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

Anastasia Stulova via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 13 08:13:48 PDT 2021


Anastasia added a comment.

I would like to explain the position of the OpenCL tooling community and the directions we would like to take with SPIR-V support in LLVM. We believe that SPIR-V triple and target should be added explicitly to LLVM/Clang for the following reasons:

- It would be better in the future to get away from the use of SPIR because SPIR has been discontinued by the Khronos Group and ever since it has evolved in various ways that are not documented anywhere to our knowledge. The use of SPIR for SPIR-V has largely been a workaround due to the failure to add SPIR-V target natively in Clang/LLVM. We would like to be able to deprecate or even remove SPIR in the future if the community is happy to switch to SPIR-V fully. Therefore we believe that it is better for the LLVM project not to create any new uses of it but instead teach the developer community to use SPIR-V target straight away.
- We believe that adding SPIR-V explicitly will better align with the conventional architecture of Clang/LLVM where each distinct target has its corresponding triple/target representation. It will also eliminate confusion in the developer community as both SPIR and SPIR-V exist in the specification as completely different formats and both are supported in tooling.
- With wider adoption of SPIR-V support in LLVM (i.e. backend or even MLIR) adding a new triple seems to be inevitable so it is better to add it straight away in order to avoid rewriting code later on or force application developers to switch to a different interface.
- We would like to improve and optimize the design of the LLVM stack for SPIR-V - for example, we are planning to change the design of the OpenCL builtins for SPIR-V that we won't be able to change for SPIR as it is used by other tools (for example clspv) differently. We can't force vendors to change their implementations because of our goals. This would be impractical considering how long SPIR was used in tools around OpenCL and possibly other languages too.

Note that we are aware that switching to SPIR-V target would require some changes in tools including SPIRV-LLVM Translator that we find fully justifiable and we, therefore, don't have any objections to adding such changes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109144



More information about the llvm-commits mailing list