[ExecuTorch][WebGPU] Add sigmoid op (aten.sigmoid.default)#20390
[ExecuTorch][WebGPU] Add sigmoid op (aten.sigmoid.default)#20390JulianCloudNTH wants to merge 6 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20390
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
|
@claude review |
|
Claude finished @JulianCloudNTH's task in 2m 3s —— View job Code Review: WebGPU sigmoid op
Clean, well-scoped op that faithfully mirrors the Main issue — op won't actually be delegated / no test
If a follow-up PR in the ghstack adds the partitioner allowlist entry + test, this is fine — please confirm. Otherwise this op is dead code in this PR. Note also the allowlist gates the Vulkan partitioner (WebGPU consumes the VK00 serialization), so delegation also depends on the Vulkan partitioner lowering Add sigmoid test + allowlist entry → Minor
Nits
No correctness or memory-management bugs found. The one thing to resolve before merge is whether the partitioner allowlist + test land here or later in the stack. |
Stack from ghstack (oldest at bottom):
Adds
aten.sigmoid.defaultto the WebGPU delegate: element-wise1/(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) + aParams{num_elements}uniform, 1D-dispatches overnum_elementswithoverride wg_size(clamped to the device limit); mirrors theaddop (uniform mapped-at-creation, released after the bind group).sigmoid/sigmoid.wgsl— guardsidx >= num_elementsand writes the logistic of each element.@exported-using-ghexport
Differential Revision: D108793157
Differential Revision: D108793157