Compiling to SPIR

Kai Nacke via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Wed Oct 15 21:32:56 PDT 2014


Hi John!

On Wednesday, 15 October 2014 at 18:14:22 UTC, John Colvin wrote:
> How unrealistic would it be to compile a small subset of D, 
> e.g. betterc, to OpenCL SPIR https://www.khronos.org/spir ?
>
> It would be fantastic to use all of D's code-generation and 
> compile-time abstractions for writing opencl kernels. In 
> addition, compile-time introspection of the kernel code would 
> allow for significant improvements in the host API.

As far as I know SPIR is a LLVM IR subset based on LLVM 3.0. 
Currently, I don't know what needs to be done here.

But in general it should be possible. Here is a tutorial which 
shows how to compile Ada to a CUDA kernel: 
http://markmail.org/download.xqy?id=4xfv2vajltcydmhi&number=1
This can be done with D, too. It requires some fiddeling with 
address spaces which is currently not implemented.

Regards,
Kai


More information about the digitalmars-d-ldc mailing list