Skip to content

[ExecuTorch][WebGPU] Add sigmoid op (aten.sigmoid.default)#20540

Merged
JulianCloudNTH merged 4 commits into
gh/JulianCloudNTH/38/origfrom
gh/JulianCloudNTH/39/orig
Jun 26, 2026
Merged

[ExecuTorch][WebGPU] Add sigmoid op (aten.sigmoid.default)#20540
JulianCloudNTH merged 4 commits into
gh/JulianCloudNTH/38/origfrom
gh/JulianCloudNTH/39/orig

Conversation

@pytorchbot

Copy link
Copy Markdown
Collaborator

This PR was created by the merge bot to help merge the original PR into the main branch.
ghstack PR number: #20390 by @JulianCloudNTH
^ Please use this as the source of truth for the PR details, comments, and reviews
ghstack PR base: https://github.com/pytorch/executorch/tree/gh/JulianCloudNTH/39/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/JulianCloudNTH/39/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/gh/JulianCloudNTH/38/orig
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/JulianCloudNTH/39/orig

@diff-train-skip-merge

Pull Request resolved: #20390

Adds `aten.sigmoid.default` to the WebGPU delegate: element-wise `1/(1+exp(-x))` over a flat fp32 buffer. On the Llama critical path (`F.silu` -> `sigmoid` + `mul`).

Composition (single dispatch):
- `sigmoid/UnaryOp.cpp` — binds input (storage, read-only) + output (storage) + a `Params{num_elements}` uniform, 1D-dispatches over `num_elements` with `override wg_size` (clamped to the device limit); mirrors the `add` op (uniform mapped-at-creation, released after the bind group).
- `sigmoid/sigmoid.wgsl` — guards `idx >= num_elements` and writes the logistic of each element.
ghstack-source-id: 397026515
@exported-using-ghexport

Differential Revision: [D108793157](https://our.internmc.facebook.com/intern/diff/D108793157/)
@pytorch-bot

pytorch-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

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 Jun 26, 2026
Pull Request resolved: #20391

Registers `aten.sigmoid.default` in the `cases.py` op-test framework: a `_sigmoid_suite` (hard-coded shapes + a saturation case over a `linspace(-12, 12)` input) that `generate_op_tests` exports and compares to an fp64 torch golden on Dawn. Also adds `test/ops/sigmoid/test_sigmoid.py` (`SigmoidModule` + `N` + `_det_input` + an export-delegation/eager smoke test) and the `aten.sigmoid.default` partitioner-allowlist entry in `tester.py`.
ghstack-source-id: 397026520
@exported-using-ghexport

Differential Revision: [D108793159](https://our.internmc.facebook.com/intern/diff/D108793159/)
Pull Request resolved: #20392

Adds `aten.squeeze_copy.dims` and `aten.unsqueeze_copy.default` to the WebGPU delegate. Both are numel-preserving shape ops; on a dense row-major buffer backend they are the same flat copy as `view_copy` — only the shape metadata differs (mirrors the Vulkan delegate, which routes both through `add_view_copy_node`).

Composition (no new kernel):
- `squeeze/Squeeze.cpp` — reads `args = [self, dims, out]`, ignores the AOT-fixed `dims`, calls `add_flat_copy(graph, in, out)` from `runtime/ops/view_copy/view_copy.h`.
- `unsqueeze/Unsqueeze.cpp` — reads `args = [self, dim, out]`, ignores the AOT-fixed `dim`, calls `add_flat_copy(graph, in, out)`.
ghstack-source-id: 397026523
@exported-using-ghexport

Differential Revision: [D108793153](https://our.internmc.facebook.com/intern/diff/D108793153/)
….py op-test framework)

Pull Request resolved: #20393

Registers `aten.squeeze_copy.dims` and `aten.unsqueeze_copy.default` in the `cases.py` op-test framework: a `_squeeze_suite` of 3 configs (squeeze leading/middle/multiple size-1 dims) and a `_unsqueeze_suite` of 3 configs (insert dim at front/middle/last) that `generate_op_tests` exports via `VulkanPartitioner` and compares to a torch golden on Dawn. Also adds `test/ops/squeeze/test_squeeze.py` (`SqueezeModule` + `CONFIGS` + `_op_delegated` smoke test), `test/ops/unsqueeze/test_unsqueeze.py` (`UnsqueezeModule` + `CONFIGS` + `_op_delegated` smoke test), and the two partitioner-allowlist entries in `tester.py`.
ghstack-source-id: 397026525
@exported-using-ghexport

Differential Revision: [D108793152](https://our.internmc.facebook.com/intern/diff/D108793152/)
@JulianCloudNTH JulianCloudNTH merged commit 4af7bb5 into gh/JulianCloudNTH/38/orig Jun 26, 2026
12 of 13 checks passed
@JulianCloudNTH JulianCloudNTH deleted the gh/JulianCloudNTH/39/orig branch June 26, 2026 15:34
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants