diff --git a/.github/workflows/compilation_on_android_ubuntu.yml b/.github/workflows/compilation_on_android_ubuntu.yml index 3d888d4aa3..9bd195fd0f 100644 --- a/.github/workflows/compilation_on_android_ubuntu.yml +++ b/.github/workflows/compilation_on_android_ubuntu.yml @@ -91,8 +91,7 @@ jobs: arch: "X86" build_wamrc: - needs: - [build_llvm_libraries_on_ubuntu_2204] + needs: [build_llvm_libraries_on_ubuntu_2204] runs-on: ${{ matrix.os }} strategy: matrix: @@ -129,8 +128,7 @@ jobs: working-directory: wamr-compiler build_iwasm: - needs: - [build_llvm_libraries_on_ubuntu_2204] + needs: [build_llvm_libraries_on_ubuntu_2204] runs-on: ${{ matrix.os }} strategy: matrix: @@ -157,8 +155,6 @@ jobs: "-DWAMR_BUILD_MEMORY_PROFILING=1", "-DWAMR_BUILD_MULTI_MODULE=1", "-DWAMR_BUILD_PERF_PROFILING=1", - "-DWAMR_BUILD_REF_TYPES=1", - "-DWAMR_BUILD_SIMD=1", "-DWAMR_BUILD_LIB_SIMDE=1", "-DWAMR_BUILD_TAIL_CALL=1", "-DWAMR_DISABLE_HW_BOUND_CHECK=1", @@ -171,8 +167,7 @@ jobs: os: [ubuntu-22.04] platform: [android, linux] exclude: - # incompatible feature and platform - # incompatible mode and feature + # incompatible feature and platform and mode # MULTI_MODULE only on INTERP mode and AOT mode - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1" @@ -182,9 +177,6 @@ jobs: make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1" - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1" - # SIMD only on JIT/AOT/fast interpreter mode - - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS - make_options_feature: "-DWAMR_BUILD_SIMD=1" # DEBUG_INTERP only on CLASSIC INTERP mode - make_options_run_mode: $AOT_BUILD_OPTIONS make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1" @@ -268,6 +260,15 @@ jobs: include: - os: ubuntu-22.04 llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }} + # classic interp doesn't support SIMD + - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_SIMD=0" + # fast jit doesn't support SIMD + - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_SIMD=0" + # multi-tier jit doesn't support SIMD + - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_SIMD=0" steps: - name: checkout uses: actions/checkout@v5 @@ -294,7 +295,7 @@ jobs: if: matrix.platform == 'linux' run: | mkdir build && cd build - cmake .. -DCMAKE_C_FLAGS="-Werror" ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} + cmake .. -DCMAKE_C_FLAGS="-Werror" ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} ${{ matrix.extra_options}} cmake --build . --config Release --parallel 4 working-directory: product-mini/platforms/${{ matrix.platform }} @@ -308,20 +309,13 @@ jobs: working-directory: product-mini/platforms/${{ matrix.platform }} build_unit_tests: - needs: - [ - build_llvm_libraries_on_ubuntu_2204, - build_wamrc - ] + needs: [build_llvm_libraries_on_ubuntu_2204, build_wamrc] runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-22.04] - build_target: [ - "X86_64", - "X86_32", - ] + build_target: ["X86_64", "X86_32"] include: - os: ubuntu-22.04 llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }} @@ -350,7 +344,7 @@ jobs: uses: ./.github/actions/install-wasi-sdk-wabt with: os: ${{ matrix.os }} - + - name: Build wamrc run: | mkdir build && cd build @@ -374,8 +368,7 @@ jobs: working-directory: tests/unit build_regression_tests: - needs: - [build_llvm_libraries_on_ubuntu_2204] + needs: [build_llvm_libraries_on_ubuntu_2204] runs-on: ${{ matrix.os }} strategy: matrix: @@ -383,7 +376,7 @@ jobs: include: - os: ubuntu-22.04 llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }} - + steps: - name: checkout uses: actions/checkout@v5 @@ -403,24 +396,19 @@ jobs: - name: Quit if cache miss if: (steps.retrieve_llvm_libs.outputs.cache-hit != 'true') run: echo "::error::can not get prebuilt llvm libraries" && exit 1 - + - name: Build wamrc and iwasm run: | ./build_wamr.sh working-directory: tests/regression/ba-issues - + - name: Run regression tests run: | python run.py working-directory: tests/regression/ba-issues build_samples_wasm_c_api: - needs: - [ - build_iwasm, - build_llvm_libraries_on_ubuntu_2204, - build_wamrc, - ] + needs: [build_iwasm, build_llvm_libraries_on_ubuntu_2204, build_wamrc] runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -439,6 +427,20 @@ jobs: include: - os: ubuntu-22.04 llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }} + # classic interp doesn't support SIMD + - make_options: $CLASSIC_INTERP_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_SIMD=0" + # fast jit doesn't support Multi-module and SIMD + - make_options: $FAST_JIT_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_SIMD=0 -DWAMR_BUILD_MULTI_MODULE=0" + # multi-tier jit doesn't support Multi-module and SIMD + - make_options: $MULTI_TIER_JIT_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_SIMD=0 -DWAMR_BUILD_MULTI_MODULE=0" + # LLVM JIT doesn't support Multi-module + - make_options: $LLVM_LAZY_JIT_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_MULTI_MODULE=0" + - make_options: $LLVM_EAGER_JIT_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_MULTI_MODULE=0" steps: - name: checkout @@ -477,7 +479,7 @@ jobs: - name: Build Sample [wasm-c-api] run: | VERBOSE=1 - cmake -S . -B build ${{ matrix.make_options }} + cmake -S . -B build ${{ matrix.make_options }} ${{ matrix.extra_options }} cmake --build build --config Debug --parallel 4 ctest --test-dir build --output-on-failure working-directory: samples/wasm-c-api @@ -488,12 +490,7 @@ jobs: working-directory: samples/printversion build_samples_others: - needs: - [ - build_iwasm, - build_llvm_libraries_on_ubuntu_2204, - build_wamrc, - ] + needs: [build_iwasm, build_llvm_libraries_on_ubuntu_2204, build_wamrc] runs-on: ${{ matrix.os }} strategy: matrix: @@ -632,12 +629,7 @@ jobs: ./import-func-callback test: - needs: - [ - build_iwasm, - build_llvm_libraries_on_ubuntu_2204, - build_wamrc, - ] + needs: [build_iwasm, build_llvm_libraries_on_ubuntu_2204, build_wamrc] runs-on: ${{ matrix.os }} strategy: fail-fast: false diff --git a/.github/workflows/compilation_on_macos.yml b/.github/workflows/compilation_on_macos.yml index 912bf7dea7..6e7da32f8a 100644 --- a/.github/workflows/compilation_on_macos.yml +++ b/.github/workflows/compilation_on_macos.yml @@ -138,8 +138,6 @@ jobs: "-DWAMR_BUILD_MEMORY_PROFILING=1", "-DWAMR_BUILD_MULTI_MODULE=1", "-DWAMR_BUILD_PERF_PROFILING=1", - "-DWAMR_BUILD_REF_TYPES=1", - "-DWAMR_BUILD_SIMD=1", "-DWAMR_BUILD_TAIL_CALL=1", "-DWAMR_DISABLE_HW_BOUND_CHECK=1", "-DWAMR_BUILD_EXTENDED_CONST_EXPR=1", @@ -154,11 +152,6 @@ jobs: make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1" - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1" - # SIMD only on JIT/AOT mode - - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS - make_options_feature: "-DWAMR_BUILD_SIMD=1" - - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS - make_options_feature: "-DWAMR_BUILD_SIMD=1" # DEBUG_INTERP only on CLASSIC INTERP mode - make_options_run_mode: $AOT_BUILD_OPTIONS make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1" @@ -188,6 +181,9 @@ jobs: include: - os: macos-13 llvm_cache_key: ${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }} + # classic interp doesn't support SIMD + - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_SIMD=0" steps: - name: checkout uses: actions/checkout@v5 @@ -213,7 +209,7 @@ jobs: - name: Build iwasm run: | mkdir build && cd build - cmake .. -DCMAKE_C_FLAGS="-Werror" ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} + cmake .. -DCMAKE_C_FLAGS="-Werror" ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} ${{ matrix.extra_options }} cmake --build . --config Release --parallel 4 working-directory: product-mini/platforms/${{ matrix.platform }} @@ -240,6 +236,20 @@ jobs: include: - os: macos-13 llvm_cache_key: ${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }} + # classic interp doesn't support SIMD + - make_options: $CLASSIC_INTERP_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_SIMD=0" + # fast jit doesn't support Multi-module and SIMD + - make_options: $FAST_JIT_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_SIMD=0 -DWAMR_BUILD_MULTI_MODULE=0" + # multi-tier jit doesn't support Multi-module and SIMD + - make_options: $MULTI_TIER_JIT_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_SIMD=0 -DWAMR_BUILD_MULTI_MODULE=0" + # LLVM JIT doesn't support Multi-module + - make_options: $LLVM_LAZY_JIT_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_MULTI_MODULE=0" + - make_options: $LLVM_EAGER_JIT_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_MULTI_MODULE=0" steps: - name: checkout @@ -278,7 +288,7 @@ jobs: - name: Build Sample [wasm-c-api] run: | VERBOSE=1 - cmake -S . -B build ${{ matrix.make_options }} + cmake -S . -B build ${{ matrix.make_options }} ${{ matrix.extra_options }} cmake --build build --config Debug --parallel 4 ctest --test-dir build --output-on-failure working-directory: samples/wasm-c-api diff --git a/.github/workflows/compilation_on_sgx.yml b/.github/workflows/compilation_on_sgx.yml index aa95f94699..7e09236f53 100644 --- a/.github/workflows/compilation_on_sgx.yml +++ b/.github/workflows/compilation_on_sgx.yml @@ -114,6 +114,13 @@ jobs: # MINI_LOADER only on INTERP mode - make_options_run_mode: $AOT_BUILD_OPTIONS make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1" + # FAST_JIT doesn't support MULTI_MODULE + - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS + make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1" + include: + # classic interp mode doesn't support SIMD + - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS + make_options_feature: "-DWAMR_BUILD_SIMD=0" steps: - name: checkout uses: actions/checkout@v5 diff --git a/.github/workflows/compilation_on_windows.yml b/.github/workflows/compilation_on_windows.yml index 003a6ba988..41dbcc9c5a 100644 --- a/.github/workflows/compilation_on_windows.yml +++ b/.github/workflows/compilation_on_windows.yml @@ -78,7 +78,6 @@ jobs: "-DWAMR_BUILD_CUSTOM_NAME_SECTION=1", "-DWAMR_DISABLE_HW_BOUND_CHECK=1", "-DWAMR_BUILD_REF_TYPES=1", - "-DWAMR_BUILD_SIMD=1", "-DWAMR_BUILD_DEBUG_INTERP=1", "-DWAMR_BUILD_LIB_PTHREAD=1", "-DWAMR_BUILD_LIB_WASI_THREADS=1", diff --git a/.github/workflows/nightly_run.yml b/.github/workflows/nightly_run.yml index 58532aac85..fb02f61363 100644 --- a/.github/workflows/nightly_run.yml +++ b/.github/workflows/nightly_run.yml @@ -122,8 +122,6 @@ jobs: "-DWAMR_BUILD_MEMORY_PROFILING=1", "-DWAMR_BUILD_MULTI_MODULE=1", "-DWAMR_BUILD_PERF_PROFILING=1", - "-DWAMR_BUILD_REF_TYPES=1", - "-DWAMR_BUILD_SIMD=1", "-DWAMR_BUILD_TAIL_CALL=1", "-DWAMR_DISABLE_HW_BOUND_CHECK=1", "-DWAMR_BUILD_MEMORY64=1", @@ -145,11 +143,6 @@ jobs: make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1" - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1" - # SIMD only on JIT/AOT mode - - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS - make_options_feature: "-DWAMR_BUILD_SIMD=1" - - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS - make_options_feature: "-DWAMR_BUILD_SIMD=1" # DEBUG_INTERP only on CLASSIC INTERP mode - make_options_run_mode: $AOT_BUILD_OPTIONS make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1" @@ -230,6 +223,15 @@ jobs: include: - os: ubuntu-22.04 llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }} + # classic interp doesn't support SIMD + - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_SIMD=0" + # fast jit doesn't support SIMD + - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_SIMD=0" + # multi-tier jit doesn't support SIMD + - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_SIMD=0" steps: - name: checkout @@ -257,7 +259,7 @@ jobs: if: matrix.platform == 'linux' run: | mkdir build && cd build - cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} + cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} ${{ matrix.extra_options }} cmake --build . --config Release --parallel 4 working-directory: product-mini/platforms/${{ matrix.platform }} @@ -265,7 +267,7 @@ jobs: if: matrix.platform == 'android' run: | mkdir build && cd build - cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} \ + cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} ${{ matrix.extra_options }} \ -DWAMR_BUILD_TARGET=X86_64 cmake --build . --config Release --parallel 4 working-directory: product-mini/platforms/${{ matrix.platform }} @@ -295,8 +297,6 @@ jobs: "-DWAMR_BUILD_MEMORY_PROFILING=1", "-DWAMR_BUILD_MULTI_MODULE=1", "-DWAMR_BUILD_PERF_PROFILING=1", - "-DWAMR_BUILD_REF_TYPES=1", - "-DWAMR_BUILD_SIMD=1", "-DWAMR_BUILD_TAIL_CALL=1", "-DWAMR_DISABLE_HW_BOUND_CHECK=1", "-DWAMR_BUILD_MEMORY64=1", @@ -339,6 +339,16 @@ jobs: make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1" - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1" + include: + # classic interp doesn't support SIMD + - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_SIMD=0" + # fast jit doesn't support SIMD + - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_SIMD=0" + # multi-tier jit doesn't support SIMD + - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_SIMD=0" steps: - name: Install dependencies run: | @@ -357,7 +367,7 @@ jobs: - name: Build iwasm run: | mkdir build && cd build - cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} -DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8 + cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} ${{ matrix.extra_options }} -DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8 cmake --build . --config Release --parallel 4 working-directory: wamr/product-mini/platforms/linux @@ -385,6 +395,22 @@ jobs: exclude: - make_options: $MULTI_TIER_JIT_BUILD_OPTIONS sanitizer: asan + include: + # classic interp doesn't support SIMD + - make_options: $CLASSIC_INTERP_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_SIMD=0" + # fast jit doesn't support Multi-module and SIMD + - make_options: $FAST_JIT_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_SIMD=0 -DWAMR_BUILD_MULTI_MODULE=0" + # multi-tier jit doesn't support Multi-module and SIMD + - make_options: $MULTI_TIER_JIT_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_SIMD=0 -DWAMR_BUILD_MULTI_MODULE=0" + # LLVM JIT doesn't support Multi-module + - make_options: $LLVM_LAZY_JIT_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_MULTI_MODULE=0" + - make_options: $LLVM_EAGER_JIT_BUILD_OPTIONS + extra_options: "-DWAMR_BUILD_MULTI_MODULE=0" + steps: - name: checkout uses: actions/checkout@v5 @@ -422,7 +448,7 @@ jobs: - name: Build Sample [wasm-c-api] run: | VERBOSE=1 - cmake -S . -B build ${{ matrix.make_options }} \ + cmake -S . -B build ${{ matrix.make_options }} ${{ matrix.extra_options }} \ -D WAMR_BUILD_SANITIZER="${{matrix.sanitizer}}" \ -D WAMR_BUILD_QUICK_AOT_ENTRY=0 cmake --build build --config Release --parallel 4 diff --git a/build-scripts/config_common.cmake b/build-scripts/config_common.cmake index c087a0e673..cb15b8b019 100644 --- a/build-scripts/config_common.cmake +++ b/build-scripts/config_common.cmake @@ -282,6 +282,8 @@ if (WAMR_BUILD_REF_TYPES EQUAL 1) set (WAMR_BUILD_CALL_INDIRECT_OVERLONG 1) endif () +include(${CMAKE_CURRENT_LIST_DIR}/unsupported_combination.cmake) + message ("-- Build Configurations:") message (" Build as target ${WAMR_BUILD_TARGET}") message (" Build for platform ${WAMR_BUILD_PLATFORM}") diff --git a/build-scripts/unsupported_combination.cmake b/build-scripts/unsupported_combination.cmake new file mode 100644 index 0000000000..635a20a057 --- /dev/null +++ b/build-scripts/unsupported_combination.cmake @@ -0,0 +1,102 @@ +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +include(CMakePrintHelpers) + +# Define a function to check for unsupported combinations +function(check_aot_mode_error error_message) + if(WAMR_BUILD_AOT EQUAL 1) + message(FATAL_ERROR "${error_message}") + endif() +endfunction() + +# Define a function to check for unsupported combinations with CLASSIC_INTERP +function(check_classic_interp_error error_message) + # Usually, Enable INTERP to enable wasm loader for JIT + # WAMR_BUILD_JIT might be undefined, so check it first + if(WAMR_BUILD_JIT EQUAL 1) + return() + endif() + + if(WAMR_BUILD_FAST_JIT EQUAL 1) + return() + endif() + + if(WAMR_BUILD_INTERP EQUAL 1 AND WAMR_BUILD_FAST_INTERP EQUAL 0) + message(FATAL_ERROR "${error_message}") + endif() +endfunction() + +# Define a function to check for unsupported combinations with FAST_INTERP +function(check_fast_interp_error error_message) + # Usually, Enable INTERP to enable wasm loader for JIT + # WAMR_BUILD_JIT might be undefined, so check it first + if(WAMR_BUILD_JIT EQUAL 1) + return() + endif() + + if(WAMR_BUILD_FAST_JIT EQUAL 1) + return() + endif() + + if(WAMR_BUILD_INTERP EQUAL 1 AND WAMR_BUILD_FAST_INTERP EQUAL 1) + message(FATAL_ERROR "${error_message}") + endif() +endfunction() + +# Define a function to check for unsupported combinations with FAST_JIT +function(check_fast_jit_error error_message) + if(WAMR_BUILD_FAST_JIT EQUAL 1) + message(FATAL_ERROR "${error_message}") + endif() +endfunction() + +# Define a function to check for unsupported combinations with LLVM_JIT +function(check_llvm_jit_error error_message) + if(WAMR_BUILD_JIT EQUAL 1) + message(FATAL_ERROR "${error_message}") + endif() +endfunction() + +# Below are the unsupported combinations checks +# Please keep this list in sync with tests/unit/unsupported-features/CMakeLists.txt +# and tests/wamr-test-suites/test_wamr.sh +#cmake_print_variables(WAMR_BUILD_INTERP WAMR_BUILD_FAST_INTERP WAMR_BUILD_JIT) + +if(WAMR_BUILD_EXCE_HANDLING EQUAL 1) + check_aot_mode_error("Unsupported build configuration: EXCE_HANDLING + AOT") + check_fast_interp_error("Unsupported build configuration: EXCE_HANDLING + FAST_INTERP") + check_fast_jit_error("Unsupported build configuration: EXCE_HANDLING + FAST_JIT") + check_llvm_jit_error("Unsupported build configuration: EXCE_HANDLING + JIT") +endif() + +if(WAMR_BUILD_GC EQUAL 1) + check_fast_jit_error("Unsupported build configuration: GC + FAST_JIT") +endif() + +if(WAMR_BUILD_MEMORY64 EQUAL 1) + check_fast_interp_error("Unsupported build configuration: MEMORY64 + FAST_INTERP") + check_fast_jit_error("Unsupported build configuration: MEMORY64 + FAST_JIT") + check_llvm_jit_error("Unsupported build configuration: MEMORY64 + JIT") +endif() + +if(WAMR_BUILD_MULTI_MEMORY EQUAL 1) + check_aot_mode_error("Unsupported build configuration: EXCE_HANDLING + AOT") + check_fast_interp_error("Unsupported build configuration: EXCE_HANDLING + FAST_INTERP") + check_fast_jit_error("Unsupported build configuration: EXCE_HANDLING + FAST_JIT") + check_llvm_jit_error("Unsupported build configuration: EXCE_HANDLING + JIT") +endif() + +if(WAMR_BUILD_MULTI_MODULE EQUAL 1) + check_fast_jit_error("Unsupported build configuration: MULTI_MODULE + FAST_JIT") + check_llvm_jit_error("Unsupported build configuration: MULTI_MODULE + JIT") +endif() + +if(WAMR_BUILD_SHARED_HEAP EQUAL 1) + check_fast_jit_error("Unsupported build configuration: SHARED_HEAP + FAST_JIT") +endif() + +if(WAMR_BUILD_SIMD EQUAL 1) + check_classic_interp_error("Unsupported build configuration: SIMD + CLASSIC_INTERP") + check_fast_jit_error("Unsupported build configuration: SIMD + FAST_JIT") +endif() diff --git a/doc/build_wamr.md b/doc/build_wamr.md index fa6c6af8db..2cb3f45aaa 100644 --- a/doc/build_wamr.md +++ b/doc/build_wamr.md @@ -1,13 +1,12 @@ - # Build WAMR vmcore WAMR vmcore is a set of runtime libraries for loading and running Wasm modules. This document introduces how to build the WAMR vmcore. References: + - [how to build iwasm](../product-mini/README.md): building different target platforms such as Linux, Windows, Mac etc - [Blog: Introduction to WAMR running modes](https://bytecodealliance.github.io/wamr.dev/blog/introduction-to-wamr-running-modes/) - ## WAMR vmcore cmake building configurations By including the script `runtime_lib.cmake` under folder [build-scripts](../build-scripts) in CMakeList.txt, it is easy to use vmcore to build host software with cmake. @@ -24,13 +23,13 @@ Please refer to [a full list of configuration options](./tired_support.md#append ### **Configure platform and architecture** -- **WAMR_BUILD_PLATFORM**: set the target platform. It can be set to any platform name (folder name) under folder [core/shared/platform](../core/shared/platform). +- **WAMR_BUILD_PLATFORM**: set the target platform. It can be set to any platform name (folder name) under folder [core/shared/platform](../core/shared/platform). -- **WAMR_BUILD_TARGET**: set the target CPU architecture. Current supported targets are: X86_64, X86_32, AARCH64, ARM, THUMB, XTENSA, ARC, RISCV32, RISCV64 and MIPS. - - For ARM and THUMB, the format is \\[\]\[_VFP], where \ is the ARM sub-architecture and the "_VFP" suffix means using VFP coprocessor registers s0-s15 (d0-d7) for passing arguments or returning results in standard procedure-call. Both \ and "_VFP" are optional, e.g. ARMV7, ARMV7_VFP, THUMBV7, THUMBV7_VFP and so on. +- **WAMR_BUILD_TARGET**: set the target CPU architecture. Current supported targets are: X86_64, X86_32, AARCH64, ARM, THUMB, XTENSA, ARC, RISCV32, RISCV64 and MIPS. + - For ARM and THUMB, the format is \\[\]\[\_VFP], where \ is the ARM sub-architecture and the "\_VFP" suffix means using VFP coprocessor registers s0-s15 (d0-d7) for passing arguments or returning results in standard procedure-call. Both \ and "\_VFP" are optional, e.g. ARMV7, ARMV7_VFP, THUMBV7, THUMBV7_VFP and so on. - For AARCH64, the format is\[\], VFP is enabled by default. \ is optional, e.g. AARCH64, AARCH64V8, AARCH64V8.1 and so on. - - For RISCV64, the format is \[_abi], where "_abi" is optional, currently the supported formats are RISCV64, RISCV64_LP64D and RISCV64_LP64: RISCV64 and RISCV64_LP64D are identical, using [LP64D](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#named-abis) as abi (LP64 with hardware floating-point calling convention for FLEN=64). And RISCV64_LP64 uses [LP64](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#named-abis) as abi (Integer calling-convention only, and hardware floating-point calling convention is not used). - - For RISCV32, the format is \[_abi], where "_abi" is optional, currently the supported formats are RISCV32, RISCV32_ILP32D, RISCV32_ILP32F and RISCV32_ILP32: RISCV32 and RISCV32_ILP32D are identical, using [ILP32D](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#named-abis) as abi (ILP32 with hardware floating-point calling convention for FLEN=64). RISCV32_ILP32F uses [ILP32F](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#named-abis) as abi (ILP32 with hardware floating-point calling convention for FLEN=32). And RISCV32_ILP32 uses [ILP32](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#named-abis) as abi (Integer calling-convention only, and hardware floating-point calling convention is not used). + - For RISCV64, the format is \[_abi], where "\_abi" is optional, currently the supported formats are RISCV64, RISCV64_LP64D and RISCV64_LP64: RISCV64 and RISCV64_LP64D are identical, using [LP64D](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#named-abis) as abi (LP64 with hardware floating-point calling convention for FLEN=64). And RISCV64_LP64 uses [LP64](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#named-abis) as abi (Integer calling-convention only, and hardware floating-point calling convention is not used). + - For RISCV32, the format is \[_abi], where "\_abi" is optional, currently the supported formats are RISCV32, RISCV32_ILP32D, RISCV32_ILP32F and RISCV32_ILP32: RISCV32 and RISCV32_ILP32D are identical, using [ILP32D](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#named-abis) as abi (ILP32 with hardware floating-point calling convention for FLEN=64). RISCV32_ILP32F uses [ILP32F](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#named-abis) as abi (ILP32 with hardware floating-point calling convention for FLEN=32). And RISCV32_ILP32 uses [ILP32](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#named-abis) as abi (Integer calling-convention only, and hardware floating-point calling convention is not used). ```bash cmake -DWAMR_BUILD_PLATFORM=linux -DWAMR_BUILD_TARGET=ARM @@ -42,7 +41,8 @@ cmake -DWAMR_BUILD_PLATFORM=linux -DWAMR_BUILD_TARGET=ARM - **WAMR_BUILD_FAST_INTERP**=1/0: build fast (default) or classic WASM interpreter. - NOTE: the fast interpreter runs ~2X faster than classic interpreter, but consumes about 2X memory to hold the pre-compiled code. +> [!NOTE] +> the fast interpreter runs ~2X faster than classic interpreter, but consumes about 2X memory to hold the pre-compiled code. ### **Configure AOT and JITs** @@ -59,150 +59,223 @@ cmake -DWAMR_BUILD_PLATFORM=linux -DWAMR_BUILD_TARGET=ARM - **WAMR_BUILD_LIBC_UVWASI**=1/0 (Experiment), build the [WASI](https://github.com/WebAssembly/WASI) libc subset for WASM app based on [uvwasi](https://github.com/nodejs/uvwasi) implementation, default to disable if not set -> Note: WAMR doesn't support a safe sandbox on all platforms. For platforms that do not support **WAMR_BUILD_LIBC_WASI**, e.g. Windows, developers can try using an unsafe uvwasi-based WASI implementation by using **WAMR_BUILD_LIBC_UVWASI**. +> [!WARNING] +> WAMR doesn't support a safe sandbox on all platforms. For platforms that do not support **WAMR_BUILD_LIBC_WASI**, e.g. Windows, developers can try using an unsafe uvwasi-based WASI implementation by using **WAMR_BUILD_LIBC_UVWASI**. ### **Enable Multi-Module feature** - **WAMR_BUILD_MULTI_MODULE**=1/0, default to disable if not set -> Note: See [Multiple Modules as Dependencies](./multi_module.md) for more details. + +> [!NOTE] +> See [Multiple Modules as Dependencies](./multi_module.md) for more details. + +> [!WARNING] +> Currently, the multi-module feature is not supported in fast-jit and llvm-jit modes. ### **Enable WASM mini loader** - **WAMR_BUILD_MINI_LOADER**=1/0, default to disable if not set -> Note: the mini loader doesn't check the integrity of the WASM binary file, developer must ensure that the WASM file is well-formed. +> [!NOTE] +> the mini loader doesn't check the integrity of the WASM binary file, developer must ensure that the WASM file is well-formed. ### **Enable shared memory feature** + - **WAMR_BUILD_SHARED_MEMORY**=1/0, default to disable if not set ### **Enable bulk memory feature** + - **WAMR_BUILD_BULK_MEMORY**=1/0, default to disable if not set ### **Enable memory64 feature** + - **WAMR_BUILD_MEMORY64**=1/0, default to disable if not set -> Note: Currently, the memory64 feature is only supported in classic interpreter running mode and AOT mode. +> [!WARNING] +> Currently, the memory64 feature is only supported in classic interpreter running mode and AOT mode. ### **Enable thread manager** + - **WAMR_BUILD_THREAD_MGR**=1/0, default to disable if not set ### **Enable lib-pthread** + - **WAMR_BUILD_LIB_PTHREAD**=1/0, default to disable if not set -> Note: The dependent feature of lib pthread such as the `shared memory` and `thread manager` will be enabled automatically. +> [!NOTE] +> The dependent feature of lib pthread such as the `shared memory` and `thread manager` will be enabled automatically. > See [WAMR pthread library](./pthread_library.md) for more details. ### **Enable lib-pthread-semaphore** + - **WAMR_BUILD_LIB_PTHREAD_SEMAPHORE**=1/0, default to disable if not set -> Note: This feature depends on `lib-pthread`, it will be enabled automatically if this feature is enabled. + +> [!NOTE] +> This feature depends on `lib-pthread`, it will be enabled automatically if this feature is enabled. ### **Enable lib wasi-threads** + - **WAMR_BUILD_LIB_WASI_THREADS**=1/0, default to disable if not set -> Note: The dependent feature of lib wasi-threads such as the `shared memory` and `thread manager` will be enabled automatically. +> [!NOTE] +> The dependent feature of lib wasi-threads such as the `shared memory` and `thread manager` will be enabled automatically. > See [wasi-threads](./pthread_impls.md#wasi-threads-new) and [Introduction to WAMR WASI threads](https://bytecodealliance.github.io/wamr.dev/blog/introduction-to-wamr-wasi-threads) for more details. ### **Enable lib wasi-nn** + - **WAMR_BUILD_WASI_NN**=1/0, default to disable if not set -> Note: WAMR_BUILD_WASI_NN without WAMR_BUILD_WASI_EPHEMERAL_NN is deprecated and will likely be removed in future versions of WAMR. Please consider to enable WAMR_BUILD_WASI_EPHEMERAL_NN as well. -> Note: See [WASI-NN](../core/iwasm/libraries/wasi-nn) for more details. + +> [!NOTE] +> WAMR_BUILD_WASI_NN without WAMR_BUILD_WASI_EPHEMERAL_NN is deprecated and will likely be removed in future versions of WAMR. Please consider to enable WAMR_BUILD_WASI_EPHEMERAL_NN as well. +> See [WASI-NN](../core/iwasm/libraries/wasi-nn) for more details. ### **Enable lib wasi-nn GPU mode** + - **WAMR_BUILD_WASI_NN_ENABLE_GPU**=1/0, default to disable if not set ### **Enable lib wasi-nn external delegate mode** + - **WAMR_BUILD_WASI_NN_ENABLE_EXTERNAL_DELEGATE**=1/0, default to disable if not set - **WAMR_BUILD_WASI_NN_EXTERNAL_DELEGATE_PATH**=Path to the external delegate shared library (e.g. `libedgetpu.so.1.0` for Coral USB) ### **Enable lib wasi-nn with `wasi_ephemeral_nn` module support** + - **WAMR_BUILD_WASI_EPHEMERAL_NN**=1/0, default to enable if not set ### **Disable boundary check with hardware trap** + - **WAMR_DISABLE_HW_BOUND_CHECK**=1/0, default to enable if not set and supported by platform -> Note: by default only platform [linux/darwin/android/windows/vxworks 64-bit](https://github.com/bytecodealliance/wasm-micro-runtime/blob/5fb5119239220b0803e7045ca49b0a29fe65e70e/core/shared/platform/linux/platform_internal.h#L81) will enable the boundary check with hardware trap feature, for 32-bit platforms it's automatically disabled even when the flag is set to 0, and the wamrc tool will generate AOT code without boundary check instructions in all 64-bit targets except SGX to improve performance. The boundary check includes linear memory access boundary and native stack access boundary, if `WAMR_DISABLE_STACK_HW_BOUND_CHECK` below isn't set. + +> [!NOTE] +> by default only platform [linux/darwin/android/windows/vxworks 64-bit](https://github.com/bytecodealliance/wasm-micro-runtime/blob/5fb5119239220b0803e7045ca49b0a29fe65e70e/core/shared/platform/linux/platform_internal.h#L81) will enable the boundary check with hardware trap feature, for 32-bit platforms it's automatically disabled even when the flag is set to 0, and the wamrc tool will generate AOT code without boundary check instructions in all 64-bit targets except SGX to improve performance. The boundary check includes linear memory access boundary and native stack access boundary, if `WAMR_DISABLE_STACK_HW_BOUND_CHECK` below isn't set. ### **Disable native stack boundary check with hardware trap** + - **WAMR_DISABLE_STACK_HW_BOUND_CHECK**=1/0, default to enable if not set and supported by platform, same as `WAMR_DISABLE_HW_BOUND_CHECK`. -> Note: When boundary check with hardware trap is disabled, or `WAMR_DISABLE_HW_BOUND_CHECK` is set to 1, the native stack boundary check with hardware trap will be disabled too, no matter what value is set to `WAMR_DISABLE_STACK_HW_BOUND_CHECK`. And when boundary check with hardware trap is enabled, the status of this feature is set according to the value of `WAMR_DISABLE_STACK_HW_BOUND_CHECK`. + +> [!NOTE] +> When boundary check with hardware trap is disabled, or `WAMR_DISABLE_HW_BOUND_CHECK` is set to 1, the native stack boundary check with hardware trap will be disabled too, no matter what value is set to `WAMR_DISABLE_STACK_HW_BOUND_CHECK`. And when boundary check with hardware trap is enabled, the status of this feature is set according to the value of `WAMR_DISABLE_STACK_HW_BOUND_CHECK`. ### **Disable async wakeup of blocking operation** + - **WAMR_DISABLE_WAKEUP_BLOCKING_OP**=1/0, default to enable if supported by the platform -> Note: The feature helps async termination of blocking threads. If you disable it, the runtime can wait for termination of blocking threads possibly forever. + +> [!NOTE] +> The feature helps async termination of blocking threads. If you disable it, the runtime can wait for termination of blocking threads possibly forever. ### **Enable tail call feature** + - **WAMR_BUILD_TAIL_CALL**=1/0, default to disable if not set ### **Enable 128-bit SIMD feature** + - **WAMR_BUILD_SIMD**=1/0, default to enable if not set -> Note: supported in AOT mode, JIT mode, and fast-interpreter mode with SIMDe library. + +> [!WARNING] +> supported in AOT mode, JIT mode, and fast-interpreter mode with SIMDe library. ### **Enable SIMDe library for SIMD in fast interpreter** + - **WAMR_BUILD_LIB_SIMDE**=1/0, default to disable if not set -> Note: If enabled, SIMDe (SIMD Everywhere) library will be used to implement SIMD operations in fast interpreter mode. + +> [!NOTE] +> If enabled, SIMDe (SIMD Everywhere) library will be used to implement SIMD operations in fast interpreter mode. ### **Enable Exception Handling** + - **WAMR_BUILD_EXCE_HANDLING**=1/0, default to disable if not set -> Note: Currently, the exception handling feature is only supported in classic interpreter running mode. +> [!WARNING] +> Currently, the exception handling feature is only supported in classic interpreter running mode. ### **Enable Garbage Collection** + - **WAMR_BUILD_GC**=1/0, default to disable if not set +> [!WARNING] +> Currently, the exception handling feature is not supported in fast-jit running mode. + ### **Set the Garbage Collection heap size** + - **WAMR_BUILD_GC_HEAP_SIZE_DEFAULT**=n, default to 128 kB (131072) if not set +### **Enable Multi Memory** + +- **WAMR_BUIL_MULTI_MEMORY**=1/0, default to disable if not set + +> [!WARNING] +> Currently, the multi memory feature is only supported in classic interpreter running mode. + ### **Configure Debug** - **WAMR_BUILD_CUSTOM_NAME_SECTION**=1/0, load the function name from custom name section, default to disable if not set ### **Enable AOT stack frame feature** + - **WAMR_BUILD_AOT_STACK_FRAME**=1/0, default to disable if not set -> Note: if it is enabled, the AOT or JIT stack frames (like stack frame of classic interpreter but only necessary data is committed) will be created for AOT or JIT mode in function calls. And please add `--enable-dump-call-stack` option to wamrc during compiling AOT module. + +> [!NOTE] +> if it is enabled, the AOT or JIT stack frames (like stack frame of classic interpreter but only necessary data is committed) will be created for AOT or JIT mode in function calls. And please add `--enable-dump-call-stack` option to wamrc during compiling AOT module. ### **Enable dump call stack feature** -- **WAMR_BUILD_DUMP_CALL_STACK**=1/0, default to disable if not set -> Note: if it is enabled, the call stack will be dumped when exception occurs. +- **WAMR_BUILD_DUMP_CALL_STACK**=1/0, default to disable if not set -> - For interpreter mode, the function names are firstly extracted from *custom name section*, if this section doesn't exist or the feature is not enabled, then the name will be extracted from the import/export sections +> [!NOTE] +> if it is enabled, the call stack will be dumped when exception occurs. +> +> - For interpreter mode, the function names are firstly extracted from _custom name section_, if this section doesn't exist or the feature is not enabled, then the name will be extracted from the import/export sections > - For AOT/JIT mode, the function names are extracted from import/export section, please export as many functions as possible (for `wasi-sdk` you can use `-Wl,--export-all`) when compiling wasm module, and add `--enable-dump-call-stack --emit-custom-sections=name` option to wamrc during compiling AOT module. ### **Enable memory profiling (Experiment)** + - **WAMR_BUILD_MEMORY_PROFILING**=1/0, default to disable if not set -> Note: if it is enabled, developer can use API `void wasm_runtime_dump_mem_consumption(wasm_exec_env_t exec_env)` to dump the memory consumption info. -Currently we only profile the memory consumption of module, module_instance and exec_env, the memory consumed by other components such as `wasi-ctx`, `multi-module` and `thread-manager` are not included. +> [!NOTE] +> if it is enabled, developer can use API `void wasm_runtime_dump_mem_consumption(wasm_exec_env_t exec_env)` to dump the memory consumption info. +> Currently we only profile the memory consumption of module, module_instance and exec_env, the memory consumed by other components such as `wasi-ctx`, `multi-module` and `thread-manager` are not included. +> > Also refer to [Memory usage estimation for a module](./memory_usage.md). ### **Enable performance profiling (Experiment)** + - **WAMR_BUILD_PERF_PROFILING**=1/0, default to disable if not set -> Note: if it is enabled, developer can use API `void wasm_runtime_dump_perf_profiling(wasm_module_inst_t module_inst)` to dump the performance consumption info. Currently we only profile the performance consumption of each WASM function. +> [!NOTE] +> if it is enabled, developer can use API `void wasm_runtime_dump_perf_profiling(wasm_module_inst_t module_inst)` to dump the performance consumption info. Currently we only profile the performance consumption of each WASM function. > The function name searching sequence is the same with dump call stack feature. - > Also refer to [Tune the performance of running wasm/aot file](./perf_tune.md). ### **Enable the global heap** -- **WAMR_BUILD_GLOBAL_HEAP_POOL**=1/0, default to disable if not set for all *iwasm* applications, except for the platforms Alios and Zephyr. -> **WAMR_BUILD_GLOBAL_HEAP_POOL** is used in the *iwasm* applications provided in the directory `product-mini`. When writing your own host application using WAMR, if you want to use a global heap and allocate memory from it, you must set the initialization argument `mem_alloc_type` to `Alloc_With_Pool`. +- **WAMR_BUILD_GLOBAL_HEAP_POOL**=1/0, default to disable if not set for all _iwasm_ applications, except for the platforms Alios and Zephyr. + +> [!NOTE] +> **WAMR_BUILD_GLOBAL_HEAP_POOL** is used in the _iwasm_ applications provided in the directory `product-mini`. When writing your own host application using WAMR, if you want to use a global heap and allocate memory from it, you must set the initialization argument `mem_alloc_type` to `Alloc_With_Pool`. > The global heap is defined in the documentation [Memory model and memory usage tunning](memory_tune.md). ### **Set the global heap size** -- **WAMR_BUILD_GLOBAL_HEAP_SIZE**=n, default to 10 MB (10485760) if not set for all *iwasm* applications, except for the platforms Alios (256 kB), Riot (256 kB) and Zephyr (128 kB). -> **WAMR_BUILD_GLOBAL_HEAP_SIZE** is used in the *iwasm* applications provided in the directory `product-mini`. When writing your own host application using WAMR, if you want to set the amount of memory dedicated to the global heap pool, you must set the initialization argument `mem_alloc_option.pool` with the appropriate values. +- **WAMR_BUILD_GLOBAL_HEAP_SIZE**=n, default to 10 MB (10485760) if not set for all _iwasm_ applications, except for the platforms Alios (256 kB), Riot (256 kB) and Zephyr (128 kB). + +> [!NOTE] +> **WAMR_BUILD_GLOBAL_HEAP_SIZE** is used in the _iwasm_ applications provided in the directory `product-mini`. When writing your own host application using WAMR, if you want to set the amount of memory dedicated to the global heap pool, you must set the initialization argument `mem_alloc_option.pool` with the appropriate values. > The global heap is defined in the documentation [Memory model and memory usage tunning](memory_tune.md). -> Note: if `WAMR_BUILD_GLOBAL_HEAP_SIZE` is not set and the flag `WAMR_BUILD_SPEC_TEST` is set, the global heap size is equal to 300 MB (314572800), or 100 MB (104857600) when compiled for Intel SGX (Linux). ### **Set maximum app thread stack size** + - **WAMR_APP_THREAD_STACK_SIZE_MAX**=n, default to 8 MB (8388608) if not set -> Note: the AOT boundary check with hardware trap mechanism might consume large stack since the OS may lazily grow the stack mapping as a guard page is hit, we may use this configuration to reduce the total stack usage, e.g. -DWAMR_APP_THREAD_STACK_SIZE_MAX=131072 (128 KB). + +> [!NOTE] +> the AOT boundary check with hardware trap mechanism might consume large stack since the OS may lazily grow the stack mapping as a guard page is hit, we may use this configuration to reduce the total stack usage, e.g. -DWAMR_APP_THREAD_STACK_SIZE_MAX=131072 (128 KB). ### **Set vprintf callback** + - **WAMR_BH_VPRINTF**=, default to disable if not set -> Note: if the vprintf_callback function is provided by developer, the os_printf() and os_vprintf() in Linux, Darwin, Windows, VxWorks, Android and esp-idf platforms, besides WASI Libc output will call the callback function instead of libc vprintf() function to redirect the stdout output. For example, developer can define the callback function like below outside runtime lib: + +> [!NOTE] +> if the vprintf_callback function is provided by developer, the os_printf() and os_vprintf() in Linux, Darwin, Windows, VxWorks, Android and esp-idf platforms, besides WASI Libc output will call the callback function instead of libc vprintf() function to redirect the stdout output. For example, developer can define the callback function like below outside runtime lib: > > ```C > int my_vprintf(const char *format, va_list ap) @@ -223,61 +296,89 @@ Currently we only profile the memory consumption of module, module_instance and > and then use `cmake -DWAMR_BH_VPRINTF=my_vprintf ..` to pass the callback function, or add `BH_VPRINTF=my_vprintf` macro for the compiler, e.g. add line `add_definitions(-DBH_VPRINTF=my_vprintf)` in CMakeLists.txt. See [basic sample](../samples/basic/src/main.c) for a usage example. ### **WAMR_BH_LOG**=, default to disable if not set -> Note: if the log_callback function is provided by the developer, WAMR logs are redirected to such callback. For example: + +> [!NOTE] +> if the log_callback function is provided by the developer, WAMR logs are redirected to such callback. For example: +> > ```C > void my_log(uint32 log_level, const char *file, int line, const char *fmt, ...) > { > /* Usage of custom logger */ > } > ``` +> > See [basic sample](../samples/basic/src/main.c) for a usage example. ### **Enable reference types feature** + - **WAMR_BUILD_REF_TYPES**=1/0, default to enable if not set ### **Exclude WAMR application entry functions** + - **WAMR_DISABLE_APP_ENTRY**=1/0, default to disable if not set -> Note: The WAMR application entry (`core/iwasm/common/wasm_application.c`) encapsulate some common process to instantiate, execute the wasm functions and print the results. Some platform related APIs are used in these functions, so you can enable this flag to exclude this file if your platform doesn't support those APIs. -> *Don't enable this flag if you are building `product-mini`* +> [!NOTE] +> The WAMR application entry (`core/iwasm/common/wasm_application.c`) encapsulate some common process to instantiate, execute the wasm functions and print the results. Some platform related APIs are used in these functions, so you can enable this flag to exclude this file if your platform doesn't support those APIs. +> _Don't enable this flag if you are building `product-mini`_ ### **Enable source debugging features** + - **WAMR_BUILD_DEBUG_INTERP**=1/0, default to 0 if not set -> Note: There are some other setup required by source debugging, please refer to [source_debugging.md](./source_debugging.md) and [WAMR source debugging basic](https://bytecodealliance.github.io/wamr.dev/blog/wamr-source-debugging-basic) for more details. -### **Enable load wasm custom sections** -- **WAMR_BUILD_LOAD_CUSTOM_SECTION**=1/0, default to disable if not set +> [!NOTE] +> There are some other setup required by source debugging, please refer to [source_debugging.md](./source_debugging.md) and [WAMR source debugging basic](https://bytecodealliance.github.io/wamr.dev/blog/wamr-source-debugging-basic) for more details. -> Note: By default, the custom sections are ignored. If the embedder wants to get custom sections from `wasm_module_t`, then `WAMR_BUILD_LOAD_CUSTOM_SECTION` should be enabled, and then `wasm_runtime_get_custom_section` can be used to get a custom section by name. +### **Enable load wasm custom sections** -> Note: If `WAMR_BUILD_CUSTOM_NAME_SECTION` is enabled, then the `custom name section` will be treated as a special section and consumed by the runtime, not available to the embedder. +- **WAMR_BUILD_LOAD_CUSTOM_SECTION**=1/0, default to disable if not set +> [!NOTE] +> By default, the custom sections are ignored. If the embedder wants to get custom sections from `wasm_module_t`, then `WAMR_BUILD_LOAD_CUSTOM_SECTION` should be enabled, and then `wasm_runtime_get_custom_section` can be used to get a custom section by name. +> +> If `WAMR_BUILD_CUSTOM_NAME_SECTION` is enabled, then the `custom name section` will be treated as a special section and consumed by the runtime, not available to the embedder. > For AoT file, must use `--emit-custom-sections` to specify which sections need to be emitted into AoT file, otherwise all custom sections will be ignored. ### **Stack guard size** + - **WAMR_BUILD_STACK_GUARD_SIZE**=n, default to N/A if not set. -> Note: By default, the stack guard size is 1K (1024) or 24K (if uvwasi enabled). + +> [!NOTE] +> By default, the stack guard size is 1K (1024) or 24K (if uvwasi enabled). ### **Disable writing the linear memory base address to x86 GS segment register** + - **WAMR_DISABLE_WRITE_GS_BASE**=1/0, default to enable if not set and supported by platform -> Note: by default only platform [linux x86-64](https://github.com/bytecodealliance/wasm-micro-runtime/blob/5fb5119239220b0803e7045ca49b0a29fe65e70e/core/shared/platform/linux/platform_internal.h#L67) will enable this feature, for 32-bit platforms it's automatically disabled even when the flag is set to 0. In linux x86-64, writing the linear memory base address to x86 GS segment register may be used to speedup the linear memory access for LLVM AOT/JIT, when `--enable-segue=[]` option is added for `wamrc` or `iwasm`. + +> [!NOTE] +> by default only platform [linux x86-64](https://github.com/bytecodealliance/wasm-micro-runtime/blob/5fb5119239220b0803e7045ca49b0a29fe65e70e/core/shared/platform/linux/platform_internal.h#L67) will enable this feature, for 32-bit platforms it's automatically disabled even when the flag is set to 0. In linux x86-64, writing the linear memory base address to x86 GS segment register may be used to speedup the linear memory access for LLVM AOT/JIT, when `--enable-segue=[]` option is added for `wamrc` or `iwasm`. > See [Enable segue optimization for wamrc when generating the aot file](./perf_tune.md#3-enable-segue-optimization-for-wamrc-when-generating-the-aot-file) for more details. ### **User defined linear memory allocator** + - **WAMR_BUILD_ALLOC_WITH_USAGE**=1/0, default to disable if not set -> Notes: by default, the linear memory is allocated by system. when it's set to 1 and Alloc_With_Allocator is selected, it will be allocated by customer. + +> [!NOTE] +> by default, the linear memory is allocated by system. when it's set to 1 and Alloc_With_Allocator is selected, it will be allocated by customer. ### **Enable running PGO(Profile-Guided Optimization) instrumented AOT file** + - **WAMR_BUILD_STATIC_PGO**=1/0, default to disable if not set -> Note: See [Use the AOT static PGO method](./perf_tune.md#5-use-the-aot-static-pgo-method) for more details. + +> [!NOTE] +> See [Use the AOT static PGO method](./perf_tune.md#5-use-the-aot-static-pgo-method) for more details. ### **Enable linux perf support** + - **WAMR_BUILD_LINUX_PERF**=1/0, enable linux perf support to generate the flamegraph to analyze the performance of a wasm application, default to disable if not set -> Note: See [Use linux-perf](./perf_tune.md#7-use-linux-perf) for more details. + +> [!NOTE] +> See [Use linux-perf](./perf_tune.md#7-use-linux-perf) for more details. ### **Enable module instance context APIs** + - **WAMR_BUILD_MODULE_INST_CONTEXT**=1/0, enable module instance context APIs which can set one or more contexts created by the embedder for a wasm module instance, default to enable if not set: + ```C wasm_runtime_create_context_key wasm_runtime_destroy_context_key @@ -285,95 +386,137 @@ Currently we only profile the memory consumption of module, module_instance and wasm_runtime_set_context_spread wasm_runtime_get_context ``` -> Note: See [wasm_export.h](../core/iwasm/include/wasm_export.h) for more details. + +> [!NOTE] +> See [wasm_export.h](../core/iwasm/include/wasm_export.h) for more details. ### **Enable quick AOT/JTI entries** + - **WAMR_BUILD_QUICK_AOT_ENTRY**=1/0, enable registering quick call entries to speedup the aot/jit func call process, default to enable if not set -> Note: See [Refine callings to AOT/JIT functions from host native](./perf_tune.md#83-refine-callings-to-aotjit-functions-from-host-native) for more details. + +> [!NOTE] +> See [Refine callings to AOT/JIT functions from host native](./perf_tune.md#83-refine-callings-to-aotjit-functions-from-host-native) for more details. ### **Enable AOT intrinsics** + - **WAMR_BUILD_AOT_INTRINSICS**=1/0, enable the AOT intrinsic functions, default to enable if not set. These functions can be called from the AOT code when `--disable-llvm-intrinsics` flag or `--enable-builtin-intrinsics=` flag is used by wamrc to generate the AOT file. -> Note: See [Tuning the XIP intrinsic functions](./xip.md#tuning-the-xip-intrinsic-functions) for more details. + +> [!NOTE] +> See [Tuning the XIP intrinsic functions](./xip.md#tuning-the-xip-intrinsic-functions) for more details. ### **Enable extended constant expression** + - **WAMR_BUILD_EXTENDED_CONST_EXPR**=1/0, default to disable if not set. -> Note: See [Extended Constant Expressions](https://github.com/WebAssembly/extended-const/blob/main/proposals/extended-const/Overview.md) for more details. + +> [!NOTE] +> See [Extended Constant Expressions](https://github.com/WebAssembly/extended-const/blob/main/proposals/extended-const/Overview.md) for more details. ### **Enable bulk-memory-opt** + - **WAMR_BUILD_BULK_MEMORY_OPT**=1/0, default to disable if not set. -> Note: See [bulk-memory-opt](https://github.com/WebAssembly/tool-conventions/blob/main/Lime.md#bulk-memory-opt) for more details. + +> [!NOTE] +> See [bulk-memory-opt](https://github.com/WebAssembly/tool-conventions/blob/main/Lime.md#bulk-memory-opt) for more details. ### **Enable call-indirect-overlong** + - **WAMR_BUILD_CALL_INDIRECT_OVERLONG**=1/0, default to disable if not set. -> Note: See [call-indirect-overlong](https://github.com/WebAssembly/tool-conventions/blob/main/Lime.md#call-indirect-overlong) for more details. + +> [!NOTE] +> See [call-indirect-overlong](https://github.com/WebAssembly/tool-conventions/blob/main/Lime.md#call-indirect-overlong) for more details. ### **Enable Lime1 target** + - **WAMR_BUILD_LIME1**=1/0, default to disable if not set. -> Note: See [Lime1](https://github.com/WebAssembly/tool-conventions/blob/main/Lime.md#lime1) for more details. + +> [!NOTE] +> See [Lime1](https://github.com/WebAssembly/tool-conventions/blob/main/Lime.md#lime1) for more details. ### **Configurable memory access boundary check** + - **WAMR_CONFIGURABLE_BOUNDS_CHECKS**=1/0, default to disable if not set -> Note: If it is enabled, allow to run `iwasm --disable-bounds-checks` to disable the memory access boundary checks for interpreter mode. + +> [!NOTE] +> If it is enabled, allow to run `iwasm --disable-bounds-checks` to disable the memory access boundary checks for interpreter mode. ### **Module instance context APIs** + - **WAMR_BUILD_MODULE_INST_CONTEXT**=1/0, default to disable if not set -> Note: If it is enabled, allow to set one or more contexts created by embedder for a module instance, the below APIs are provided: -```C - wasm_runtime_create_context_key - wasm_runtime_destroy_context_key - wasm_runtime_set_context - wasm_runtime_set_context_spread - wasm_runtime_get_context -``` + +> [!NOTE] +> If it is enabled, allow to set one or more contexts created by embedder for a module instance, the below APIs are provided: +> +> ```C +> wasm_runtime_create_context_key +> wasm_runtime_destroy_context_key +> wasm_runtime_set_context +> wasm_runtime_set_context_spread +> wasm_runtime_get_context +> ``` ### **Shared heap among wasm apps and host native** + - **WAMR_BUILD_SHARED_HEAP**=1/0, default to disable if not set -> Note: If it is enabled, allow to create one or more shared heaps, and attach one to a module instance, the belows APIs ared provided: -```C - wasm_runtime_create_shared_heap - wasm_runtime_attach_shared_heap - wasm_runtime_detach_shared_heap - wasm_runtime_shared_heap_malloc - wasm_runtime_shared_heap_free -``` -And the wasm app can calls below APIs to allocate/free memory from/to the shared heap if it is attached to the app's module instance: -```C - void *shared_heap_malloc(); - void shared_heap_free(void *ptr); -``` + +> [!NOTE] +> If it is enabled, allow to create one or more shared heaps, and attach one to a module instance, the belows APIs ared provided: +> +> ```C +> wasm_runtime_create_shared_heap +> wasm_runtime_attach_shared_heap +> wasm_runtime_detach_shared_heap +> wasm_runtime_shared_heap_malloc +> wasm_runtime_shared_heap_free +> ``` +> +> And the wasm app can calls below APIs to allocate/free memory from/to the shared heap if it is attached to the app's module instance: +> +> ```C +> void *shared_heap_malloc(); +> void shared_heap_free(void *ptr); +> ``` + +> [!WARNING] +> Currently, the shared-heap feature is not supported in fast-jit mode. ### **Shrunk the memory usage** + - **WAMR_BUILD_SHRUNK_MEMORY**=1/0, default to enable if not set -> Note: When enabled, this feature will reduce memory usage by decreasing the size of the linear memory, particularly when the `memory.grow` opcode is not used and memory usage is somewhat predictable. + +> [!NOTE] +> When enabled, this feature will reduce memory usage by decreasing the size of the linear memory, particularly when the `memory.grow` opcode is not used and memory usage is somewhat predictable. ## **Instruction metering** + - **WAMR_BUILD_INSTRUCTION_METERING**=1/0, default to disable if not set -> Note: Enabling this feature allows limiting the number of instructions a wasm module instance can execute. Use the `wasm_runtime_set_instruction_count_limit(...)` API before calling `wasm_runtime_call_*(...)` APIs to enforce this limit. + +> [!NOTE] +> Enabling this feature allows limiting the number of instructions a wasm module instance can execute. Use the `wasm_runtime_set_instruction_count_limit(...)` API before calling `wasm_runtime_call_*(...)` APIs to enforce this limit. ## **Combination of configurations:** We can combine the configurations. For example, if we want to disable interpreter, enable AOT and WASI, we can run command: -``` Bash +```Bash cmake .. -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_LIBC_WASI=1 -DWAMR_BUILD_PLATFORM=linux ``` Or if we want to enable interpreter, disable AOT and WASI, and build as X86_32, we can run command: -``` Bash +```Bash cmake .. -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_AOT=0 -DWAMR_BUILD_LIBC_WASI=0 -DWAMR_BUILD_TARGET=X86_32 ``` When enabling SIMD for fast interpreter mode, you'll need to enable both SIMD and the SIMDe library: -``` Bash +```Bash cmake .. -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_SIMD=1 -DWAMR_BUILD_LIB_SIMDE=1 ``` For Valgrind, begin with the following configurations and add additional ones as needed: -``` Bash +```Bash #... -DCMAKE_BUILD_TYPE=Debug \ -DWAMR_DISABLE_HW_BOUND_CHECK=0 \ @@ -381,7 +524,7 @@ For Valgrind, begin with the following configurations and add additional ones as #... ``` -To enable the minimal Lime1 feature set, we need to disable some features that are on by default, such as +To enable the minimal Lime1 feature set, we need to disable some features that are on by default, such as bulk memory and reference types: ```Bash diff --git a/product-mini/platforms/linux-sgx/CMakeLists.txt b/product-mini/platforms/linux-sgx/CMakeLists.txt index af911a0db0..dd2dc39197 100644 --- a/product-mini/platforms/linux-sgx/CMakeLists.txt +++ b/product-mini/platforms/linux-sgx/CMakeLists.txt @@ -16,10 +16,6 @@ if (NOT DEFINED WAMR_BUILD_TARGET) if (CMAKE_SIZEOF_VOID_P EQUAL 8) # Build as X86_64 by default in 64-bit platform set (WAMR_BUILD_TARGET "X86_64") - if (NOT DEFINED WAMR_BUILD_SIMD) - # Enable SIMD by default in 64-bit platform - set (WAMR_BUILD_SIMD 1) - endif () elseif (CMAKE_SIZEOF_VOID_P EQUAL 4) # Build as X86_32 by default in 32-bit platform set (WAMR_BUILD_TARGET "X86_32") @@ -74,7 +70,7 @@ if (NOT DEFINED WAMR_BUILD_FAST_INTERP) endif () if (NOT DEFINED WAMR_BUILD_MULTI_MODULE) - # Enable multiple modules + # Disable multiple modules set (WAMR_BUILD_MULTI_MODULE 0) endif () diff --git a/samples/wasm-c-api/CMakeLists.txt b/samples/wasm-c-api/CMakeLists.txt index c15cd28026..15eafaf4b5 100644 --- a/samples/wasm-c-api/CMakeLists.txt +++ b/samples/wasm-c-api/CMakeLists.txt @@ -66,9 +66,12 @@ if(NOT DEFINED WAMR_BUILD_JIT) set(WAMR_BUILD_JIT 0) endif() +if(NOT DEFINED WAMR_BUILD_MULTI_MODULE) + set(WAMR_BUILD_MULTI_MODULE 1) +endif() + set(WAMR_BUILD_LIBC_BUILTIN 1) set(WAMR_BUILD_LIBC_WASI 0) -set(WAMR_BUILD_MULTI_MODULE 1) set(WAMR_BUILD_DUMP_CALL_STACK 1) set(WAMR_BUILD_REF_TYPES 1) diff --git a/tests/regression/ba-issues/build_wamr.sh b/tests/regression/ba-issues/build_wamr.sh index 76562c5a9b..98a065b0f3 100755 --- a/tests/regression/ba-issues/build_wamr.sh +++ b/tests/regression/ba-issues/build_wamr.sh @@ -48,8 +48,8 @@ build_iwasm "-DWAMR_BUILD_GC=1 -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=1 -DW # build llvm-jit iwasm for testing llvm-jit build_iwasm "-DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_JIT=1" "llvm-jit" -# build multi-tier-jit iwasm for testing classic-interp, fast-jit, llvm-jit and multi-tier-jit -build_iwasm "-DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1" "multi-tier-jit" +# build fast-jit iwasm for testing fast-jit +build_iwasm "-DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_SIMD=0" "fast-jit" # build default iwasm for testing fast-interp and AOT with libc-wasi disabled build_iwasm "-DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_LIBC_WASI=0" "default-wasi-disabled" @@ -57,7 +57,7 @@ build_iwasm "-DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTER # build llvm-jit iwasm for testing llvm-jit with libc-wasi disabled build_iwasm "-DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LIBC_WASI=0" "llvm-jit-wasi-disabled" -# build multi-tier-jit iwasm for testing classic-interp, fast-jit, llvm-jit and multi-tier-jit with libc-wasi disabled -build_iwasm "-DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LIBC_WASI=0" "multi-tier-jit-wasi-disabled" +# build fast-jit iwasm for testing fast-jit with libc-wasi disabled +build_iwasm "-DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_SIMD=0 -DWAMR_BUILD_LIBC_WASI=0" "fast-jit-wasi-disabled" # TODO: add more version of iwasm, for example, sgx version diff --git a/tests/regression/ba-issues/running_config.json b/tests/regression/ba-issues/running_config.json index bc62c54915..f5ccd8e4f5 100644 --- a/tests/regression/ba-issues/running_config.json +++ b/tests/regression/ba-issues/running_config.json @@ -105,7 +105,7 @@ "ids": [ 2965 ], - "runtime": "iwasm-multi-tier-jit-wasi-disabled", + "runtime": "iwasm-fast-jit-wasi-disabled", "file": "i64.shl_75.wasm", "mode": "fast-jit", "options": "--heap-size=0 -f to_test", @@ -124,7 +124,7 @@ 2963, 2962 ], - "runtime": "iwasm-multi-tier-jit-wasi-disabled", + "runtime": "iwasm-fast-jit-wasi-disabled", "file": "*.wasm", "mode": "fast-jit", "options": "--heap-size=0 -f to_test", @@ -143,7 +143,7 @@ 2959, 2958 ], - "runtime": "iwasm-multi-tier-jit-wasi-disabled", + "runtime": "iwasm-fast-jit-wasi-disabled", "file": "*.wasm", "mode": "fast-jit", "options": "--heap-size=0 -f to_test", @@ -191,7 +191,7 @@ "ids": [ 2954 ], - "runtime": "iwasm-multi-tier-jit-wasi-disabled", + "runtime": "iwasm-llvm-jit-wasi-disabled", "file": "iwasm_jit_unexpected_exception_stack_underflow.wasm", "mode": "llvm-jit", "options": "--heap-size=0 -f to_test", @@ -240,7 +240,7 @@ "ids": [ 2950 ], - "runtime": "iwasm-multi-tier-jit-wasi-disabled", + "runtime": "iwasm-fast-jit-wasi-disabled", "file": "iwasm_fast_jit_unexpected_moob.wasm", "mode": "fast-jit", "options": "--heap-size=0 -f to_test", @@ -257,7 +257,7 @@ 2949, 2944 ], - "runtime": "iwasm-multi-tier-jit-wasi-disabled", + "runtime": "iwasm-fast-jit-wasi-disabled", "file": "*.wasm", "mode": "fast-jit", "options": "--heap-size=0 -f to_test", @@ -322,7 +322,7 @@ "ids": [ 3020 ], - "runtime": "iwasm-multi-tier-jit-wasi-disabled", + "runtime": "iwasm-fast-jit-wasi-disabled", "file": "all_wamr_memory.init_no_exception2.wasm", "mode": "fast-jit", "options": "--heap-size=0 -f to_test", @@ -338,7 +338,7 @@ "ids": [ 3021 ], - "runtime": "iwasm-multi-tier-jit-wasi-disabled", + "runtime": "iwasm-fast-jit-wasi-disabled", "file": "all_wamr_table.init_no_exception.wasm", "mode": "fast-jit", "options": "--heap-size=0 -f to_test", @@ -354,7 +354,7 @@ "ids": [ 3023 ], - "runtime": "iwasm-multi-tier-jit-wasi-disabled", + "runtime": "iwasm-fast-jit-wasi-disabled", "file": "all_wamr_table.init_no_exception2.wasm", "mode": "fast-jit", "options": "--heap-size=0 -f to_test", @@ -594,7 +594,7 @@ "ids": [ 2943 ], - "runtime": "iwasm-multi-tier-jit-wasi-disabled", + "runtime": "iwasm-llvm-jit-wasi-disabled", "file": "iwasm_jit_timeout.wasm", "mode": "llvm-jit", "options": " --heap-size=0 -f to_test", @@ -610,7 +610,7 @@ "ids": [ 2942 ], - "runtime": "iwasm-multi-tier-jit-wasi-disabled", + "runtime": "iwasm-llvm-jit-wasi-disabled", "file": "iwasm_jit_without_exception.wasm", "mode": "llvm-jit", "options": " --heap-size=0 -f to_test", @@ -626,7 +626,7 @@ "ids": [ 2931 ], - "runtime": "iwasm-multi-tier-jit", + "runtime": "iwasm-fast-jit", "file": "case.wasm", "mode": "fast-jit", "options": "", @@ -642,7 +642,7 @@ "ids": [ 2897 ], - "runtime": "iwasm-multi-tier-jit", + "runtime": "iwasm-llvm-jit", "file": "test.wasm", "mode": "llvm-jit", "options": "", @@ -940,7 +940,7 @@ "ids": [ 2759 ], - "runtime": "iwasm-multi-tier-jit", + "runtime": "iwasm-fast-jit", "file": "case.wasm", "mode": "fast-jit", "options": "", @@ -956,7 +956,7 @@ "ids": [ 2732 ], - "runtime": "iwasm-multi-tier-jit", + "runtime": "iwasm-llvm-jit", "file": "filea9.wasm", "mode": "llvm-jit", "options": "--heap-size=0 -f main", @@ -1144,7 +1144,7 @@ "ids": [ 2710 ], - "runtime": "iwasm-multi-tier-jit", + "runtime": "iwasm-fast-jit", "file": "t.wasm", "mode": "fast-jit", "options": "", diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index 9c641049b4..df3c2b80d1 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -63,6 +63,7 @@ add_subdirectory(linear-memory-aot) add_subdirectory(linux-perf) add_subdirectory(gc) add_subdirectory(tid-allocator) +add_subdirectory(unsupported-features) if (NOT WAMR_BUILD_TARGET STREQUAL "X86_32") add_subdirectory(aot-stack-frame) diff --git a/tests/unit/shared-heap/CMakeLists.txt b/tests/unit/shared-heap/CMakeLists.txt index e1e7a1a9a3..c275ac6385 100644 --- a/tests/unit/shared-heap/CMakeLists.txt +++ b/tests/unit/shared-heap/CMakeLists.txt @@ -12,11 +12,7 @@ set(WAMR_BUILD_AOT 1) set(WAMR_BUILD_INTERP 1) set(WAMR_BUILD_FAST_INTERP 1) set(WAMR_BUILD_JIT 0) -if(WAMR_BUILD_TARGET STREQUAL "X86_32") - set(WAMR_BUILD_MEMORY64 0) -else() - set(WAMR_BUILD_MEMORY64 1) -endif() +set(WAMR_BUILD_MEMORY64 0) set(WAMR_BUILD_SHARED_HEAP 1) # Compile wasm modules diff --git a/tests/unit/unsupported-features/CMakeLists.txt b/tests/unit/unsupported-features/CMakeLists.txt new file mode 100644 index 0000000000..d585e8ff8e --- /dev/null +++ b/tests/unit/unsupported-features/CMakeLists.txt @@ -0,0 +1,69 @@ +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +cmake_minimum_required(VERSION 3.14) + +project(unsupported_features_tests) + +include(CMakePrintHelpers) + +# fake target +if(NOT DEFINED WAMR_BUILD_AOT) + set(WAMR_BUILD_AOT 0) +endif() +set(WAMR_BUILD_INTERP 1) +if(NOT DEFINED WAMR_BUILD_JIT) + set(WAMR_BUILD_JIT 0) +endif() +if(NOT DEFINED WAMR_BUILD_FAST_JIT) + set(WAMR_BUILD_FAST_JIT 0) +endif() +include(../unit_common.cmake) +add_library(unsupported_features_tests ${WAMR_RUNTIME_LIB_SOURCE}) + +enable_testing() + +# Define a function to add tests with unsupported features +function(add_unsupported_feature_test test_name flags) + add_test( + NAME ${PROJECT_NAME}.verify_${test_name} + COMMAND ${CMAKE_COMMAND} -S ${CMAKE_CURRENT_LIST_DIR} -B build_${test_name} ${flags} --fresh + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + set_tests_properties(${PROJECT_NAME}.verify_${test_name} PROPERTIES WILL_FAIL TRUE) +endfunction() + +# List of unsupported feature tests +set(UNSUPPORTED_FEATURE_TESTS + "exce_handling_aot -DWAMR_BUILD_EXCE_HANDLING=1 -DWAMR_BUILD_AOT=1" + "exce_handling_fast_interp -DWAMR_BUILD_EXCE_HANDLING=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=1" + "exce_handling_fast_jit -DWAMR_BUILD_EXCE_HANDLING=1 -DWAMR_BUILD_FAST_JIT=1" + "exce_handling_llvm_jit -DWAMR_BUILD_EXCE_HANDLING=1 -DWAMR_BUILD_JIT=1" + "gc_fast_jit -DWAMR_BUILD_GC=1 -DWAMR_BUILD_FAST_JIT=1" + "memory64_fast_interp -DWAMR_BUILD_MEMORY64=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=1" + "memory64_fast_jit -DWAMR_BUILD_MEMORY64=1 -DWAMR_BUILD_FAST_JIT=1" + "memory64_llvm_jit -DWAMR_BUILD_MEMORY64=1 -DWAMR_BUILD_JIT=1" + "multi_memory_aot -DWAMR_BUILD_MULTI_MEMORY=1 -DWAMR_BUILD_AOT=1" + "multi_memory_fast_interp -DWAMR_BUILD_MULTI_MEMORY=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=1" + "multi_memory_fast_jit -DWAMR_BUILD_MULTI_MEMORY=1 -DWAMR_BUILD_FAST_JIT=1" + "multi_memory_llvm_jit -DWAMR_BUILD_MULTI_MEMORY=1 -DWAMR_BUILD_JIT=1" + "multi_module_fast_jit -DWAMR_BUILD_MULTI_MODULE=1 -DWAMR_BUILD_FAST_JIT=1" + "multi_module_llvm_jit -DWAMR_BUILD_MULTI_MODULE=1 -DWAMR_BUILD_JIT=1" + "simd_classic_interp -DWAMR_BUILD_SIMD=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=0" + "simd_fast_jit -DWAMR_BUILD_SIMD=1 -DWAMR_BUILD_FAST_JIT=1" +) + +# Add each test using the function +foreach(test ${UNSUPPORTED_FEATURE_TESTS}) + # string -> list by replacing space with ; + string(REPLACE " " ";" test_parts "${test}") + # list[0] + list(GET test_parts 0 test_name) + # list[1:] + list(REMOVE_AT test_parts 0) + # pass list to cmake and let cmake split it + set(flags ${test_parts}) + + add_unsupported_feature_test(${test_name} "${flags}") +endforeach() +