From 7ce55ff7c2ed743c7396e7f4681f11bd4feeb9ac Mon Sep 17 00:00:00 2001 From: Stella Laurenzo Date: Wed, 3 Apr 2019 17:43:00 -0700 Subject: [PATCH] Add CMakeLists.txt for Quantization and FxpMathOps dialects (and misc fixes to build with OSS setup). Tested: cmake -G Ninja ../llvm/ -DLLVM_BUILD_EXAMPLES=ON ninja check-mlir -- PiperOrigin-RevId: 241841296 --- mlir/include/mlir/CMakeLists.txt | 2 ++ mlir/include/mlir/FxpMathOps/CMakeLists.txt | 4 ++++ mlir/include/mlir/Quantization/CMakeLists.txt | 4 ++++ mlir/lib/CMakeLists.txt | 2 ++ mlir/lib/FxpMathOps/CMakeLists.txt | 15 +++++++++++++++ mlir/lib/Quantization/CMakeLists.txt | 20 ++++++++++++++++++++ mlir/lib/Quantization/IR/QuantOps.cpp | 4 ++-- mlir/tools/mlir-opt/CMakeLists.txt | 2 ++ 8 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 mlir/include/mlir/FxpMathOps/CMakeLists.txt create mode 100644 mlir/include/mlir/Quantization/CMakeLists.txt create mode 100644 mlir/lib/FxpMathOps/CMakeLists.txt create mode 100644 mlir/lib/Quantization/CMakeLists.txt diff --git a/mlir/include/mlir/CMakeLists.txt b/mlir/include/mlir/CMakeLists.txt index dba92ff..344a5d0 100644 --- a/mlir/include/mlir/CMakeLists.txt +++ b/mlir/include/mlir/CMakeLists.txt @@ -1,3 +1,5 @@ +add_subdirectory(FxpMathOps) add_subdirectory(LLVMIR) +add_subdirectory(Quantization) add_subdirectory(StandardOps) add_subdirectory(EDSC) diff --git a/mlir/include/mlir/FxpMathOps/CMakeLists.txt b/mlir/include/mlir/FxpMathOps/CMakeLists.txt new file mode 100644 index 0000000..eaf72d2 --- /dev/null +++ b/mlir/include/mlir/FxpMathOps/CMakeLists.txt @@ -0,0 +1,4 @@ +set(LLVM_TARGET_DEFINITIONS FxpMathOps.td) +mlir_tablegen(FxpMathOps.h.inc -gen-op-decls) +mlir_tablegen(FxpMathOps.cpp.inc -gen-op-defs) +add_public_tablegen_target(MLIRFxpMathOpsIncGen) diff --git a/mlir/include/mlir/Quantization/CMakeLists.txt b/mlir/include/mlir/Quantization/CMakeLists.txt new file mode 100644 index 0000000..8826488 --- /dev/null +++ b/mlir/include/mlir/Quantization/CMakeLists.txt @@ -0,0 +1,4 @@ +set(LLVM_TARGET_DEFINITIONS QuantOps.td) +mlir_tablegen(QuantOps.h.inc -gen-op-decls) +mlir_tablegen(QuantOps.cpp.inc -gen-op-defs) +add_public_tablegen_target(MLIRQuantizationOpsIncGen) diff --git a/mlir/lib/CMakeLists.txt b/mlir/lib/CMakeLists.txt index c9e7801..3d05cd1 100644 --- a/mlir/lib/CMakeLists.txt +++ b/mlir/lib/CMakeLists.txt @@ -3,10 +3,12 @@ add_subdirectory(Analysis) add_subdirectory(Dialect) add_subdirectory(EDSC) add_subdirectory(ExecutionEngine) +add_subdirectory(FxpMathOps) add_subdirectory(IR) add_subdirectory(LLVMIR) add_subdirectory(Parser) add_subdirectory(Pass) +add_subdirectory(Quantization) add_subdirectory(StandardOps) add_subdirectory(Support) add_subdirectory(TableGen) diff --git a/mlir/lib/FxpMathOps/CMakeLists.txt b/mlir/lib/FxpMathOps/CMakeLists.txt new file mode 100644 index 0000000..43ac6a9 --- /dev/null +++ b/mlir/lib/FxpMathOps/CMakeLists.txt @@ -0,0 +1,15 @@ +add_llvm_library(MLIRFxpMathOps + IR/FxpMathOps.cpp + IR/DialectRegistration.cpp + Transforms/LowerUniformRealMath.cpp + + ADDITIONAL_HEADER_DIRS + ${MLIR_MAIN_INCLUDE_DIR}/mlir/FxpMathOps + ) +add_dependencies(MLIRFxpMathOps + MLIRFxpMathOpsIncGen + MLIRQuantization + MLIRIR + MLIRPass + MLIRSupport + MLIRStandardOps) diff --git a/mlir/lib/Quantization/CMakeLists.txt b/mlir/lib/Quantization/CMakeLists.txt new file mode 100644 index 0000000..12bfb4d --- /dev/null +++ b/mlir/lib/Quantization/CMakeLists.txt @@ -0,0 +1,20 @@ +add_llvm_library(MLIRQuantization + IR/DialectRegistration.cpp + IR/FakeQuantSupport.cpp + IR/QuantOps.cpp + IR/TypeDetail.h + IR/TypeParser.cpp + IR/UniformSupport.cpp + Transforms/ConvertConst.cpp + Transforms/ConvertSimQuant.cpp + Utils/QuantizeUtils.cpp + + ADDITIONAL_HEADER_DIRS + ${MLIR_MAIN_INCLUDE_DIR}/mlir/Quantization + ) +add_dependencies(MLIRQuantization + MLIRQuantizationOpsIncGen + MLIRIR + MLIRPass + MLIRSupport + MLIRStandardOps) diff --git a/mlir/lib/Quantization/IR/QuantOps.cpp b/mlir/lib/Quantization/IR/QuantOps.cpp index 05a5162..94e5a1c 100644 --- a/mlir/lib/Quantization/IR/QuantOps.cpp +++ b/mlir/lib/Quantization/IR/QuantOps.cpp @@ -261,7 +261,7 @@ LogicalResult UniformQuantizedType::verifyConstructionInvariants( } // Verify scale. - if (scale <= 0.0 || isinf(scale) || isnan(scale)) { + if (scale <= 0.0 || std::isinf(scale) || std::isnan(scale)) { if (loc) { context->emitError(*loc, "illegal scale: " + Twine(std::to_string(scale))); @@ -323,7 +323,7 @@ LogicalResult UniformQuantizedPerAxisType::verifyConstructionInvariants( // Verify scale. for (double scale : scales) { - if (scale <= 0.0 || isinf(scale) || isnan(scale)) { + if (scale <= 0.0 || std::isinf(scale) || std::isnan(scale)) { if (loc) { context->emitError(*loc, "illegal scale: " + Twine(std::to_string(scale))); diff --git a/mlir/tools/mlir-opt/CMakeLists.txt b/mlir/tools/mlir-opt/CMakeLists.txt index def266d..a68b30d 100644 --- a/mlir/tools/mlir-opt/CMakeLists.txt +++ b/mlir/tools/mlir-opt/CMakeLists.txt @@ -2,9 +2,11 @@ set(LIBS MLIRAffineOps MLIRAnalysis MLIREDSC + MLIRFxpMathOps MLIRLLVMIR MLIRParser MLIRPass + MLIRQuantization MLIRStandardOps MLIRTransforms MLIRSupport -- 2.7.4