Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix constant tagging in mps backend #3503

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 1 addition & 7 deletions backends/apple/mps/partition/mps_partitioner.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import torch
from executorch.backends.apple.mps.mps_preprocess import MPSBackend
from executorch.backends.apple.mps.operators.node_visitor import get_node_visitors
from executorch.backends.apple.mps.utils.mps_utils import is_parameter
from executorch.backends.transforms import get_shape
from executorch.exir.backend.backend_details import CompileSpec
from executorch.exir.backend.canonical_partitioners.pattern_op_partitioner import (
Expand Down Expand Up @@ -43,12 +42,6 @@ def __init__(self, edge_program: torch.export.ExportedProgram, compiler_specs):
self.edge_program = edge_program

def is_node_supported(self, submodules, node: torch.fx.Node) -> bool:
# Parameters are supported if any of their users are supported
if is_parameter(self.edge_program, node):
return any(
self.is_node_supported(submodules, user) for user in node.users.keys()
)

if node.op != "call_function":
return False

Expand Down Expand Up @@ -132,6 +125,7 @@ def partition(self, edge_program: ExportedProgram) -> PartitionResult:
partitions = self.generate_partitions(edge_program=edge_program)
if self.check_partitions(partitions):
self.tag_nodes(partitions)
# Tag constant data that are used by the supported ops in MPS backend.
tag_constant_data(edge_program)
x = PartitionResult(
tagged_exported_program=edge_program, partition_tags=self.partition_tags
Expand Down