Skip to content

error in per-op mode #7209

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

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions backends/xnnpack/partition/xnnpack_partitioner.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,30 @@ def generate_per_op_partitions(self, ep: ExportedProgram) -> List[Partition]:
partitions = []
matched_nodes = self.get_matched_nodes_from_configs(ep)
partition_id = itertools.count()
nodes_seen = set()
nodes_seen = {}
for match in matched_nodes:
match_set = set(match)
# for debug information we map the node to the string form
# of the partition it belongs to
match_map = dict.fromkeys(match, str(match))
# We only create partitions from the first PartitionerConfig match
# if a subsequent partitioner match contains the same node, we do
# not create a partition for it
if match_set.isdisjoint(nodes_seen):
overlap = match_map.keys() & nodes_seen.keys()
if len(overlap) == 0:
partitions.append(
Partition(
id=next(partition_id),
nodes=match_set,
nodes=match_map.keys(),
)
)
nodes_seen.update(match_set)
nodes_seen.update(match_map)
else:
error_str = f"per_op mode expects no overlaps between partitions but the partition {match_map.keys()} overlaps with the following partitions:\n"
for overlap_node in overlap:
error_str += f"{nodes_seen[overlap_node]}\n"

raise RuntimeError(error_str)

return partitions


Expand Down
Loading