Skip to content

Commit

Permalink
adding a means to disable a pass in relay build module
Browse files Browse the repository at this point in the history
  • Loading branch information
tmoreau89 committed May 14, 2019
1 parent 666baaf commit 283da32
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion python/tvm/relay/build_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class BuildConfig(object):
defaults = {
"opt_level": 2,
"add_pass": None,
"disable_pass": None,
"fallback_device": None,
}

Expand Down Expand Up @@ -100,6 +101,8 @@ def pass_enabled(self, pass_name):
"""
if self.add_pass and pass_name in self.add_pass:
return True
if self.disable_pass and pass_name in self.disable_pass:
return False
return self.opt_level >= OPT_PASS_LEVEL[pass_name]


Expand All @@ -114,9 +117,12 @@ def build_config(**kwargs):
opt_level: int, default=2
Optimization level. See OPT_PASS_LEVEL for level of each pass.
add_pass: set of str
add_pass: Set[str]
Optimization pass to be added regardless of optimization level.
disable_pass: Set[str]
Optimization pass to be disabled regardless of optimization level.
fallback_device : str or tvm.TVMContext
The fallback device. It is also used as the default device for
operators without specified device during heterogeneous execution.
Expand Down

0 comments on commit 283da32

Please sign in to comment.