From 94b66b80ada8bdaa2c6718e0d7118838f215b38d Mon Sep 17 00:00:00 2001 From: Cody Yu Date: Mon, 23 Nov 2020 19:14:45 +0000 Subject: [PATCH 1/2] [Bugfix][AutoScheduler] Strictly select impl using plevel --- python/tvm/relay/backend/compile_engine.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/python/tvm/relay/backend/compile_engine.py b/python/tvm/relay/backend/compile_engine.py index 28f2ac6d489b..5689ac0e9e94 100644 --- a/python/tvm/relay/backend/compile_engine.py +++ b/python/tvm/relay/backend/compile_engine.py @@ -22,6 +22,7 @@ import numpy as np import tvm from tvm import te, autotvm +from tvm.ir.transform import PassContext from tvm.runtime import Object from tvm.support import libinfo from tvm.target import Target @@ -287,7 +288,12 @@ def lower_call(call, inputs, target): env.tracing = False reenable_tracing = True - if not is_dyn: + # check if auto_scheduler is enabled, and use pevel to select the implementation if so + use_auto_scheduler = PassContext.current().config.get( + "relay.backend.use_auto_scheduler", False + ) + + if not is_dyn and not use_auto_scheduler: best_impl, outputs = select_implementation(op, call.attrs, inputs, ret_type, target) else: # TODO(@icemelon9): Allow tvm to generate multiple kernels for dynamic shapes. From 4321450b736622916672e7ebc0840291f14128b1 Mon Sep 17 00:00:00 2001 From: Cody Yu Date: Mon, 23 Nov 2020 19:25:51 +0000 Subject: [PATCH 2/2] lint --- python/tvm/relay/backend/compile_engine.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/python/tvm/relay/backend/compile_engine.py b/python/tvm/relay/backend/compile_engine.py index 5689ac0e9e94..a3108a7f1b41 100644 --- a/python/tvm/relay/backend/compile_engine.py +++ b/python/tvm/relay/backend/compile_engine.py @@ -289,9 +289,7 @@ def lower_call(call, inputs, target): reenable_tracing = True # check if auto_scheduler is enabled, and use pevel to select the implementation if so - use_auto_scheduler = PassContext.current().config.get( - "relay.backend.use_auto_scheduler", False - ) + use_auto_scheduler = PassContext.current().config.get("relay.backend.use_auto_scheduler", False) if not is_dyn and not use_auto_scheduler: best_impl, outputs = select_implementation(op, call.attrs, inputs, ret_type, target)