From b0a3fa25b94a3d21811d049feb82eba57c6618f3 Mon Sep 17 00:00:00 2001 From: Curio Yang Date: Tue, 28 May 2024 13:32:39 +0800 Subject: [PATCH 01/10] fix bug --- src/Nncase.Importer/Onnx/Reduce.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) From b1975dac2fbff72a964ef35ecddbc7f5e3195242 Mon Sep 17 00:00:00 2001 From: Curio Yang Date: Tue, 28 May 2024 13:35:44 +0800 Subject: [PATCH 02/10] add reduce sum test --- tests/importer/onnx_/basic/test_reduce.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/importer/onnx_/basic/test_reduce.py b/tests/importer/onnx_/basic/test_reduce.py index 879d7f9a7b..a44dc0a2dc 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 = [ From 293d8839b10f43a82c5f06f27dae220099e853d0 Mon Sep 17 00:00:00 2001 From: Curio Yang Date: Tue, 28 May 2024 15:26:54 +0800 Subject: [PATCH 03/10] update test --- tests/importer/onnx_/basic/test_reduce.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/importer/onnx_/basic/test_reduce.py b/tests/importer/onnx_/basic/test_reduce.py index a44dc0a2dc..3f2bd007d7 100644 --- a/tests/importer/onnx_/basic/test_reduce.py +++ b/tests/importer/onnx_/basic/test_reduce.py @@ -121,11 +121,12 @@ 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) + if reduce_op == 'ReduceSum' and op_version < 13: + 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) + runner = OnnxTestRunner(request.node.name) + model_file = runner.from_onnx_helper(model_def) + runner.run(model_file) if __name__ == "__main__": From dd0003ce47993a6dedc7015ac9b027cab4d3cc0d Mon Sep 17 00:00:00 2001 From: Curio Yang Date: Tue, 28 May 2024 15:27:09 +0800 Subject: [PATCH 04/10] add tips for bug in homepage --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7ec32fbf7d..e4c31fcf0a 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. --- From 647e75e04da7ca9b743f106f5b5a3bbbca52a911 Mon Sep 17 00:00:00 2001 From: curioyang Date: Wed, 29 May 2024 12:32:54 +0800 Subject: [PATCH 05/10] fix condition --- tests/importer/onnx_/basic/test_reduce.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/importer/onnx_/basic/test_reduce.py b/tests/importer/onnx_/basic/test_reduce.py index 3f2bd007d7..75681ad001 100644 --- a/tests/importer/onnx_/basic/test_reduce.py +++ b/tests/importer/onnx_/basic/test_reduce.py @@ -121,7 +121,9 @@ 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): - if reduce_op == 'ReduceSum' and op_version < 13: + 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) From 503c4483e72e469cb55783e9db244a3c588fcc9e Mon Sep 17 00:00:00 2001 From: Curio Yang Date: Fri, 7 Jun 2024 16:25:51 +0800 Subject: [PATCH 06/10] fix MSVC_VERSION 1930-1949 = VS 17.0 (v143 toolset) link:https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html --- cmake/conan.cmake | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) 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") From bc7785604f205c9f76416d9f27c6036eef61cc23 Mon Sep 17 00:00:00 2001 From: Curio Yang <39184746+curioyang@users.noreply.github.com> Date: Fri, 7 Jun 2024 17:09:34 +0800 Subject: [PATCH 07/10] Update compiler-build.yml test windows version --- .github/workflows/compiler-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/compiler-build.yml b/.github/workflows/compiler-build.yml index 130cd7f434..2543e03f50 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-2022, arch: x64, cmakeArgs: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl, buildType: Release} steps: - uses: actions/checkout@v3 @@ -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 From c70ed69c96c67f7ff47b37ec8028ec91d6fdbac2 Mon Sep 17 00:00:00 2001 From: Curio Yang <39184746+curioyang@users.noreply.github.com> Date: Fri, 7 Jun 2024 17:16:35 +0800 Subject: [PATCH 08/10] Update compiler-build.yml --- .github/workflows/compiler-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/compiler-build.yml b/.github/workflows/compiler-build.yml index 2543e03f50..bcd3ca429b 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-2022, 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 From 56b978c0f5697e6a30c0ee531649992b3b3bac47 Mon Sep 17 00:00:00 2001 From: Curio Yang Date: Fri, 7 Jun 2024 17:44:37 +0800 Subject: [PATCH 09/10] fix build: downgrade windows version to 2019 --- .github/workflows/compiler-python-release.yml | 2 +- .github/workflows/jupyter-test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/compiler-python-release.yml b/.github/workflows/compiler-python-release.yml index 689979ea52..4d57754f53 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 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 From 13286486ecca4dc0a08da98f5805d06547951b59 Mon Sep 17 00:00:00 2001 From: Curio Yang Date: Fri, 7 Jun 2024 18:05:33 +0800 Subject: [PATCH 10/10] fix build: downgrade windows version to 2019 --- .github/workflows/compiler-build.yml | 4 ++-- .github/workflows/compiler-python-release.yml | 2 +- .github/workflows/runtime-build.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/compiler-build.yml b/.github/workflows/compiler-build.yml index bcd3ca429b..ac8ae1f861 100644 --- a/.github/workflows/compiler-build.yml +++ b/.github/workflows/compiler-build.yml @@ -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 diff --git a/.github/workflows/compiler-python-release.yml b/.github/workflows/compiler-python-release.yml index 4d57754f53..378532c60f 100644 --- a/.github/workflows/compiler-python-release.yml +++ b/.github/workflows/compiler-python-release.yml @@ -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/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