onnxruntime
426d9b35 - Add FP16 and BF16 H512 GQA decode support (#33176)

Commit
4 days ago
Add FP16 and BF16 H512 GQA decode support (#33176) ### Description - Add FP16/BF16 H512 XQA decode kernels with FP32 online softmax and partial-result merging. - Support BNSH/BSNH caches, integral positive GQA ratios, local windows, and attention sinks. - Align runtime scratch geometry, workspace recipes, bounds, estimation, and eligibility checks. - Prefer native grouped H512 attention where eligible instead of oversized expanded-KV fallback workspaces. - Add documented kernel, eligibility, workspace, and cache-immutability regressions; retain existing smaller-head dispatch paths. - Preserve main's shared route-eligibility helpers and integrate H512 geometry into the shared XQA predicate. ### Motivation and Context Gemma 4 grouped attention includes 512-wide heads. This adds a bounded decode implementation and consistent workspace accounting rather than expanding the cache to query-head count. ### Validation After merging main at `05517e129656033b13a1617f1d94d0bdc9f0dff1`, resolved commit `e4dedff734cadcc2df828f176aaecf2a54ce3312` was rebuilt in an isolated Release CPU/CUDA build on Linux/A100 (SM80), CUDA 13, QUICK_BUILD off. All 90 native GQA operator tests and 106 focused internal CUDA kernel/workspace/eligibility tests passed. The 13 operator skips are 12 unavailable WebGPU tests and one FP8 test requiring SM89+. Both direct FP16/BF16 H512 kernel tests and all four typed instances of the new unquantized-H512 geometry regression ran and passed. All 17 PR files pass configured lint and whitespace checks. No full-suite, Windows, ROCm, or other GPU-architecture validation. This is one of four independent ORT drafts. Prefer merging the companion GQA cache/window draft https://github.com/microsoft/onnxruntime/pull/33175 first so the native fallback also receives its window-bound correction; this branch was built and tested without that draft applied. ### Conflict Resolution Merged main without rewriting the original tested commit. The resolution retains main's XQA and MEA helper refactors, adds H512 geometry to the shared XQA predicate, keeps the native-H512 MEA exclusion, and preserves both operator tests that collided at the same insertion point. No other companion draft commits were applied. ### Latest Main Merge (2026-10-09) Resolved the current conflict by merging main at `e379df24dbe4b0c6912282f30fe3f5ae4c1836d4` in `d73ed2d1538ed3dc02a2762057156c122eb6eb00` without rewriting branch history. The operator-test conflict was two independent insertions at the same location: both the native H512 fallback eligibility regression and the upstream FlashAttention L2-cache block-size regressions are preserved, with their original platform guards. Upstream GQA runtime changes merged automatically. For this merge, rebuilt the resolved GQA test translation unit against the merged H512 headers and ran all three conflict-local header-only helper tests successfully. The test executable reused retained backend libraries; this is not a fresh H512 numerical-kernel validation. The automatically merged CUDA GQA runtime source passed a compile check. All 17 remaining PR files passed configured lint and whitespace checks, and editor diagnostics reported no errors in the resolved file. The full native H512 runtime results above describe the earlier validated revision; those numerical tests and a full native rebuild were not rerun for this merge. CI for the new merge commit remains pending.
Author
Parents
Loading