Skip to content

Commit d874ac3

Browse files
Expose opt-out for horizontal partition fusion (pytorch#23082)
Summary: `CapabilityBasedPartitioner` normally merges supported partitions even when their nodes are independent in dataflow. This produces larger delegated subgraphs, but its pairwise candidate checks are quadratic in the number of partitions. Wide graphs with many independent branches—Eagle-3 is the motivating case—can therefore spend prohibitive time in partition generation before backend compilation begins. `CapabilityBasedPartitioner` already exposes `skip_horizontal_fusion`, but the canonical `generate_pattern_op_partitions` helper did not forward it. Backend integrations had to duplicate the helper or accept the quadratic work. Expose the option in both the fbcode and xplat mirrors; the default remains false, so existing callers keep their current partitioning behavior. Differential Revision: D121425768 Pull Request resolved: pytorch#23082
1 parent deef069 commit d874ac3

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎exir/backend/canonical_partitioners/pattern_op_partitioner.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ def generate_pattern_op_partitions(
110110
partitions_list: Optional[List[List[torch.fx.Node]]] = None,
111111
op_support: Optional[OperatorSupportBase] = None,
112112
ignore_literals: bool = False,
113+
skip_horizontal_fusion: bool = False,
113114
) -> List[Partition]:
114115
"""
115116
Args:
@@ -126,6 +127,7 @@ def generate_pattern_op_partitions(
126127
- Getting the result of create_op_support()
127128
- Getting the result of create_pattern_support()
128129
- Multiple OperatorSupportBase classes chained together with chain()
130+
skip_horizontal_fusion: Restrict merging to data-dependent partitions.
129131
130132
Returns
131133
A list of partitions (largest possible subgraphs) containing nodes are
@@ -175,6 +177,7 @@ def is_node_supported(self, submodules, node: torch.fx.Node) -> bool:
175177
graph_module,
176178
final_op_support,
177179
allows_single_node_partition=True,
180+
skip_horizontal_fusion=skip_horizontal_fusion,
178181
)
179182
partition_list = capability_partitioner.propose_partitions()
180183

0 commit comments

Comments
 (0)