lhutton1 commented on code in PR #13212:
URL: https://github.com/apache/tvm/pull/13212#discussion_r1039686396
##########
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 was thinking that traversing the Relay IR itself here might simplify the
logic below and decouple the implementation from the textual representation
making it more robust to changes in the future. It seems like it would also
remove the need to make changes such as
https://github.com/apache/tvm/pull/13212/files#diff-237c52e4e68362990738b47cc97c81b5c84ec92dfbcb672e961f0e9887f436c0R378
which might require more motivation from the community. WDYT?
cc @ashutosh-arm @ekalda incase you have any other suggestions
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]