farshidsp commented on code in PR #15764:
URL: https://github.com/apache/tvm/pull/15764#discussion_r1336337450


##########
python/tvm/relax/transform/legalize_ops/ccl.py:
##########
@@ -46,6 +46,30 @@ def _allreduce(_bb: BlockBuilder, call: Call) -> Expr:
     )
 
 
+@register_legalize("relax.ccl.allgather")
+def _allgather(_bb: BlockBuilder, call: Call) -> Expr:
+    output_shape = []
+    assert isinstance(
+        call.args[0].struct_info, TensorStructInfo
+    ), "The input struct info of allgather should be TensorStructInfo."
+    assert isinstance(call.args[0].struct_info.shape.struct_info, 
ShapeStructInfo)
+    arg_shape = call.args[0].struct_info.shape.struct_info
+    for i, shape_value in enumerate(arg_shape.values):
+        if i == 0:
+            output_shape.append(tir.multiply(shape_value, call.args[1].value))

Review Comment:
   That make sense. Resolved. 



-- 
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-unsubscr...@tvm.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to