Skip to content

Add parallel chunked prefill for channelwise gated delta rule (#21061)#21061

Merged
JakeStevens merged 3 commits into
pytorch:mainfrom
JakeStevens:export-D112597348
Jul 23, 2026
Merged

Add parallel chunked prefill for channelwise gated delta rule (#21061)#21061
JakeStevens merged 3 commits into
pytorch:mainfrom
JakeStevens:export-D112597348

Conversation

@JakeStevens

@JakeStevens JakeStevens commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary:

Route the channelwise gated delta rule by sequence length: T == 1 keeps the two-pass token recurrence for autoregressive decode, while T != 1 uses a chunkwise WY/UT formulation for prefill.

The chunked path computes per-channel log-decay prefixes, causal query/key terms, the beta-folded triangular transform, WY pseudo-keys and pseudo-values, and inter-chunk state carry. It handles a ragged final chunk without a separate tail implementation.

Parallelize independent (batch, head) work across the ExecuTorch threadpool. Each worker receives a disjoint slice of one temporary scratch arena, avoiding shared mutable buffers while amortizing allocation across chunks.

Reviewed By: billmguo

Differential Revision: D112597348

@pytorch-bot

pytorch-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ No Failures

As of commit 1b7ba84 with merge base 179c4ee (image):
💚 Looks good so far! There are no failures yet. 💚

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 21, 2026
@meta-codesync

meta-codesync Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

@JakeStevens has exported this pull request. If you are a Meta employee, you can view the originating Diff in D112597348.

@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.

@meta-codesync meta-codesync Bot changed the title Add parallel chunked prefill for channelwise gated delta rule Add parallel chunked prefill for channelwise gated delta rule (#21061) Jul 21, 2026
JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Jul 21, 2026
…h#21061)

Summary:

Route the channelwise gated delta rule by sequence length: T == 1 keeps the two-pass token recurrence for autoregressive decode, while T != 1 uses a chunkwise WY/UT formulation for prefill.

The chunked path computes per-channel log-decay prefixes, causal query/key terms, the beta-folded triangular transform, WY pseudo-keys and pseudo-values, and inter-chunk state carry. It handles a ragged final chunk without a separate tail implementation.

Parallelize independent (batch, head) work across the ExecuTorch threadpool. Each worker receives a disjoint slice of one temporary scratch arena, avoiding shared mutable buffers while amortizing allocation across chunks.

Reviewed By: billmguo

Differential Revision: D112597348
JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Jul 21, 2026
…h#21061)

Summary:

Route the channelwise gated delta rule by sequence length: T == 1 keeps the two-pass token recurrence for autoregressive decode, while T != 1 uses a chunkwise WY/UT formulation for prefill.

The chunked path computes per-channel log-decay prefixes, causal query/key terms, the beta-folded triangular transform, WY pseudo-keys and pseudo-values, and inter-chunk state carry. It handles a ragged final chunk without a separate tail implementation.

Parallelize independent (batch, head) work across the ExecuTorch threadpool. Each worker receives a disjoint slice of one temporary scratch arena, avoiding shared mutable buffers while amortizing allocation across chunks.

Reviewed By: billmguo

Differential Revision: D112597348
…BUCK (pytorch#21105)

Summary:

Relands the two-pass optimization for the `channelwise_gated_delta_rule` custom op (originally pytorch#21020, D112596724), which was reverted in D113048961 because it broke OSS `unittest macos / linux`.

The revert was caused by the benchmark BUCK target:
```
runtime.python_binary(name = ..., srcs = [...], main_module = ...)
```


Fix: move the source into a `runtime.python_library` and have the `runtime.python_binary` reference it via `deps` with only `main_module`

Differential Revision: D113076546
…h#21061)

Summary:

Route the channelwise gated delta rule by sequence length: T == 1 keeps the two-pass token recurrence for autoregressive decode, while T != 1 uses a chunkwise WY/UT formulation for prefill.

The chunked path computes per-channel log-decay prefixes, causal query/key terms, the beta-folded triangular transform, WY pseudo-keys and pseudo-values, and inter-chunk state carry. It handles a ragged final chunk without a separate tail implementation.

Parallelize independent (batch, head) work across the ExecuTorch threadpool. Each worker receives a disjoint slice of one temporary scratch arena, avoiding shared mutable buffers while amortizing allocation across chunks.

Reviewed By: billmguo

Differential Revision: D112597348
JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Jul 22, 2026
…h#21061)

Summary:

Route the channelwise gated delta rule by sequence length: T == 1 keeps the two-pass token recurrence for autoregressive decode, while T != 1 uses a chunkwise WY/UT formulation for prefill.

The chunked path computes per-channel log-decay prefixes, causal query/key terms, the beta-folded triangular transform, WY pseudo-keys and pseudo-values, and inter-chunk state carry. It handles a ragged final chunk without a separate tail implementation.

Parallelize independent (batch, head) work across the ExecuTorch threadpool. Each worker receives a disjoint slice of one temporary scratch arena, avoiding shared mutable buffers while amortizing allocation across chunks.

Reviewed By: billmguo

Differential Revision: D112597348
@JakeStevens
JakeStevens merged commit 8134bb2 into pytorch:main Jul 23, 2026
183 checks passed
@JakeStevens
JakeStevens deleted the export-D112597348 branch July 23, 2026 20:08
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. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants