Open athas opened 3 years ago
Some notes.
wgpuDevicePoll
to wait until various async operations complete. Dawn has a similar function. Apparently browsers normally hook this into their own event loop or something, but maybe webgpu.h will need to be extended for our purposes.Apart from the blocking/polling issue, the WebGPU C API looks reasonably simple (although more complex than OpenCL and CUDA). I don't think it will present major issues. I have yet to closely study WGSL (the language for writing shaders/kernels), but I did notice that it is missing many important scalar types (integers other than 32-bit for example).
It may be worth investigating how feasible it is to convert SPIR-V shaders to WGSL shaders. We already have parts of a SPIR-V codegen in the Vulkan backend branch, and we'll probably need a SPIR-V codegen eventually. The biggest question is whether we can expect such a conversion program to be available to our users.
This is a big one. Current plan is to generate C that calls native WebGPU, which Emscripten can translate to WASM+WebGPU. Two major challenges exist:
Before we can even think about starting the implementation, we need to gain more WebGPU expertise. The best starting point is to write some WebGPU compute shader programs, initially in straight JavaScript, and then in C translated with Emscripten.
On top of these significant tasks, WebGPU is also not a ratified standard and browser support is really shaky. This is a technically very challenging project in all regards.