Skip to content

remove is_causal flag - #172245

Closed
liangel-02 wants to merge 11 commits into
gh/liangel-02/5/basefrom
gh/liangel-02/5/head
Closed

liangel-02 wants to merge 11 commits into
gh/liangel-02/5/basefrom
gh/liangel-02/5/head

Conversation

@liangel-02

@liangel-02 liangel-02 commented Jan 12, 2026 •

Copy link
Copy Markdown
Contributor

the is_causal flag is now deprecated in varlen_attn. to express causal attention, use window_size = (-1, 0)

Stack from ghstack (oldest at bottom):

cc @albanD @mruberry @jbschlosser @walterddr @mikaylagawarecki

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Jan 12, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ No Failures

As of commit 8a32c4d with merge base fb5eb91 (image):
💚 Looks good so far! There are no failures yet. 💚

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

liangel-02 added a commit that referenced this pull request Jan 12, 2026
ghstack-source-id: 3feeb89
Pull Request resolved: #172245
liangel-02 added a commit that referenced this pull request Jan 12, 2026
ghstack-source-id: a654f81
Pull Request resolved: #172245
@liangel-02 liangel-02 added the module: nn Related to torch.nn label Jan 12, 2026
@liangel-02
liangel-02 requested a review from drisspg January 12, 2026 18:20
deprecating `is_causal` flag since this can be expressed with `window_size = (-1, 0)`

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):

* __->__ #172245
* #172238



[ghstack-poisoned]
liangel-02 added a commit that referenced this pull request Jan 12, 2026
deprecating `is_causal` flag since this can be expressed with `window_size = (-1, 0)`

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):

* __->__ #172245
* #172238



[ghstack-poisoned]
liangel-02 added a commit that referenced this pull request Jan 12, 2026
ghstack-source-id: 345e1e8
Pull Request resolved: #172245
@liangel-02 liangel-02 added suppress-bc-linter Suppresses the failures of API backward-compatibility linter (Lint/bc_linter) release notes: nn release notes category and removed module: nn Related to torch.nn labels Jan 12, 2026
@mikaylagawarecki
mikaylagawarecki removed their request for review January 12, 2026 21:38
Comment thread test/test_varlen_attention.py Outdated
batch_size, self.num_heads, seq_len, seq_len
)

is_causal = window_size[1] == 0

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.

it shoudl probably window right = 0 and left == -1? right

Comment thread test/test_varlen_attention.py Outdated
@parametrize("scale", [None, 0.1])
@parametrize("window_size", [(-1, 4)])
def test_varlen_vs_sdpa(self, device, dtype, is_causal, scale, window_size):
@parametrize("window_size", [(-1, -1), (-1, 0), (-1, 4)])

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.

or more common window size is some look back so (4, 0)

@mikaylagawarecki

Copy link
Copy Markdown
Contributor

@liangel-02 to make 2.11 release notes a bit easier could you mark this topic: bc breaking and update the PR desc per the guidelines in https://docs.google.com/document/d/14OmgGBr1w6gl1VO47GGGdwrIaUNr92DFhQbY_NEk8mQ/edit?tab=t.0#heading=h.xh2g8i1hef88 please

deprecating `is_causal` flag in `varlen_attn` since this can be expressed with `window_size = (-1, 0)`

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):

* __->__ #172245
* #172238



cc albanD mruberry jbschlosser walterddr mikaylagawarecki

[ghstack-poisoned]
liangel-02 added a commit that referenced this pull request Jan 13, 2026
deprecating `is_causal` flag in `varlen_attn` since this can be expressed with `window_size = (-1, 0)`

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):

* __->__ #172245
* #172238



cc albanD mruberry jbschlosser walterddr mikaylagawarecki

[ghstack-poisoned]
liangel-02 added a commit that referenced this pull request Jan 13, 2026
ghstack-source-id: 46b0a46
Pull Request resolved: #172245
@liangel-02 liangel-02 added topic: bc breaking topic category and removed suppress-bc-linter Suppresses the failures of API backward-compatibility linter (Lint/bc_linter) labels Jan 13, 2026
the `is_causal` flag is now deprecated in `varlen_attn`. to express causal attention, use `window_size = (-1, 0)`

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):

* __->__ #172245
* #172238



cc albanD mruberry jbschlosser walterddr mikaylagawarecki

[ghstack-poisoned]
liangel-02 added a commit that referenced this pull request Jan 14, 2026
ghstack-source-id: f704221
Pull Request resolved: #172245
liangel-02 added a commit that referenced this pull request Jan 14, 2026
the `is_causal` flag is now deprecated in `varlen_attn`. to express causal attention, use `window_size = (-1, 0)`

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):

* __->__ #172245
* #172238



cc albanD mruberry jbschlosser walterddr mikaylagawarecki

[ghstack-poisoned]
@liangel-02
liangel-02 requested a review from drisspg January 14, 2026 20:23
liangel-02 added a commit that referenced this pull request Jan 15, 2026
ghstack-source-id: c740a43
Pull Request resolved: #172245
@liangel-02

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jan 15, 2026
@pytorchmergebot

Copy link
Copy Markdown
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

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

the `is_causal` flag is now deprecated in `varlen_attn`. to express causal attention, use `window_size = (-1, 0)`

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):

* __->__ #172245
* #172238



cc albanD mruberry jbschlosser walterddr mikaylagawarecki

[ghstack-poisoned]
liangel-02 added a commit that referenced this pull request Jan 15, 2026
the `is_causal` flag is now deprecated in `varlen_attn`. to express causal attention, use `window_size = (-1, 0)`

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):

* __->__ #172245
* #172238



cc albanD mruberry jbschlosser walterddr mikaylagawarecki

[ghstack-poisoned]
liangel-02 added a commit that referenced this pull request Jan 15, 2026
ghstack-source-id: c915fb8
Pull Request resolved: #172245
the `is_causal` flag is now deprecated in `varlen_attn`. to express causal attention, use `window_size = (-1, 0)`

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):

* __->__ #172245
* #172238



cc albanD mruberry jbschlosser walterddr mikaylagawarecki

[ghstack-poisoned]
liangel-02 added a commit that referenced this pull request Jan 20, 2026
ghstack-source-id: 244f420
Pull Request resolved: #172245
liangel-02 added a commit that referenced this pull request Jan 20, 2026
the `is_causal` flag is now deprecated in `varlen_attn`. to express causal attention, use `window_size = (-1, 0)`

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):

* __->__ #172245
* #172238



cc albanD mruberry jbschlosser walterddr mikaylagawarecki

[ghstack-poisoned]
the `is_causal` flag is now deprecated in `varlen_attn`. to express causal attention, use `window_size = (-1, 0)`

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):

* __->__ #172245
* #172238



cc albanD mruberry jbschlosser walterddr mikaylagawarecki

[ghstack-poisoned]
liangel-02 added a commit that referenced this pull request Jan 21, 2026
the `is_causal` flag is now deprecated in `varlen_attn`. to express causal attention, use `window_size = (-1, 0)`

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):

* __->__ #172245
* #172238



cc albanD mruberry jbschlosser walterddr mikaylagawarecki

[ghstack-poisoned]
liangel-02 added a commit that referenced this pull request Jan 21, 2026
ghstack-source-id: 3b12215
Pull Request resolved: #172245
@liangel-02

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
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

tianyu-l pushed a commit to pytorch/torchtitan that referenced this pull request Jan 23, 2026
`is_causal` flag has been deprecated in `varlen_attn`, use `window_size
= [-1, 0]` instead, see [this
PR](pytorch/pytorch#172245)

*Test*
<img width="1225" height="496" alt="Screenshot 2026-01-21 at 11 55
59 AM"
src="https://github.com/user-attachments/assets/125c56af-76ed-4f6f-a433-da4d9a631dab"
/>
xrsrke pushed a commit to NousResearch/torchtitan that referenced this pull request Feb 13, 2026
`is_causal` flag has been deprecated in `varlen_attn`, use `window_size
= [-1, 0]` instead, see [this
PR](pytorch/pytorch#172245)

*Test*
<img width="1225" height="496" alt="Screenshot 2026-01-21 at 11 55
59 AM"
src="https://github.com/user-attachments/assets/125c56af-76ed-4f6f-a433-da4d9a631dab"
/>
@github-actions
github-actions Bot deleted the gh/liangel-02/5/head branch February 21, 2026 02:21
TXacs pushed a commit to McmillanTAC/torchtitan that referenced this pull request Apr 13, 2026
`is_causal` flag has been deprecated in `varlen_attn`, use `window_size
= [-1, 0]` instead, see [this
PR](pytorch/pytorch#172245)

*Test*
<img width="1225" height="496" alt="Screenshot 2026-01-21 at 11 55
59 AM"
src="https://github.com/user-attachments/assets/125c56af-76ed-4f6f-a433-da4d9a631dab"
/>
ACharacterInASimulation pushed a commit to ACharacterInASimulation/torchtitan that referenced this pull request Apr 21, 2026
`is_causal` flag has been deprecated in `varlen_attn`, use `window_size
= [-1, 0]` instead, see [this
PR](pytorch/pytorch#172245)

*Test*
<img width="1225" height="496" alt="Screenshot 2026-01-21 at 11 55
59 AM"
src="https://github.com/user-attachments/assets/125c56af-76ed-4f6f-a433-da4d9a631dab"
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged release notes: nn release notes category suppress-bc-linter Suppresses the failures of API backward-compatibility linter (Lint/bc_linter) topic: bc breaking topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants