[Unity][Relax][Transform] Do not remove MatchCast for RemoveAllUnused#15290
[Unity][Relax][Transform] Do not remove MatchCast for RemoveAllUnused#15290Hzfengsy merged 1 commit intoapache:unityfrom
Conversation
|
Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.
Generated by tvm-bot |
|
if we call @R.function
def main(
shape_tensor: R.Tensor((3,), dtype="int64")
) -> R.Tensor(dtype="int32", ndim=3):
m = T.int64()
n = T.int64()
k = T.int64()
with R.dataflow():
lv: R.Shape(ndim=3) = R.call_pure_packed(
"vm.builtin.tensor_to_shape", shape_tensor, sinfo_args=(R.Shape(ndim=3),)
)
lv1: R.Shape([m, n, k]) = R.match_cast(lv, R.Shape([m, n, k]))
lv2: R.Tensor((m, 1, k), dtype="int32") = R.full(
R.shape([m, 1, k]), R.const(1, "int32"), dtype="int32"
)
gv: R.Tensor((m, 1, k), dtype="int32") = lv2
R.output(gv)
return gv |
|
Thanks for the fixing. Could you please add a regression test, i.e., a test case that fails before this fix but passes after this patch? |
sure |
|
add regression test |
Match_cast can be used to capture symbolic shapes, remove MatchCast binding will cause `Prim Expr xxx has not been computed` in build stage.
|
Please fix the CI and we can get it in |
|
@tvm-bot rerun |
|
Failed to re-run CI in https://github.com/apache/tvm/actions/runs/5531296114 Detailswith response |
|
cc @slyubomirsky @ganler as well |
|
A likely better approach is to also analyze the use of symbolic vars and remove match-cast if the generated symbolic vars are not referenced in followup struct info and Exprs. But this is a good first step to ensure correctness |
…apache#15290) Match_cast can be used to capture symbolic shapes, remove MatchCast binding will cause `Prim Expr xxx has not been computed` in build stage.
Match_cast can be used to capture symbolic shapes, remove MatchCast binding will cause
Prim Expr xxx has not been computedin build stage.