You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "ashutosh-arm (via GitHub)" <gi...@apache.org> on 2023/01/27 12:42:34 UTC

[GitHub] [tvm] ashutosh-arm commented on a diff in pull request #13212: [TVMC][microNPU] tvmc option for printing which operators are offloaded to Ethos-U

ashutosh-arm commented on code in PR #13212:
URL: https://github.com/apache/tvm/pull/13212#discussion_r1088919482


##########
python/tvm/driver/tvmc/compiler.py:
##########
@@ -459,3 +493,65 @@ def save_dumps(module_name: str, dumps: Dict[str, str], dump_root: str = "."):
         dump_name = module_name + "." + dump_format
         with open(Path(dump_root, dump_name), "w") as f:
             f.write(dumps[dump_format])
+
+
+def dump_operation_offloads(mod: tvm.ir.IRModule, initial_relay_astext: list, dump_path: str):
+    """This helper function forms a line-by-line output of the initial Relay lines,
+    indicating which operations are ported to which backend,
+    indicating the composite that includes those operations e.g
+    'device1    <- device2.qnn_conv2d'
+    'device1    <-        %0 = qnn.conv2d(%tfl.quantize, %v_param_1, ...'
+    'device1    <-        %1 = nn.bias_add(%0, %v_param_2, axis=3);'
+    'device1    <-        %2 = qnn.requantize(%1, meta[relay.Constant]...'
+    'device2    <- device2.reshape'
+    'device2    <-        %3 = reshape(%206, newshape=[1, 1001]);'
+
+    Parameters
+    ----------
+    mod : tvm.ir.IRModule
+        The IRModule that gets generated from a relay frontend.
+    initial_relay_astext : list

Review Comment:
   I would suggest the same thing as @lhutton1 did above. Text representation changes quite often. It is better to rely on the information available inside the module object and extract it using let's say `ExprVisitor`.  



-- 
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