Skip to content

Add an aten.erf kernel - #24908

Open
psiddh wants to merge 2 commits into
pytorch:mainfrom
psiddh:export-D129036503
Open

psiddh wants to merge 2 commits into
pytorch:mainfrom
psiddh:export-D129036503

Conversation

@psiddh

@psiddh psiddh commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Summary:
aten.erf had no WebGPU kernel, so models with a hand-written exact GELU (x * 0.5 * (1 + erf(x / sqrt(2)))) split into many delegates around CPU erf nodes.
This adds a one-dispatch erf (rational fit; NaN passes through, +-inf gives +-1) with a resize hook, and the WebGPU partitioner delegates it.
Use case: unmodified Hugging Face ESM-2 and BERT-style models, including dynamic sequence length.

Reviewed By: SS-JIA

Differential Revision: D129036503

…#24907)

Summary:

A 3-D transposed convolution (ConvTranspose1d) was not delegated, so models had to rewrite it as a 4-D conv_transpose2d.
It now runs on the transposed 2-D kernels with H = 1. Transposed convs with dynamic input, or whose direct user is relu/hardtanh, stay on CPU.
This unblocks the upsamplers of streaming audio decoders, e.g. text-to-speech in the browser.
Follow-up (pre-existing): ConvTranspose2d -> BatchNorm2d -> ReLU still fuses into a transposed conv_with_clamp, which fails to load.

Reviewed By: SS-JIA

Differential Revision: D127010336
Summary:
aten.erf had no WebGPU kernel, so models with a hand-written exact GELU (x * 0.5 * (1 + erf(x / sqrt(2)))) split into many delegates around CPU erf nodes.
This adds a one-dispatch erf (rational fit; NaN passes through, +-inf gives +-1) with a resize hook, and the WebGPU partitioner delegates it.
Use case: unmodified Hugging Face ESM-2 and BERT-style models, including dynamic sequence length.

Reviewed By: SS-JIA

Differential Revision: D129036503
Copilot AI balanced review requested due to automatic review settings November 11, 2026 19:34
@pytorch-bot

pytorch-bot Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 1 Unclassified Failure

As of commit 096a944 with merge base 80c14ec (image):

UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:

  • Check Labels / Check labels (gh) (this job did not run on the merge base, so DrCI cannot tell whether the failure is pre-existing)
    ##[error]The operation was canceled.

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 Nov 11, 2026

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@meta-codesync

meta-codesync Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

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

@SS-JIA SS-JIA left a comment

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.

Review automatically exported from Phabricator review in Meta.

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

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

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.

3 participants