Skip to content

Commit

Permalink
[AutoTVM] Use new target object
Browse files Browse the repository at this point in the history
Use new target object tvm.target.Targe(), which now holds both 'target'
and 'target_host', in AutoTVM measurement functions. At some point the
tvm.driver.build() will be called by AutoTVM and it expects now such a
kind of target instead of the old (separate) one for 'target' and
'target_host'.

This avoids several deprecate warning messages caused by build() when
AutoTVM is used by tools like 'tvmc'.

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
  • Loading branch information
gromero committed Apr 12, 2022
1 parent 45f3d4a commit de4fb30
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/tvm/autotvm/measure/measure_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
from tvm.contrib.popen_pool import PopenPoolExecutor
from tvm.driver import build
from tvm.error import TVMError
from tvm.ir.container import Map
from tvm.target import Target

from ..env import AutotvmGlobalScope
Expand Down Expand Up @@ -496,7 +497,8 @@ def set_task(self, task):
def _build_func_common(measure_input, runtime=None, check_gpu=None, build_option=None):
"""Common part for building a configuration"""
target, task, config = measure_input
target, task.target_host = Target.check_and_update_host_consist(target, task.target_host)
assert not isinstance(target, (Map, dict)), "It's expected that 'target' is a string here."
target, _ = Target.check_and_update_host_consist(target, task.target_host)

with target:
s, args = task.instantiate(config)
Expand All @@ -520,7 +522,7 @@ def _build_func_common(measure_input, runtime=None, check_gpu=None, build_option
func = vta.build(s, args, target_host=task.target_host)
else:
with tvm.ir.transform.PassContext(config=opts):
func = build(s, args, target_host=task.target_host, runtime=runtime)
func = build(s, args, target=target, runtime=runtime)
return func, tuple((get_const_tuple(x.shape), x.dtype) for x in args)


Expand Down

0 comments on commit de4fb30

Please sign in to comment.