From d8a8b91453755233021a12f8b21af4968ba89aaf Mon Sep 17 00:00:00 2001 From: Leandro Nunes Date: Thu, 29 Oct 2020 20:55:11 +0000 Subject: [PATCH] [TVMC] use common function to obtain target from --target value on 'tvmc compile' (#6788) - This is solving a TODO item on tvmc --- python/tvm/driver/tvmc/common.py | 1 - python/tvm/driver/tvmc/compiler.py | 11 +---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/python/tvm/driver/tvmc/common.py b/python/tvm/driver/tvmc/common.py index a625a99f0e7e5..9db22f3f33901 100644 --- a/python/tvm/driver/tvmc/common.py +++ b/python/tvm/driver/tvmc/common.py @@ -76,7 +76,6 @@ def convert_graph_layout(mod, desired_layout): ) -# TODO In a separate PR, eliminate the duplicated code here and in compiler.py (@leandron) def target_from_cli(target): """ Create a tvm.target.Target instance from a diff --git a/python/tvm/driver/tvmc/compiler.py b/python/tvm/driver/tvmc/compiler.py index eeb5d07fe0513..e1a4a7481f6a8 100644 --- a/python/tvm/driver/tvmc/compiler.py +++ b/python/tvm/driver/tvmc/compiler.py @@ -177,16 +177,7 @@ def compile_model( if alter_layout: mod = common.convert_graph_layout(mod, alter_layout) - # Handle the case in which target is a path to a JSON file. - if os.path.exists(target): - with open(target) as target_file: - logger.info("using target input from file: %s", target) - target = "".join(target_file.readlines()) - - # TODO(@leandron) We don't have an API to collect a list of supported - # targets yet - logger.debug("creating target from input: %s", target) - tvm_target = tvm.target.Target(target) + tvm_target = common.target_from_cli(target) target_host = target_host or "" if tuning_records and os.path.exists(tuning_records):