You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/03/18 10:41:26 UTC

[GitHub] [tvm] DzAvril commented on a change in pull request #10650: [AUTOTVM] Tuning with subgraph as granularity

DzAvril commented on a change in pull request #10650:
URL: https://github.com/apache/tvm/pull/10650#discussion_r829882871



##########
File path: python/tvm/autotvm/task/task.py
##########
@@ -48,6 +50,105 @@ def _lookup_task(name):
     return task
 
 
+def _get_compute(name):
+    """get compute by given name.
+
+    Parameters
+    ----------
+    name: name of compute
+    """
+    task = _lookup_task(name)
+    return task.fcompute
+
+
+def format_subgraph_task_name(name, args):
+    if re.match(r"\w+\d+$", name):
+        # remove number of reduplicative subgraph name like '_1'
+        name = re.sub(r"[_]\d+$", "", name)
+    str_args = format_args(args).encode("utf-8")
+    hash_key = hashlib.md5(str_args).hexdigest()
+    return name + "_" + hash_key
+
+
+def format_args(args):
+    """format arguments of a topi function to a string
+
+    Parameters
+    ----------
+    args: list of hashable or Tensor
+    """
+
+    def _encode(x):

Review comment:
       have added an annotation in code -> get subgraph's workload which is attached to the last op, because the anchor op has attached workload too, so we should get by post order




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org