Skip to content

[inductor] Fix FlexibleLayout stride reads in flex attention lowerings - #200993

Draft
eellison wants to merge 13 commits into
gh/eellison/1125/basefrom
gh/eellison/1125/head
Draft

eellison wants to merge 13 commits into
gh/eellison/1125/basefrom
gh/eellison/1125/head

Conversation

@eellison

@eellison eellison commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

AI-generated description (unreviewed)

  • Backward scatter emitted indexing from a grad buffer whose strides were not
    final; the grad is now created with exact contiguous strides (so padding
    cannot force a copy either).
  • contiguous_last_dim trusted provisional strides; it now freezes a flexible
    input in place (decide_layout's order, last dim innermost). On main, flex
    attention on CPU with a computed transposed q/k/v is wrong in every element.
  • flex_mps and FlyDSL flex bake strides into kernel source/constants; their
    inputs are frozen first (FlyDSL via the snapshot from the GEMM PR).
  • Hint migrations for output/grad layouts that only follow the input's order.

Test Plan (strict on):

python test/inductor/test_layout_freezing.py  # computed-transpose tests fail on main
python test/inductor/test_flex_attention.py
python test/inductor/test_flex_decoding.py

Authored with Claude Code.

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ No Failures

As of commit b1ec169 with merge base 4a03eed (image):
💚 Looks good so far! There are no failures yet. 💚

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

@pytorch-bot

pytorch-bot Bot commented Oct 14, 2026

Copy link
Copy Markdown

This PR needs a release notes: label

If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

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

[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@eellison
eellison requested a review from drisspg December 2, 2026 10:02

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant