From 283da32d3f243cc6a5ce9f9c7a85a54114baa4ae Mon Sep 17 00:00:00 2001 From: Thierry Moreau Date: Tue, 14 May 2019 11:22:48 -0700 Subject: [PATCH] adding a means to disable a pass in relay build module --- python/tvm/relay/build_module.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/python/tvm/relay/build_module.py b/python/tvm/relay/build_module.py index c8b69e011543b..2376f05879b67 100644 --- a/python/tvm/relay/build_module.py +++ b/python/tvm/relay/build_module.py @@ -56,6 +56,7 @@ class BuildConfig(object): defaults = { "opt_level": 2, "add_pass": None, + "disable_pass": None, "fallback_device": None, } @@ -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] @@ -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.