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


##########
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,
   thank you for the detailed explanations!
   
   I'm sorry, but I'm a bit confused. Let me explain my question:
   
   First, do I understand correctly that the workflow in my case will be as 
follows:
   
   ```
   frontend model -> Relay IR (IR1)
   if --dump-offloads option is on
        tag IR1 with suffixes using the _SuffixTagger pass
   inside the tvmc.compiler.compile_model:
        ...
        IR1(optionally tagged) transfoms by partitions for selected backends 
(IR2)
        if --dump-offloads option is on
             dump initial_relay offloaded result
        ... 
   ```
           
   And here is my question:
   If I understand correctly, the suffix, although optional, sometimes will 
still be present in the Relay.
   Doesn't this mean that, although optional, we will again get the situation 
we wanted to avoid by removing the suffixes?



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