LLVM-SPIRV-Backend icon indicating copy to clipboard operation
LLVM-SPIRV-Backend copied to clipboard

Getting started guide and other documentation

Open seanbaxter opened this issue 3 years ago • 3 comments

Hi, I read that the SPIRV target is being merged into LLVM trunk. I'd be interested in using it. Is there a getting started guide for compiler developers? I wrote a C++ compiler that already supports CUDA, and SPIR-V and DXIL shaders, and it makes a lot of sense for me to target SPIR-V compute if you think it's ready.

seanbaxter avatar Feb 24 '22 03:02 seanbaxter

Hi Sean, Thanks for your interest in this project. Currently we have no special getting started guide other than standard LLVM's one. So you can download and build the sources from this repository on Khronos and use it as a standard LLVM backend. Our first goal is to achieve SPIR-V OpenCL stability comparable to SPIRV-LLVM-Translator on LIT tests and OpenCL CTS suit. Now we have about 62% pass rate. We run it at -O0. Please feel free to ask questions, publish issues, or share your feedback about this project.

iliya-diyachkov avatar Feb 27 '22 10:02 iliya-diyachkov

There have got to be lots of LLVM attributes for indicating block information, marking kernels, defining address spaces, plus hundreds of intrinsics for accessing block/grid terms, synchronization, intra-subgroup operations, and all the libm functions. Are these things written down somewhere? Impossible to use the tool without it.

seanbaxter avatar Feb 27 '22 15:02 seanbaxter

Well, we have no special documentation about this yet. The general approach is that we are trying to make the backend compatible with the SPIRV-LLVM-Translator as much as possible, as well as follow the existing OpenCL and SPIR-V documentation. More specifically, you can find some of the information in https://github.com/KhronosGroup/SPIRV-LLVM-Translator/blob/master/docs/SPIRVRepresentationInLLVM.rst (at least about address spaces and SPIRV builtin functions and types) and in https://www.khronos.org/registry/OpenCL (OpenCL builtins, Itanium name-mangling is used). Note that not all existing builtins/intrinsics are supported yet. Later this week we will probably be able to provide more answers to your questions.

iliya-diyachkov avatar Mar 01 '22 10:03 iliya-diyachkov