Skip to content

Commit

Permalink
[Target] Print deprecation warning before canonicalisation in build m…
Browse files Browse the repository at this point in the history
…odule (#12747)

Hopefully fixes #12742, as the warning should only be printed when a user passes `target_host`, in the current case if the user passes `None` as `target_host` it'll be processed by `canon_target_map_and_host` which seems to always produce a `target_host` and thus triggering the warning despite the user doing nothing wrong.
  • Loading branch information
Mousius authored Sep 15, 2022
1 parent f5517d4 commit c900250
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/tvm/driver/build_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,15 @@ def build(
raise ValueError("inputs must be Schedule, IRModule," "or dict of str to IRModule.")
annotated_mods[tar] = mod.with_attr("runtime", runtime)

annotated_mods, target_host = Target.canon_target_map_and_host(annotated_mods, target_host)

# TODO(mbs): Both CompilationConfig and TIRToRuntime implement the same host target
# defaulting logic, but there's currently no way to get back the decided host.
if target_host is not None:
warnings.warn(
"target_host parameter is going to be deprecated. "
"Please pass in tvm.target.Target(target, host=target_host) instead."
)

annotated_mods, target_host = Target.canon_target_map_and_host(annotated_mods, target_host)
if not target_host:
for tar, mod in annotated_mods.items():
device_type = ndarray.device(tar.kind.name, 0).device_type
Expand Down

0 comments on commit c900250

Please sign in to comment.