Skip to content

[executorch][cuda] Optimize short-query INT5 matvec kernels - #21458

Open
Gasoonjia wants to merge 1 commit into
gh/gasoonjia/177/basefrom
gh/gasoonjia/177/head
Open

[executorch][cuda] Optimize short-query INT5 matvec kernels#21458
Gasoonjia wants to merge 1 commit into
gh/gasoonjia/177/basefrom
gh/gasoonjia/177/head

Conversation

@Gasoonjia

@Gasoonjia Gasoonjia commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Add specialized M=1 and M=4 short-query paths for the planar INT5 W5A8 matvec operator. These are the latency-sensitive single-row and four-row shapes. M=2/M=3 retain the generic fallback path; this change does not claim those shapes as optimized.

The M=1 implementation shares safe gs32 decode/accumulate logic through a compile-time ROWS device template. M=4 remains explicit because KernelAgent experiments with the generalized template increased register pressure and regressed latency. The final kernels were generated and tuned with KernelAgent.

A100 kernel microbenchmarks versus the previous generic path:

  • M1: 1.09971 -> 0.70441 ms (1.56x; no regression)
  • M4: 1.96445 -> 1.12976 ms (1.74x)
  • M2/M3: no specialized dispatch; generic fallback remains unchanged

Correctness tests cover M=1,2,3,4 with three randomized seeds; ptxas reports zero spills.

Differential Revision: D114032323

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 2 New Failures, 2 Unclassified Failures

As of commit 0d04c58 with merge base e47f373 (image):

NEW FAILURES - The following jobs have failed:

UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:

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 29, 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.

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant