Skip to content

feat: nonblocking buffer readback#8

Merged
sebcrozet merged 9 commits into
mainfrom
nonblock-readback
Jul 4, 2026
Merged

feat: nonblocking buffer readback#8
sebcrozet merged 9 commits into
mainfrom
nonblock-readback

Conversation

@sebcrozet

Copy link
Copy Markdown
Member

Added

  • Non-blocking GPU→CPU readback. A new GpuReadback type stages a buffer copy and returns immediately: request/request_copy start the transfer and try_take polls for completion (is_idle reports whether a readback is in flight). GpuTimestamps gained matching request_read/try_take/is_idle for non-blocking timestamp readback. Both are driven by a new Backend::poll maintenance method (a non-blocking counterpart to synchronize) implemented across the WebGPU, CUDA, Metal, and CPU backends. The metal feature now pulls in block for command-buffer completion handlers.
  • WebGpu::from_device: build a WebGPU backend on top of an already-created wgpu instance/adapter/device/queue instead of creating its own.
  • from_wgpu constructors on GpuBufferSlice, GpuBufferSliceMut, and WebGpuBufferSlice to wrap a foreign wgpu::Buffer (owned by another library sharing the device) as a khal buffer slice.
  • force_cpu_coroutines option for #[spirv_bindgen]: forces the CPU backend to dispatch a kernel through the coroutine scheduler so barrier_wait() synchronizes, even for kernels with no #[spirv(workgroup)] parameter. Replaces the old dummy-workgroup-parameter hack.

Fixed

  • WebGPU entry-point lookup on wasm now mirrors naga's identifier sanitization, which appends a trailing _ to names ending in a digit, so kernels like reduce_add_f32 resolve correctly.

@sebcrozet sebcrozet merged commit b7f0aa7 into main Jul 4, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant