onnxruntime
4ae10e3e - [WebGPU] Separate command recording from buffer reuse tracking (#32874)

Commit
37 days ago
[WebGPU] Separate command recording from buffer reuse tracking (#32874) ### Description Remove the mutex and pending-buffer list from `CommandRecordingState`. Each Session owns its command recording, while plugin streamless allocations and transfers use independent recordings. `BufferManager` owns deferred buffer releases and protects them with its existing cache mutex. - Plain plugin allocations submit cached-buffer clears before returning. Streamless GPU copies also submit before returning, so later Session work on the shared queue observes them. Matching explicit-stream operations continue to use the Session recording. - Reusable buffers remain pending until their recording submits. Pending entries are grouped by recording; another recording's submission cannot return them to the pool. An atomic work flag lets concurrent frees distinguish pending from submitted work without inspecting encoders or capture state. Non-reusing caches bypass this tracking. - Flush retires entries in both the active manager and the context-shared manager. Graph cache policy applies only to the active manager, so frees during replay and uniforms used during prepacking return to the correct pools. Failure and Session destruction discard abandoned entries. - Keep concurrency support scoped to plugin WebGPU. Preserve the standalone shader-dump concurrency test and sequential buffer-pool memory diagnostic while removing tests that require built-in inference concurrency. Follow-up to #32587. Initial-capture coverage includes independent Sessions and serialized Runs for different graph IDs within one Session, using preallocated bindings. ### Dependency Builds on #32902, now merged into `main`, which serializes graph-state checks and replay with normal Session execution. This PR targets `main` and contains only the WebGPU changes. Standard PR CI runs automatically on updates. ### Validation Native Windows Release validation before rebasing onto the latest main: - Plugin tests: 43 passed across suite and focused runs; two existing tests disabled. - Built-in WebGPU suite: 37 tests passed; one configuration-specific adapter test skipped. - Core/session suite: 78 tests passed. - Plugin concurrency stress: 12 tests repeated 20 times with shuffled order, all 240 executions passed. - Initial capture and replay: three tests repeated 20 times with shuffled order, all 60 executions passed. - Restored shader-dump test and sequential memory diagnostic: both passed. The diagnostic was explicitly enabled with two Sessions, 1 MB tensors, two iterations and no hold time; it remains disabled by default. - Lint and whitespace checks passed. Rebase verification: all five WebGPU patches are unchanged according to `git range-diff`, and `git diff --check` passed.
Author
Parents
Loading