Skip to content

Commit

Permalink
[TVMC] use common function to obtain target from --target value on 't…
Browse files Browse the repository at this point in the history
…vmc compile' (apache#6788)

- This is solving a TODO item on tvmc
  • Loading branch information
leandron authored and Trevor Morris committed Dec 2, 2020
1 parent 81f0a0e commit d8a8b91
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
1 change: 0 additions & 1 deletion python/tvm/driver/tvmc/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 1 addition & 10 deletions python/tvm/driver/tvmc/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit d8a8b91

Please sign in to comment.