Lunderberg commented on code in PR #15900:
URL: https://github.com/apache/tvm/pull/15900#discussion_r1350620665
##########
tests/python/relax/test_transform_cse.py:
##########
@@ -276,5 +276,19 @@ def foo(x: R.Tensor((2, 3), dtype="float32"), y:
R.Tensor((2, 3), dtype="float32
verify(Before, Expected)
+def test_do_not_eliminate_extern_func():
+ @I.ir_module
+ class Before:
+ @R.function(pure=False)
+ def foo(x: R.Tensor((2, 3), dtype="float32")):
+ y = R.call_packed("extern_func_name", x, sinfo_args=R.Tensor([2,
3]))
+ z = R.call_packed("extern_func_name", y, sinfo_args=R.Tensor([2,
3]))
Review Comment:
Previously, it wasn't a computational step that was being extracted as the
common subexpression, but the `R.ExternFunc` object itself.
```python
@I.ir_module
class Module:
@R.function(pure=False)
def foo(x: R.Tensor((2, 3), dtype="float32")):
gv = R.ExternFunc("extern_func_name")
y = gv(x, sinfo_args=(R.Tensor((2, 3)),))
z = gv(y, sinfo_args=(R.Tensor((2, 3)),))
return z
```
--
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]