Skip to content

[CP][BE] Cosmetic refactors for CP code base#163115

Closed
fegin wants to merge 2 commits intogh/fegin/319/basefrom
gh/fegin/319/head
Closed

[CP][BE] Cosmetic refactors for CP code base#163115
fegin wants to merge 2 commits intogh/fegin/319/basefrom
gh/fegin/319/head

Conversation

@fegin
Copy link
Contributor

@fegin fegin commented Sep 16, 2025

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Sep 16, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit 15134ea with merge base 7a0f933 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@vadimkantorov
Copy link
Contributor

vadimkantorov commented Sep 16, 2025

Curious for CP, could also explicit variants / args be added to F.sdpa (e.g. a new backend and a new dict arg backend_hints = {} which could allow passing in any options for CP)? or a new explicit function be introduced? I think in some educational contexts it's better to also have an explicit way of invoking these distributed SDPA directly...

[ghstack-poisoned]
@fegin fegin added the ciflow/trunk Trigger trunk jobs on your pull request label Sep 19, 2025
@fegin
Copy link
Contributor Author

fegin commented Sep 19, 2025

Curious for CP, could also explicit variants / args be added to F.sdpa (e.g. a new backend and a new dict arg backend_hints = {} which could allow passing in any options for CP)? or a new explicit function be introduced? I think in some educational contexts it's better to also have an explicit way of invoking these distributed SDPA directly...

CP currently only supports what F.sdpa and FlexAttention, we basically just forward the arguments to the underlying SDPA or FlexAttention. Also there is a backend selection API for SDPA. Can you describe more your requirement if I misunderstood your request? @vadimkantorov

@fegin
Copy link
Contributor Author

fegin commented Sep 19, 2025

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@vadimkantorov
Copy link
Contributor

vadimkantorov commented Sep 19, 2025

Can you describe more your requirement if I misunderstood your request?

Well, I was proposing to add an explicit way of invoking CP-SDPA via F.sdpa(..., backend="cp", backend_hints = {...cp_params}) (related in spirit to #137574) or via F.cp_attention(...) (akin to flex_attention) - e.g. so that there is also a way of explicitly invoking CP-SDPA without context manager.

pytorchmergebot pushed a commit that referenced this pull request Sep 19, 2025
pytorchmergebot pushed a commit that referenced this pull request Sep 20, 2025
We should only unsqueeze if necessary.

Fix #162743

Pull Request resolved: #163231
Approved by: https://github.com/eqy
ghstack dependencies: #162539, #162540, #162541, #163115, #163131
mansiag05 pushed a commit to mansiag05/pytorch that referenced this pull request Sep 22, 2025
Summary:
This PR is extracted from pytorch#162542, to make the original PR
easier to review. This PR only contains cosmetic changes.

Pull Request resolved: pytorch#163115
Approved by: https://github.com/tianyu-l
ghstack dependencies: pytorch#162539, pytorch#162540, pytorch#162541
mansiag05 pushed a commit to mansiag05/pytorch that referenced this pull request Sep 22, 2025
mansiag05 pushed a commit to mansiag05/pytorch that referenced this pull request Sep 22, 2025
cleonard530 pushed a commit to cleonard530/pytorch that referenced this pull request Sep 22, 2025
Summary:
This PR is extracted from pytorch#162542, to make the original PR
easier to review. This PR only contains cosmetic changes.

Pull Request resolved: pytorch#163115
Approved by: https://github.com/tianyu-l
ghstack dependencies: pytorch#162539, pytorch#162540, pytorch#162541
cleonard530 pushed a commit to cleonard530/pytorch that referenced this pull request Sep 22, 2025
cleonard530 pushed a commit to cleonard530/pytorch that referenced this pull request Sep 22, 2025
dsashidh pushed a commit to dsashidh/pytorch that referenced this pull request Sep 26, 2025
Summary:
This PR is extracted from pytorch#162542, to make the original PR
easier to review. This PR only contains cosmetic changes.

Pull Request resolved: pytorch#163115
Approved by: https://github.com/tianyu-l
ghstack dependencies: pytorch#162539, pytorch#162540, pytorch#162541
dsashidh pushed a commit to dsashidh/pytorch that referenced this pull request Sep 26, 2025
dsashidh pushed a commit to dsashidh/pytorch that referenced this pull request Sep 26, 2025
@github-actions github-actions bot deleted the gh/fegin/319/head branch October 20, 2025 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/inductor ciflow/trunk Trigger trunk jobs on your pull request Merged oncall: distributed Add this issue/PR to distributed oncall triage queue topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants