slyubomirsky commented on code in PR #14394:
URL: https://github.com/apache/tvm/pull/14394#discussion_r1165987975
##########
python/tvm/relax/transform/legalize_ops/index.py:
##########
@@ -105,10 +106,12 @@ def get_length(begin, end, strides, length):
# Get shape length
ndim = int(output_shape.struct_info.shape[0])
output_shape = bb.emit(
- Call(
- ExternFunc("vm.builtin.tensor_to_shape"),
- [output_shape],
- sinfo_args=[ShapeStructInfo(ndim=ndim)],
+ # TODO(@relax-team): Ideally, we should use the tensor_to_shape op
here to
+ # address the issue with purity, but that introduces a staging issue:
+ # we need to apply DecomposeOpsForInference in that case
+ # and it's unclear when in the build it should happen
+ call_pure_packed(
+ "vm.builtin.tensor_to_shape", output_shape,
sinfo_args=ShapeStructInfo(ndim=ndim)
Review Comment:
This is another example of staging causing issues: The `tensor_to_shape` op
needs to be lowered to this builtin, but it's done only in
`DecomposeOpsForInference`, not (perhaps as might be logical) `VMBuiltinLower`.
@sunggg This led to a rather bizarre issue: I tried to use the
`tensor_to_shape` op with `DecomposeOpsForInference`, but that led to a bug
with `VMShapeLower` (the well-formed checker claimed there was an unbound var).
Not sure where that could have come from.
--
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]