Skip to content

Commit 123860f

Browse files
authored
Fix ModAI recipe and add a CLI ModAI zoo runner
Differential Revision: D95989086 Pull Request resolved: pytorch#18409
1 parent 994f1fe commit 123860f

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎backends/cadence/aot/compiler.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,11 @@ def apply_pre_edge_transform_passes(
148148
quantizer: CadenceQuantizer,
149149
) -> ExportedProgram:
150150
"""
151-
Fuse a converted exported program using the given quantizer.
151+
Apply pre-edge transform passes including QuantFusion and torch ops passes.
152+
This mirrors the Cadence AOT compiler flow:
153+
1. QuantFusion - fuses dq->op->q patterns
154+
2. apply_torch_ops_passes - applied just before to_edge()
155+
152156
The quantizer must be the same as the one used to convert the model.
153157
If you do not expect that behavior, please use quantize_pt2 instead,
154158
which will instantiate a default quantizer for you if needed.
@@ -159,6 +163,9 @@ def apply_pre_edge_transform_passes(
159163
patterns = [q.pattern for q in quantizer.quantizers]
160164
fused_program = _transform(converted_program, QuantFusion(patterns))
161165

166+
# Apply torch ops passes (e.g., ReplaceMulTensorWithMulAndFullOpsPass)
167+
fused_program = apply_torch_ops_passes(fused_program)
168+
162169
return fused_program
163170

164171

0 commit comments

Comments
 (0)