Hzfengsy commented on code in PR #14149:
URL: https://github.com/apache/tvm/pull/14149#discussion_r1121278408


##########
python/tvm/relax/analysis/analysis.py:
##########
@@ -319,3 +320,35 @@ def suggest_layout_transforms(
         assert isinstance(transform, IndexMap)
         write_buffer_index_maps.append(transform)
     return _ffi_api.suggest_layout_transforms(func, write_buffer_index_maps)  
# type: ignore
+
+
+def detect_recursion(mod: tvm.IRModule) -> List[List[GlobalVar]]:
+    """
+    Find all sets of recursive or mutually recursive functions in the module.
+
+    Two or more functions are mutually recursive if there is some cycle of 
references
+    among them. For example, if there are two functions A and B, they are
+    mutually recursive if A calls B and B calls A. Another case would be with
+    three functions A, B, and C, where A calls B, B calls C, and C calls A.
+
+    (Note that functions do not have to call each other to reference each 
other.
+    For example, if a function returns another function, that is still a 
reference
+    that could potentially be recursive, even without a call.)
+
+
+    If a function is simply recursive and not mutually recursive with any 
other,
+    it will be reported as a group by itself.
+
+        Parameters

Review Comment:
   ```suggestion
       Parameters
   ```



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