Skip to content

Add WebGPU Support #319

Open
Open
@jrissman

Description

@jrissman

WebGPU is a new API that lets web applications leverage the power of modern hardware for general purpose computation. After six years of development, it was just released in beta on Chrome for Windows, Mac, and ChromeOS. All major browsers are currently working on adding support (it can already be enabled in Safari, Firefox, Edge, etc. with a flag), and Android and iOS support are coming as well. For more, see the beta release announcement here: https://developer.chrome.com/blog/webgpu-release/

WebGPU might enable much faster model run speeds on modern devices. This might allow models to perform more calculations (such as full 8760-hour electricity dispatch) while still running the model quickly enough to feel interactive. It would also be useful for optimization and genetic algorithms, where a model may need to be run many times, with the computer varying the settings each time, to home in on an optimal solution defined by a goal function.

A modern GPU can have over 1,000 cores, vastly more than a CPU. Assuming WebGPU abstracts the process of distributing work among GPU cores, runspeed might increase by orders of magnitude.

WebGPU can be invoked by WebAssembly code generated by Emscripten. Here's a repo I found where someone built tools to do this: https://github.com/juj/wasm_webgpu . Therefore, it appears that WebGPU is not a replacement for WebAssembly but rather could be added on for further speed gains.

It would be useful to investigate how easy or difficult it would be to use the WebGPU API and see what sort of runspeed improvement it provides. If the runspeed improvement is dramatic, it might be worthwhile to plan to migrate to WebGPU as the standard method of running models once the WebGPU API is broadly supported across browsers and operating systems, as it likely will be in a couple years.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions