Skip to content

[cp] dispatch flex_attention_backward to CP impl in TorchDispatchMode #152311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: gh/XilunWu/139/base
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update on "[cp] dispatch flex_attention_backward to CP impl in TorchD…
…ispatchMode"

cc H-Huang awgu wanchaol fegin fduwjj wz337 wconstab d4l3k

[ghstack-poisoned]
  • Loading branch information
XilunWu committed Apr 30, 2025
commit 38d5e2dfd57da61bcc5b6ac9ceabc3e46cfb61bc
1 change: 0 additions & 1 deletion test/distributed/tensor/test_attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,6 @@ def world_size(self) -> int:
def test_ring_flex_attention(self) -> None:
def causal_mask(b, h, q_idx, kv_idx):
return q_idx >= kv_idx
# return q_idx >= 0

from torch.nn.attention.flex_attention import create_block_mask, flex_attention

Expand Down
7 changes: 6 additions & 1 deletion torch/distributed/tensor/experimental/_attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -1509,9 +1509,14 @@ def context_parallel(
):
yield

return
for buffer, original_buffer in zip(buffers, original_buffers):
if original_buffer is not None:
# tensor cannot resize if requires_grad is True
# key and value's requires_grad has been set to False in manual comm calls
# unless via DTensor.
if buffer.requires_grad:
buffer.requires_grad = False

buffer.resize_(original_buffer.shape)
buffer.copy_(original_buffer)

Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy