Skip to content

Commit da63cae

Browse files
mcr229facebook-github-bot
authored andcommitted
improve error messaging in to_edge_transform_and_lower
Summary: when sanity checks fail, the error message isn't super useful because we don't know what node or what op target is the violating one. We improve the error message here so that we can see what it is. Differential Revision: D66787170
1 parent fd33294 commit da63cae

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

exir/program/_program.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,9 +880,10 @@ def _sanity_check_graph_for_non_decomp_ops(
880880
generate_error=False,
881881
partitioner_name=None,
882882
):
883-
warning_str = f"Found {ops_set_to_not_decompose} in edge dialect program {name}."
883+
warning_str_end = ""
884884
if partitioner_name is not None:
885-
warning_str += f" This op was registered by the partitioner {partitioner_name} to not be decomposed."
885+
warning_str_end += f"This op was registered by the partitioner {partitioner_name} to not be decomposed.\n"
886+
warning_str_end += f"The following ops: {ops_set_to_not_decompose} were specified to not be decomposed in {name}."
886887

887888
# Check that the ops that were registered to not be decomposed are not present in the
888889
# graph anymore as the transform passes and backends should have consumed them by now.
@@ -894,6 +895,7 @@ def _sanity_check_graph_for_non_decomp_ops(
894895
if (
895896
node.op == "call_function" and node.target in ops_set_to_not_decompose
896897
) and is_op_supported:
898+
warning_str = f"Node {node} with op {node.target} was not decomposed or delegated.\n" + warning_str_end
897899
if generate_error:
898900
raise RuntimeError(warning_str)
899901
else:
@@ -904,6 +906,7 @@ def _sanity_check_graph_for_non_decomp_ops(
904906
if (
905907
node.op == "call_function" and node.target in ops_set_to_not_decompose
906908
) and is_op_supported:
909+
warning_str = f"Node {node} with op {node.target} was not decomposed or delegated.\n" + warning_str_end
907910
if generate_error:
908911
raise RuntimeError(warning_str)
909912
else:

0 commit comments

Comments
 (0)