diff --git a/WORKSPACE b/WORKSPACE index 15d22f3..916c23a 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -15,9 +15,9 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -LLVM_COMMIT = "20d5c42e0ef5d252b434bcb610b04f1cb79fe771" +LLVM_COMMIT = "482283042f795ecc27838a3b2f76b5494991401c" -LLVM_SHA256 = "d5ec1b6318510c8bc349c41edf985d087785fc6ae63274d1319a344f30eabfc6" +LLVM_SHA256 = "350b8bd0def4bef191b512a79923c3e591e47b189d63e37abf149ac4751d2334" LLVM_BAZEL_TAG = "llvm-project-{commit}".format(commit = LLVM_COMMIT) diff --git a/build_tools/llvm_version.txt b/build_tools/llvm_version.txt index a8215c4..e785cdd 100644 --- a/build_tools/llvm_version.txt +++ b/build_tools/llvm_version.txt @@ -1,2 +1,2 @@ -20d5c42e0ef5d252b434bcb610b04f1cb79fe771 +482283042f795ecc27838a3b2f76b5494991401c diff --git a/include/mlir-hlo/Dialect/mhlo/IR/chlo_ops.td b/include/mlir-hlo/Dialect/mhlo/IR/chlo_ops.td index b3f81a0..96b9437 100644 --- a/include/mlir-hlo/Dialect/mhlo/IR/chlo_ops.td +++ b/include/mlir-hlo/Dialect/mhlo/IR/chlo_ops.td @@ -80,7 +80,7 @@ class HLOClient_BroadcastBinaryElementwiseOp< HLOClient_Op])> { + ["inferReturnTypeComponents", "reifyReturnTypeShapes"]>])> { let arguments = (ins HLO_Tensor:$lhs, HLO_Tensor:$rhs, @@ -558,7 +558,8 @@ def HLOClient_TanOp : HLOClient_UnaryElementwiseOp<"tan", def HLOClient_ConstantLikeOp : HLOClient_Op<"constant_like", [NoSideEffect, SameOperandsAndResultShape, InferTypeOpInterface, - DeclareOpInterfaceMethods, + DeclareOpInterfaceMethods, NativeOpTrait<"InferTensorType">]> { let summary = "Constant like operator"; @@ -684,7 +685,9 @@ def HLOClient_BroadcastCompareOp : HLOClient_BroadcastBinaryElementwiseOp< def HLOClient_BroadcastSelectOp : HLOClient_Op< "broadcast_select", - [NoSideEffect, DeclareOpInterfaceMethods]> { + [NoSideEffect, + DeclareOpInterfaceMethods]> { string summary = "Select operator (with optional numpy-style broadcasting)"; string description = [{ diff --git a/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops.td b/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops.td index 52a5a49..aab5981 100644 --- a/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops.td +++ b/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops.td @@ -677,7 +677,8 @@ def HLO_TupleOp : HLO_Op<"tuple", [NoSideEffect]>, BASE_HLO_TupleOp { def HLO_CompareOp: HLO_Op<"compare", [NoSideEffect, SameTypeOperands, SameOperandsAndResultShape, DeclareOpInterfaceMethods]>, BASE_HLO_CompareOp { + ["inferReturnTypeComponents", "reifyReturnTypeShapes"]>]>, + BASE_HLO_CompareOp { let arguments = (ins HLO_Tensor:$lhs, HLO_Tensor:$rhs, @@ -827,7 +828,7 @@ def HLO_BroadcastInDimOp : HLO_Op<"broadcast_in_dim", def HLO_DynamicBroadcastInDimOp : HLO_Op<"dynamic_broadcast_in_dim", [ NoSideEffect, DeclareOpInterfaceMethods]> { + ["inferReturnTypeComponents", "reifyReturnTypeShapes"]>]> { string summary = "Broadcast a tensor into the given dynamic shape by adding dimensions."; string description = [{ This is a generalization of the BroadcastInDimOp which accepts its output @@ -1114,7 +1115,8 @@ def HLO_ScatterOp: HLO_Op<"scatter", [RecursiveSideEffects]>, // TODO(jpienaar): Add broadcastable trait. def HLO_SelectOp: HLO_Op<"select", [NoSideEffect, DeclareOpInterfaceMethods, DeclareOpInterfaceMethods, + ["inferReturnTypeComponents", "reifyReturnTypeShapes"]>, + DeclareOpInterfaceMethods, ]>, BASE_HLO_SelectOp { let arguments = (ins HLO_PredTensor:$pred, diff --git a/tests/move_up_dynamic_broadcasts_for_fusion.mlir b/tests/move_up_dynamic_broadcasts_for_fusion.mlir index 3e97be9..9a36180 100644 --- a/tests/move_up_dynamic_broadcasts_for_fusion.mlir +++ b/tests/move_up_dynamic_broadcasts_for_fusion.mlir @@ -4,9 +4,8 @@ // CHECK-LABEL: @shape_of_unary // CHECK-SAME: (%[[ARG:.*]]: tensor) func @shape_of_unary(%arg : tensor) { - // CHECK: %[[SHAPE:.*]] = shape.shape_of %[[ARG]] : tensor -> tensor<2xindex> - // CHECK: %[[CASTED:.*]] = tensor.cast %[[SHAPE]] : tensor<2xindex> to tensor - // CHECK: "use"(%[[CASTED]]) + // CHECK: %[[SHAPE:.*]] = shape.shape_of %[[ARG]] : tensor -> tensor + // CHECK: "use"(%[[SHAPE]]) %0 = "mhlo.convert"(%arg) : (tensor) -> tensor %1 = shape.shape_of %0 : tensor -> tensor "use"(%1) : (tensor) -> () @@ -19,9 +18,8 @@ func @shape_of_unary(%arg : tensor) { // CHECK-LABEL: @shape_of_nary // CHECK-SAME: (%[[ARG0:.*]]: tensor, %[[ARG1:.*]]: tensor) func @shape_of_nary(%arg0 : tensor, %arg1 : tensor) { - // CHECK: %[[SHAPE:.*]] = shape.shape_of %[[ARG0]] : tensor -> tensor<2xindex> - // CHECK: %[[CASTED:.*]] = tensor.cast %[[SHAPE]] : tensor<2xindex> to tensor - // CHECK: "use"(%[[CASTED]]) + // CHECK: %[[SHAPE:.*]] = shape.shape_of %[[ARG0]] : tensor -> tensor + // CHECK: "use"(%[[SHAPE]]) %0 = mhlo.subtract %arg0, %arg1 : tensor %1 = mhlo.subtract %0, %arg1 : tensor %2 = shape.shape_of %1 : tensor -> tensor