File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626from .utils import (
2727 filecheck_pattern ,
2828 make_dynamic_shapes ,
29- run_transforms ,
3029 validate_numerical_output ,
3130)
3231
@@ -229,7 +228,7 @@ async def test_buffer_mutation_after_make_stateful(self) -> None:
229228 .add_exported_program (self ._mutable_buffer_program ())
230229 .to_coreai ()
231230 )
232- await run_transforms ( result )
231+ result . optimize ( )
233232 filecheck_pattern (
234233 str (result ),
235234 check_file = """
@@ -395,7 +394,7 @@ async def test_user_input_mutation_after_make_stateful(self) -> None:
395394 result = (
396395 TorchConverter ().add_exported_program (self ._mutating_program ()).to_coreai ()
397396 )
398- await run_transforms ( result )
397+ result . optimize ( )
399398 filecheck_pattern (
400399 str (result ),
401400 check_file = """
@@ -507,7 +506,7 @@ async def test_both_mutations_after_make_stateful(self) -> None:
507506 .add_exported_program (self ._both_mutations_program ())
508507 .to_coreai ()
509508 )
510- await run_transforms ( result )
509+ result . optimize ( )
511510 filecheck_pattern (
512511 str (result ),
513512 check_file = """
Original file line number Diff line number Diff line change 1616import numpy as np
1717import numpy .typing as npt
1818import torch
19- from coreai ._compiler ._transforms import GlobalOptions , PassEntry , apply_passes
20- from coreai ._compiler ._transforms .passes import CorePasses
21- from coreai .authoring import AIProgram
2219from coreai .runtime import NDArray , StorageKind
2320from filecheck .matcher import Matcher
2421from filecheck .options import Options
@@ -81,19 +78,6 @@ def _get_test_specialization_options() -> "SpecializationOptions | None":
8178 raise ValueError (msg )
8279
8380
84- async def run_transforms (coreai_program : AIProgram ) -> None :
85- """Run essential transformation passes."""
86- await apply_passes (
87- coreai_program ._mlir_module ,
88- passes = [
89- PassEntry .get (CorePasses ._CORE_OPTIMIZE ),
90- PassEntry .get (CorePasses ._UPDATE_SIGNATURE_TO_HANDLES ),
91- PassEntry .get (CorePasses ._PROPAGATE_HANDLE_UPDATES ),
92- ],
93- options = GlobalOptions (Path ()),
94- )
95-
96-
9781def make_dynamic_shapes (
9882 ** arg_specs : list [str | None ] | dict [int , str | None ],
9983) -> dict [str , dict [int , torch .export .Dim ]]:
You can’t perform that action at this time.
0 commit comments