From bfc368b4f8b0718712c077c50030fe06196290fd Mon Sep 17 00:00:00 2001 From: Marius Brehler Date: Fri, 12 Jan 2024 13:45:11 +0000 Subject: [PATCH] Integrate LLVM at llvm/llvm-project@ba4cf31f Updates LLVM usage to match llvm/llvm-project@ba4cf31f. Further updates the StableHLO submodule to openxla/stablehlo@11804dd. This also renames the CMake target `MLIREmitCTransforms` to `MLIREmitCTransformsLocal` as the former is now defined upstream. --- build_tools/llvm_version.txt | 2 +- .../Dialect/EmitC/Transforms/CMakeLists.txt | 2 +- .../StablehloRegionOpsToEmitC.cpp | 16 ++++++++-------- .../StablehloToEmitC/StablehloToEmitC.cpp | 13 ++++++------- lib/Dialect/EmitC/Transforms/CMakeLists.txt | 2 +- third_party/stablehlo | 2 +- tools/emitc-opt/CMakeLists.txt | 2 +- 7 files changed, 19 insertions(+), 20 deletions(-) diff --git a/build_tools/llvm_version.txt b/build_tools/llvm_version.txt index e817b738..4df9b944 100644 --- a/build_tools/llvm_version.txt +++ b/build_tools/llvm_version.txt @@ -1 +1 @@ -b2cdf3cc4c08729d0ff582d55e40793a20bbcdcc +ba4cf31facdaf9bb9943c057d325ff0968331e9a diff --git a/include/emitc/Dialect/EmitC/Transforms/CMakeLists.txt b/include/emitc/Dialect/EmitC/Transforms/CMakeLists.txt index 8213dd69..d7f79c6e 100644 --- a/include/emitc/Dialect/EmitC/Transforms/CMakeLists.txt +++ b/include/emitc/Dialect/EmitC/Transforms/CMakeLists.txt @@ -1,3 +1,3 @@ set(LLVM_TARGET_DEFINITIONS Passes.td) -mlir_tablegen(Passes.h.inc -gen-pass-decls -name EmitC) +mlir_tablegen(Passes.h.inc -gen-pass-decls -name EmitCLocal) add_public_tablegen_target(MLIREmitCPassIncGen) diff --git a/lib/Conversion/StablehloToEmitC/StablehloRegionOpsToEmitC.cpp b/lib/Conversion/StablehloToEmitC/StablehloRegionOpsToEmitC.cpp index ff396442..55185b2b 100644 --- a/lib/Conversion/StablehloToEmitC/StablehloRegionOpsToEmitC.cpp +++ b/lib/Conversion/StablehloToEmitC/StablehloRegionOpsToEmitC.cpp @@ -156,7 +156,7 @@ struct ConvertStablehloRegionOpsToEmitCPass SmallVector arguments = indexSequence(operands.size(), op.getContext()); - arguments.push_back(op.getDimensions()); + arguments.push_back(builder.getI64TensorAttr(op.getDimensions())); arguments.push_back(SymbolRefAttr::get(ctx, funcOp.getName())); ArrayAttr args = ArrayAttr::get(ctx, arguments); @@ -192,13 +192,13 @@ struct ConvertStablehloRegionOpsToEmitCPass SmallVector arguments = indexSequence(operands.size(), ctx); size_t dim = op.getResult(0).getType().cast().getRank(); - arguments.push_back(op.getWindowDimensions()); - arguments.push_back(op.getWindowStrides().value_or( - builder.getI64TensorAttr(SmallVector(dim, 1)))); - arguments.push_back(op.getBaseDilations().value_or( - builder.getI64TensorAttr(SmallVector(dim, 1)))); - arguments.push_back(op.getBaseDilations().value_or( - builder.getI64TensorAttr(SmallVector(dim, 1)))); + arguments.push_back(builder.getI64TensorAttr(op.getWindowDimensions())); + arguments.push_back(builder.getI64TensorAttr( + op.getWindowStrides().value_or(SmallVector(dim, 1)))); + arguments.push_back(builder.getI64TensorAttr( + op.getBaseDilations().value_or(SmallVector(dim, 1)))); + arguments.push_back(builder.getI64TensorAttr( + op.getBaseDilations().value_or(SmallVector(dim, 1)))); arguments.push_back(op.getPadding().value_or( builder.getI64TensorAttr(SmallVector(2 * dim, 0)))); arguments.push_back(SymbolRefAttr::get(ctx, funcOp.getName())); diff --git a/lib/Conversion/StablehloToEmitC/StablehloToEmitC.cpp b/lib/Conversion/StablehloToEmitC/StablehloToEmitC.cpp index 549f2895..2ea66bb3 100644 --- a/lib/Conversion/StablehloToEmitC/StablehloToEmitC.cpp +++ b/lib/Conversion/StablehloToEmitC/StablehloToEmitC.cpp @@ -182,15 +182,14 @@ class ConvOpConversion : public OpConversionPattern { arguments.push_back(rewriter.getI64TensorAttr( convOp.getDimensionNumbers().getOutputSpatialDimensions())); arguments.push_back(convOp.getFeatureGroupCountAttr()); - arguments.push_back(convOp.getPadding().value_or( rewriter.getI64TensorAttr(SmallVector(2, 0)))); - arguments.push_back(convOp.getLhsDilation().value_or( - rewriter.getI64TensorAttr(SmallVector(2, 1)))); - arguments.push_back(convOp.getRhsDilation().value_or( - rewriter.getI64TensorAttr(SmallVector(2, 1)))); - arguments.push_back(convOp.getWindowStrides().value_or( - rewriter.getI64TensorAttr(SmallVector(2, 1)))); + arguments.push_back(rewriter.getI64TensorAttr( + convOp.getLhsDilation().value_or((SmallVector(2, 1))))); + arguments.push_back(rewriter.getI64TensorAttr( + convOp.getRhsDilation().value_or((SmallVector(2, 1))))); + arguments.push_back(rewriter.getI64TensorAttr( + convOp.getWindowStrides().value_or((SmallVector(2, 1))))); ArrayAttr args = rewriter.getArrayAttr(arguments); ArrayAttr templateArgs = diff --git a/lib/Dialect/EmitC/Transforms/CMakeLists.txt b/lib/Dialect/EmitC/Transforms/CMakeLists.txt index e4000b88..e5355543 100644 --- a/lib/Dialect/EmitC/Transforms/CMakeLists.txt +++ b/lib/Dialect/EmitC/Transforms/CMakeLists.txt @@ -1,4 +1,4 @@ -add_mlir_library(MLIREmitCTransforms +add_mlir_library(MLIREmitCTransformsLocal InsertIncludes.cpp DEPENDS diff --git a/third_party/stablehlo b/third_party/stablehlo index 3bdd8593..11804dd3 160000 --- a/third_party/stablehlo +++ b/third_party/stablehlo @@ -1 +1 @@ -Subproject commit 3bdd8593a46ababb362928187d58ccc418e15b99 +Subproject commit 11804dd311bcb5630074cd48a67caad823385dd3 diff --git a/tools/emitc-opt/CMakeLists.txt b/tools/emitc-opt/CMakeLists.txt index e83327de..1ac88f93 100644 --- a/tools/emitc-opt/CMakeLists.txt +++ b/tools/emitc-opt/CMakeLists.txt @@ -40,7 +40,7 @@ set(LIBS MLIRArithToEmitC MLIRTensorToEmitC MLIRTosaToEmitC - MLIREmitCTransforms + MLIREmitCTransformsLocal MLIREmitCPipelines ${HLO_LIBS} )