stdgpu icon indicating copy to clipboard operation
stdgpu copied to clipboard

Any chance to support spirv as a backend?

Open warvstar opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe. I'd like to use this in a hardware vendor agnostic way, and more specifically I'd like to use with webgpu. Any plans to support in the future? OpenCL subset can compile to spirv, so that could be another option?

warvstar avatar Oct 19 '20 14:10 warvstar

After taking a quick look at SPIR-V, I believe that it is not easily possible to add it as a backend. stdgpu requires C++14 (I guess it is possible to break it down to C++11 if absolutely needed). SPIR-V on the other hand is an intermediate format for GLSL, etc. which are based on C.

I guess OpenCL C++, i.e. version 2.x which is also based on a subset of C++14, might be possible. Support for an algorithms library is a requirement. At the moment, stdgpu depends on thrust for this purpose, but perhaps allowing to choose Boost.Compute here might be a good solution. However, implementing such an OpenCL backend requires more investigation.

stotko avatar Oct 20 '20 14:10 stotko

SYCL (https://www.khronos.org/sycl/) may be an easier way to go about it. It's standard C++11 (SYCL 2020 released 6/2020 is based on C++17)

ipapadop avatar Oct 20 '20 14:10 ipapadop

Thanks for the suggestion. A SYCL backend also requires relaxing the dependency to thrust (or adding a SYCL backend to thrust which is more difficult I guess). Since there will be more breaking changes to stdgpu 2.0.0, we may target this as well to be part of the next major version.

stotko avatar Oct 20 '20 15:10 stotko