slyubomirsky commented on code in PR #16642:
URL: https://github.com/apache/tvm/pull/16642#discussion_r1534643145


##########
tests/python/relax/test_transform_compute_prim_value.py:
##########
@@ -76,5 +76,29 @@ def compute_symbolic_expr(N: T.int64) -> T.bool:
             T.ret(N % 16 == 0)
 
 
+class TestPrimValueInPureFunction(BaseCompare):
+    @I.ir_module
+    class Before:
+        @R.function
+        def main(_N: R.Prim(value="N"), _M: R.Prim(value="M")) -> 
R.Prim(value="N*M"):
+            N = T.int64()
+            M = T.int64()
+            out = R.prim_value(N * M)
+            return out
+
+    @I.ir_module
+    class Expected:
+        @R.function
+        def main(_N: R.Prim(value="N"), _M: R.Prim(value="M")) -> 
R.Prim(value="N*M"):
+            N = T.int64()
+            M = T.int64()
+            out = Expected.compute_symbolic_expr(R.prim_value(N), 
R.prim_value(M))
+            return out
+
+        @T.prim_func(private=True)
+        def compute_symbolic_expr(N: T.int64, M: T.int64) -> T.int64:
+            T.ret(N * M)

Review Comment:
   Now that purity checking is implemented for PrimFuncs, this will roundtrip, 
correct?



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