onnxruntime
cfbc790b - [WebGPU] Add SparsePagedAttention (#32533)

Commit
37 days ago
[WebGPU] Add SparsePagedAttention (#32533) ### Description Adds WebGPU Execution Provider support for `com.microsoft.SparsePagedAttention` using the shared CPU/CUDA schema. - **Attention** - Supports selected main-cache reads. - Supports local paged attention plus selected contiguous auxiliary K/V. - Computes one FP32 softmax across local, selected, and sink logits. - **Cache and metadata** - Reuses PagedAttention QKV splitting, RoPE, and cache-update paths. - Keeps selection, request metadata, and block-table resolution device-resident. - Supports slot mapping, suppressed writes, cache aliasing, and shared auxiliary K/V. - **Safety** - Validates signed indices before unsigned conversion. - Bounds logical positions and shader iteration counts by cache capacity. - Rejects unsupported types, layouts, dimensions, quantization, and resource limits without truncation. - **Coverage** - Adds deterministic tests for selected-main, local-plus-auxiliary, joint softmax, grouped-query batching, cache writes, invalid inputs, and extreme lengths. - Documents the supported WebGPU feature matrix and limits. ### Motivation and Context `SparsePagedAttention` enables QSA-style selected reads and CSA-style local-plus-compressed attention over paged caches. WebGPU support allows these models to preserve the common operator ABI and device-resident scheduling semantics without provider-specific graph rewrites. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com> Co-authored-by: Kunal Vaishnavi <kvaishnavi@microsoft.com>
Author
Parents
Loading