Skip to content

Commit 64b9188

Browse files
committed
Remove restriction on static dimensions in Shape method
mlir::shape::ToExtentTensorOp::areCastCompatible didn't allow the input to have a static dimension, but that is allowed.
1 parent 99d9502 commit 64b9188

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

mlir/lib/Dialect/Shape/IR/Shape.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1767,7 +1767,7 @@ bool ToExtentTensorOp::areCastCompatible(TypeRange inputs, TypeRange outputs) {
17671767
return false;
17681768
if (auto inputTensor = inputs[0].dyn_cast<RankedTensorType>()) {
17691769
if (!inputTensor.getElementType().isa<IndexType>() ||
1770-
inputTensor.getRank() != 1 || !inputTensor.isDynamicDim(0))
1770+
inputTensor.getRank() != 1)
17711771
return false;
17721772
} else if (!inputs[0].isa<ShapeType>()) {
17731773
return false;

mlir/test/Dialect/Shape/ops.mlir

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@ func @test_to_extent_tensor(%arg: !shape.shape) -> tensor<3xindex> {
168168
return %0 : tensor<3xindex>
169169
}
170170

171+
func @test_identity_to_extent_tensor(%arg: tensor<3xindex>) -> tensor<3xindex> {
172+
%0 = shape.to_extent_tensor %arg : tensor<3xindex> -> tensor<3xindex>
173+
return %0 : tensor<3xindex>
174+
}
175+
171176
func @test_from_extent_tensor(%arg: tensor<?xindex>) -> !shape.shape {
172177
%0 = shape.from_extent_tensor %arg : tensor<?xindex>
173178
return %0 : !shape.shape

0 commit comments

Comments
 (0)