@@ -232,6 +232,30 @@ def canon_target(target):
232232 return target
233233 return Target (target )
234234
235+ @staticmethod
236+ def canon_target_and_host (target , target_host = None ):
237+ """Returns a TVM Target capturing target and target_host. Also returns the host in
238+ canonical form. The given target can be in any form recognized by
239+ Target.canon_target. If given, target_host can be in any form recognized by
240+ Target.canon_target. If target_host is given it will be set as the 'host' in the
241+ result Target object (and a warning given).
242+
243+ Note that this method does not support heterogeneous compilation targets.
244+ """
245+ target = Target .canon_target (target )
246+ target_host = Target .canon_target (target_host )
247+ if target is None :
248+ assert target_host is None , "Target host is not empty when target is empty."
249+ if target_host is not None :
250+ warnings .warn (
251+ "target_host parameter is going to be deprecated. "
252+ "Please pass in tvm.target.Target(target, host=target_host) instead."
253+ )
254+ target = Target (target , target_host )
255+ if target is not None :
256+ target_host = target .host
257+ return target , target_host
258+
235259 @staticmethod
236260 def canon_multi_target (multi_targets ):
237261 """Given a single target-like object, or a collection-like object of target-like objects,
@@ -276,30 +300,6 @@ def canon_multi_target_and_host(target, target_host=None):
276300 raw_targets = convert ([Target (t , target_host ) for t in raw_targets ])
277301 return raw_targets
278302
279- @staticmethod
280- def canon_target_and_host (target , target_host = None ):
281- """Returns a TVM Target capturing target and target_host. Also returns the host in
282- canonical form. The given target can be in any form recognized by
283- Target.canon_target. If given, target_host can be in any form recognized by
284- Target.canon_target. If target_host is given it will be set as the 'host' in the
285- result Target object (and a warning given).
286-
287- Note that this method does not support heterogeneous compilation targets.
288- """
289- target = Target .canon_target (target )
290- target_host = Target .canon_target (target_host )
291- if target is None :
292- assert target_host is None , "Target host is not empty when target is empty."
293- if target_host is not None :
294- warnings .warn (
295- "target_host parameter is going to be deprecated. "
296- "Please pass in tvm.target.Target(target, host=target_host) instead."
297- )
298- target = Target (target , target_host )
299- if target is not None :
300- target_host = target .host
301- return target , target_host
302-
303303 @staticmethod
304304 def canon_target_map_and_host (target_map , target_host = None ):
305305 """Returns target_map as a map from TVM Target's in canonical form to IRModules. The keys
0 commit comments