Commit ae07d06
authored
[ET-VK] Only partition copy.default to Vulkan when it is a no-op (#18576)
Summary: Previously, copy.default was unconditionally added to the
Vulkan partition as
an ephemeral op (assumed to always be a no-op removed by
RemoveRedundantOpsTransform). However, copy.default can also represent a
dtype
cast, and blindly partitioning casts to Vulkan causes runtime failures
since
the Vulkan backend has no copy implementation.
Replace the unconditional registration with a custom
are_node_inputs_supported_fn that checks both dtype and shape match
between
src and dst. Only same-dtype, same-shape copies (true no-ops) are
partitioned
to Vulkan; dtype casts remain on CPU.
Authored with Claude.
Test Plan: Exported EfficientNet for Vulkan, which contains copy.default
for dtype casts,
and confirmed it no longer errors during Vulkan compilation. No-op
copies in
other models (e.g. MobileNetV3) still partition correctly.
Reviewers:
Subscribers:
Tasks:
Tags:
---
[ET-VK] Prevent hardswish decomposition by adding to ops_not_to_decompose
Summary: Without this change, aten.hardswish.default decomposes into several
arithmetic ops (add, clamp, mul, div) which prevents the Vulkan conv2d
depthwise fusion pass from recognizing and fusing the activation. Adding
hardswish to ops_not_to_decompose keeps it as a single op so the conv2d
output tile shader can apply the clamp fusion.
Also adds the conv2d_dw_output_tile_3x3_b1x1_clamp shader variant needed
for the fused path.
Authored with Claude.
Test Plan: Exported MobileNetV3 for Vulkan and verified hardswish no longer decomposes.
Reviewers:
Subscribers:
Tasks:
Tags:
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with
[ReviewStack](https://reviewstack.dev/pytorch/executorch/pull/18576).
* __->__ #18576
* #18575
cc @manuelcandales @digantdesai @cbilgin1 parent 330a567 commit ae07d06
3 files changed
Lines changed: 31 additions & 3 deletions
File tree
- backends/vulkan
- partitioner
- runtime/graph/ops/glsl
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | 172 | | |
176 | 173 | | |
177 | 174 | | |
| |||
181 | 178 | | |
182 | 179 | | |
183 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
184 | 206 | | |
185 | 207 | | |
186 | 208 | | |
| |||
193 | 215 | | |
194 | 216 | | |
195 | 217 | | |
| 218 | + | |
196 | 219 | | |
197 | 220 | | |
198 | 221 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
0 commit comments