masahi opened a new pull request, #14097:
URL: https://github.com/apache/tvm/pull/14097
Currently, when `FuseOps` and `FuseOpsByPattern` see a call node whose
arguments have duplicated parameters, e.g.
```
with R.dataflow():
out = R.add(data, data)
R.output(out)
```
they create a grouped function whose signature has parameters deduplicated:
```
@R.function
def main(data: R.Tensor((1, 64, 56, 56), dtype="float32")) ->
R.Tensor((1, 64, 56, 56), dtype="float32"):
with R.dataflow():
gv: R.Tensor((1, 64, 56, 56), dtype="float32") =
fused_relax_add(data)
R.output(gv)
return gv
@R.function
def fused_relax_add(data: R.Tensor((1, 64, 56, 56), dtype="float32")) ->
R.Tensor((1, 64, 56, 56), dtype="float32"):
R.func_attr({"Composite": "tensorrt.add", "Primitive": 1})
with R.dataflow():
gv: R.Tensor((1, 64, 56, 56), dtype="float32") = R.add(data,
data)
R.output(gv)
return gv
```
This is fine if the grouped function is codegen-ed automatically by TVM, but
for BYOC use cases (`FuseOpsByPattern`) this is problematic. If a user creates
a pattern
```
add_pat = is_op("relax.add")(wildcard(), wildcard())
```
he / she expects to create a function with two parameters, that does
addition. Indeed, if I replace the RHS with an expression other than data, such
function is created. The fact that the same expression is used for both LHS and
RHS shouldn't matter when creating a grouped function. So the current behavior
doesn't match user's intention.
--
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]