From b80c8805496c42c5a0d4b5c93ae90902bfa2f3f0 Mon Sep 17 00:00:00 2001 From: hamptonm1 <79232909+hamptonm1@users.noreply.github.com> Date: Tue, 11 Oct 2022 17:14:16 -0400 Subject: [PATCH] Update onnx-mlir product version (#1727) * Update onnx-mlir product version Signed-off-by: Megan Hampton * fix einsum decomposition bug (#1730) Signed-off-by: Soren Lassen Signed-off-by: Soren Lassen Signed-off-by: Megan Hampton * Update version to 0.3.1 (#1728) Signed-off-by: Megan Hampton * Fix issues to compile Yolov3-12. (#1726) Stop conversion to enable onnx.LeakyRelu on NNPA when the stickified layouts of input and output are not the same. Signed-off-by: Yasushi Negishi Signed-off-by: Megan Hampton * simplified if lowering (#1717) borrowed ideas from ConvertTrivialIfToSelect from https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/SCF/IR/SCF.cpp Signed-off-by: Soren Lassen Signed-off-by: Soren Lassen Co-authored-by: chentong319 Signed-off-by: Megan Hampton * Add definitions Signed-off-by: Megan Hampton * parse string type from getTypeMap() (#1735) added a parse lit test that passes with this fix Signed-off-by: Soren Lassen Signed-off-by: Soren Lassen Co-authored-by: chentong319 Signed-off-by: Megan Hampton * fix 2 compiler warnings (#1736) * fix sprintf-is-deprecated clang warning warning from Apple clang version 14.0.0 (clang-1400.0.29.201): ``` .../src/Conversion/ONNXToKrnl/PerfectHash.cpp:47:5: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] sprintf(str, "%lld", (long long)val); /Library/Developer/CommandLineTools/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.") ``` Signed-off-by: Soren Lassen * fix copy constructor warning copied solution from InstrumentONNXPass.cpp fixes compiler warning in Linux CI pipelines: ``` .../src/Transform/ONNX/ConvOpt.cpp: In copy constructor '{anonymous}::ConvOptONNXToONNXPass::ConvOptONNXToONNXPass(const {anonymous}::ConvOptONNXToONNXPass&)': .../src/Transform/ONNX/ConvOpt.cpp:211:3: warning: base class 'class mlir::PassWrapper<{anonymous}::ConvOptONNXToONNXPass, mlir::OperationPass >' should be explicitly initialized in the copy constructor [-Wextra] ConvOptONNXToONNXPass(const ConvOptONNXToONNXPass &pass) {} ``` Signed-off-by: Soren Lassen Signed-off-by: Soren Lassen Co-authored-by: chentong319 Signed-off-by: Megan Hampton * cleanup some include files (#1733) Signed-off-by: Soren Lassen Signed-off-by: Soren Lassen Co-authored-by: chentong319 Signed-off-by: Megan Hampton * Fix remaining warnings on Windows and turn on warning-as-error (#1706) This change applies the remaining fixes needed for warnings to be treated as errors on Windows and then turns them on on Windows only. Of particular interest are a couple of changes: * The `check-docs` target needs an update to properly parse the directive even when it contains parenthesis in the path. For example: `C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python39_64/python.exe` * The Windows CI build now builds `onnx` first and then builds all of the targets that are enabled in onnx-mlir. This will make sure that no targets get missed * The remaining warnings (4927) in `ConstProp.cpp` are fixed as well. Signed-off-by: Stella Stamenova Signed-off-by: Megan Hampton * Fix synax Signed-off-by: Megan Hampton * Simplify shape-related operations (#1695) * Simplify shape-related operations Signed-off-by: Tung D. Le Signed-off-by: Megan Hampton * run-onnx-lib script and docs fixes (#1705) * update documentation for build-run-onnx-lib.sh * clarified Mac issue with running statically linked version in the directory where model library was built * moved usage string up to the top of RunONNXLib.cpp, so it's visible next to the top of file block comment, * allow llvm-project location to be set with LLVM_PROJECT, otherwise read from $MLIR_DIR if defined Signed-off-by: Soren Lassen Co-authored-by: Alexandre Eichenberger Signed-off-by: Megan Hampton * remove initializedTensors map from ONNX parser (#1739) instead insert a constant for each initializer in the frontend_symbols_ symbol map this is better for several reasons: 1. initializedTensors were incorrectly visible to function bodies (in TryImportFunctionCallNode) 2. nested bindings didn't hide initializedTensors within their scope 3. it's more efficient to create a constant for each initializer once rather than every time an initializer is accessed 4. it's simpler to look up a single symbol mapping Signed-off-by: Soren Lassen Signed-off-by: Soren Lassen Co-authored-by: chentong319 Signed-off-by: Megan Hampton * Add decompositions for v11 split, squeeze, and unsqueeze (#1702) * Add decompositions for v11 split, squeeze, and unsqueeze Co-authored-by: Roberto DiCecco Signed-off-by: Philip Lassen * Fix lit test Signed-off-by: Philip Lassen * Add lit tests Signed-off-by: Philip Lassen * Delete unneccesary decomp for unsqueeze Signed-off-by: Philip Lassen Signed-off-by: Philip Lassen Co-authored-by: Roberto DiCecco Signed-off-by: Megan Hampton * factored input shaping into ModelInputShaper (#1740) * factored input shaping into ModelInputShaper this makes the it easier to read and understand the input shaping logic and also makes the rest of the FrontendDialectTransformer implementation shorter and easier to read Signed-off-by: Soren Lassen * documented public methods Signed-off-by: Soren Lassen Signed-off-by: Soren Lassen Co-authored-by: Tung D. Le Co-authored-by: Philip Lassen Signed-off-by: Megan Hampton * Ingest all of Opset 16 (#1704) * Ingest al of opset 16 Signed-off-by: Philip Lassen * Delete GridSample test which is no longer relevant Signed-off-by: Philip Lassen * Use NullStringAttr insead of "none" string Signed-off-by: Philip Lassen Signed-off-by: Philip Lassen Co-authored-by: chentong319 Signed-off-by: Megan Hampton * Fix onnx-mlir.py docker wrapper (#1734) * Requiring input files to have known suffix (.onnx, .json, or .mlir) greatly simplifies the onnx-mlir.py docker wrapper. Signed-off-by: Gong Su * Return exit code Signed-off-by: Gong Su * Add copyright notice Signed-off-by: Gong Su Signed-off-by: Megan Hampton * Update protobuf (#1747) * Update to protobuf 3.20.2 Signed-off-by: Charles Volzka * Try 3.18.3 Signed-off-by: Charles Volzka Signed-off-by: Charles Volzka Signed-off-by: Megan Hampton * Add the product version and fix formatting Signed-off-by: Megan Hampton * Make updates to product version Signed-off-by: Megan Hampton * further updates Signed-off-by: Megan Hampton * Add product version text file Signed-off-by: Megan Hampton * Removed the memory leaks directly in execution session (#1746) * removed the memory leaks directly in execution session Signed-off-by: Alexandre Eichenberger Co-authored-by: chentong319 Signed-off-by: Megan Hampton * Add support for ArgMin (#1737) * add support for ArgMin Signed-off-by: Hengyu Meng Signed-off-by: Megan Hampton * Inclusive terminology update (#1750) * Update `master` reference to `main` in onnx-mlir doc * Update rapidcheck to newer commit with inclusive terminology changes * Update benchmark to 1.6.2 with inclusive terminology changes * Update pybind11 to 2.10 with inclusive terminology changes Signed-off-by: Megan Hampton * Warning and instructions that --onnx-op-stats needs more than EmitONNXIR (#1719) Signed-off-by: Alexandre Eichenberger Co-authored-by: chentong319 Signed-off-by: Megan Hampton * Move product version text file Signed-off-by: Megan Hampton * Remove comment Signed-off-by: Megan Hampton * Output the product version for the compiler/version Signed-off-by: Megan Hampton * Cleaned up commit of the InferTypes change. (#1753) Signed-off-by: Brad Messer Co-authored-by: Soren Lassen Signed-off-by: Megan Hampton * setup.py install is deprecated, use pip install instead (#1752) * setup.py install is deprecated, use pip install instead (see https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for more details). Signed-off-by: Gong Su * - pip install doesn't work for protobuf, revert back to setup.py install - use --cpp_implementation for better performance Signed-off-by: Gong Su * Update Windows CI Signed-off-by: Gong Su Signed-off-by: Megan Hampton * adding reference to onnx-mlir-serving (#1745) Signed-off-by: Alexandre Eichenberger Co-authored-by: chentong319 Signed-off-by: Megan Hampton * [TOSA] Update type converter and unary ops (#1553) Signed-off-by: Philipp Braun Co-authored-by: Alexandre Eichenberger Signed-off-by: Megan Hampton * Fix syntax Signed-off-by: Megan Hampton * Remove strip Signed-off-by: Megan Hampton * Revert "Cleaned up commit of the InferTypes change. (#1753)" This reverts commit d08c5ac4e03f55e2a11aa5c37c331389ce170ac6. Signed-off-by: Megan Hampton * Cleaned up commit of the InferTypes change. (#1753) Signed-off-by: Brad Messer Co-authored-by: Soren Lassen Signed-off-by: Megan Hampton * Fix for GatherND verifier (#1754) Co-authored-by: Hadi Jooybar Signed-off-by: Philip Lassen Signed-off-by: Megan Hampton * Fix OnnxBuilder::concat where axis was not used (#1759) Signed-off-by: Tung D. Le Signed-off-by: Megan Hampton * Simplify GatherOp when its inputs are dimensions (#1755) Signed-off-by: Tung D. Le Signed-off-by: Megan Hampton * Assign each question mark a unique negative integer value (#1757) * Assign each question mark a unique negative integer value Signed-off-by: Tung D. Le * Add a mutex to protect the counter Signed-off-by: Tung D. Le * Using decrement Signed-off-by: Tung D. Le Signed-off-by: Tung D. Le Signed-off-by: Megan Hampton * Change the regex Signed-off-by: Megan Hampton * Fix regex and display product numbers Signed-off-by: Megan Hampton * normalize axis in ScatterElements verify (#1760) Signed-off-by: Philip Lassen Signed-off-by: Philip Lassen Co-authored-by: Alexandre Eichenberger Signed-off-by: Megan Hampton * redo ArrayRefOrSmallVector with enable_if (#1758) closes #1729 * redo ArrayRefOrSmallVector with enable_if attempt to address issue #1729: Build error on Linux Signed-off-by: Soren Lassen * added @qedawkins fix: begin,end -> data,size Signed-off-by: Soren Lassen Signed-off-by: Soren Lassen Co-authored-by: Quinn Dawkins quinn.dawkins@gmail.com Co-authored-by: Philip Lassen Signed-off-by: Megan Hampton * fix syntax Signed-off-by: Megan Hampton * Handle scalar tensor tensor in SimplifyShapeRelatesOps pass (#1764) Signed-off-by: Tung D. Le Signed-off-by: Tung D. Le Signed-off-by: Megan Hampton * namespace cleanup (#1763) * namespace cleanup removed `using namespace mlir` from ConstPropHelper.hpp and added requisite `mlir::` and `llvm::` in header files to get everything to compile again also put ConstPropHelper definitions in namespace onnx_mlir Signed-off-by: Soren Lassen * added more missing `mlir/llvm::` Signed-off-by: Soren Lassen Signed-off-by: Soren Lassen Co-authored-by: Tung D. Le Signed-off-by: Megan Hampton * Signed-off-by: Megan Hampton Fix Clang format error * Make use of the product vendor flag Signed-off-by: Megan Hampton * Address feedback Signed-off-by: Megan Hampton Signed-off-by: Megan Hampton Signed-off-by: Soren Lassen Signed-off-by: Stella Stamenova Signed-off-by: Tung D. Le Signed-off-by: Philip Lassen Signed-off-by: Gong Su Signed-off-by: Charles Volzka Signed-off-by: Hengyu Meng Signed-off-by: Alexandre Eichenberger Signed-off-by: Philipp Braun Co-authored-by: Megan Hampton Co-authored-by: Soren Lassen Co-authored-by: Charles Volzka <42243335+cjvolzka@users.noreply.github.com> Co-authored-by: Yasushi Negishi Co-authored-by: chentong319 Co-authored-by: Stella Stamenova Co-authored-by: Tung D. Le Co-authored-by: Alexandre Eichenberger Co-authored-by: Philip Lassen Co-authored-by: Roberto DiCecco Co-authored-by: gongsu832 Co-authored-by: Meng, Hengyu Co-authored-by: Brad Messer Co-authored-by: Philipp Braun <3589810@gmail.com> Co-authored-by: Hadi Jooybar --- src/Compiler/CMakeLists.txt | 7 +++++-- src/Version/CMakeLists.txt | 2 +- src/Version/Version.cpp | 18 ++++++++++-------- test/mlir/driver/version.mlir | 2 +- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/Compiler/CMakeLists.txt b/src/Compiler/CMakeLists.txt index da29f06e78..1825d44062 100644 --- a/src/Compiler/CMakeLists.txt +++ b/src/Compiler/CMakeLists.txt @@ -87,6 +87,8 @@ if (DEFINED ONNX_MLIR_PRODUCT_VERSION) message(DEBUG "PRODUCT_VERSION_PATCH = ${PRODUCT_VERSION_PATCH}") message(DEBUG "PRODUCT_ID = ${PRODUCT_ID}") + list(APPEND DEFINITIONS "ONNX_MLIR_PRODUCT_VERSION=${ONNX_MLIR_PRODUCT_VERSION}") + # Major and product ID are mandatory, minor and patch are optional. if (("${PRODUCT_VERSION_MAJOR}" STREQUAL "") OR ("${PRODUCT_ID}" STREQUAL "")) message(STATUS "Product version : Invalid version ${ONNX_MLIR_PRODUCT_VERSION} ignored") @@ -113,6 +115,7 @@ list(APPEND DEFINITIONS "PRODUCT_VERSION_MAJOR=${PRODUCT_VERSION_MAJOR}") list(APPEND DEFINITIONS "PRODUCT_VERSION_MINOR=${PRODUCT_VERSION_MINOR}") list(APPEND DEFINITIONS "PRODUCT_VERSION_PATCH=${PRODUCT_VERSION_PATCH}") list(APPEND DEFINITIONS "PRODUCT_ID=\"${PRODUCT_ID}\"") +target_compile_definitions(OMVersion PUBLIC ${DEFINITIONS}) set_property(SOURCE CompilerUtils.cpp APPEND PROPERTY COMPILE_DEFINITIONS ${DEFINITIONS}) add_onnx_mlir_library(CompilerUtils @@ -128,7 +131,7 @@ add_onnx_mlir_library(CompilerUtils INCLUDE_DIRS PRIVATE ${FILE_GENERATE_DIR} - + INCLUDE_DIRS PUBLIC ${ONNX_MLIR_SRC_ROOT}/include @@ -166,7 +169,7 @@ add_onnx_mlir_library(OnnxMlirCompiler ${FILE_GENERATE_DIR} EXCLUDE_FROM_OM_LIBS - + LINK_LIBS PRIVATE CompilerUtils ) diff --git a/src/Version/CMakeLists.txt b/src/Version/CMakeLists.txt index 9528d36768..d05af9387c 100644 --- a/src/Version/CMakeLists.txt +++ b/src/Version/CMakeLists.txt @@ -73,7 +73,7 @@ else() list(APPEND DEFINITIONS "ONNX_VERSION=\"${ONNX_VERSION}\"") endif() if (ONNX_MLIR_VENDOR) - list(APPEND DEFINITIONS "ONNX_MLIR_VENDOR=\"${ONNX_MLIR_VENDOR }\"") + list(APPEND DEFINITIONS "ONNX_MLIR_VENDOR=\"${ONNX_MLIR_VENDOR}\"") endif() list(APPEND DEFINITIONS "LLVM_PACKAGE_VERSION=\"${LLVM_PACKAGE_VERSION}\"") target_compile_definitions(OMVersion PUBLIC ${DEFINITIONS}) diff --git a/src/Version/Version.cpp b/src/Version/Version.cpp index 1277ddb3a2..6a55a48317 100644 --- a/src/Version/Version.cpp +++ b/src/Version/Version.cpp @@ -80,9 +80,6 @@ std::string getLLVMFullRepositoryVersion() { std::string getOnnxMlirFullVersion(bool toIncludeLLVM) { std::string buf; llvm::raw_string_ostream os(buf); -#ifdef ONNX_MLIR_VENDOR - os << ONNX_MLIR_VENDOR; -#endif os << "onnx-mlir version " ONNX_MLIR_VERSION; #ifdef ONNX_VERSION os << ", onnx version " ONNX_VERSION; @@ -118,13 +115,18 @@ std::string getOnnxMlirFullVersion(bool toIncludeLLVM) { #endif void getVersionPrinter(llvm::raw_ostream &os) { +#if defined(ONNX_MLIR_VENDOR) && defined(ONNX_MLIR_PRODUCT_VERSION) + os << ONNX_MLIR_VENDOR << " " << PRODUCT_VERSION_MAJOR << '.'; + os << PRODUCT_VERSION_MINOR << '.'; + os << PRODUCT_VERSION_PATCH << '-' << PRODUCT_ID << '\n'; +#endif os << getOnnxMlirFullVersion(false) << "\n"; - os << " LLVM version " << LLVM_PACKAGE_VERSION << ' ' + os << "LLVM version " << LLVM_PACKAGE_VERSION << ' ' << getLLVMFullRepositoryVersion() << '\n'; #if ONNX_MLIR_IS_DEBUG_BUILD - os << " DEBUG build"; + os << "DEBUG build"; #else - os << " Optimized build"; + os << "Optimized build"; #endif #ifndef NDEBUG os << " with assertions"; @@ -133,8 +135,8 @@ void getVersionPrinter(llvm::raw_ostream &os) { if (CPU == "generic") CPU = "(unknown)"; os << ".\n"; - os << " Default target: " << llvm::sys::getDefaultTargetTriple() << '\n' - << " Host CPU: " << CPU << '\n'; + os << "Default target: " << llvm::sys::getDefaultTargetTriple() << '\n' + << "Host CPU: " << CPU << '\n'; } } // namespace onnx_mlir diff --git a/test/mlir/driver/version.mlir b/test/mlir/driver/version.mlir index 83e956479a..923b768af4 100644 --- a/test/mlir/driver/version.mlir +++ b/test/mlir/driver/version.mlir @@ -1,6 +1,6 @@ // RUN: onnx-mlir --version | FileCheck %s -// CHECK: onnx-mlir version {{[0-9]+}}.{{[0-9]+}}.{{[0-9]+}}, onnx version {{[0-9]+}}.{{[0-9]+}}.{{[0-9]+}} +// CHECK: onnx-mlir version {{[0-9]+}}.{{[0-9]+}}.{{[0-9]+}}, onnx version {{[0-9]+}}.{{[0-9]+}}.{{[0-9]+}} // CHECK: LLVM version {{[0-9]+}}.{{[0-9]+}}.{{[0-9]+}} // CHECK: {{[DEBUG|Optimized]}} build{{[ with assertions]*}} // CHECK: Default target: