|
27 | 27 | from executorch.exir.passes import MemoryPlanningPass
|
28 | 28 | from executorch.exir.passes.quant_fusion_pass import QuantFusionPass
|
29 | 29 | from executorch.exir.passes.sym_shape_eval_pass import ConstraintBasedSymShapeEvalPass
|
30 |
| -from executorch.exir.program._program import to_edge |
| 30 | +from executorch.exir.program._program import to_edge, to_edge_transform_and_lower |
31 | 31 | from executorch.extension.export_util.utils import save_pte_program
|
32 | 32 |
|
33 | 33 |
|
@@ -196,26 +196,35 @@ def main() -> None:
|
196 | 196 | print("Exported program")
|
197 | 197 | print(ep)
|
198 | 198 |
|
199 |
| - edge_manager = to_edge( |
| 199 | + # edge_manager = to_edge( |
| 200 | + # ep, |
| 201 | + # compile_config=EdgeCompileConfig( |
| 202 | + # _check_ir_validity=False, |
| 203 | + # _skip_dim_order=True, |
| 204 | + # preserve_ops=[ |
| 205 | + # torch.ops.aten.scaled_dot_product_attention.default, |
| 206 | + # # preserve norm op for numerical stability |
| 207 | + # torch.ops.aten.linalg_vector_norm.default, |
| 208 | + # torch.ops.aten.reciprocal.default, |
| 209 | + # ], |
| 210 | + # ), |
| 211 | + # ) |
| 212 | + # print("Edge program") |
| 213 | + # print(edge_manager.exported_program()) |
| 214 | + |
| 215 | + # for node in edge_manager.exported_program().graph_module.graph.nodes: |
| 216 | + # print(node.name, node.target, node.args, node.kwargs) |
| 217 | + |
| 218 | + # edge_manager = edge_manager.to_backend(partitioner) |
| 219 | + |
| 220 | + edge_manager = to_edge_transform_and_lower( |
200 | 221 | ep,
|
| 222 | + partitioner=[partitioner], |
201 | 223 | compile_config=EdgeCompileConfig(
|
202 | 224 | _check_ir_validity=False,
|
203 | 225 | _skip_dim_order=True,
|
204 |
| - preserve_ops=[ |
205 |
| - torch.ops.aten.scaled_dot_product_attention.default, |
206 |
| - # preserve norm op for numerical stability |
207 |
| - torch.ops.aten.linalg_vector_norm.default, |
208 |
| - torch.ops.aten.reciprocal.default, |
209 |
| - ], |
210 | 226 | ),
|
211 | 227 | )
|
212 |
| - print("Edge program") |
213 |
| - print(edge_manager.exported_program()) |
214 |
| - |
215 |
| - for node in edge_manager.exported_program().graph_module.graph.nodes: |
216 |
| - print(node.name, node.target, node.args, node.kwargs) |
217 |
| - |
218 |
| - edge_manager = edge_manager.to_backend(partitioner) |
219 | 228 |
|
220 | 229 | print("Delegated program")
|
221 | 230 |
|
|
0 commit comments