mirror of https://github.com/llvm/torch-mlir
Update llvm-project to 6f9c25167d16acff3ff8e4f54a8c14a2a175fc59
- Changes to dialect conversion that result in no-op materializations not being created.pull/381/head snapshot-20211029.51
parent
c46d48f9f5
commit
eb6996d557
|
@ -1 +1 @@
|
|||
Subproject commit f1b922188ead5ca492c8d8edd47921b013a22ae0
|
||||
Subproject commit 6f9c25167d16acff3ff8e4f54a8c14a2a175fc59
|
|
@ -2,15 +2,15 @@
|
|||
|
||||
// CHECK-LABEL: func @torch.prim.if(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: !torch.bool) -> !torch.int {
|
||||
// CHECK: %[[VAL_1:.*]] = torch.constant.int 2
|
||||
// CHECK: %[[VAL_2:.*]] = torch.constant.int 1
|
||||
// CHECK: %[[VAL_3:.*]] = torch_c.to_i1 %[[VAL_0]]
|
||||
// CHECK: %[[VAL_4:.*]] = scf.if %[[VAL_3]] -> (i64) {
|
||||
// CHECK: %[[VAL_5:.*]] = torch_c.to_i64 %[[VAL_1]]
|
||||
// CHECK: scf.yield %[[VAL_5]] : i64
|
||||
// CHECK: %[[VAL_1:.*]] = torch_c.to_i1 %[[VAL_0]]
|
||||
// CHECK: %[[VAL_2:.*]] = torch.constant.int 2
|
||||
// CHECK: %[[VAL_3:.*]] = torch_c.to_i64 %[[VAL_2]]
|
||||
// CHECK: %[[VAL_4:.*]] = torch.constant.int 1
|
||||
// CHECK: %[[VAL_5:.*]] = torch_c.to_i64 %[[VAL_4]]
|
||||
// CHECK: %[[VAL_6:.*]] = scf.if %[[VAL_1]] -> (i64) {
|
||||
// CHECK: scf.yield %[[VAL_3]] : i64
|
||||
// CHECK: } else {
|
||||
// CHECK: %[[VAL_6:.*]] = torch_c.to_i64 %[[VAL_2]]
|
||||
// CHECK: scf.yield %[[VAL_6]] : i64
|
||||
// CHECK: scf.yield %[[VAL_5]] : i64
|
||||
// CHECK: }
|
||||
// CHECK: %[[VAL_7:.*]] = torch_c.from_i64 %[[VAL_8:.*]]
|
||||
// CHECK: return %[[VAL_7]] : !torch.int
|
||||
|
@ -28,23 +28,23 @@ func @torch.prim.if(%arg0: !torch.bool) -> !torch.int {
|
|||
// CHECK-LABEL: func @aten.prim.if$nested(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: !torch.bool,
|
||||
// CHECK-SAME: %[[VAL_1:.*]]: !torch.bool) -> !torch.int {
|
||||
// CHECK: %[[VAL_2:.*]] = torch.constant.int 2
|
||||
// CHECK: %[[VAL_3:.*]] = torch.constant.int 3
|
||||
// CHECK: %[[VAL_4:.*]] = torch.constant.int 4
|
||||
// CHECK: %[[VAL_5:.*]] = torch_c.to_i1 %[[VAL_0]]
|
||||
// CHECK: %[[VAL_6:.*]] = scf.if %[[VAL_5]] -> (i64) {
|
||||
// CHECK: %[[VAL_7:.*]] = torch_c.to_i1 %[[VAL_1]]
|
||||
// CHECK: %[[VAL_8:.*]] = scf.if %[[VAL_7]] -> (i64) {
|
||||
// CHECK: %[[VAL_9:.*]] = torch_c.to_i64 %[[VAL_2]]
|
||||
// CHECK: scf.yield %[[VAL_9]] : i64
|
||||
// CHECK: %[[VAL_2:.*]] = torch_c.to_i1 %[[VAL_0]]
|
||||
// CHECK: %[[VAL_3:.*]] = torch_c.to_i1 %[[VAL_1]]
|
||||
// CHECK: %[[VAL_4:.*]] = torch.constant.int 2
|
||||
// CHECK: %[[VAL_5:.*]] = torch_c.to_i64 %[[VAL_4]]
|
||||
// CHECK: %[[VAL_6:.*]] = torch.constant.int 3
|
||||
// CHECK: %[[VAL_7:.*]] = torch_c.to_i64 %[[VAL_6]]
|
||||
// CHECK: %[[VAL_8:.*]] = torch.constant.int 4
|
||||
// CHECK: %[[VAL_9:.*]] = torch_c.to_i64 %[[VAL_8]]
|
||||
// CHECK: %[[VAL_10:.*]] = scf.if %[[VAL_2]] -> (i64) {
|
||||
// CHECK: %[[VAL_11:.*]] = scf.if %[[VAL_3]] -> (i64) {
|
||||
// CHECK: scf.yield %[[VAL_5]] : i64
|
||||
// CHECK: } else {
|
||||
// CHECK: %[[VAL_10:.*]] = torch_c.to_i64 %[[VAL_3]]
|
||||
// CHECK: scf.yield %[[VAL_10]] : i64
|
||||
// CHECK: scf.yield %[[VAL_7]] : i64
|
||||
// CHECK: }
|
||||
// CHECK: scf.yield %[[VAL_11:.*]] : i64
|
||||
// CHECK: scf.yield %[[VAL_12:.*]] : i64
|
||||
// CHECK: } else {
|
||||
// CHECK: %[[VAL_12:.*]] = torch_c.to_i64 %[[VAL_4]]
|
||||
// CHECK: scf.yield %[[VAL_12]] : i64
|
||||
// CHECK: scf.yield %[[VAL_9]] : i64
|
||||
// CHECK: }
|
||||
// CHECK: %[[VAL_13:.*]] = torch_c.from_i64 %[[VAL_14:.*]]
|
||||
// CHECK: return %[[VAL_13]] : !torch.int
|
||||
|
|
|
@ -5,22 +5,16 @@
|
|||
|
||||
// CHECK-LABEL: func @identity(
|
||||
// CHECK-SAME: %[[ARG:.*]]: tensor<f32>) -> tensor<f32> {
|
||||
// CHECK: %[[TENSOR:.*]] = torch_c.from_builtin_tensor %[[ARG]] : tensor<f32> -> !torch.vtensor<[],f32>
|
||||
// CHECK: %[[MEMREF:.*]] = torch_c.to_builtin_tensor %[[TENSOR]] : !torch.vtensor<[],f32> -> tensor<f32>
|
||||
// CHECK: return %[[MEMREF]] : tensor<f32>
|
||||
// CHECK: return %[[ARG]] : tensor<f32>
|
||||
func @identity(%arg0: !torch.vtensor<[],f32>) -> !torch.vtensor<[],f32> {
|
||||
return %arg0 : !torch.vtensor<[],f32>
|
||||
}
|
||||
|
||||
// CHECK-LABEL: func @block_arguments(
|
||||
// CHECK-SAME: %[[ARG:.*]]: tensor<f32>) -> tensor<f32> {
|
||||
// CHECK: %[[T1:.*]] = torch_c.from_builtin_tensor %[[ARG]] : tensor<f32> -> !torch.vtensor<[],f32>
|
||||
// CHECK: %[[M1:.*]] = torch_c.to_builtin_tensor %[[T1]] : !torch.vtensor<[],f32> -> tensor<f32>
|
||||
// CHECK: br ^bb1(%[[M1]] : tensor<f32>)
|
||||
// CHECK: br ^bb1(%[[ARG]] : tensor<f32>)
|
||||
// CHECK: ^bb1(%[[BBARG:.*]]: tensor<f32>):
|
||||
// CHECK: %[[T2:.*]] = torch_c.from_builtin_tensor %[[BBARG]] : tensor<f32> -> !torch.vtensor<[],f32>
|
||||
// CHECK: %[[M2:.*]] = torch_c.to_builtin_tensor %[[T2]] : !torch.vtensor<[],f32> -> tensor<f32>
|
||||
// CHECK: return %[[M2]] : tensor<f32>
|
||||
// CHECK: return %[[BBARG]] : tensor<f32>
|
||||
func @block_arguments(%arg0: !torch.vtensor<[],f32>) -> !torch.vtensor<[],f32> {
|
||||
br ^bb1(%arg0: !torch.vtensor<[],f32>)
|
||||
^bb1(%bbarg: !torch.vtensor<[],f32>):
|
||||
|
@ -38,9 +32,7 @@ func @call_source() -> !torch.vtensor<[],f32> {
|
|||
}
|
||||
// CHECK-LABEL: func @call_sink(
|
||||
// CHECK-SAME: %[[ARG:.*]]: tensor<f32>) {
|
||||
// CHECK: %[[TENSOR:.*]] = torch_c.from_builtin_tensor %[[ARG]] : tensor<f32> -> !torch.vtensor<[],f32>
|
||||
// CHECK: %[[MEMREF:.*]] = torch_c.to_builtin_tensor %[[TENSOR]] : !torch.vtensor<[],f32> -> tensor<f32>
|
||||
// CHECK: call @sink(%[[MEMREF]]) : (tensor<f32>) -> ()
|
||||
// CHECK: call @sink(%[[ARG]]) : (tensor<f32>) -> ()
|
||||
// CHECK: return
|
||||
func private @sink(!torch.vtensor<[],f32>)
|
||||
func @call_sink(%arg0: !torch.vtensor<[],f32>) {
|
||||
|
@ -50,8 +42,8 @@ func @call_sink(%arg0: !torch.vtensor<[],f32>) {
|
|||
|
||||
// CHECK-LABEL: func @unconverted_op_in_body() -> tensor<f32> {
|
||||
// CHECK: %[[TENSOR:.*]] = "test.source"() : () -> !torch.vtensor<[],f32>
|
||||
// CHECK: %[[MEMREF:.*]] = torch_c.to_builtin_tensor %[[TENSOR]] : !torch.vtensor<[],f32> -> tensor<f32>
|
||||
// CHECK: return %[[MEMREF]] : tensor<f32>
|
||||
// CHECK: %[[BUILTIN_TENSOR:.*]] = torch_c.to_builtin_tensor %[[TENSOR]] : !torch.vtensor<[],f32> -> tensor<f32>
|
||||
// CHECK: return %[[BUILTIN_TENSOR]] : tensor<f32>
|
||||
func @unconverted_op_in_body() -> !torch.vtensor<[],f32> {
|
||||
%0 = "test.source"() : () -> !torch.vtensor<[],f32>
|
||||
return %0 : !torch.vtensor<[],f32>
|
||||
|
@ -98,27 +90,21 @@ func @bwhile(%arg0: i64, %arg1: i64) -> i64 {
|
|||
|
||||
// CHECK-LABEL: func @identity$torch.bool(
|
||||
// CHECK-SAME: %[[ARG:.*]]: i1) -> i1 {
|
||||
// CHECK: %[[TORCH_BOOL:.*]] = torch_c.from_i1 %[[ARG]]
|
||||
// CHECK: %[[I1:.*]] = torch_c.to_i1 %[[TORCH_BOOL]]
|
||||
// CHECK: return %[[I1]] : i1
|
||||
// CHECK: return %[[ARG]] : i1
|
||||
func @identity$torch.bool(%arg0: !torch.bool) -> !torch.bool {
|
||||
return %arg0 : !torch.bool
|
||||
}
|
||||
|
||||
// CHECK-LABEL: func @identity$torch.int(
|
||||
// CHECK-SAME: %[[ARG:.*]]: i64) -> i64 {
|
||||
// CHECK: %[[TORCH_INT:.*]] = torch_c.from_i64 %[[ARG]]
|
||||
// CHECK: %[[I64:.*]] = torch_c.to_i64 %[[TORCH_INT]]
|
||||
// CHECK: return %[[I64]] : i64
|
||||
// CHECK: return %[[ARG]] : i64
|
||||
func @identity$torch.int(%arg0: !torch.int) -> !torch.int {
|
||||
return %arg0 : !torch.int
|
||||
}
|
||||
|
||||
// CHECK-LABEL: func @identity$torch.float(
|
||||
// CHECK-SAME: %[[ARG:.*]]: f64) -> f64 {
|
||||
// CHECK: %[[TORCH_FLOAT:.*]] = torch_c.from_f64 %[[ARG]]
|
||||
// CHECK: %[[F64:.*]] = torch_c.to_f64 %[[TORCH_FLOAT]]
|
||||
// CHECK: return %[[F64]] : f64
|
||||
// CHECK: return %[[ARG]] : f64
|
||||
func @identity$torch.float(%arg0: !torch.float) -> !torch.float {
|
||||
return %arg0 : !torch.float
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue