Skip to content

Commit

Permalink
[RELAY][PASS] Enable switching CanonicalizeOps in pass_enabled (apach…
Browse files Browse the repository at this point in the history
  • Loading branch information
vinx13 authored and wweic committed Mar 9, 2019
1 parent 25a2e75 commit 6f4d7c7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions python/tvm/relay/build_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"CombineParallelConv2D": 3,
"FoldScaleAxis": 3,
"AlterOpLayout": 3,
"CanonicalizeOps": 3,
}


Expand Down Expand Up @@ -177,13 +178,15 @@ def optimize(func, target=None, params=None):
func = ir_pass.forward_fold_scale_axis(func)
func = ir_pass.fold_constant(func)

if cfg.pass_enabled("CanonicalizeOps"):
func = ir_pass.infer_type(func)
func = ir_pass.canonicalize_ops(func)

# FIXME(zhiics) Skip AlterOpLayout pass for heterogeneous compilation for
# now. We probably need to pass target to this pass as well. Fix it in
# a followup PR.
if cfg.pass_enabled("AlterOpLayout"):
if isinstance(target, _target.Target):
func = ir_pass.infer_type(func)
func = ir_pass.canonicalize_ops(func)
func = ir_pass.infer_type(func)
with target:
func = ir_pass.alter_op_layout(func)
Expand Down

0 comments on commit 6f4d7c7

Please sign in to comment.