Fix GroupQueryAttention right-padded rotary prefill CUDA test#29218
Merged
tianleiwu merged 2 commits intoJun 23, 2026
Conversation
BatchedRightPaddedRotaryPrefill_CUDA fed fp32 inputs via AddInput<float>. The CUDA/WebGPU GroupQueryAttention kernels only register for MLFloat16/BFloat16, so the fp32 node silently fell back to the CPU EP and the _CUDA test never exercised the CUDA kernel it is named for. Make RunGQAPackedQKVRotaryPrefill feed fp16 tensors when targeting a GPU EP (matching the existing RunGQASharedKVFp16 convention and the test's own fp16 tolerance), so the test runs on the actual CUDA kernel. The CPU path is unchanged. Verified the CUDA fp16 path passes the right-padded prefill.
Member
|
FYI @qjia7 |
hariharans29
approved these changes
Jun 22, 2026
tianleiwu
added a commit
that referenced
this pull request
Jun 23, 2026
### Description The `GroupQueryAttentionTest.BatchedRightPaddedRotaryPrefill_CUDA` test (added in #29002) fed **fp32** inputs via `AddInput<float>`. The CUDA (and WebGPU) GroupQueryAttention kernels only register for `MLFloat16`/`BFloat16`, so the fp32 node silently fell back to the **CPU EP** — the `_CUDA` test never actually exercised the CUDA kernel it is named for. This surfaced as a CI failure on the CUDA test leg after #29002 and #29046 merged. This PR makes `RunGQAPackedQKVRotaryPrefill` feed **fp16** tensors when targeting CUDA EP, matching the existing `RunGQASharedKVFp16` convention and the test's own "loose enough for fp16 rounding" tolerance. The CPU code path is unchanged. ### Key Changes - `RunGQAPackedQKVRotaryPrefill` now branches on the target EP: - CUDA EP: inputs/outputs use `MLFloat16` (converted via `ToFloat16`), so the node is placed on the real GPU kernel. - WebGPU/CPU EP: unchanged (`float`). - Output is converted back to `float` for the existing comparison logic. ### Testing - `onnxruntime_provider_test --gtest_filter='GroupQueryAttentionTest.BatchedRightPaddedRotaryPrefill_CUDA'` → **PASSED** (now runs on the CUDA fp16 kernel). - Full `GroupQueryAttentionTest.*` suite → 47 passed, WebGPU-only tests skipped locally (no WebGPU EP), no regressions. ### Motivation and Context Restores genuine CUDA kernel coverage for the right-padded rotary prefill scenario and fixes the CI failure. Related: #29002, #29046.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
GroupQueryAttentionTest.BatchedRightPaddedRotaryPrefill_CUDAtest (added in #29002) fed fp32 inputs viaAddInput<float>. The CUDA (and WebGPU) GroupQueryAttention kernels only register forMLFloat16/BFloat16, so the fp32 node silently fell back to the CPU EP — the_CUDAtest never actually exercised the CUDA kernel it is named for. This surfaced as a CI failure on the CUDA test leg after #29002 and #29046 merged.This PR makes
RunGQAPackedQKVRotaryPrefillfeed fp16 tensors when targeting CUDA EP, matching the existingRunGQASharedKVFp16convention and the test's own "loose enough for fp16 rounding" tolerance. The CPU code path is unchanged.Key Changes
RunGQAPackedQKVRotaryPrefillnow branches on the target EP:MLFloat16(converted viaToFloat16), so the node is placed on the real GPU kernel.float).floatfor the existing comparison logic.Testing
onnxruntime_provider_test --gtest_filter='GroupQueryAttentionTest.BatchedRightPaddedRotaryPrefill_CUDA'→ PASSED (now runs on the CUDA fp16 kernel).GroupQueryAttentionTest.*suite → 47 passed, WebGPU-only tests skipped locally (no WebGPU EP), no regressions.Motivation and Context
Restores genuine CUDA kernel coverage for the right-padded rotary prefill scenario and fixes the CI failure. Related: #29002, #29046.