ncnn icon indicating copy to clipboard operation
ncnn copied to clipboard

[RFC] vulkan on webgpu native

Open nihui opened this issue 10 months ago • 2 comments

bring webgpu native for webassembly, reuse vulkan code as much as possible

to be investigated

webassembly vulkan build system integration

build tint library

runtime comp➡️preprocess➡️spirv➡️wgsl

push constant to uniform binding

thin vulkan adaptor on webgpu native

webgpu native ci

resources

webgpu native implementation https://github.com/gfx-rs/wgpu-native https://github.com/google/dawn https://github.com/emscripten-core/emscripten/tree/main/system/include/webgpu

spir-v to wgsl https://dawn.googlesource.com/dawn/+/refs/heads/chromium/6530/docs/tint/spirv-reader-overview.md https://github.com/BabylonJS/twgsl

compatibility https://caniuse.com/webgpu

nihui avatar Apr 08 '25 03:04 nihui

push constant changes for

error: unknown SPIR-V storage class: 9
layout (push_constant) uniform parameter
{
    int dims;
    int w;
    int h;
    int c;
    int cstep;
} p;
struct parameter
{
    int dims;
    int w;
    int h;
    int c;
    int cstep;
};
layout (binding = 1) uniform parameter_blob { parameter p; };

psc macro changes for

error: unhandled expression for ID 33
%33 = OpSpecConstantOp %32 IEqual %30 %31
#define psc(x) (x==0?p.x:x)
#define psc(x) (float(x)==0?p.x:x)

nihui avatar Apr 08 '25 07:04 nihui

Finally, this will be huge improvement for web.

qwertypower avatar May 22 '25 20:05 qwertypower