[Compile] Fix noop_elimination pass and add tests for noop_elimination (#24880)

Signed-off-by: zjy0516 <riverclouds.zhu@qq.com>
This commit is contained in:
Jiangyun Zhu
2025-09-15 23:33:18 +00:00
committed by GitHub
parent 45bfa49cb8
commit 5bcc153d7b
4 changed files with 130 additions and 23 deletions
+5 -1
View File
@@ -64,4 +64,8 @@ class TestBackend:
num_pre = len(list(find_op_nodes(op, self.graph_pre_pass)))
num_post = len(list(find_op_nodes(op, self.graph_post_pass)))
assert num_pre == 0, f"Unexpected op {op.name()} in pre-pass graph"
assert num_post > 0, f"Op {op.name()} not found in post-pass graph"
assert num_post > 0, f"Op {op.name()} not found in post-pass graph"
def op_count(self, op: OpOverload, before=False) -> int:
graph = self.graph_pre_pass if before else self.graph_post_pass
return len(list(find_op_nodes(op, graph)))