Skip to content

fix(webgpu): release GPU resources on failure - #1795

Draft
CharlesHoskinson wants to merge 1 commit into
Consensys:feat/webgpu-backendsfrom
CharlesHoskinson:agent/release-webgpu-resources
Draft

fix(webgpu): release GPU resources on failure#1795
CharlesHoskinson wants to merge 1 commit into
Consensys:feat/webgpu-backendsfrom
CharlesHoskinson:agent/release-webgpu-resources

Conversation

@CharlesHoskinson

@CharlesHoskinson CharlesHoskinson commented Jul 15, 2026

Copy link
Copy Markdown

What changed

  • guarantee sparse Pippenger buffers are returned to the pool or destroyed on both success and failure
  • clean window-reduction and readback intermediates when a dispatch or mapAsync fails
  • make context shutdown destroy the GPUDevice and prevent reuse of a closed buffer pool
  • add failure-injection tests for dispatch, mapping, successful cleanup, and idempotent context shutdown

Why

Browser proving allocates large GPU buffers. Previously, cleanup happened only after a successful readback, so WebGPU validation, shader, or device-loss errors could retain those allocations and make fallback or retry unsafe.

Validation

  • npm run lint
  • npm test (5 tests)
  • GOOS=js GOARCH=wasm go build -buildvcs=false ./backend/accelerated/webgpu/...
  • go test -short ./... was also attempted; the WebGPU/backend packages passed, while the full run hit two checkout-environment issues: WSL could not resolve the Windows worktree gitdir for TestVersion, and Solidity golden files differed only by CRLF/LF line endings.

Light Reading

Have a look at my repo for more context. I have a full implementation running in WASM https://github.com/CharlesHoskinson/proof-zk-recovery

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