From 04291aea6b50d9573e6f4de184938d83b9564cd0 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Fri, 3 Nov 2023 11:36:09 -0700 Subject: [PATCH] Integrate LLVM at llvm/llvm-project@46732e2abb34 (#1822) --- WORKSPACE.bazel | 4 ++-- build_tools/llvm_version.txt | 2 +- stablehlo/conversions/tosa/tests/nullary.mlir | 8 ++++---- .../tosa/transforms/StablehloLegalizeToTosa.cpp | 5 +++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index b23f84ff7f3..2a501a6f357 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -28,9 +28,9 @@ http_archive( ], ) -LLVM_COMMIT = "6ae7b735dbd50eb7ade1573a86d037a2943e679c" +LLVM_COMMIT = "46732e2abb34fd7a5c1d52b959d4d07f118479dd" -LLVM_SHA256 = "fb798e60da1f6d55fa44ec9c44e7e8765b33bc23ed4a497e8370d62332be0f5f" +LLVM_SHA256 = "6e493b00b558d5c30dff9d6089747e8e5a355f0111730ff8053863e72fba37bd" http_archive( name = "llvm-raw", diff --git a/build_tools/llvm_version.txt b/build_tools/llvm_version.txt index 5d5aafef8bb..735708cd62f 100644 --- a/build_tools/llvm_version.txt +++ b/build_tools/llvm_version.txt @@ -1 +1 @@ -6ae7b735dbd50eb7ade1573a86d037a2943e679c +46732e2abb34fd7a5c1d52b959d4d07f118479dd diff --git a/stablehlo/conversions/tosa/tests/nullary.mlir b/stablehlo/conversions/tosa/tests/nullary.mlir index b584d0ef8c9..e9882bdd1d3 100644 --- a/stablehlo/conversions/tosa/tests/nullary.mlir +++ b/stablehlo/conversions/tosa/tests/nullary.mlir @@ -17,16 +17,16 @@ func.func @constant_f64() -> tensor<10xf64> { // CHECK-LABEL: @iota_dimension_0 func.func @iota_dimension_0() -> tensor<4x8xf32> { - // CHECK-DAG: %[[VAR0:.*]] = "tosa.const"() <{value = dense<[0.000000e+00, 1.000000e+00, 2.000000e+00, 3.000000e+00]> : tensor<4xf32>}> - // CHECK-DAG: %[[VAR1:.*]] = tosa.tile %[[VAR0]] {multiples = array} + // CHECK-DAG: %[[VAR0:.*]] = "tosa.const"() + // CHECK-SAME{LITERAL}: <{value = dense<[[0.000000e+00], [1.000000e+00], [2.000000e+00], [3.000000e+00]]> : tensor<4x1xf32>}> %0 = "stablehlo.iota"() {iota_dimension = 0 : i64} : () -> (tensor<4x8xf32>) return %0 : tensor<4x8xf32> } // CHECK-LABEL: @iota_dimension_1 func.func @iota_dimension_1() -> tensor<4x8xi32> { - // CHECK-DAG: %[[VAR0:.*]] = "tosa.const"() <{value = dense<[0, 1, 2, 3, 4, 5, 6, 7]> : tensor<8xi32>}> - // CHECK-DAG: %[[VAR1:.*]] = tosa.tile %[[VAR0]] {multiples = array} + // CHECK-DAG: %[[VAR0:.*]] = "tosa.const"() + // CHECK-SAME{LITERAL}: <{value = dense<[[0, 1, 2, 3, 4, 5, 6, 7]]> : tensor<1x8xi32>}> %0 = "stablehlo.iota"() {iota_dimension = 1 : i64} : () -> (tensor<4x8xi32>) return %0 : tensor<4x8xi32> } diff --git a/stablehlo/conversions/tosa/transforms/StablehloLegalizeToTosa.cpp b/stablehlo/conversions/tosa/transforms/StablehloLegalizeToTosa.cpp index f2d26566f6d..020879ccc7c 100644 --- a/stablehlo/conversions/tosa/transforms/StablehloLegalizeToTosa.cpp +++ b/stablehlo/conversions/tosa/transforms/StablehloLegalizeToTosa.cpp @@ -213,8 +213,9 @@ struct ConvertStablehloIotaOp : public OpRewritePattern { } } - RankedTensorType constType = - RankedTensorType::get(iotaArrayLength, elementType); + llvm::SmallVector constShape(resultShape.size(), 1); + constShape[iotaDimension] = resultShape[iotaDimension]; + RankedTensorType constType = RankedTensorType::get(constShape, elementType); auto constOp = rewriter.create( op.getLoc(), constType, DenseElementsAttr::get(constType, constValues));