XNNPACK: Preserve FP16 SiLU through XNNPACK partitioning - #22604
Merged
Conversation
PyTorch's default decomposition can lower FP16 aten.silu to a float32 sigmoid and multiply surrounded by dtype copies. For SiLU-heavy models, this fragments XNNPACK delegation and adds portable conversion overhead. Add an XNNPACK partitioner configuration that preserves aten.silu only for FP16 inputs and outputs in to_edge_transform_and_lower(). During delegate preprocessing, rewrite the preserved Edge SiLU as x * sigmoid(x), keeping computation in FP16. FP32 SiLU continues through the default decomposition. Add an XNNPACK transform pass that recognizes this decomposition and rewrites it as x * sigmoid(x) in FP16 before partitioning. Restrict the rewrite to the exact FP16-to-FP32 pattern and support both Edge copy forms. In an Yolo26 BundleIO benchmark, mean latency fell from about 15.6 ms to about 8.8 ms. This is approximately 7 ms faster, a 45% reduction and a 1.8x speedup. Delegated subgraphs fell from 143 to 19 and non-delegated nodes from 425 to 86, while delegated nodes remained at 363. All runs passed BundleIO. Signed-off-by: Måns Nilsson <mans.nilsson@arm.com> Change-Id: I4594acd4ed57e9a2b882a98c88a906eb989bb821
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/22604
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 29ad31a with merge base c9eee94 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
rjm-git
approved these changes
Sep 8, 2026
JakeStevens
approved these changes
Sep 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PyTorch's default decomposition can lower FP16 aten.silu to a float32 sigmoid and multiply surrounded by dtype copies. For SiLU-heavy models, this fragments XNNPACK delegation and adds portable conversion overhead.
Add an XNNPACK partitioner configuration that preserves aten.silu only for FP16 inputs and outputs in to_edge_transform_and_lower(). During delegate preprocessing, rewrite the preserved Edge SiLU as x * sigmoid(x), keeping computation in FP16. FP32 SiLU continues through the default decomposition.
Add an XNNPACK transform pass that recognizes this decomposition and rewrites it as x * sigmoid(x) in FP16 before partitioning. Restrict the rewrite to the exact FP16-to-FP32 pattern and support both Edge copy forms.
In an Yolo26 BundleIO benchmark, mean latency fell from about 15.6 ms to about 8.8 ms. This is approximately 7 ms faster, a 45% reduction and a 1.8x speedup.
Delegated subgraphs fell from 143 to 19 and non-delegated nodes from 425 to 86, while delegated nodes remained at 363. All runs passed BundleIO.
cc @GregoryComer @digantdesai @cbilgin @JakeStevens @freddan80 @per @zingo @oscarandersson8218 @Sebastian-Larsson @robell @rascani