diff --git a/.github/workflows/compiler-build.yml b/.github/workflows/compiler-build.yml index 130cd7f434..ac8ae1f861 100644 --- a/.github/workflows/compiler-build.yml +++ b/.github/workflows/compiler-build.yml @@ -19,7 +19,7 @@ jobs: config: - {name: x86_64-macos, os: macos-12, cmakeArgs: -DENABLE_X86SIMD=OFF, buildType: Release} - {name: x86_64-linux, os: ubuntu-latest, cmakeArgs: '', buildType: Release} - - {name: x86_64-windows, os: windows-latest, arch: x64, cmakeArgs: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl, buildType: Release} + - {name: x86_64-windows, os: windows-2019, arch: x64, cmakeArgs: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl, buildType: Release} steps: - uses: actions/checkout@v3 @@ -81,7 +81,7 @@ jobs: config: - {name: x86_64-macos, os: macos-12, shell: bash, rid: osx-x64, buildType: Release} - {name: x86_64-linux, os: ubuntu-latest, shell: bash, rid: linux-x64, buildType: Release} - - {name: x86_64-windows, os: windows-latest, shell: bash, rid: win-x64, buildType: Release} + - {name: x86_64-windows, os: windows-2019, shell: bash, rid: win-x64, buildType: Release} steps: - uses: actions/checkout@v2 @@ -170,7 +170,7 @@ jobs: config: - {name: x86_64-macos, os: macos-12, shell: bash} - {name: x86_64-linux, os: ubuntu-latest, shell: bash} - - {name: x86_64-windows, os: windows-latest, shell: bash} + - {name: x86_64-windows, os: windows-2019, shell: bash} env: VULKANSDK_VER: 1.3.268.0 @@ -327,4 +327,4 @@ jobs: with: name: nncase-coverage-report path: coveragereport - if-no-files-found: error \ No newline at end of file + if-no-files-found: error diff --git a/.github/workflows/compiler-python-release.yml b/.github/workflows/compiler-python-release.yml index 689979ea52..378532c60f 100644 --- a/.github/workflows/compiler-python-release.yml +++ b/.github/workflows/compiler-python-release.yml @@ -16,7 +16,7 @@ jobs: config: - {name: x86_64-macos, os: macos-12, shell: bash, rid: osx-x64, buildType: Release} - {name: x86_64-linux, os: ubuntu-latest, shell: bash, rid: linux-x64, buildType: Release} - - {name: x86_64-windows, os: windows-latest, shell: bash, rid: win-x64, buildType: Release} + - {name: x86_64-windows, os: windows-2019, shell: bash, rid: win-x64, buildType: Release} steps: - uses: actions/checkout@v2 @@ -55,7 +55,7 @@ jobs: config: - {name: x86_64-macos, os: macos-12} - {name: x86_64-linux, os: ubuntu-latest} - - {name: x86_64-windows, os: windows-latest, arch: x64} + - {name: x86_64-windows, os: windows-2019, arch: x64} env: VULKANSDK_VER: 1.3.268.0 diff --git a/.github/workflows/jupyter-test.yml b/.github/workflows/jupyter-test.yml index c6de31343d..a2b1ba974a 100755 --- a/.github/workflows/jupyter-test.yml +++ b/.github/workflows/jupyter-test.yml @@ -12,7 +12,7 @@ jobs: config: - {name: x86_64-macos, os: macos-12} - {name: x86_64-linux, os: ubuntu-latest} - - {name: x86_64-windows, os: windows-latest} + - {name: x86_64-windows, os: windows-2019} steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/runtime-build.yml b/.github/workflows/runtime-build.yml index b7fe4403f1..98a4291003 100644 --- a/.github/workflows/runtime-build.yml +++ b/.github/workflows/runtime-build.yml @@ -15,7 +15,7 @@ jobs: config: - { name: x86_64-macos, os: macos-12, cmakeArgs: '', buildType: Release } - { name: x86_64-linux, os: ubuntu-latest, cmakeArgs: '', buildType: Release } - - { name: x86_64-windows, os: windows-latest, arch: x64, cmakeArgs: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl, buildType: Release } + - { name: x86_64-windows, os: windows-2019, arch: x64, cmakeArgs: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl, buildType: Release } steps: - uses: actions/checkout@v3 diff --git a/README.md b/README.md index 35257f3530..e5c0378697 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,11 @@ Telegram: [nncase community](https://t.me/joinchat/PPcEPZMLaTViNDI1) Technical Discussion QQ Group: 790699378 . Answer: 人工智能 -[TOC] +--- + +## Tips + +- [2024/05/28] [BUG] nncase v2.8.3: ReduceSum(onnx) has a BUG that causes segmentfault. Please downgrade to v2.8.2, if your model has ReduceSum. --- diff --git a/cmake/conan.cmake b/cmake/conan.cmake index 87bd448166..5d4f0b5552 100644 --- a/cmake/conan.cmake +++ b/cmake/conan.cmake @@ -55,7 +55,7 @@ function(_get_msvc_ide_version result) set(${result} 15 PARENT_SCOPE) elseif(NOT MSVC_VERSION VERSION_LESS 1920 AND MSVC_VERSION VERSION_LESS 1930) set(${result} 16 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1930 AND MSVC_VERSION VERSION_LESS 1940) + elseif(NOT MSVC_VERSION VERSION_LESS 1930 AND MSVC_VERSION VERSION_LESS 1950) set(${result} 17 PARENT_SCOPE) else() message(FATAL_ERROR "Conan: Unknown MSVC compiler version [${MSVC_VERSION}]") @@ -152,7 +152,7 @@ macro(_conan_detect_compiler) set(COMPILER_VERSION ${MAJOR}) else() set(COMPILER_VERSION ${MAJOR}.${MINOR}) - endif() + endif() elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL QCC) set(_CONAN_SETTING_COMPILER qcc) set(COMPILER_VERSION ${MAJOR}.${MINOR}) @@ -186,7 +186,7 @@ macro(_conan_detect_compiler) set(COMPILER_VERSION ${MAJOR}) else() set(COMPILER_VERSION ${MAJOR}.${MINOR}) - endif() + endif() set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION}) @@ -196,7 +196,7 @@ macro(_conan_detect_compiler) set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) endif () elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang - AND NOT "${CMAKE_${LANGUAGE}_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC" + AND NOT "${CMAKE_${LANGUAGE}_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC" AND NOT "${CMAKE_${LANGUAGE}_SIMULATE_ID}" STREQUAL "MSVC") string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) @@ -209,7 +209,7 @@ macro(_conan_detect_compiler) set(COMPILER_VERSION ${MAJOR}) else() set(COMPILER_VERSION ${MAJOR}.${MINOR}) - endif() + endif() set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION}) @@ -225,8 +225,8 @@ macro(_conan_detect_compiler) set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) endif () elseif(${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL MSVC - OR (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang - AND "${CMAKE_${LANGUAGE}_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC" + OR (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang + AND "${CMAKE_${LANGUAGE}_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC" AND "${CMAKE_${LANGUAGE}_SIMULATE_ID}" STREQUAL "MSVC")) set(_VISUAL "Visual Studio") @@ -481,7 +481,7 @@ function(conan_cmake_autodetect detected_settings) endfunction() macro(conan_parse_arguments) - set(options BASIC_SETUP CMAKE_TARGETS UPDATE KEEP_RPATHS NO_LOAD NO_OUTPUT_DIRS + set(options BASIC_SETUP CMAKE_TARGETS UPDATE KEEP_RPATHS NO_LOAD NO_OUTPUT_DIRS OUTPUT_QUIET NO_IMPORTS SKIP_STD) set(oneValueArgs CONANFILE ARCH BUILD_TYPE INSTALL_FOLDER OUTPUT_FOLDER CONAN_COMMAND) set(multiValueArgs DEBUG_PROFILE RELEASE_PROFILE RELWITHDEBINFO_PROFILE MINSIZEREL_PROFILE @@ -662,11 +662,11 @@ function(conan_cmake_install) if(DEFINED NO_IMPORTS) set(NO_IMPORTS --no-imports) endif() - set(install_args install ${PATH_OR_REFERENCE} ${REFERENCE} ${UPDATE} ${NO_IMPORTS} ${REMOTE} - ${LOCKFILE} ${LOCKFILE_OUT} ${LOCKFILE_NODE_ID} ${INSTALL_FOLDER} - ${OUTPUT_FOLDER} ${GENERATOR} ${BUILD} ${ENV} ${ENV_HOST} ${ENV_BUILD} - ${OPTIONS} ${OPTIONS_HOST} ${OPTIONS_BUILD} ${PROFILE} ${PROFILE_HOST} - ${PROFILE_BUILD} ${SETTINGS} ${SETTINGS_HOST} ${SETTINGS_BUILD} + set(install_args install ${PATH_OR_REFERENCE} ${REFERENCE} ${UPDATE} ${NO_IMPORTS} ${REMOTE} + ${LOCKFILE} ${LOCKFILE_OUT} ${LOCKFILE_NODE_ID} ${INSTALL_FOLDER} + ${OUTPUT_FOLDER} ${GENERATOR} ${BUILD} ${ENV} ${ENV_HOST} ${ENV_BUILD} + ${OPTIONS} ${OPTIONS_HOST} ${OPTIONS_BUILD} ${PROFILE} ${PROFILE_HOST} + ${PROFILE_BUILD} ${SETTINGS} ${SETTINGS_HOST} ${SETTINGS_BUILD} ${CONF} ${CONF_HOST} ${CONF_BUILD}) string(REPLACE ";" " " _install_args "${install_args}") @@ -770,12 +770,12 @@ function(conan_cmake_lock_create) set(BASE --base) endif() set(lock_create_Args lock create ${PATH} ${REFERENCE} ${UPDATE} ${BASE} ${REMOTE} ${LOCKFILE} ${LOCKFILE_OUT} ${LOCKFILE_NODE_ID} ${INSTALL_FOLDER} - ${GENERATOR} ${BUILD} ${ENV} ${ENV_HOST} ${ENV_BUILD} ${OPTIONS} ${OPTIONS_HOST} ${OPTIONS_BUILD} + ${GENERATOR} ${BUILD} ${ENV} ${ENV_HOST} ${ENV_BUILD} ${OPTIONS} ${OPTIONS_HOST} ${OPTIONS_BUILD} ${PROFILE} ${PROFILE_HOST} ${PROFILE_BUILD} ${SETTINGS} ${SETTINGS_HOST} ${SETTINGS_BUILD}) string(REPLACE ";" " " _lock_create_Args "${lock_create_Args}") message(STATUS "Conan executing: ${CONAN_CMD} ${_lock_create_Args}") - + if(ARGS_OUTPUT_QUIET) set(OUTPUT_OPT OUTPUT_QUIET) endif() @@ -1089,7 +1089,7 @@ function(conan_cmake_profile) set(profileMultiValueArgs SETTINGS OPTIONS CONF ENV BUILDENV RUNENV TOOL_REQUIRES) cmake_parse_arguments(ARGS "" "${profileOneValueArgs}" "${profileMultiValueArgs}" ${ARGN}) - if(DEFINED ARGS_FILEPATH) + if(DEFINED ARGS_FILEPATH) set(_FN "${ARGS_FILEPATH}") else() set(_FN "${CMAKE_CURRENT_BINARY_DIR}/profile") diff --git a/src/Nncase.Importer/Onnx/Reduce.cs b/src/Nncase.Importer/Onnx/Reduce.cs index 3020143ca5..2d0f4b03c2 100644 --- a/src/Nncase.Importer/Onnx/Reduce.cs +++ b/src/Nncase.Importer/Onnx/Reduce.cs @@ -13,7 +13,7 @@ public partial class OnnxImporter { private Expr VisitReduce(in NodeProto op, ReduceOp reduceOp, Expr initValue) { - return ReduceCore(op, reduceOp, initValue, expr => expr); + return ReduceCore(op, reduceOp, initValue, expr => expr, GetOpSet(op)); } private Expr ReduceCore(in NodeProto op, ReduceOp reduceOp, Expr initValue, Func f, long opVersion = 999) diff --git a/tests/importer/onnx_/basic/test_reduce.py b/tests/importer/onnx_/basic/test_reduce.py index 879d7f9a7b..75681ad001 100644 --- a/tests/importer/onnx_/basic/test_reduce.py +++ b/tests/importer/onnx_/basic/test_reduce.py @@ -82,7 +82,8 @@ def _make_module(in_shape, in_datatype, reduce_op, axes, keepdims, op_version): 'ReduceMax', 'ReduceMean', 'ReduceMin', - 'ReduceProd' + 'ReduceProd', + 'ReduceSum', ] axes_list = [ @@ -120,11 +121,14 @@ def _make_module(in_shape, in_datatype, reduce_op, axes, keepdims, op_version): @pytest.mark.parametrize('op_version', op_version_lists) def test_reduce(in_shape, in_datatype, reduce_op, axes, keepdims, request, op_version): if len(axes) <= len(in_shape): - model_def = _make_module(in_shape, in_datatype, reduce_op, axes, keepdims, op_version) - - runner = OnnxTestRunner(request.node.name) - model_file = runner.from_onnx_helper(model_def) - runner.run(model_file) + if reduce_op == 'ReduceSum' and op_version >= 13: + pass + else: + model_def = _make_module(in_shape, in_datatype, reduce_op, axes, keepdims, op_version) + + runner = OnnxTestRunner(request.node.name) + model_file = runner.from_onnx_helper(model_def) + runner.run(model_file) if __name__ == "__main__":