Skip to content

WebGPU backend compiles shaders but never dispatches them? #51

Description

@devangpratap

Was reading through the native backend and I don't think the WebGPU target actually runs on the GPU. Wanted to check if this is WIP before assuming.

What I'm seeing:

  • device.rs compiles every .wgsl into a ComputePipeline and exposes get_pipeline(), create_buffer_init(), create_buffer_zeros().
  • None of those have callers. The only command encoder in the file (read_buffer) is a buffer-to-staging copy for readback, not a compute pass, and there's no dispatch_workgroups anywhere in src/native/. So no shader ever executes.
  • Every GpuDevice::instance() call in ops/ sits inside a #[cfg(feature="cuda")] block, so under --features webgpu they don't compile. The ops fall through to the #[cfg(any(feature="cpu", feature="webgpu"))] bodies, which are pure host code (add is a closure over Vec<f32>, matmul is the CPU triple-loop). A webgpu build computes on the CPU while uploading shaders it never runs.

Separate thing: the README says all three backends share the same autograd tape. The browser WebGPU path looks like its own TS engine in src/web/ with its own tape (src/web/tape.ts), separate from the Rust tape in autograd.rs that CPU and CUDA use. So that line might be worth rescoping to CPU+CUDA.

Is native WebGPU WIP? If so it'd help to note it in the README so the webgpu flag isn't read as GPU execution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions