From 4578c736bcdf7e2c2eaf0f137d25e5e248431017 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 1 Oct 2024 16:50:07 +0000 Subject: [PATCH 1/2] Integrate LLVM at llvm/llvm-project@ac2a2816e3fe --- WORKSPACE.bazel | 4 ++-- build_tools/llvm_version.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index d79c95f0f9..508bd9b551 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -17,9 +17,9 @@ workspace(name = "stablehlo") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -LLVM_COMMIT = "29b92d07746fac26cd64c914bc9c5c3833974f6d" +LLVM_COMMIT = "ac2a2816e3fe934998e5f950c9426fca0796929d" -LLVM_SHA256 = "3e8e93e3749454af4b64f7f34b792a4748b62fc533bca1703d33b2b04e34eb70" +LLVM_SHA256 = "bfcec3c9a582ab71c1e4a212e5a7cfe2c9a8164331a0b728da5c8a99d81c46de" http_archive( name = "llvm-raw", diff --git a/build_tools/llvm_version.txt b/build_tools/llvm_version.txt index 547d6a6cd6..7d3ed19c23 100644 --- a/build_tools/llvm_version.txt +++ b/build_tools/llvm_version.txt @@ -1 +1 @@ -29b92d07746fac26cd64c914bc9c5c3833974f6d +ac2a2816e3fe934998e5f950c9426fca0796929d From b64ce0c717a343fa16f2e44213ef2dfcb46cc387 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 1 Oct 2024 17:24:37 +0000 Subject: [PATCH 2/2] remove expander test file --- examples/c++/ExampleAdd.cpp | 4 ++-- .../tosa/transforms/StablehloQuantLegalizeToTosaRescale.cpp | 2 +- .../tosa/transforms/TosaRescaleLegalizeToStablehlo.cpp | 2 +- stablehlo/dialect/Base.cpp | 2 +- stablehlo/dialect/ChloOps.h | 2 +- stablehlo/dialect/Register.cpp | 4 ++-- stablehlo/dialect/StablehloOps.cpp | 2 +- stablehlo/dialect/StablehloOps.h | 2 +- stablehlo/dialect/TypeInference.cpp | 2 +- stablehlo/dialect/VhloTypes.cpp | 2 +- stablehlo/reference/Api.cpp | 2 +- stablehlo/tests/CheckOps.h | 2 +- stablehlo/tests/ops_stablehlo_quantized.mlir | 6 +++--- stablehlo/tools/StablehloTranslateMain.cpp | 4 ++-- stablehlo/transforms/Passes.h | 2 +- stablehlo/transforms/Passes.td | 2 +- stablehlo/transforms/StablehloLegalizeQDQToQuantizedOp.cpp | 2 +- stablehlo/transforms/StablehloLegalizeQuantToMath.cpp | 6 +++--- stablehlo/transforms/StablehloLegalizeQuantizedOpToQDQ.cpp | 2 +- 19 files changed, 26 insertions(+), 26 deletions(-) diff --git a/examples/c++/ExampleAdd.cpp b/examples/c++/ExampleAdd.cpp index d90b8b3e7f..1161723acd 100644 --- a/examples/c++/ExampleAdd.cpp +++ b/examples/c++/ExampleAdd.cpp @@ -18,7 +18,7 @@ limitations under the License. #include "llvm/ADT/SmallVector.h" #include "llvm/Support/LogicalResult.h" #include "mlir/Dialect/Func/IR/FuncOps.h" -#include "mlir/Dialect/Quant/QuantOps.h" +#include "mlir/Dialect/Quant/IR/Quant.h" #include "mlir/IR/Attributes.h" #include "mlir/IR/Block.h" #include "mlir/IR/Builders.h" @@ -43,7 +43,7 @@ int main() { mlir::ModuleOp::create(mlir::UnknownLoc::get(&context)); module->getContext()->loadDialect(); module->getContext()->loadDialect(); - module->getContext()->loadDialect(); + module->getContext()->loadDialect(); module->setName("test_module"); /** create function **/ diff --git a/stablehlo/conversions/tosa/transforms/StablehloQuantLegalizeToTosaRescale.cpp b/stablehlo/conversions/tosa/transforms/StablehloQuantLegalizeToTosaRescale.cpp index 44d1a0c7b8..9d092446fe 100644 --- a/stablehlo/conversions/tosa/transforms/StablehloQuantLegalizeToTosaRescale.cpp +++ b/stablehlo/conversions/tosa/transforms/StablehloQuantLegalizeToTosaRescale.cpp @@ -17,7 +17,7 @@ limitations under the License. #include #include "mlir/Dialect/Func/IR/FuncOps.h" -#include "mlir/Dialect/Quant/QuantOps.h" +#include "mlir/Dialect/Quant/IR/Quant.h" #include "mlir/Dialect/Tosa/IR/TosaOps.h" #include "mlir/Dialect/Tosa/Utils/ConversionUtils.h" #include "mlir/Dialect/Tosa/Utils/QuantUtils.h" diff --git a/stablehlo/conversions/tosa/transforms/TosaRescaleLegalizeToStablehlo.cpp b/stablehlo/conversions/tosa/transforms/TosaRescaleLegalizeToStablehlo.cpp index 74013e4339..214f035d77 100644 --- a/stablehlo/conversions/tosa/transforms/TosaRescaleLegalizeToStablehlo.cpp +++ b/stablehlo/conversions/tosa/transforms/TosaRescaleLegalizeToStablehlo.cpp @@ -18,7 +18,7 @@ limitations under the License. #include #include "mlir/Dialect/Func/IR/FuncOps.h" -#include "mlir/Dialect/Quant/QuantOps.h" +#include "mlir/Dialect/Quant/IR/Quant.h" #include "mlir/Dialect/Tosa/IR/TosaOps.h" #include "mlir/Dialect/Tosa/Utils/ConversionUtils.h" #include "mlir/Dialect/Tosa/Utils/QuantUtils.h" diff --git a/stablehlo/dialect/Base.cpp b/stablehlo/dialect/Base.cpp index d8d1339647..1f1811a058 100644 --- a/stablehlo/dialect/Base.cpp +++ b/stablehlo/dialect/Base.cpp @@ -31,7 +31,7 @@ limitations under the License. #include "llvm/ADT/SmallVector.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" -#include "mlir/Dialect/Quant/QuantTypes.h" +#include "mlir/Dialect/Quant/IR/QuantTypes.h" #include "mlir/Dialect/Shape/IR/Shape.h" #include "mlir/IR/Builders.h" #include "mlir/IR/BuiltinAttributes.h" diff --git a/stablehlo/dialect/ChloOps.h b/stablehlo/dialect/ChloOps.h index 988c672141..33c3de5336 100644 --- a/stablehlo/dialect/ChloOps.h +++ b/stablehlo/dialect/ChloOps.h @@ -20,7 +20,7 @@ limitations under the License. #include "llvm/ADT/APFloat.h" #include "llvm/ADT/StringRef.h" #include "mlir/Bytecode/BytecodeOpInterface.h" -#include "mlir/Dialect/Quant/QuantTypes.h" +#include "mlir/Dialect/Quant/IR/QuantTypes.h" #include "mlir/IR/Attributes.h" #include "mlir/IR/Builders.h" #include "mlir/IR/BuiltinTypes.h" diff --git a/stablehlo/dialect/Register.cpp b/stablehlo/dialect/Register.cpp index b19bb0316e..b839ed3cba 100644 --- a/stablehlo/dialect/Register.cpp +++ b/stablehlo/dialect/Register.cpp @@ -17,7 +17,7 @@ limitations under the License. #include "stablehlo/dialect/Register.h" #include "mlir/Dialect/Func/IR/FuncOps.h" -#include "mlir/Dialect/Quant/QuantOps.h" +#include "mlir/Dialect/Quant/IR/Quant.h" #include "mlir/Dialect/SparseTensor/IR/SparseTensor.h" #include "mlir/IR/DialectRegistry.h" #include "stablehlo/dialect/ChloOps.h" @@ -30,7 +30,7 @@ namespace stablehlo { void registerAllDialects(mlir::DialectRegistry ®istry) { // clang-format off registry.insert(); registry.insert #include "llvm/ADT/StringRef.h" -#include "mlir/Dialect/Quant/QuantTypes.h" +#include "mlir/Dialect/Quant/IR/QuantTypes.h" #include "mlir/Dialect/Shape/IR/Shape.h" #include "mlir/IR/Attributes.h" #include "mlir/IR/Builders.h" diff --git a/stablehlo/dialect/TypeInference.cpp b/stablehlo/dialect/TypeInference.cpp index 15671d73e2..ffe5599270 100644 --- a/stablehlo/dialect/TypeInference.cpp +++ b/stablehlo/dialect/TypeInference.cpp @@ -52,7 +52,7 @@ limitations under the License. #include "llvm/Support/Regex.h" #include "llvm/Support/raw_ostream.h" #include "mlir/Dialect/Func/IR/FuncOps.h" -#include "mlir/Dialect/Quant/QuantTypes.h" +#include "mlir/Dialect/Quant/IR/QuantTypes.h" #include "mlir/IR/Attributes.h" #include "mlir/IR/Builders.h" #include "mlir/IR/BuiltinAttributes.h" diff --git a/stablehlo/dialect/VhloTypes.cpp b/stablehlo/dialect/VhloTypes.cpp index bbbb1af86b..251c163cf6 100644 --- a/stablehlo/dialect/VhloTypes.cpp +++ b/stablehlo/dialect/VhloTypes.cpp @@ -20,7 +20,7 @@ limitations under the License. #include "llvm/ADT/SmallVectorExtras.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/TypeSwitch.h" -#include "mlir/Dialect/Quant/QuantTypes.h" +#include "mlir/Dialect/Quant/IR/QuantTypes.h" #include "mlir/Dialect/Shape/IR/Shape.h" #include "mlir/IR/Attributes.h" #include "mlir/IR/BuiltinTypes.h" diff --git a/stablehlo/reference/Api.cpp b/stablehlo/reference/Api.cpp index 3366d4f66b..55721fa0be 100644 --- a/stablehlo/reference/Api.cpp +++ b/stablehlo/reference/Api.cpp @@ -31,7 +31,7 @@ limitations under the License. #include "llvm/Support/Path.h" #include "llvm/Support/SourceMgr.h" #include "mlir/Dialect/Func/IR/FuncOps.h" -#include "mlir/Dialect/Quant/QuantTypes.h" +#include "mlir/Dialect/Quant/IR/QuantTypes.h" #include "mlir/IR/BuiltinAttributes.h" #include "mlir/IR/BuiltinOps.h" #include "mlir/IR/BuiltinTypeInterfaces.h" diff --git a/stablehlo/tests/CheckOps.h b/stablehlo/tests/CheckOps.h index 1cd7010253..01c448d290 100644 --- a/stablehlo/tests/CheckOps.h +++ b/stablehlo/tests/CheckOps.h @@ -17,7 +17,7 @@ limitations under the License. #define STABLEHLO_DIALECT_CHECKOPS_H_ #include "mlir/Bytecode/BytecodeOpInterface.h" -#include "mlir/Dialect/Quant/QuantTypes.h" +#include "mlir/Dialect/Quant/IR/QuantTypes.h" #include "mlir/IR/BuiltinAttributes.h" #include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Dialect.h" diff --git a/stablehlo/tests/ops_stablehlo_quantized.mlir b/stablehlo/tests/ops_stablehlo_quantized.mlir index 89c8e4d00d..482eec5875 100644 --- a/stablehlo/tests/ops_stablehlo_quantized.mlir +++ b/stablehlo/tests/ops_stablehlo_quantized.mlir @@ -1338,24 +1338,24 @@ func.func @quantized_element_type_c8(%arg0: tensor<1x2x!quant.uniform>) { - // expected-error-re@+1 {{operand #0 must be ranked tensor of {{.*}} 2/4/8/16/32-bit uniform quantized signed integer or 2/4/8/16/32-bit uniform quantized unsigned integer or 2/4/8/16/32-bit uniform quantized per axis signed integer or 2/4/8/16/32-bit uniform quantized per axis unsigned integer values, but got 'tensor<1x2x!quant.uniform>'}} %0 = stablehlo.add %arg0, %arg0 : tensor<1x2x!quant.uniform> func.return } // ----- +// expected-error@+1 {{scale out of expressed type range}} func.func @quantized_element_type_c6(%arg0: tensor<1x2x!quant.uniform>) { - // expected-error-re@+1 {{operand #0 must be ranked tensor of {{.*}} 2/4/8/16/32-bit uniform quantized signed integer or 2/4/8/16/32-bit uniform quantized unsigned integer or 2/4/8/16/32-bit uniform quantized per axis signed integer or 2/4/8/16/32-bit uniform quantized per axis unsigned integer values, but got 'tensor<1x2x!quant.uniform>'}} %0 = stablehlo.add %arg0, %arg0 : tensor<1x2x!quant.uniform> func.return } // ----- +// expected-error@+1 {{illegal quantized dimension: -1}} func.func @quantized_element_type_c11(%arg0: tensor<1x5x2x!quant.uniform:f32:-1, {0.1:-30, 0.1:-30}>>) { - // expected-error-re@+1 {{operand #0 must be ranked tensor of {{.*}} 2/4/8/16/32-bit uniform quantized signed integer or 2/4/8/16/32-bit uniform quantized unsigned integer or 2/4/8/16/32-bit uniform quantized per axis signed integer or 2/4/8/16/32-bit uniform quantized per axis unsigned integer values, but got 'tensor<1x5x2x!quant.uniform>'}} %0 = stablehlo.add %arg0, %arg0 : tensor<1x5x2x!quant.uniform:f32:-1, {0.1:-30, 0.1:-30}>> func.return } diff --git a/stablehlo/tools/StablehloTranslateMain.cpp b/stablehlo/tools/StablehloTranslateMain.cpp index 107f5adb29..3b1252a1c2 100644 --- a/stablehlo/tools/StablehloTranslateMain.cpp +++ b/stablehlo/tools/StablehloTranslateMain.cpp @@ -24,7 +24,7 @@ limitations under the License. #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/LogicalResult.h" #include "mlir/Dialect/Func/IR/FuncOps.h" -#include "mlir/Dialect/Quant/QuantOps.h" +#include "mlir/Dialect/Quant/IR/Quant.h" #include "mlir/IR/BuiltinAttributes.h" #include "mlir/IR/BuiltinOps.h" #include "mlir/IR/DialectRegistry.h" @@ -237,7 +237,7 @@ TranslateFromMLIRRegistration interpretRegistration( }, [](DialectRegistry ®istry) { registry.insert(); - registry.insert(); + registry.insert(); registry.insert(); registry.insert(); registry.insert(); diff --git a/stablehlo/transforms/Passes.h b/stablehlo/transforms/Passes.h index 5fc81c801a..6c61e50926 100644 --- a/stablehlo/transforms/Passes.h +++ b/stablehlo/transforms/Passes.h @@ -19,7 +19,7 @@ limitations under the License. #include #include "mlir/Dialect/Func/IR/FuncOps.h" -#include "mlir/Dialect/Quant/QuantOps.h" +#include "mlir/Dialect/Quant/IR/Quant.h" #include "mlir/Dialect/Shape/IR/Shape.h" #include "mlir/IR/BuiltinOps.h" #include "mlir/Pass/Pass.h" diff --git a/stablehlo/transforms/Passes.td b/stablehlo/transforms/Passes.td index e5559075b5..1ad1b57def 100644 --- a/stablehlo/transforms/Passes.td +++ b/stablehlo/transforms/Passes.td @@ -362,7 +362,7 @@ def VhloLegalizeToStablehloPass : Pass<"vhlo-legalize-to-stablehlo", "ModuleOp"> let summary = "Legalize VHLO to StableHLO."; let dependentDialects = [ "mlir::func::FuncDialect", - "mlir::quant::QuantizationDialect", + "mlir::quant::QuantDialect", "mlir::shape::ShapeDialect", "mlir::stablehlo::StablehloDialect", ]; diff --git a/stablehlo/transforms/StablehloLegalizeQDQToQuantizedOp.cpp b/stablehlo/transforms/StablehloLegalizeQDQToQuantizedOp.cpp index 470093e447..9649221924 100644 --- a/stablehlo/transforms/StablehloLegalizeQDQToQuantizedOp.cpp +++ b/stablehlo/transforms/StablehloLegalizeQDQToQuantizedOp.cpp @@ -15,7 +15,7 @@ limitations under the License. #include "llvm/ADT/SmallVector.h" #include "mlir/Dialect/Func/IR/FuncOps.h" -#include "mlir/Dialect/Quant/QuantTypes.h" +#include "mlir/Dialect/Quant/IR/QuantTypes.h" #include "mlir/IR/Operation.h" #include "mlir/IR/PatternMatch.h" #include "mlir/Transforms/DialectConversion.h" // Include for TypeConverter diff --git a/stablehlo/transforms/StablehloLegalizeQuantToMath.cpp b/stablehlo/transforms/StablehloLegalizeQuantToMath.cpp index 69089d4f7f..35e3c15bd7 100644 --- a/stablehlo/transforms/StablehloLegalizeQuantToMath.cpp +++ b/stablehlo/transforms/StablehloLegalizeQuantToMath.cpp @@ -24,8 +24,8 @@ limitations under the License. #include "llvm/ADT/SmallVector.h" #include "mlir/Dialect/Func/IR/FuncOps.h" #include "mlir/Dialect/Func/Transforms/FuncConversions.h" -#include "mlir/Dialect/Quant/QuantOps.h" -#include "mlir/Dialect/Quant/QuantTypes.h" +#include "mlir/Dialect/Quant/IR/Quant.h" +#include "mlir/Dialect/Quant/IR/QuantTypes.h" #include "mlir/IR/Attributes.h" #include "mlir/IR/BuiltinAttributes.h" #include "mlir/IR/BuiltinTypeInterfaces.h" @@ -1331,7 +1331,7 @@ class StablehloLegalizeQuantToMathPass populateReturnOpTypeConversionPattern(patterns, converter); ConversionTarget target(*op->getContext()); - target.addIllegalDialect(); + target.addIllegalDialect(); auto isLegal = [&converter](Operation *op) { return converter.isLegal(op); }; diff --git a/stablehlo/transforms/StablehloLegalizeQuantizedOpToQDQ.cpp b/stablehlo/transforms/StablehloLegalizeQuantizedOpToQDQ.cpp index e9eebea7c9..9fae84f9e3 100644 --- a/stablehlo/transforms/StablehloLegalizeQuantizedOpToQDQ.cpp +++ b/stablehlo/transforms/StablehloLegalizeQuantizedOpToQDQ.cpp @@ -17,7 +17,7 @@ limitations under the License. #include "llvm/ADT/STLExtras.h" #include "mlir/Dialect/Func/IR/FuncOps.h" -#include "mlir/Dialect/Quant/QuantTypes.h" +#include "mlir/Dialect/Quant/IR/QuantTypes.h" #include "mlir/IR/BuiltinTypeInterfaces.h" #include "mlir/IR/PatternMatch.h" #include "mlir/IR/TypeRange.h"