[Mlir-commits] [mlir] [mlir][Transforms] Dialect conversion: Add missing "else if" branch (PR #101148)
Adrian Kuegel
llvmlistbot at llvm.org
Wed Jul 31 05:35:36 PDT 2024
akuegel wrote:
I only spot-checked some failures, and those would be fixed. I can double-check whether it fixes everything.
I got the -debug flag working, forgot to pass --copt=-UNDEBUG. Here is some relevant part of the output:
```
//===-------------------------------------------===//
Legalizing operation : 'tf.TensorListFromTensor'(0x71153effd9b0) {
%7 = "tf.TensorListFromTensor"(%arg4, %4) : (tensor<2x3xf32>, tensor<1xi32>) -> tensor<!tf_type.variant<tensor<3xf32>>>
* Fold {
ImplicitTypeIDRegistry::lookupOrInsert(mlir::OpTrait::HasRecursiveMemoryEffects<Empty>)
} -> FAILURE : unable to fold
* Pattern : 'tf.TensorListFromTensor -> ()' {
Trying to match "mlir::(anonymous namespace)::ConvertTensorListFromTensor"
** Replace : 'tf.TensorListFromTensor'(0x71153effd9b0)
"mlir::(anonymous namespace)::ConvertTensorListFromTensor" result 1
} -> SUCCESS : pattern applied successfully
// *** IR Dump After Pattern Application ***
func.func @tensorlistWhileLoop(%arg0: tensor<2x3xf32>) -> tensor<2x3xf32> {
%cst = arith.constant dense<3> : tensor<1xi32>
%cst_0 = arith.constant dense<0> : tensor<i32>
%cst_1 = arith.constant dense<-1> : tensor<i32>
%0 = "tf.TensorListFromTensor"(%arg0, %cst) : (tensor<2x3xf32>, tensor<1xi32>) -> tensor<!tf_type.variant<tensor<3xf32>>>
%1:2 = "tf.While"(%cst_0, %0) <{body = @tensorlistWhileBody, cond = @tensorlistWhileCond, is_stateless = false}> {T = ["tfdtype$DT_INT32", "tfdtype$DT_VARIANT"]} : (tensor<i32>, tensor<!tf_type.variant<tensor<3xf32>>>) -> (tensor<i32>, tensor<!tf_type.variant<tensor<*xf32>>>)
%2 = "tf.TensorListStack"(%1#1, %cst_1) : (tensor<!tf_type.variant<tensor<*xf32>>>, tensor<i32>) -> tensor<2x3xf32>
return %2 : tensor<2x3xf32>
}
} -> SUCCESS
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'tf.While'(0x71153effbb40) {
%8:2 = "tf.While"(%5, %7) <{body = @tensorlistWhileBody, cond = @tensorlistWhileCond, is_stateless = false}> {T = ["tfdtype$DT_INT32", "tfdtype$DT_VARIANT"]} : (tensor<i32>, tensor<!tf_type.variant<tensor<3xf32>>>) -> (tensor<i32>, tensor<!tf_type.variant<tensor<*xf32>>>)
* Fold {
} -> FAILURE : unable to fold
* Pattern : 'tf.While -> ()' {
Trying to match "mlir::(anonymous namespace)::ConvertWhile"
ImplicitTypeIDRegistry::lookupOrInsert(mlir::TF::detail::WhileOpGenericAdaptorBase::Properties)
** Insert : 'tf.While'(0x71153effbd00)
** Insert Block into : 'func.func'(0x71153ee4bd80)
** Insert Block into : 'func.func'(0x71153ee4be00)
** Replace : 'tf.While'(0x71153effbb40)
"mlir::(anonymous namespace)::ConvertWhile" result 1
//===-------------------------------------------===//
Legalizing operation : 'func.func'(0x71153ee4bd80) {
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'func.func'(0x71153ee4be00) {
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'func.func'(0x71153ee4bd80) {
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'func.func'(0x71153ee4be00) {
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'tf.While'(0x71153effbd00) {
%12:2 = "tf.While"(%9, %arg4) <{body = @tensorlistWhileBody, cond = @tensorlistWhileCond, is_stateless = false}> : (tensor<i32>, tensor<2x3xf32>) -> (tensor<i32>, tensor<2x3xf32>)
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
} -> SUCCESS : pattern applied successfully
// *** IR Dump After Pattern Application ***
func.func @tensorlistWhileLoop(%arg0: tensor<2x3xf32>) -> tensor<2x3xf32> {
%cst = arith.constant dense<3> : tensor<1xi32>
%cst_0 = arith.constant dense<0> : tensor<i32>
%cst_1 = arith.constant dense<-1> : tensor<i32>
%0 = "tf.TensorListFromTensor"(%arg0, %cst) : (tensor<2x3xf32>, tensor<1xi32>) -> tensor<!tf_type.variant<tensor<3xf32>>>
%1:2 = "tf.While"(%cst_0, %arg0) <{body = @tensorlistWhileBody, cond = @tensorlistWhileCond, is_stateless = false}> : (tensor<i32>, tensor<2x3xf32>) -> (tensor<i32>, tensor<2x3xf32>)
%2:2 = "tf.While"(%cst_0, %0) <{body = @tensorlistWhileBody, cond = @tensorlistWhileCond, is_stateless = false}> {T = ["tfdtype$DT_INT32", "tfdtype$DT_VARIANT"]} : (tensor<i32>, tensor<!tf_type.variant<tensor<3xf32>>>) -> (tensor<i32>, tensor<!tf_type.variant<tensor<*xf32>>>)
%3 = "tf.TensorListStack"(%2#1, %cst_1) : (tensor<!tf_type.variant<tensor<*xf32>>>, tensor<i32>) -> tensor<2x3xf32>
return %3 : tensor<2x3xf32>
}
} -> SUCCESS
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'tf.TensorListStack'(0x71153ef98e80) {
%14 = "tf.TensorListStack"(%13#1, %10) : (tensor<!tf_type.variant<tensor<*xf32>>>, tensor<i32>) -> tensor<2x3xf32>
* Fold {
} -> FAILURE : unable to fold
* Pattern : 'tf.TensorListStack -> ()' {
Trying to match "mlir::(anonymous namespace)::ConvertTensorListStack"
** Replace : 'tf.TensorListStack'(0x71153ef98e80)
"mlir::(anonymous namespace)::ConvertTensorListStack" result 1
} -> SUCCESS : pattern applied successfully
// *** IR Dump After Pattern Application ***
func.func @tensorlistWhileLoop(%arg0: tensor<2x3xf32>) -> tensor<2x3xf32> {
%cst = arith.constant dense<3> : tensor<1xi32>
%cst_0 = arith.constant dense<0> : tensor<i32>
%cst_1 = arith.constant dense<-1> : tensor<i32>
%0 = "tf.TensorListFromTensor"(%arg0, %cst) : (tensor<2x3xf32>, tensor<1xi32>) -> tensor<!tf_type.variant<tensor<3xf32>>>
%1:2 = "tf.While"(%cst_0, %arg0) <{body = @tensorlistWhileBody, cond = @tensorlistWhileCond, is_stateless = false}> : (tensor<i32>, tensor<2x3xf32>) -> (tensor<i32>, tensor<2x3xf32>)
%2:2 = "tf.While"(%cst_0, %0) <{body = @tensorlistWhileBody, cond = @tensorlistWhileCond, is_stateless = false}> {T = ["tfdtype$DT_INT32", "tfdtype$DT_VARIANT"]} : (tensor<i32>, tensor<!tf_type.variant<tensor<3xf32>>>) -> (tensor<i32>, tensor<!tf_type.variant<tensor<*xf32>>>)
%3 = "tf.TensorListStack"(%2#1, %cst_1) : (tensor<!tf_type.variant<tensor<*xf32>>>, tensor<i32>) -> tensor<2x3xf32>
return %3 : tensor<2x3xf32>
}
} -> SUCCESS
//===-------------------------------------------===//
```
https://github.com/llvm/llvm-project/pull/101148
More information about the Mlir-commits
mailing list