diku-dk / futhark

:boom::computer::boom: A data-parallel functional programming language
http://futhark-lang.org
ISC License
2.35k stars 164 forks source link

Add WebGPU backend #2140

Open spaarmann opened 2 months ago

spaarmann commented 2 months ago

WIP WebGPU backend (#1403)

The JS glue generation is still very basic and barely enough to implement the server protocol on top of. There's also a slightly weird mixture of generating JS vs just accessing the embedded JSON manifest that I'm still hoping to clean up a bit.

athas commented 2 months ago

I pushed a commit that enables some more browser crud. With that change, it works on my home machine. (Probably not on my laptop, which I think has a GPU that is blocklisted by Chromium.)

spaarmann commented 1 month ago

I pushed a commit that enables some more browser crud.

I guarded the extra arguments to not apply when using a remote driver as heuristic for my WSL setup since it seems passing them to Windows Chrome is not allowed. I assume this is fine for your home machine, but we might need a better heuristic if we ever use the remote mechanism for anything else.

I also revamped the JS interface to be much more usable. I ended up making a new JS implementation of the binary data protocol. There were some problems with using the one for the WASM backend, it uses some node-specific things and isn't exactly set up to deal with some of the API functions suddenly being asynchronous. Didn't want to mess with it too much without having looked much at the WASM backend codegen etc. and the format is simple enough.