Skip to content

Commit 0fca189

Browse files
huiyujie0105facebook-github-bot
authored andcommitted
add not decomposition into vulkan_partition
Differential Revision: D58900868
1 parent 6b3de99 commit 0fca189

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

backends/vulkan/partitioner/vulkan_partitioner.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# pyre-strict
88

99
import logging
10-
from typing import Any, Dict, final, List, Mapping, Optional
10+
from typing import Any, Callable, Dict, final, List, Mapping, Optional, Tuple
1111

1212
import executorch.backends.vulkan.serialization.vulkan_graph_schema as vk_graph_schema
1313

@@ -33,6 +33,16 @@
3333

3434
from torch.fx.passes.operator_support import OperatorSupportBase
3535

36+
# pyre-ignore
37+
ops_not_to_decompose = [
38+
torch.ops.aten.upsample_nearest2d.vec,
39+
]
40+
41+
# pyre-ignore
42+
edge_ops_non_decomposed = [
43+
exir_ops.edge.aten.upsample_nearest2d.vec,
44+
]
45+
3646

3747
class VulkanSupportedOperators(OperatorSupportBase):
3848
_ops: OpList = enumerate_supported_ops()
@@ -117,6 +127,9 @@ def _is_node_supported(
117127
if node.target not in VulkanSupportedOperators._ops:
118128
return False
119129

130+
if node.op == "call_function" and node.target in edge_ops_non_decomposed:
131+
return True
132+
120133
features = VulkanSupportedOperators._ops[node.target]
121134

122135
if self.require_dynamic_shapes and not features.supports_dynamic_shape:
@@ -150,6 +163,11 @@ def __init__(self, compile_options: Optional[Dict[str, Any]] = None) -> None:
150163
compile_spec = parse_compile_options(self.options)
151164
self.delegation_spec = DelegationSpec(VulkanBackend.__name__, compile_spec)
152165

166+
def ops_to_not_decompose(
167+
self, ep: ExportedProgram
168+
) -> Tuple[List[torch._ops.OpOverload], Optional[Callable[[torch.fx.Node], bool]]]:
169+
return (ops_not_to_decompose, None)
170+
153171
def partition(self, exported_program: ExportedProgram) -> PartitionResult:
154172
# Run the CapabilityBasedPartitioner to return the largest possible
155173
# subgraphs containing the nodes with the tags

0 commit comments

Comments
 (0)