Adding MSM for WebGPU #386
Replies: 3 comments 1 reply
-
|
Could we add a feature flag and then depending on the future flag we make the methods have appropriate signatures? Would that work? |
Beta Was this translation helpful? Give feedback.
-
|
Yes, but one needs to make so many changes that it becomes quite messy. You can get an idea from this PR. My suggestion is to create a separate repo/clone (e.g. |
Beta Was this translation helpful? Give feedback.
-
|
I don't think so, wasm runtimes in browsers run on a single thread, and you cannot block the main thread waiting for a Promise. So even |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
ICME have open sourced a WebGPU implementation for BN254 (other curves can be added):
https://github.com/ICME-Lab/msm-webgpu
For 2^20 MSMs, it brings a 10x improvement in performance.
Computing MSM on WebGPU is asynchronous. This means that any function that calls wgpu msm will need to be async, too.
One option is to have a
wasm_32variant for each of these functions. Another is to make all of these functions async regardless of the backend. Another one may be using WebWorkers, but I don't know much about it.I don't think blocking approaches work. For example,
pollster::block_ondoesn't work forwasm_32, since the runtime is single-threaded and blocking it freezes the environment (e.g. the browser). In any case, despite the seemingly small change, I wanted to discuss which approach would be best for this codebase.Beta Was this translation helpful? Give feedback.
All reactions