arina-grovety commented on code in PR #13212:
URL: https://github.com/apache/tvm/pull/13212#discussion_r1102871792


##########
python/tvm/relay/frontend/common.py:
##########
@@ -1067,6 +1067,20 @@ def __init__(self, span):
             self._span = 
tvm.relay.Span(tvm.relay.SourceName(span.decode("utf-8")), 0, 0, 0, 0)
         else:
             assert False, f"unsupported span type: {type(span)}"
+        self.suffix_str = "_PART_"
+        self.counter = 0
+        self.distance_from_leaf = -1
+
+    def _create_span(self):
+        """Adds suffix_str + counter value to _span.source_name.name,
+        to create a unique source_name for the Relay layer
+        """
+        if self.distance_from_leaf == 0:
+            return tvm.relay.Span(tvm.relay.SourceName(self._span), 0, 0, 0, 0)
+        self.distance_from_leaf -= 1
+        span_str = "{}{}{}".format(self._span.source_name.name, 
self.suffix_str, str(self.counter))
+        self.counter += 1
+        return tvm.relay.Span(tvm.relay.SourceName(span_str), 0, 0, 0, 0)

Review Comment:
   Hello @chunit-quic.
   
   Unfortunately, in my case the value of tvm.ir.structural_hash(call) given at 
AnalyzeOperationsDistribution:visit_call()
   differ from the value of tvm.ir.structural_hash(x) at 
dump_operation_offloads:annotate_f().
   
   Our task was to print in a human-readable form, which operators from the 
original graph are offloaded to Ethos-u and which aren't. 
   To do this, we collected the information from the Relay after Partition and 
annotated the original Relay (it is implemented in this PR). And the key point 
was that we used a suffix to obtain a unique identifier that associates the 
string of the original Relay with the operator from the resulting Relay. 
   
   But the suffixes will be removed, and the hash does not match.
   It looks like we don't have the right mechanism yet to associate the 
original Relay call with the resulting Relay.
   
   We probably need to wait a decision for this 
[preRFC](https://discuss.tvm.apache.org/t/pre-rfc-tvm-explorer-infrastructure/13457#reference-level-explanation-9).
 



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

Reply via email to