Skip to content

Commit

Permalink
[GML] Allow running make_fx in pre_dispatch mode
Browse files Browse the repository at this point in the history
Signed-off-by: James Bartlett <[email protected]>
  • Loading branch information
JamesMBartlett committed Apr 29, 2024
1 parent d0af31d commit a444e92
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion projects/pt1/python/torch_mlir/torchscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ def compile(
verbose: bool = False,
use_make_fx: bool = False,
enable_ir_printing: bool = False,
pre_dispatch: bool = False,
decompose: bool = True,
):
"""Convert a PyTorch model to MLIR.
Expand Down Expand Up @@ -311,7 +313,7 @@ def compile(
args = example_args._get_for_tracing(
use_tracing=True, ignore_traced_shapes=True
)["forward"]
model = make_fx(model, decomposition_table=_get_decomposition_table())(*args)
model = make_fx(model, pre_dispatch=pre_dispatch, decomposition_table=_get_decomposition_table())(*args)

# For FX-based models, automatically strip overloads.
if isinstance(model, torch.fx.GraphModule):
Expand Down Expand Up @@ -385,6 +387,8 @@ def compile(
+ ",".join(backend_legal_ops)
+ " extra-library="
+ extra_library_file_name
+ " decompose-complex-ops="
+ str(decompose)
+ "}"
)
run_pipeline_with_repro_report(
Expand Down

0 comments on commit a444e92

Please sign in to comment.