Skip to content

Improve PagedAttention dispatch diagnostics - #32099

Open
Baiju Meswani (baijumeswani) wants to merge 2 commits into
mainfrom
baijumeswani/paged-attention-telemetry
Open

Improve PagedAttention dispatch diagnostics#32099
Baiju Meswani (baijumeswani) wants to merge 2 commits into
mainfrom
baijumeswani/paged-attention-telemetry

Conversation

@baijumeswani

@baijumeswani Baiju Meswani (baijumeswani) commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Extend the existing CUDA attention debug output with PagedAttention-specific dispatch details.

When ORT_ENABLE_ATTENTION_KERNEL_DEBUG_INFO=1, PagedAttention now reports:

  • the selected backend, including XQA versus portable paged decode;
  • the number of decode splits;
  • the GQA group size;
  • the effective KV-length bound after applying the local window;

This makes it easier to verify that an intended optimized path is selected instead of silently falling back. The diagnostics are opt-in and do not change kernel selection or execution when disabled.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends ONNX Runtime’s CUDA attention kernel diagnostics for the PagedAttention contrib op, adding more dispatch-selection details to the opt-in debug output controlled by ORT_ENABLE_ATTENTION_KERNEL_DEBUG_INFO=1.

Changes:

  • Add PagedAttention-specific debug fields (decode split count, GQA group size, and effective KV-length bound) to AttentionKernelDebugInfo and its Print() output.
  • Populate the new debug fields from PagedAttention::ComputeInternal() during backend selection.
  • Add a CUDA unit test that captures stdout and asserts the presence of the new debug markers.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
onnxruntime/test/contrib_ops/paged_attention_op_test.cc Adds a CUDA test that captures attention debug output and checks for expected PagedAttention dispatch diagnostics.
onnxruntime/contrib_ops/cuda/bert/paged_attention.cc Populates new debug-info fields for PagedAttention dispatch (including splits/GQA group size/effective KV bound).
onnxruntime/contrib_ops/cuda/bert/attention_kernel_options.h Extends AttentionKernelDebugInfo with optional fields for additional dispatch diagnostics.
onnxruntime/contrib_ops/cuda/bert/attention_kernel_options.cc Prints the new optional debug fields when present.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread onnxruntime/contrib_ops/cuda/bert/paged_attention.cc

@tianleiwu Tianlei Wu (tianleiwu) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The decode-path fields follow the final fallback state and remain behind the opt-in debug flag. One supported backend is still misclassified; see the inline comment.

Comment thread onnxruntime/contrib_ops/cuda/bert/paged_attention.cc
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.

3 participants