Skip to content

[ET-VK][sdpa] Add SDPA operator perf benchmark binary (test_sdpa)#21062

Merged
meta-codesync[bot] merged 2 commits into
gh/SS-JIA/575/basefrom
gh/SS-JIA/575/head
Jul 22, 2026
Merged

[ET-VK][sdpa] Add SDPA operator perf benchmark binary (test_sdpa)#21062
meta-codesync[bot] merged 2 commits into
gh/SS-JIA/575/basefrom
gh/SS-JIA/575/head

Conversation

@SS-JIA

@SS-JIA SS-JIA commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Adds a standalone custom-ops perf binary that builds a ComputeGraph containing only the SDPA op (llama.custom_sdpa, the causal LLM KV-cache decode/prefill path) and reports per-dispatch GPU timing for the three SDPA dispatches (QK GEMM, softmax, AV GEMM) in isolation, so shader variants can be A/B-benchmarked without a full model. TestSDPA.cpp registers a test_etvk.test_sdpa op wrapper that synthesizes input_pos from the tensor shapes and drives llama.custom_sdpa. Two env toggles: SDPA_DECODE_ONLY=1 restricts the sweep to the decode (S==1) shape matrix, and SDPA_NO_CHAIN=1 sets op_invocations_per_execute=1 to remove inter-invocation pipelining from the timing. Follows the existing test/custom_ops/ pattern (e.g. test_mm) and is registered via define_custom_op_test_binary in targets.bzl.

Differential Revision: D112906312

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21062

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

⏳ No Failures, 2 Pending

As of commit 7aa5888 with merge base 37400d9 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 21, 2026
@github-actions

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@digantdesai digantdesai 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.

Review automatically exported from Phabricator review in Meta.

[ghstack-poisoned]
@meta-codesync
meta-codesync Bot merged commit 400c19e into gh/SS-JIA/575/base Jul 22, 2026
187 of 189 checks passed
@meta-codesync
meta-codesync Bot deleted the gh/SS-JIA/575/head branch July 22, 2026 02:34
@meta-codesync
meta-codesync Bot temporarily deployed to cherry-pick-bot July 22, 2026 02:34 Inactive
SS-JIA added a commit that referenced this pull request Jul 22, 2026
Pull Request resolved: #21062

Adds a standalone custom-ops perf binary that builds a ComputeGraph containing only the SDPA op (`llama.custom_sdpa`, the causal LLM KV-cache decode/prefill path) and reports per-dispatch GPU timing for the three SDPA dispatches (QK GEMM, softmax, AV GEMM) in isolation, so shader variants can be A/B-benchmarked without a full model. `TestSDPA.cpp` registers a `test_etvk.test_sdpa` op wrapper that synthesizes `input_pos` from the tensor shapes and drives `llama.custom_sdpa`. Two env toggles: `SDPA_DECODE_ONLY=1` restricts the sweep to the decode (S==1) shape matrix, and `SDPA_NO_CHAIN=1` sets `op_invocations_per_execute=1` to remove inter-invocation pipelining from the timing. Follows the existing `test/custom_ops/` pattern (e.g. `test_mm`) and is registered via `define_custom_op_test_binary` in `targets.bzl`.
ghstack-source-id: 405400496
@exported-using-ghexport

Differential Revision: [D112906312](https://our.internmc.facebook.com/intern/diff/D112906312/)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants