From f6d0806cdf273a42219dabfb30894fc4b3b7f8f9 Mon Sep 17 00:00:00 2001 From: hamptonm1 <79232909+hamptonm1@users.noreply.github.com> Date: Fri, 20 Dec 2024 10:24:13 -0500 Subject: [PATCH] Update llvm-project to llvm/llvm-project@af20aff35ec3 (#3032) Co-authored-by: Megan Hampton --- docs/BuildOnLinuxOSX.md | 2 +- docs/BuildOnWindows.md | 2 +- .../Tensor/GatherElements.mlir | 30 +++++++++++-------- third_party/stablehlo | 2 +- utils/clone-mlir.sh | 2 +- 5 files changed, 21 insertions(+), 17 deletions(-) diff --git a/docs/BuildOnLinuxOSX.md b/docs/BuildOnLinuxOSX.md index 7cf2d5467c..4bf2fcffea 100644 --- a/docs/BuildOnLinuxOSX.md +++ b/docs/BuildOnLinuxOSX.md @@ -15,7 +15,7 @@ Firstly, install MLIR (as a part of LLVM-Project): ``` bash git clone -n https://github.com/llvm/llvm-project.git # Check out a specific branch that is known to work with ONNX-MLIR. -cd llvm-project && git checkout 01d233ff403823389f8480897e41aea84ecbb3d3 && cd .. +cd llvm-project && git checkout af20aff35ec37ead88903bc3e44f6a81c5c9ca4e && cd .. ``` [same-as-file]: <> (utils/build-mlir.sh) diff --git a/docs/BuildOnWindows.md b/docs/BuildOnWindows.md index 8b53b1d4f9..64b6387e23 100644 --- a/docs/BuildOnWindows.md +++ b/docs/BuildOnWindows.md @@ -52,7 +52,7 @@ Install MLIR (as a part of LLVM-Project): ```shell git clone -n https://github.com/llvm/llvm-project.git # Check out a specific branch that is known to work with ONNX-MLIR. -cd llvm-project && git checkout 01d233ff403823389f8480897e41aea84ecbb3d3 && cd .. +cd llvm-project && git checkout af20aff35ec37ead88903bc3e44f6a81c5c9ca4e && cd .. ``` [same-as-file]: <> (utils/build-mlir.cmd) diff --git a/test/mlir/conversion/onnx_to_stablehlo/Tensor/GatherElements.mlir b/test/mlir/conversion/onnx_to_stablehlo/Tensor/GatherElements.mlir index a5893a6833..15de997cad 100644 --- a/test/mlir/conversion/onnx_to_stablehlo/Tensor/GatherElements.mlir +++ b/test/mlir/conversion/onnx_to_stablehlo/Tensor/GatherElements.mlir @@ -3,17 +3,21 @@ func.func @main_gather_elements(%arg0: tensor<3x2xf32>, %arg1: tensor<2x2xi64>) -> tensor<2x2xf32> { %0 = "onnx.GatherElements"(%arg0, %arg1) {axis = 0 : si64} : (tensor<3x2xf32>, tensor<2x2xi64>) -> tensor<2x2xf32> return %0 : tensor<2x2xf32> -// CHECK: func.func @main_gather_elements([[PARAM_0_:%.+]]: tensor<3x2xf32>, [[PARAM_1_:%.+]]: tensor<2x2xi64>) -> tensor<2x2xf32> { -// CHECK-DAG: [[CST_:%.+]] = arith.constant dense<[2, 2, 1]> : tensor<3xindex> -// CHECK-DAG: [[VAR_0_:%.+]] = stablehlo.constant dense<3> : tensor -// CHECK-DAG: [[VAR_1_:%.+]] = stablehlo.constant dense<0> : tensor<2x2xi64> -// CHECK-DAG: [[VAR_2_:%.+]] = stablehlo.broadcast_in_dim [[VAR_0_]], dims = [] : (tensor) -> tensor<2x2xi64> -// CHECK-DAG: [[VAR_3_:%.+]] = stablehlo.compare LT, [[PARAM_1_]], [[VAR_1_]] : (tensor<2x2xi64>, tensor<2x2xi64>) -> tensor<2x2xi1> -// CHECK-DAG: [[VAR_4_:%.+]] = stablehlo.add [[PARAM_1_]], [[VAR_2_]] : tensor<2x2xi64> -// CHECK-NEXT: [[VAR_5_:%.+]] = stablehlo.select [[VAR_3_]], [[VAR_4_]], [[PARAM_1_]] : tensor<2x2xi1>, tensor<2x2xi64> -// CHECK-DAG: [[VAR_6_:%.+]] = stablehlo.dynamic_reshape [[VAR_5_]], [[CST_]] : (tensor<2x2xi64>, tensor<3xindex>) -> tensor<2x2x1xi64> -// CHECK-DAG: [[VAR_7_:%.+]] = stablehlo.dynamic_iota [[CST_]], dim = 1 : (tensor<3xindex>) -> tensor<2x2x1xi64> -// CHECK-NEXT: [[VAR_8_:%.+]] = stablehlo.concatenate [[VAR_6_]], [[VAR_7_]], dim = 2 : (tensor<2x2x1xi64>, tensor<2x2x1xi64>) -> tensor<2x2x2xi64> -// CHECK-NEXT: [[VAR_9_:%.+]] = "stablehlo.gather"([[PARAM_0_]], [[VAR_8_]]) <{dimension_numbers = #stablehlo.gather, indices_are_sorted = false, slice_sizes = array}> : (tensor<3x2xf32>, tensor<2x2x2xi64>) -> tensor<2x2xf32> -// CHECK-NEXT: return [[VAR_9_]] : tensor<2x2xf32> +// mlir2FileCheck.py +// CHECK-LABEL: func.func @main_gather_elements +// CHECK-SAME: ([[PARAM_0_:%.+]]: tensor<3x2xf32>, [[PARAM_1_:%.+]]: tensor<2x2xi64>) -> tensor<2x2xf32> { +// CHECK-DAG: [[VAR_cst_:%.+]] = arith.constant dense<[2, 2, 1]> : tensor<3xindex> +// CHECK-DAG: [[VAR_c_:%.+]] = stablehlo.constant dense<3> : tensor +// CHECK-DAG: [[VAR_c_0_:%.+]] = stablehlo.constant dense<0> : tensor<2x2xi64> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_0_:%.+]] = stablehlo.broadcast_in_dim [[VAR_c_]], dims = [] : (tensor) -> tensor<2x2xi64> +// CHECK-DAG: [[VAR_1_:%.+]] = stablehlo.compare LT, [[PARAM_1_]], [[VAR_c_0_]] : (tensor<2x2xi64>, tensor<2x2xi64>) -> tensor<2x2xi1> +// CHECK: [[VAR_2_:%.+]] = stablehlo.add [[PARAM_1_]], [[VAR_0_]] : tensor<2x2xi64> +// CHECK: [[VAR_3_:%.+]] = stablehlo.select [[VAR_1_]], [[VAR_2_]], [[PARAM_1_]] : tensor<2x2xi1>, tensor<2x2xi64> +// CHECK-DAG: [[VAR_4_:%.+]] = stablehlo.dynamic_reshape [[VAR_3_]], [[VAR_cst_]] : (tensor<2x2xi64>, tensor<3xindex>) -> tensor<2x2x1xi64> +// CHECK-DAG: [[VAR_5_:%.+]] = stablehlo.dynamic_iota [[VAR_cst_]], dim = 1 : (tensor<3xindex>) -> tensor<2x2x1xi64> +// CHECK: [[VAR_6_:%.+]] = stablehlo.concatenate [[VAR_4_]], [[VAR_5_]], dim = 2 : (tensor<2x2x1xi64>, tensor<2x2x1xi64>) -> tensor<2x2x2xi64> +// CHECK: [[VAR_7_:%.+]] = "stablehlo.gather"([[PARAM_0_]], [[VAR_6_]]) <{dimension_numbers = #stablehlo.gather, slice_sizes = array}> : (tensor<3x2xf32>, tensor<2x2x2xi64>) -> tensor<2x2xf32> +// CHECK: return [[VAR_7_]] : tensor<2x2xf32> +// CHECK: } } \ No newline at end of file diff --git a/third_party/stablehlo b/third_party/stablehlo index 37487a8ee0..54dafb1c41 160000 --- a/third_party/stablehlo +++ b/third_party/stablehlo @@ -1 +1 @@ -Subproject commit 37487a8ee0783f29eff64910702074ba52bf6c5c +Subproject commit 54dafb1c4104707fb15d35dfa125631c4761f158 diff --git a/utils/clone-mlir.sh b/utils/clone-mlir.sh index aea9f011a8..7f61e97f83 100644 --- a/utils/clone-mlir.sh +++ b/utils/clone-mlir.sh @@ -1,3 +1,3 @@ git clone -n https://github.com/llvm/llvm-project.git # Check out a specific branch that is known to work with ONNX-MLIR. -cd llvm-project && git checkout 01d233ff403823389f8480897e41aea84ecbb3d3 && cd .. +cd llvm-project && git checkout af20aff35ec37ead88903bc3e44f6a81c5c9ca4e && cd ..