Lunderberg commented on code in PR #16306:
URL: https://github.com/apache/tvm/pull/16306#discussion_r1446439873
##########
tests/python/relax/test_transform_lambda_lift.py:
##########
@@ -205,34 +211,40 @@ def while_loop(
def test_multi_func():
+ """Lifting may be required for multiple top-level functions
+
+ De-duplication of GlobalVar names at the IRModule is done by
+ appending the name of the function from which they were lifted.
+ """
+
# expected IRModule
@tvm.script.ir_module
class Expected:
@R.function
def glob_func_1(
x1: R.Tensor((10, 5), "float32"), y1: R.Tensor((10, 5), "float32")
) -> R.Tensor(None, "float32", ndim=2):
- inner = Expected.lifted_func_0
+ inner = Expected.glob_func_1_inner
gv1: R.Tensor((10, 5), "float32") = inner(x1, y1)
return gv1
@R.function
def glob_func_2(
x11: R.Tensor((10, 5), "float32"), y11: R.Tensor((10, 5),
"float32")
) -> R.Tensor(None, "float32", ndim=2):
- inner = Expected.lifted_func_1
+ inner = Expected.glob_func_2_inner
gv11: R.Tensor((10, 5), "float32") = inner(x11, y11)
return gv11
@R.function(private=True)
- def lifted_func_0(
+ def glob_func_1_inner(
x2: R.Tensor((10, 5), "float32"), y2: R.Tensor((10, 5), "float32")
) -> R.Tensor((10, 5), "float32"):
s: R.Tensor((10, 5), "float32") = R.add(x2, y2)
return s
@R.function(private=True)
- def lifted_func_1(
+ def glob_func_2_inner(
Review Comment:
Good call, and added.
--
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]