For the past few weeks, I’ve been exploring ISPC (Intel SPMD Program Compiler) and experimenting with a few ideas I have in mind around CPU and GPU interop that work well with the SPMD (single program, multiple data) model.

Along the way I felt like something was missing. What if I was able to write ISPC kernels in a way that I’m super familiar with, such as HLSL?

And so I’ve created this HLSL-to-ISPC helper library: a utility library with helper types and functions to provide similar syntax to HLSL inside the ISPC programming environment.

I’ve used it for the following mini-projects:

ispc-smallpt ispc-mandelbrot
ispc-flower ispc-worley

The first project (ispc-smallpt) is an ISPC implementation of Kevin Beason’s famous smallpt path tracer. The following two are shadertoys (originally from Inigo Quilez) that got converted to ISPC. Finally, the fourth example is an implementation of Worley cellular noise.

All of the previous use the HLSL-to-ISPC helper library. It’s also a great way to validate that the library works, with minimal alteration to the original code as it gets transformed to ISPC.

The library is not complete, but good enough for now to get started. Please check the Github page for upcoming features and updates. I plan to keep improving it during the following months, with additional test cases, mini-projects and new features. Moreover there is a lot to be said regarding CPU/GPU interop, and I hope to find some time in the following months to chat more about it.

In the meantime, please check out the library and let me know what you think, find any bugs, or even if you want to contribute.