Compare commits

...

15 Commits

Author SHA1 Message Date
liang.he
5d15f8fa2d
Update Dockerfile to install minimal Zephyr SDK (#4515)
Some checks failed
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_DISABLE_HW_BOUND_CHECK=1, $FAST_INTERP_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_DISABLE_HW_BOUND_CHECK=1, $LLVM_EAGER_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_iwasm (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, -DWAMR_DISABLE_HW_BOUND_CHECK=1, $LLVM_LAZY_JIT_BUILD_OPTIONS, macos-13, darwin) (push) Has been cancelled
compilation on macos / build_samples_wasm_c_api (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, $AOT_BUILD_OPTIONS, macos-13) (push) Has been cancelled
compilation on macos / build_samples_wasm_c_api (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, $CLASSIC_INTERP_BUILD_OPTIONS, macos-13) (push) Has been cancelled
compilation on macos / build_samples_wasm_c_api (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, $FAST_INTERP_BUILD_OPTIONS, macos-13) (push) Has been cancelled
compilation on macos / build_samples_wasm_c_api (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, $FAST_JIT_BUILD_OPTIONS, macos-13) (push) Has been cancelled
compilation on macos / build_samples_wasm_c_api (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, $LLVM_EAGER_JIT_BUILD_OPTIONS, macos-13) (push) Has been cancelled
compilation on macos / build_samples_wasm_c_api (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, $LLVM_LAZY_JIT_BUILD_OPTIONS, macos-13) (push) Has been cancelled
compilation on macos / build_samples_wasm_c_api (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, $MULTI_TIER_JIT_BUILD_OPTIONS, macos-13) (push) Has been cancelled
compilation on macos / build_samples_others (${{ needs.build_llvm_libraries_on_arm_macos.outputs.cache_key }}, macos-14) (push) Has been cancelled
compilation on macos / build_samples_others (${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}, macos-13) (push) Has been cancelled
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $AOT_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Has been cancelled
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $CLASSIC_INTERP_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Has been cancelled
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $FAST_INTERP_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Has been cancelled
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $FAST_JIT_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Has been cancelled
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $DEFAULT_TEST_OPTIONS) (push) Has been cancelled
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $SIMD_TEST_OPTIONS) (push) Has been cancelled
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $XIP_TEST_OPTIONS) (push) Has been cancelled
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, classic-interp, $DEFAULT_TEST_OPTIONS) (push) Has been cancelled
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, fast-jit, $DEFAULT_TEST_OPTIONS) (push) Has been cancelled
compilation on windows-latest / build_wamrc (${{ needs.build_llvm_libraries_on_windows.outputs.cache_key }}, windows-latest) (push) Has been cancelled
compilation on windows-latest / test (classic-interp, $DEFAULT_TEST_OPTIONS) (push) Has been cancelled
compilation on windows-latest / test (classic-interp, $MULTI_MODULES_TEST_OPTIONS) (push) Has been cancelled
compilation on windows-latest / test (classic-interp, $THREADS_TEST_OPTIONS) (push) Has been cancelled
compilation on windows-latest / test (classic-interp, $WASI_TEST_OPTIONS) (push) Has been cancelled
compilation on windows-latest / test (fast-interp, $DEFAULT_TEST_OPTIONS) (push) Has been cancelled
compilation on windows-latest / test (fast-interp, $MULTI_MODULES_TEST_OPTIONS) (push) Has been cancelled
compilation on windows-latest / test (fast-interp, $THREADS_TEST_OPTIONS) (push) Has been cancelled
compilation on windows-latest / test (fast-interp, $WASI_TEST_OPTIONS) (push) Has been cancelled
Reduce the time consumption for `docker build`.
2025-08-01 14:44:26 +08:00
liang.he
e40b05a5c6
Add smoke tests for iwasm and wamrc binaries to validate build output (#4455) 2025-08-01 14:31:36 +08:00
YAMAMOTO Takashi
29d465b44e
wasi_nn_tensorflowlite.cpp: make this compatible with wasmedge (#4517)
for wasi_ephemeral_nn,

* implement u8 input

* stop dealing with quantization.

  * wasi-nn doesn't have a concept of quantization or pre/post-processing.
    i can't think of any ways to make the backend perform zero-point/scale
    processing without risking to break other applications.

  * there seems to be applications which just use u8 inputs/outputs for
    a quantized model. (see [1] for an example.)
    for certain kinds of inputs/outputs, it usually just works.

this commit keeps the legacy wasi_nn logic intact for now.

tested with [1] with [2] applied.

WAMR with this patch:
```
Read graph weights, size in bytes: 3561598
[wasi_nn.c:297 WARNING] load_by_name_with_config() not found
[wasi_nn_tensorflowlite.cpp:272 WARNING] Default encoding is CPU.
Loaded graph into wasi-nn with ID: Graph#0
Read input tensor, size in bytes: 150528
   1.) [166](198)Aix galericulata
   2.) [34](1)Gallus gallus domesticus
   3.) [158](1)Coccothraustes coccothraustes
   4.) [778](1)Sitta europaea
   5.) [819](1)Anas platyrhynchos
```

wasmedge:
```
Read graph weights, size in bytes: 3561598
Loaded graph into wasi-nn with ID: Graph#0
Read input tensor, size in bytes: 150528
   1.) [166](198)Aix galericulata
   2.) [34](1)Gallus gallus domesticus
   3.) [158](1)Coccothraustes coccothraustes
   4.) [778](1)Sitta europaea
   5.) [819](1)Anas platyrhynchos
```

and "Aix galericulata" seems like a reasonable classification
of the image to my eyes.

[1] 67f174bab5/tflite-birds_v1-image

[2] https://github.com/second-state/WasmEdge-WASINN-examples/pull/204

Related:
https://github.com/bytecodealliance/wasm-micro-runtime/issues/3555
https://github.com/bytecodealliance/wasm-micro-runtime/issues/2611
2025-08-01 14:31:02 +08:00
Jaco Kroon
272a41dc80
Avoid executable stack by marking that it's not required. (#4418)
Also refer to: https://github.com/fluent/fluent-bit/issues/10513

Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2025-08-01 14:30:39 +08:00
Zhenwei Jin
378320b886
loader: add type index checking (#4521)
Some checks are pending
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $CLASSIC_INTERP_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $FAST_INTERP_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $FAST_JIT_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $SIMD_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $XIP_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, classic-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, fast-jit, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / build_llvm_libraries_on_windows (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_AOT=0) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=0) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_CUSTOM_NAME_SECTION=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_DEBUG_INTERP=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_LIBC_UVWASI=0 -DWAMR_BUILD_LIBC_WASI=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_LIB_PTHREAD=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_LIB_WASI_THREADS=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_REF_TYPES=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_SIMD=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_TAIL_CALL=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_DISABLE_HW_BOUND_CHECK=1) (push) Waiting to run
compilation on windows-latest / build_wamrc (${{ needs.build_llvm_libraries_on_windows.outputs.cache_key }}, windows-latest) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $MULTI_MODULES_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $THREADS_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $WASI_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $MULTI_MODULES_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $THREADS_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $WASI_TEST_OPTIONS) (push) Blocked by required conditions
compilation on zephyr / smoke_test (push) Waiting to run
2025-08-01 08:58:26 +08:00
Zhenwei Jin
33eff933c0
add validation for rec indices in aot loader (#4520) 2025-08-01 08:45:57 +08:00
Zhenwei Jin
aad1866260
add validation for recursive type count in loader (#4522)
Some checks are pending
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $CLASSIC_INTERP_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $FAST_INTERP_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $FAST_JIT_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $SIMD_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $XIP_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, classic-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, fast-jit, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / build_llvm_libraries_on_windows (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_AOT=0) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=0) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_CUSTOM_NAME_SECTION=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_DEBUG_INTERP=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_LIBC_UVWASI=0 -DWAMR_BUILD_LIBC_WASI=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_LIB_PTHREAD=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_LIB_WASI_THREADS=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_REF_TYPES=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_SIMD=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_TAIL_CALL=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_DISABLE_HW_BOUND_CHECK=1) (push) Waiting to run
compilation on windows-latest / build_wamrc (${{ needs.build_llvm_libraries_on_windows.outputs.cache_key }}, windows-latest) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $MULTI_MODULES_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $THREADS_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $WASI_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $MULTI_MODULES_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $THREADS_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $WASI_TEST_OPTIONS) (push) Blocked by required conditions
compilation on zephyr / smoke_test (push) Waiting to run
2025-07-31 16:19:08 +08:00
YAMAMOTO Takashi
a0de8c7b7d
wasi-nn: fix buffer overruns in load_by_name/load_by_name_with_config (#4491)
Some checks are pending
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $CLASSIC_INTERP_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $FAST_INTERP_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $FAST_JIT_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $SIMD_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $XIP_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, classic-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, fast-jit, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / build_llvm_libraries_on_windows (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_AOT=0) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=0) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_CUSTOM_NAME_SECTION=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_DEBUG_INTERP=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_LIBC_UVWASI=0 -DWAMR_BUILD_LIBC_WASI=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_LIB_PTHREAD=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_LIB_WASI_THREADS=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_REF_TYPES=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_SIMD=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_TAIL_CALL=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_DISABLE_HW_BOUND_CHECK=1) (push) Waiting to run
compilation on windows-latest / build_wamrc (${{ needs.build_llvm_libraries_on_windows.outputs.cache_key }}, windows-latest) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $MULTI_MODULES_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $THREADS_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $WASI_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $MULTI_MODULES_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $THREADS_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $WASI_TEST_OPTIONS) (push) Blocked by required conditions
compilation on zephyr / smoke_test (push) Waiting to run
also, ensure NUL terminations here to simplify backend implementations.
(note that, although names with '\0' in the middle are usually valid
in wasm, wamr doesn't support them in general. we might revisit this
later.)

also, add a missing address validation in load_by_name_with_config.

cf. https://github.com/bytecodealliance/wasm-micro-runtime/issues/4487
2025-07-30 10:27:20 +08:00
ChenWen
c6afa131a4
feat(core): Support pthread using SPIRAM as stack (#4509)
Signed-off-by: chenwen@espressif.com <chenwen@espressif.com>
2025-07-30 10:26:41 +08:00
Liu Jia
6c6447fadb
Add regression test CI (#4512)
The entire CI test run takes approximately 3 minutes.
The test run fails if there is at least one failed case (failed > 0).
2025-07-30 10:26:19 +08:00
Marcin Kolny
2685f2cae0
Use venv to install llvm dependencies and run build script (#4514)
Installing pip packages system-wide is no longer recommended, therefore
we create virtual environment for setting up the build environment for LLVM.
2025-07-30 10:25:52 +08:00
dependabot[bot]
2fe36f4516
build(deps): Bump github/codeql-action from 3.29.3 to 3.29.4 (#4519)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.29.3 to 3.29.4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v3.29.3...v3.29.4)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 3.29.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-30 10:25:21 +08:00
TianlongLiang
b322e297c6
Add CLI option for iwasm to create and attach shared heap to wasm app (#4499)
Some checks are pending
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $CLASSIC_INTERP_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $FAST_INTERP_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $FAST_JIT_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $SIMD_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $XIP_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, classic-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, fast-jit, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / build_llvm_libraries_on_windows (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_AOT=0) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=0) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_CUSTOM_NAME_SECTION=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_DEBUG_INTERP=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_LIBC_UVWASI=0 -DWAMR_BUILD_LIBC_WASI=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_LIB_PTHREAD=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_LIB_WASI_THREADS=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_REF_TYPES=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_SIMD=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_BUILD_TAIL_CALL=1) (push) Waiting to run
compilation on windows-latest / build_iwasm (-DWAMR_DISABLE_HW_BOUND_CHECK=1) (push) Waiting to run
compilation on windows-latest / build_wamrc (${{ needs.build_llvm_libraries_on_windows.outputs.cache_key }}, windows-latest) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $MULTI_MODULES_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $THREADS_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $WASI_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $MULTI_MODULES_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $THREADS_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $WASI_TEST_OPTIONS) (push) Blocked by required conditions
compilation on zephyr / smoke_test (push) Waiting to run
2025-07-29 11:13:23 +08:00
YAMAMOTO Takashi
f34d28cfbc
lib-socket: implement gai_strerror (#4508)
cf. https://pubs.opengroup.org/onlinepubs/9799919799/functions/gai_strerror.html
2025-07-29 11:12:27 +08:00
YAMAMOTO Takashi
224b426d70
doc/build_wasm_app.md: restore the recommendation of exact version match (#4518)
the intention of the original text was to recommend to use the exactly
same version (eg. 2.4.1) regardless of AOT_CURRENT_VERSION.
2025-07-29 10:33:28 +08:00
34 changed files with 430 additions and 150 deletions

View File

@ -34,58 +34,58 @@ on:
env: env:
DEFAULT_BUILD_OPTIONS: DEFAULT_BUILD_OPTIONS:
"-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1 \ "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1 \
-DWAMR_BUILD_CUSTOM_NAME_SECTION=0 \ -DWAMR_BUILD_CUSTOM_NAME_SECTION=0 \
-DWAMR_BUILD_DEBUG_INTERP=0 \ -DWAMR_BUILD_DEBUG_INTERP=0 \
-DWAMR_BUILD_DEBUG_AOT=0 \ -DWAMR_BUILD_DEBUG_AOT=0 \
-DWAMR_BUILD_DUMP_CALL_STACK=0 \ -DWAMR_BUILD_DUMP_CALL_STACK=0 \
-DWAMR_BUILD_LIBC_UVWASI=0 \ -DWAMR_BUILD_LIBC_UVWASI=0 \
-DWAMR_BUILD_LIBC_EMCC=0 \ -DWAMR_BUILD_LIBC_EMCC=0 \
-DWAMR_BUILD_LIB_RATS=0 \ -DWAMR_BUILD_LIB_RATS=0 \
-DWAMR_BUILD_LOAD_CUSTOM_SECTION=0 \ -DWAMR_BUILD_LOAD_CUSTOM_SECTION=0 \
-DWAMR_BUILD_MEMORY_PROFILING=0 \ -DWAMR_BUILD_MEMORY_PROFILING=0 \
-DWAMR_BUILD_MINI_LOADER=0 \ -DWAMR_BUILD_MINI_LOADER=0 \
-DWAMR_BUILD_MULTI_MODULE=0 \ -DWAMR_BUILD_MULTI_MODULE=0 \
-DWAMR_BUILD_PERF_PROFILING=0 \ -DWAMR_BUILD_PERF_PROFILING=0 \
-DWAMR_BUILD_SPEC_TEST=0 \ -DWAMR_BUILD_SPEC_TEST=0 \
-DWAMR_BUILD_BULK_MEMORY=1 \ -DWAMR_BUILD_BULK_MEMORY=1 \
-DWAMR_BUILD_LIB_PTHREAD=1 \ -DWAMR_BUILD_LIB_PTHREAD=1 \
-DWAMR_BUILD_LIB_PTHREAD_SEMAPHORE=1 \ -DWAMR_BUILD_LIB_PTHREAD_SEMAPHORE=1 \
-DWAMR_BUILD_LIB_WASI_THREADS=1 \ -DWAMR_BUILD_LIB_WASI_THREADS=1 \
-DWAMR_BUILD_LIBC_BUILTIN=1 \ -DWAMR_BUILD_LIBC_BUILTIN=1 \
-DWAMR_BUILD_LIBC_WASI=1 \ -DWAMR_BUILD_LIBC_WASI=1 \
-DWAMR_BUILD_REF_TYPES=1 \ -DWAMR_BUILD_REF_TYPES=1 \
-DWAMR_BUILD_SIMD=1 \ -DWAMR_BUILD_SIMD=1 \
-DWAMR_BUILD_SHARED_MEMORY=1 \ -DWAMR_BUILD_SHARED_MEMORY=1 \
-DWAMR_BUILD_TAIL_CALL=1 \ -DWAMR_BUILD_TAIL_CALL=1 \
-DWAMR_BUILD_THREAD_MGR=1" -DWAMR_BUILD_THREAD_MGR=1"
GC_EH_BUILD_OPTIONS: GC_EH_BUILD_OPTIONS:
"-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=0 \ "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=0 \
-DWAMR_BUILD_CUSTOM_NAME_SECTION=0 \ -DWAMR_BUILD_CUSTOM_NAME_SECTION=0 \
-DWAMR_BUILD_DEBUG_INTERP=0 \ -DWAMR_BUILD_DEBUG_INTERP=0 \
-DWAMR_BUILD_DEBUG_AOT=0 \ -DWAMR_BUILD_DEBUG_AOT=0 \
-DWAMR_BUILD_DUMP_CALL_STACK=0 \ -DWAMR_BUILD_DUMP_CALL_STACK=0 \
-DWAMR_BUILD_LIBC_UVWASI=0 \ -DWAMR_BUILD_LIBC_UVWASI=0 \
-DWAMR_BUILD_LIBC_EMCC=0 \ -DWAMR_BUILD_LIBC_EMCC=0 \
-DWAMR_BUILD_LIB_RATS=0 \ -DWAMR_BUILD_LIB_RATS=0 \
-DWAMR_BUILD_LOAD_CUSTOM_SECTION=0 \ -DWAMR_BUILD_LOAD_CUSTOM_SECTION=0 \
-DWAMR_BUILD_MEMORY_PROFILING=0 \ -DWAMR_BUILD_MEMORY_PROFILING=0 \
-DWAMR_BUILD_MINI_LOADER=0 \ -DWAMR_BUILD_MINI_LOADER=0 \
-DWAMR_BUILD_MULTI_MODULE=0 \ -DWAMR_BUILD_MULTI_MODULE=0 \
-DWAMR_BUILD_PERF_PROFILING=0 \ -DWAMR_BUILD_PERF_PROFILING=0 \
-DWAMR_BUILD_SPEC_TEST=0 \ -DWAMR_BUILD_SPEC_TEST=0 \
-DWAMR_BUILD_BULK_MEMORY=1 \ -DWAMR_BUILD_BULK_MEMORY=1 \
-DWAMR_BUILD_LIB_PTHREAD=1 \ -DWAMR_BUILD_LIB_PTHREAD=1 \
-DWAMR_BUILD_LIB_PTHREAD_SEMAPHORE=1 \ -DWAMR_BUILD_LIB_PTHREAD_SEMAPHORE=1 \
-DWAMR_BUILD_LIB_WASI_THREADS=1 \ -DWAMR_BUILD_LIB_WASI_THREADS=1 \
-DWAMR_BUILD_LIBC_BUILTIN=1 \ -DWAMR_BUILD_LIBC_BUILTIN=1 \
-DWAMR_BUILD_LIBC_WASI=1 \ -DWAMR_BUILD_LIBC_WASI=1 \
-DWAMR_BUILD_REF_TYPES=1 \ -DWAMR_BUILD_REF_TYPES=1 \
-DWAMR_BUILD_SIMD=1 \ -DWAMR_BUILD_SIMD=1 \
-DWAMR_BUILD_SHARED_MEMORY=1 \ -DWAMR_BUILD_SHARED_MEMORY=1 \
-DWAMR_BUILD_TAIL_CALL=1 \ -DWAMR_BUILD_TAIL_CALL=1 \
-DWAMR_BUILD_THREAD_MGR=1 \ -DWAMR_BUILD_THREAD_MGR=1 \
-DWAMR_BUILD_EXCE_HANDLING=1 \ -DWAMR_BUILD_EXCE_HANDLING=1 \
-DWAMR_BUILD_GC=1" -DWAMR_BUILD_GC=1"
permissions: permissions:
contents: read contents: read
@ -97,9 +97,9 @@ jobs:
matrix: matrix:
include: include:
- build_options: $DEFAULT_BUILD_OPTIONS - build_options: $DEFAULT_BUILD_OPTIONS
suffix: '' suffix: ""
- build_options: $GC_EH_BUILD_OPTIONS - build_options: $GC_EH_BUILD_OPTIONS
suffix: '-gc-eh' suffix: "-gc-eh"
permissions: permissions:
contents: write # for uploading release artifacts contents: write # for uploading release artifacts
@ -126,6 +126,30 @@ jobs:
cmake --build build --config Release --parallel 4 cmake --build build --config Release --parallel 4
working-directory: ${{ inputs.cwd }} working-directory: ${{ inputs.cwd }}
- name: smoke test on non-Windows
if: ${{ !startsWith(inputs.runner, 'windows') }}
shell: bash
run: |
if [[ ! -f build/iwasm ]]; then
echo "iwasm binary is not found in the expected location."
exit 1
fi
build/iwasm --version
working-directory: ${{ inputs.cwd }}
- name: smoke test on Windows
if: ${{ startsWith(inputs.runner, 'windows') }}
shell: bash
run: |
if [[ ! -f build/Release/iwasm ]]; then
echo "iwasm binary is not found in the expected location."
exit 1
fi
build/Release/iwasm --version
working-directory: ${{ inputs.cwd }}
- name: Compress the binary on Windows - name: Compress the binary on Windows
if: inputs.runner == 'windows-latest' if: inputs.runner == 'windows-latest'
run: | run: |

View File

@ -62,6 +62,30 @@ jobs:
cmake --build build --config Release --parallel 4 cmake --build build --config Release --parallel 4
working-directory: wamr-compiler working-directory: wamr-compiler
- name: smoke test on non-windows
if: ${{ !startsWith(inputs.runner, 'windows') }}
shell: bash
run: |
if [[ ! -f build/wamrc ]]; then
echo "wamrc binary is not found in the expected location."
exit 1
fi
build/wamrc --version
working-directory: wamr-compiler
- name: smoke test on Windows
if: ${{ startsWith(inputs.runner, 'windows') }}
shell: bash
run: |
if [[ ! -f build/Release/wamrc ]]; then
echo "wamrc binary is not found in the expected location."
exit 1
fi
build/Release/wamrc --version
working-directory: wamr-compiler
- name: Compress the binary on Windows - name: Compress the binary on Windows
if: inputs.runner == 'windows-latest' && inputs.release if: inputs.runner == 'windows-latest' && inputs.release
run: | run: |

View File

@ -53,7 +53,7 @@ jobs:
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v3.29.3 uses: github/codeql-action/init@v3.29.4
with: with:
languages: ${{ matrix.language }} languages: ${{ matrix.language }}
@ -70,7 +70,7 @@ jobs:
- run: | - run: |
./.github/scripts/codeql_buildscript.sh ./.github/scripts/codeql_buildscript.sh
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3.29.3 uses: github/codeql-action/analyze@v3.29.4
with: with:
category: "/language:${{matrix.language}}" category: "/language:${{matrix.language}}"
upload: false upload: false
@ -99,7 +99,7 @@ jobs:
output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
- name: Upload CodeQL results to code scanning - name: Upload CodeQL results to code scanning
uses: github/codeql-action/upload-sarif@v3.29.3 uses: github/codeql-action/upload-sarif@v3.29.4
with: with:
sarif_file: ${{ steps.step1.outputs.sarif-output }} sarif_file: ${{ steps.step1.outputs.sarif-output }}
category: "/language:${{matrix.language}}" category: "/language:${{matrix.language}}"

View File

@ -371,6 +371,47 @@ jobs:
ctest ctest
working-directory: tests/unit working-directory: tests/unit
build_regression_tests:
needs:
[build_llvm_libraries_on_ubuntu_2204]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
include:
- os: ubuntu-22.04
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
steps:
- name: checkout
uses: actions/checkout@v4
- name: Get LLVM libraries
id: retrieve_llvm_libs
uses: actions/cache@v4
with:
path: |
./core/deps/llvm/build/bin
./core/deps/llvm/build/include
./core/deps/llvm/build/lib
./core/deps/llvm/build/libexec
./core/deps/llvm/build/share
key: ${{ matrix.llvm_cache_key }}
- 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: build_samples_wasm_c_api:
needs: needs:
[ [

View File

@ -60,6 +60,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard. # Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning" - name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@7710ed11e398ea99c7f7004c2b2e0f580458db42 uses: github/codeql-action/upload-sarif@701df0e49d84a24bd8f0d01f80c0dbf69ab07674
with: with:
sarif_file: results.sarif sarif_file: results.sarif

View File

@ -1786,7 +1786,8 @@ load_types(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
read_uint32(buf, buf_end, j); read_uint32(buf, buf_end, j);
#if WASM_ENABLE_AOT_VALIDATOR != 0 #if WASM_ENABLE_AOT_VALIDATOR != 0
if (j >= module->type_count) { /* an equivalence type should be before the type it refers to */
if (j > i) {
set_error_buf(error_buf, error_buf_size, "invalid type index"); set_error_buf(error_buf, error_buf_size, "invalid type index");
goto fail; goto fail;
} }
@ -1805,7 +1806,12 @@ load_types(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
read_uint32(buf, buf_end, parent_type_idx); read_uint32(buf, buf_end, parent_type_idx);
read_uint16(buf, buf_end, rec_count); read_uint16(buf, buf_end, rec_count);
read_uint16(buf, buf_end, rec_idx); read_uint16(buf, buf_end, rec_idx);
#if WASM_ENABLE_AOT_VALIDATOR != 0
if (rec_idx > i) {
set_error_buf(error_buf, error_buf_size, "invalid rec_idx");
goto fail;
}
#endif
if (type_flag == WASM_TYPE_FUNC) { if (type_flag == WASM_TYPE_FUNC) {
AOTFuncType *func_type; AOTFuncType *func_type;

View File

@ -0,0 +1,3 @@
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -79,3 +79,6 @@ return:
add sp, sp, #0x30 /* restore sp */ add sp, sp, #0x30 /* restore sp */
ret ret
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -77,3 +77,6 @@ return:
add sp, sp, #0x30 /* restore sp */ add sp, sp, #0x30 /* restore sp */
ret ret
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -67,3 +67,6 @@ call_func:
j_s [blink] /* ret */ j_s [blink] /* ret */
nop_s nop_s
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -73,3 +73,6 @@ return:
add sp, sp, #4 add sp, sp, #4
ldmfd sp!, {r4, r5, r6, r7, lr} ldmfd sp!, {r4, r5, r6, r7, lr}
bx lr bx lr
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -84,3 +84,6 @@ return:
ldmfd sp!, {r4, r5, r6, r7, lr} ldmfd sp!, {r4, r5, r6, r7, lr}
bx lr bx lr
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -62,3 +62,6 @@ push_args_end:
leave leave
ret ret
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -62,3 +62,6 @@ push_args_end:
leave leave
ret ret
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -35,3 +35,6 @@ skip_push_args:
leave leave
ret ret
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -72,3 +72,6 @@ done:
j $31 j $31
.end invokeNative .end invokeNative
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -89,3 +89,6 @@ return:
pop {r4, r5, r6, r7} pop {r4, r5, r6, r7}
mov lr, r3 mov lr, r3
bx lr bx lr
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -98,3 +98,6 @@ return:
mov lr, r3 mov lr, r3
bx lr bx lr
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -72,3 +72,6 @@ call_func:
return: return:
retw.n retw.n
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -199,6 +199,8 @@ wasm_runtime_create_shared_heap(SharedHeapInitArgs *init_args)
heap->heap_handle = NULL; heap->heap_handle = NULL;
heap->base_addr = init_args->pre_allocated_addr; heap->base_addr = init_args->pre_allocated_addr;
LOG_VERBOSE("Create preallocated shared heap %p with size %u",
heap->base_addr, size);
} }
else { else {
if (!(heap->heap_handle = if (!(heap->heap_handle =
@ -225,6 +227,8 @@ wasm_runtime_create_shared_heap(SharedHeapInitArgs *init_args)
LOG_WARNING("init share heap failed"); LOG_WARNING("init share heap failed");
goto fail4; goto fail4;
} }
LOG_VERBOSE("Create pool shared heap %p with size %u", heap->base_addr,
size);
} }
os_mutex_lock(&shared_heap_list_lock); os_mutex_lock(&shared_heap_list_lock);
@ -509,6 +513,8 @@ wasm_runtime_attach_shared_heap_internal(WASMModuleInstanceCommon *module_inst,
os_mutex_lock(&shared_heap_list_lock); os_mutex_lock(&shared_heap_list_lock);
shared_heap->attached_count++; shared_heap->attached_count++;
os_mutex_unlock(&shared_heap_list_lock); os_mutex_unlock(&shared_heap_list_lock);
LOG_VERBOSE("Shared heap %p is attached to module instance %p", shared_heap,
module_inst);
return true; return true;
} }
@ -570,6 +576,7 @@ wasm_runtime_detach_shared_heap_internal(WASMModuleInstanceCommon *module_inst)
e->shared_heap_base_addr_adj = NULL; e->shared_heap_base_addr_adj = NULL;
} }
#endif /* end of WASM_ENABLE_AOT != 0 */ #endif /* end of WASM_ENABLE_AOT != 0 */
LOG_VERBOSE("Shared heap is detached from module instance %p", module_inst);
} }
void void

View File

@ -400,8 +400,7 @@ check_array_type(const WASMModule *module, uint32 type_index, char *error_buf,
error_buf_size)) { error_buf_size)) {
return false; return false;
} }
if (module->types[type_index] == NULL if (module->types[type_index]->type_flag != WASM_TYPE_ARRAY) {
|| module->types[type_index]->type_flag != WASM_TYPE_ARRAY) {
set_error_buf(error_buf, error_buf_size, "unknown array type"); set_error_buf(error_buf, error_buf_size, "unknown array type");
return false; return false;
} }
@ -424,8 +423,7 @@ check_function_type(const WASMModule *module, uint32 type_index,
} }
#if WASM_ENABLE_GC != 0 #if WASM_ENABLE_GC != 0
if (module->types[type_index] == NULL if (module->types[type_index]->type_flag != WASM_TYPE_FUNC) {
|| module->types[type_index]->type_flag != WASM_TYPE_FUNC) {
set_error_buf(error_buf, error_buf_size, "unknown function type"); set_error_buf(error_buf, error_buf_size, "unknown function type");
return false; return false;
} }
@ -1257,9 +1255,8 @@ load_init_expr(WASMModule *module, const uint8 **p_buf, const uint8 *buf_end,
error_buf_size)) { error_buf_size)) {
goto fail; goto fail;
} }
if (module->types[type_idx] == NULL if (module->types[type_idx]->type_flag
|| module->types[type_idx]->type_flag != WASM_TYPE_STRUCT) {
!= WASM_TYPE_STRUCT) {
set_error_buf(error_buf, error_buf_size, set_error_buf(error_buf, error_buf_size,
"unknown struct type"); "unknown struct type");
goto fail; goto fail;
@ -2499,6 +2496,13 @@ load_type_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
#endif /* end of WASM_ENABLE_GC == 0 */ #endif /* end of WASM_ENABLE_GC == 0 */
} }
for (i = 0; i < module->type_count; i++) {
if (module->types[i] == NULL) {
set_error_buf_v(error_buf, error_buf_size, "unknown type %d", i);
return false;
}
}
if (p != p_end) { if (p != p_end) {
set_error_buf(error_buf, error_buf_size, "section size mismatch"); set_error_buf(error_buf, error_buf_size, "section size mismatch");
return false; return false;
@ -12685,9 +12689,7 @@ re_scan:
error_buf, error_buf_size)) { error_buf, error_buf_size)) {
goto fail; goto fail;
} }
if (module->types[type_idx1] == NULL if (module->types[type_idx1]->type_flag != WASM_TYPE_FUNC) {
|| module->types[type_idx1]->type_flag
!= WASM_TYPE_FUNC) {
set_error_buf(error_buf, error_buf_size, set_error_buf(error_buf, error_buf_size,
"unknown function type"); "unknown function type");
goto fail; goto fail;
@ -12704,9 +12706,7 @@ re_scan:
error_buf, error_buf_size)) { error_buf, error_buf_size)) {
goto fail; goto fail;
} }
if (module->types[type_idx] == NULL if (module->types[type_idx]->type_flag != WASM_TYPE_FUNC) {
|| module->types[type_idx]->type_flag
!= WASM_TYPE_FUNC) {
set_error_buf(error_buf, error_buf_size, set_error_buf(error_buf, error_buf_size,
"unknown function type"); "unknown function type");
goto fail; goto fail;
@ -14542,9 +14542,8 @@ re_scan:
error_buf_size)) { error_buf_size)) {
goto fail; goto fail;
} }
if (module->types[type_idx] == NULL if (module->types[type_idx]->type_flag
|| module->types[type_idx]->type_flag != WASM_TYPE_STRUCT) {
!= WASM_TYPE_STRUCT) {
set_error_buf(error_buf, error_buf_size, set_error_buf(error_buf, error_buf_size,
"unknown struct type"); "unknown struct type");
goto fail; goto fail;
@ -14630,9 +14629,8 @@ re_scan:
error_buf_size)) { error_buf_size)) {
goto fail; goto fail;
} }
if (module->types[type_idx] == NULL if (module->types[type_idx]->type_flag
|| module->types[type_idx]->type_flag != WASM_TYPE_STRUCT) {
!= WASM_TYPE_STRUCT) {
set_error_buf(error_buf, error_buf_size, set_error_buf(error_buf, error_buf_size,
"unknown struct type"); "unknown struct type");
goto fail; goto fail;

View File

@ -219,6 +219,9 @@ getaddrinfo(const char *node, const char *service, const struct addrinfo *hints,
void void
freeaddrinfo(struct addrinfo *res); freeaddrinfo(struct addrinfo *res);
const char *
gai_strerror(int code);
#endif #endif
/** /**

View File

@ -590,6 +590,28 @@ freeaddrinfo(struct addrinfo *res)
free(res); free(res);
} }
const char *
gai_strerror(int code)
{
switch (code) {
#define ERR(a) \
case a: \
return #a
ERR(EAI_AGAIN);
ERR(EAI_BADFLAGS);
ERR(EAI_FAIL);
ERR(EAI_FAMILY);
ERR(EAI_MEMORY);
ERR(EAI_NONAME);
ERR(EAI_OVERFLOW);
ERR(EAI_SERVICE);
ERR(EAI_SOCKTYPE);
ERR(EAI_SYSTEM);
#undef ERR
}
return "Unknown error";
}
static struct timeval static struct timeval
time_us_to_timeval(uint64_t time_us) time_us_to_timeval(uint64_t time_us)
{ {

View File

@ -507,10 +507,35 @@ fail:
return res; return res;
} }
static wasi_nn_error
copyin_and_nul_terminate(wasm_module_inst_t inst, char *name, uint32_t name_len,
char **resultp)
{
char *nul_terminated_name;
if (!wasm_runtime_validate_native_addr(inst, name, name_len)) {
return invalid_argument;
}
nul_terminated_name = wasm_runtime_malloc(name_len + 1);
if (nul_terminated_name == NULL) {
return runtime_error;
}
bh_memcpy_s(nul_terminated_name, name_len + 1, name, name_len);
nul_terminated_name[name_len] = '\0'; /* ensure NUL termination */
if (strlen(nul_terminated_name) != name_len) {
/* reject names containing '\0' for now */
wasm_runtime_free(nul_terminated_name);
return invalid_argument;
}
*resultp = nul_terminated_name;
return success;
}
wasi_nn_error wasi_nn_error
wasi_nn_load_by_name(wasm_exec_env_t exec_env, char *name, uint32_t name_len, wasi_nn_load_by_name(wasm_exec_env_t exec_env, char *name, uint32_t name_len,
graph *g) graph *g)
{ {
WASINNContext *wasi_nn_ctx = NULL;
char *nul_terminated_name = NULL;
wasi_nn_error res; wasi_nn_error res;
wasm_module_inst_t instance = wasm_runtime_get_module_inst(exec_env); wasm_module_inst_t instance = wasm_runtime_get_module_inst(exec_env);
@ -518,25 +543,21 @@ wasi_nn_load_by_name(wasm_exec_env_t exec_env, char *name, uint32_t name_len,
return runtime_error; return runtime_error;
} }
if (!wasm_runtime_validate_native_addr(instance, name, name_len)) {
NN_ERR_PRINTF("name is invalid");
return invalid_argument;
}
if (!wasm_runtime_validate_native_addr(instance, g, if (!wasm_runtime_validate_native_addr(instance, g,
(uint64)sizeof(graph))) { (uint64)sizeof(graph))) {
NN_ERR_PRINTF("graph is invalid"); NN_ERR_PRINTF("graph is invalid");
return invalid_argument; return invalid_argument;
} }
if (name_len == 0 || name[name_len] != '\0') { res = copyin_and_nul_terminate(instance, name, name_len,
NN_ERR_PRINTF("Invalid filename"); &nul_terminated_name);
return invalid_argument; if (res != success) {
goto fail;
} }
NN_DBG_PRINTF("[WASI NN] LOAD_BY_NAME %s...", name); NN_DBG_PRINTF("[WASI NN] LOAD_BY_NAME %s...", nul_terminated_name);
WASINNContext *wasi_nn_ctx = lock_ctx(instance); wasi_nn_ctx = lock_ctx(instance);
if (wasi_nn_ctx == NULL) { if (wasi_nn_ctx == NULL) {
res = busy; res = busy;
goto fail; goto fail;
@ -547,14 +568,20 @@ wasi_nn_load_by_name(wasm_exec_env_t exec_env, char *name, uint32_t name_len,
goto fail; goto fail;
call_wasi_nn_func(wasi_nn_ctx->backend, load_by_name, res, call_wasi_nn_func(wasi_nn_ctx->backend, load_by_name, res,
wasi_nn_ctx->backend_ctx, name, name_len, g); wasi_nn_ctx->backend_ctx, nul_terminated_name, name_len,
g);
if (res != success) if (res != success)
goto fail; goto fail;
wasi_nn_ctx->is_model_loaded = true; wasi_nn_ctx->is_model_loaded = true;
res = success; res = success;
fail: fail:
unlock_ctx(wasi_nn_ctx); if (nul_terminated_name != NULL) {
wasm_runtime_free(nul_terminated_name);
}
if (wasi_nn_ctx != NULL) {
unlock_ctx(wasi_nn_ctx);
}
return res; return res;
} }
@ -563,6 +590,9 @@ wasi_nn_load_by_name_with_config(wasm_exec_env_t exec_env, char *name,
int32_t name_len, char *config, int32_t name_len, char *config,
int32_t config_len, graph *g) int32_t config_len, graph *g)
{ {
WASINNContext *wasi_nn_ctx = NULL;
char *nul_terminated_name = NULL;
char *nul_terminated_config = NULL;
wasi_nn_error res; wasi_nn_error res;
wasm_module_inst_t instance = wasm_runtime_get_module_inst(exec_env); wasm_module_inst_t instance = wasm_runtime_get_module_inst(exec_env);
@ -570,30 +600,27 @@ wasi_nn_load_by_name_with_config(wasm_exec_env_t exec_env, char *name,
return runtime_error; return runtime_error;
} }
if (!wasm_runtime_validate_native_addr(instance, name, name_len)) {
NN_ERR_PRINTF("name is invalid");
return invalid_argument;
}
if (!wasm_runtime_validate_native_addr(instance, g, if (!wasm_runtime_validate_native_addr(instance, g,
(uint64)sizeof(graph))) { (uint64)sizeof(graph))) {
NN_ERR_PRINTF("graph is invalid"); NN_ERR_PRINTF("graph is invalid");
return invalid_argument; return invalid_argument;
} }
if (name_len == 0 || name[name_len] != '\0') { res = copyin_and_nul_terminate(instance, name, name_len,
NN_ERR_PRINTF("Invalid filename"); &nul_terminated_name);
return invalid_argument; if (res != success) {
goto fail;
}
res = copyin_and_nul_terminate(instance, config, config_len,
&nul_terminated_config);
if (res != success) {
goto fail;
} }
if (!config || config_len == 0 || config[config_len] != '\0') { NN_DBG_PRINTF("[WASI NN] LOAD_BY_NAME_WITH_CONFIG %s %s...",
NN_ERR_PRINTF("Invalid config"); nul_terminated_name, nul_terminated_config);
return invalid_argument;
}
NN_DBG_PRINTF("[WASI NN] LOAD_BY_NAME_WITH_CONFIG %s %s...", name, config); wasi_nn_ctx = lock_ctx(instance);
WASINNContext *wasi_nn_ctx = lock_ctx(instance);
if (wasi_nn_ctx == NULL) { if (wasi_nn_ctx == NULL) {
res = busy; res = busy;
goto fail; goto fail;
@ -605,15 +632,23 @@ wasi_nn_load_by_name_with_config(wasm_exec_env_t exec_env, char *name,
; ;
call_wasi_nn_func(wasi_nn_ctx->backend, load_by_name_with_config, res, call_wasi_nn_func(wasi_nn_ctx->backend, load_by_name_with_config, res,
wasi_nn_ctx->backend_ctx, name, name_len, config, wasi_nn_ctx->backend_ctx, nul_terminated_name, name_len,
config_len, g); nul_terminated_config, config_len, g);
if (res != success) if (res != success)
goto fail; goto fail;
wasi_nn_ctx->is_model_loaded = true; wasi_nn_ctx->is_model_loaded = true;
res = success; res = success;
fail: fail:
unlock_ctx(wasi_nn_ctx); if (nul_terminated_name != NULL) {
wasm_runtime_free(nul_terminated_name);
}
if (nul_terminated_config != NULL) {
wasm_runtime_free(nul_terminated_config);
}
if (wasi_nn_ctx != NULL) {
unlock_ctx(wasi_nn_ctx);
}
return res; return res;
} }

View File

@ -9,6 +9,7 @@
#include "wasi_nn_backend.h" #include "wasi_nn_backend.h"
#include "wasm_export.h" #include "wasm_export.h"
#include <tensorflow/lite/c/c_api.h>
#include <tensorflow/lite/interpreter.h> #include <tensorflow/lite/interpreter.h>
#include <tensorflow/lite/kernels/register.h> #include <tensorflow/lite/kernels/register.h>
#include <tensorflow/lite/model.h> #include <tensorflow/lite/model.h>
@ -279,29 +280,53 @@ set_input(void *tflite_ctx, graph_execution_context ctx, uint32_t index,
tensor *input_tensor) tensor *input_tensor)
{ {
TFLiteContext *tfl_ctx = (TFLiteContext *)tflite_ctx; TFLiteContext *tfl_ctx = (TFLiteContext *)tflite_ctx;
TfLiteType tfl_type;
if (input_tensor->type != fp32) { switch (input_tensor->type) {
NN_ERR_PRINTF("unsupported input tensor type %u", input_tensor->type); case fp32:
return runtime_error; tfl_type = TfLiteType::kTfLiteFloat32;
break;
#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0
case u8:
tfl_type = TfLiteType::kTfLiteUInt8;
break;
#endif
default:
NN_ERR_PRINTF("unsupported input tensor type %u",
input_tensor->type);
return runtime_error;
} }
wasi_nn_error res; wasi_nn_error res;
if (success != (res = is_valid_graph_execution_context(tfl_ctx, ctx))) if (success != (res = is_valid_graph_execution_context(tfl_ctx, ctx)))
return res; return res;
uint32_t num_tensors = auto interpreter = tfl_ctx->interpreters[ctx].interpreter.get();
tfl_ctx->interpreters[ctx].interpreter->inputs().size();
uint32_t num_tensors = interpreter->inputs().size();
NN_DBG_PRINTF("Number of tensors (%d)", num_tensors); NN_DBG_PRINTF("Number of tensors (%d)", num_tensors);
if (index + 1 > num_tensors) { if (index + 1 > num_tensors) {
return runtime_error; return runtime_error;
} }
auto tensor = tfl_ctx->interpreters[ctx].interpreter->input_tensor(index); auto tensor = interpreter->input_tensor(index);
if (tensor == NULL) { if (tensor == NULL) {
NN_ERR_PRINTF("Missing memory"); NN_ERR_PRINTF("Missing memory");
return too_large; return too_large;
} }
#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0
if (TfLiteTensorType(tensor) != tfl_type) {
NN_ERR_PRINTF("Type mismatch");
return runtime_error;
}
if (TfLiteTensorCopyFromBuffer(tensor, input_tensor->data.buf,
input_tensor->data.size)
!= kTfLiteOk) {
return runtime_error;
}
#else
uint32_t model_tensor_size = 1; uint32_t model_tensor_size = 1;
for (int i = 0; i < tensor->dims->size; ++i) for (int i = 0; i < tensor->dims->size; ++i)
model_tensor_size *= (uint32_t)tensor->dims->data[i]; model_tensor_size *= (uint32_t)tensor->dims->data[i];
@ -346,6 +371,7 @@ set_input(void *tflite_ctx, graph_execution_context ctx, uint32_t index,
it[i] = (uint8_t)(input_tensor_f[i] / scale + zero_point); it[i] = (uint8_t)(input_tensor_f[i] / scale + zero_point);
} }
} }
#endif
return success; return success;
} }
@ -388,14 +414,19 @@ get_output(void *tflite_ctx, graph_execution_context ctx, uint32_t index,
return too_large; return too_large;
} }
#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0
size_t sz = TfLiteTensorByteSize(tensor);
if (output_tensor->size < sz) {
NN_ERR_PRINTF("Insufficient memory to copy tensor %d", index);
return too_large;
}
if (TfLiteTensorCopyToBuffer(tensor, output_tensor->buf, sz) != kTfLiteOk) {
return runtime_error;
}
*output_tensor_size = sz;
#else
if (tensor->quantization.type == kTfLiteNoQuantization) { if (tensor->quantization.type == kTfLiteNoQuantization) {
NN_DBG_PRINTF("No quantization information"); NN_DBG_PRINTF("No quantization information");
#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0
if (output_tensor->size < tensor->bytes) {
NN_ERR_PRINTF("Insufficient memory to copy tensor %d", index);
return too_large;
}
#else
/* /*
* for now, maintain the bug-to-bug compatibility with the old abi, * for now, maintain the bug-to-bug compatibility with the old abi,
* where the size here is the number of fp32, not bytes. * where the size here is the number of fp32, not bytes.
@ -404,18 +435,13 @@ get_output(void *tflite_ctx, graph_execution_context ctx, uint32_t index,
NN_ERR_PRINTF("Insufficient memory to copy tensor %d", index); NN_ERR_PRINTF("Insufficient memory to copy tensor %d", index);
return too_large; return too_large;
} }
#endif
bh_memcpy_s(output_tensor->buf, output_tensor->size, tensor->data.data, bh_memcpy_s(output_tensor->buf, output_tensor->size, tensor->data.data,
tensor->bytes); tensor->bytes);
#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0
*output_tensor_size = tensor->bytes;
#else
/* /*
* for now, maintain the bug-to-bug compatibility with the old abi, * for now, maintain the bug-to-bug compatibility with the old abi,
* where the size here is the number of fp32, not bytes. * where the size here is the number of fp32, not bytes.
*/ */
*output_tensor_size = tensor->bytes / sizeof(float); *output_tensor_size = tensor->bytes / sizeof(float);
#endif
} }
else { // TODO: Assuming uint8 quantized networks. else { // TODO: Assuming uint8 quantized networks.
TfLiteAffineQuantization *quant_info = TfLiteAffineQuantization *quant_info =
@ -429,12 +455,6 @@ get_output(void *tflite_ctx, graph_execution_context ctx, uint32_t index,
for (int i = 0; i < (int)tensor->dims->size; ++i) for (int i = 0; i < (int)tensor->dims->size; ++i)
model_tensor_size *= (uint32_t)tensor->dims->data[i]; model_tensor_size *= (uint32_t)tensor->dims->data[i];
#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0
if (output_tensor->size / sizeof(float) < model_tensor_size) {
NN_ERR_PRINTF("Insufficient memory to copy tensor %d", index);
return too_large;
}
#else
/* /*
* for now, maintain the bug-to-bug compatibility with the old abi, * for now, maintain the bug-to-bug compatibility with the old abi,
* where the size here is the number of fp32, not bytes. * where the size here is the number of fp32, not bytes.
@ -443,7 +463,6 @@ get_output(void *tflite_ctx, graph_execution_context ctx, uint32_t index,
NN_ERR_PRINTF("Insufficient memory to copy tensor %d", index); NN_ERR_PRINTF("Insufficient memory to copy tensor %d", index);
return too_large; return too_large;
} }
#endif
uint8_t *ot = tfl_ctx->interpreters[ctx] uint8_t *ot = tfl_ctx->interpreters[ctx]
.interpreter->typed_output_tensor<uint8_t>(index); .interpreter->typed_output_tensor<uint8_t>(index);
@ -458,16 +477,13 @@ get_output(void *tflite_ctx, graph_execution_context ctx, uint32_t index,
output_tensor_f[i] = (ot[i] - zero_point) * scale; output_tensor_f[i] = (ot[i] - zero_point) * scale;
} }
#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0
*output_tensor_size = model_tensor_size * sizeof(float);
#else
/* /*
* for now, maintain the bug-to-bug compatibility with the old abi, * for now, maintain the bug-to-bug compatibility with the old abi,
* where the size here is the number of fp32, not bytes. * where the size here is the number of fp32, not bytes.
*/ */
*output_tensor_size = model_tensor_size; *output_tensor_size = model_tensor_size;
#endif
} }
#endif
return success; return success;
} }

View File

@ -110,6 +110,13 @@ os_thread_create_with_prio(korp_tid *tid, thread_start_routine_t start,
targ->start = start; targ->start = start;
targ->arg = arg; targ->arg = arg;
#ifdef CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM
esp_pthread_cfg_t default_config = esp_pthread_get_default_config();
default_config.stack_alloc_caps = MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM;
ESP_ERROR_CHECK(esp_pthread_set_cfg(&default_config));
#endif
if (pthread_create(tid, &tattr, os_thread_wrapper, targ) != 0) { if (pthread_create(tid, &tattr, os_thread_wrapper, targ) != 0) {
pthread_attr_destroy(&tattr); pthread_attr_destroy(&tattr);
os_free(targ); os_free(targ);

View File

@ -382,9 +382,11 @@ a non-compatible`AOT_CURRENT_VERSION`.
We try our best to maintain our runtime ABI for AoT-compiled modules We try our best to maintain our runtime ABI for AoT-compiled modules
compatible among WAMR versions with compatible `AOT_CURRENT_VERSION` compatible among WAMR versions with compatible `AOT_CURRENT_VERSION`
so that combinations of older wamrc and newer runtime usually work. so that combinations of older wamrc and newer runtime usually work.
However, there might be minor incompatibilities time to time.
For productions, we recommend to use compatible versions of However, there might be minor incompatibilities from time to time. For
wamrc and the runtime. example, we usually avoid bumping the version when making a change which
affects only a small fraction of users. For productions, we recommend
using exactly same versions of wamrc and the runtime.
| WAMR version | AOT_CURRENT_VERSION | Compatible AOT version | | | WAMR version | AOT_CURRENT_VERSION | Compatible AOT version | |
| ------------ | ------------------- | ---------------------- | ---------------------- | | ------------ | ------------------- | ---------------------- | ---------------------- |

View File

@ -57,6 +57,10 @@ print_help(void)
#else #else
printf(" --heap-size=n Set maximum heap size in bytes, default is 16 KB when libc wasi is diabled\n"); printf(" --heap-size=n Set maximum heap size in bytes, default is 16 KB when libc wasi is diabled\n");
#endif #endif
#if WASM_ENABLE_SHARED_HEAP != 0
printf(" --shared-heap-size=n Create shared heap of n bytes and attach to the wasm app.\n");
printf(" The size n will be adjusted to a minumum number aligned to page size\n");
#endif
#if WASM_ENABLE_FAST_JIT != 0 #if WASM_ENABLE_FAST_JIT != 0
printf(" --jit-codecache-size=n Set fast jit maximum code cache size in bytes,\n"); printf(" --jit-codecache-size=n Set fast jit maximum code cache size in bytes,\n");
printf(" default is %u KB\n", FAST_JIT_DEFAULT_CODE_CACHE_SIZE / 1024); printf(" default is %u KB\n", FAST_JIT_DEFAULT_CODE_CACHE_SIZE / 1024);
@ -578,6 +582,11 @@ main(int argc, char *argv[])
#else #else
uint32 heap_size = 16 * 1024; uint32 heap_size = 16 * 1024;
#endif #endif
#if WASM_ENABLE_SHARED_HEAP != 0
SharedHeapInitArgs heap_init_args;
uint32 shared_heap_size = 0;
void *shared_heap = NULL;
#endif
#if WASM_ENABLE_FAST_JIT != 0 #if WASM_ENABLE_FAST_JIT != 0
uint32 jit_code_cache_size = FAST_JIT_DEFAULT_CODE_CACHE_SIZE; uint32 jit_code_cache_size = FAST_JIT_DEFAULT_CODE_CACHE_SIZE;
#endif #endif
@ -685,6 +694,13 @@ main(int argc, char *argv[])
return print_help(); return print_help();
heap_size = atoi(argv[0] + 12); heap_size = atoi(argv[0] + 12);
} }
#if WASM_ENABLE_SHARED_HEAP != 0
else if (!strncmp(argv[0], "--shared-heap-size=", 19)) {
if (argv[0][19] == '\0')
return print_help();
shared_heap_size = atoi(argv[0] + 19);
}
#endif
#if WASM_ENABLE_FAST_JIT != 0 #if WASM_ENABLE_FAST_JIT != 0
else if (!strncmp(argv[0], "--jit-codecache-size=", 21)) { else if (!strncmp(argv[0], "--jit-codecache-size=", 21)) {
if (argv[0][21] == '\0') if (argv[0][21] == '\0')
@ -1007,6 +1023,24 @@ main(int argc, char *argv[])
} }
#endif #endif
#if WASM_ENABLE_SHARED_HEAP != 0
if (shared_heap_size > 0) {
memset(&heap_init_args, 0, sizeof(heap_init_args));
heap_init_args.size = shared_heap_size;
shared_heap = wasm_runtime_create_shared_heap(&heap_init_args);
if (!shared_heap) {
printf("Create preallocated shared heap failed\n");
goto fail6;
}
/* attach module instance 2 to the shared heap */
if (!wasm_runtime_attach_shared_heap(wasm_module_inst, shared_heap)) {
printf("Attach shared heap failed.\n");
goto fail6;
}
}
#endif
ret = 0; ret = 0;
const char *exception = NULL; const char *exception = NULL;
if (is_repl_mode) { if (is_repl_mode) {
@ -1050,6 +1084,9 @@ main(int argc, char *argv[])
} }
#endif #endif
#if WASM_ENABLE_SHARED_HEAP != 0
fail6:
#endif
#if WASM_ENABLE_THREAD_MGR != 0 #if WASM_ENABLE_THREAD_MGR != 0
fail5: fail5:
#endif #endif

View File

@ -27,15 +27,16 @@ ARG ZEPHYR_SDK_VERSION=0.16.9
# In west_lite.yml, the Zephyr version is set to v3.7.0 # In west_lite.yml, the Zephyr version is set to v3.7.0
#ARG ZEPHYR_VERSION=3.7.0 #ARG ZEPHYR_VERSION=3.7.0
# Install the Zephyr Software Development Kit (SDK) # Install the Zephyr Software Development Kit (SDK) minimal version
WORKDIR /root/zephyrproject/zephyr-sdk WORKDIR /root/zephyrproject/zephyr-sdk
# hadolint ignore=DL4006 # hadolint ignore=DL4006
RUN wget --progress=dot:giga https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_SDK_VERSION}/zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64.tar.xz \ RUN wget --progress=dot:giga https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_SDK_VERSION}/zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64_minimal.tar.xz \
&& wget --progress=dot:giga -O - https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_SDK_VERSION}/sha256.sum | shasum --check --ignore-missing \ && wget --progress=dot:giga -O - https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_SDK_VERSION}/sha256.sum | shasum --check --ignore-missing \
&& tar --strip-components=1 -xf zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64.tar.xz && rm zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64.tar.xz && tar --strip-components=1 -xf zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64_minimal.tar.xz && rm zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64_minimal.tar.xz
# hadolint ignore=DL4006 # hadolint ignore=DL4006
# Install host tools and Register Zephyr SDK CMake package # Install arc tools, host tools and Register Zephyr SDK CMake package
RUN ./setup.sh -h -c # If you want to use other toolchains, please change the -t option
RUN ./setup.sh -t arc-zephyr-elf -h -c
# Install west # Install west
# hadolint ignore=DL3013,DL3059 # hadolint ignore=DL3013,DL3059

View File

@ -11,6 +11,7 @@ import subprocess
import glob import glob
import re import re
import argparse import argparse
import sys
from typing import Dict, Optional, List from typing import Dict, Optional, List
@ -275,6 +276,11 @@ def process_and_run_test_cases(
else: else:
print(f" Issues not found in folder: {format_issue_ids_should_test}") print(f" Issues not found in folder: {format_issue_ids_should_test}")
if failed > 0:
# Exit with error code if there are failed test for CI
print("Some tests failed, see log file for details.")
sys.exit(1)
def main(): def main():
parser = argparse.ArgumentParser(description="Run BA issue tests.") parser = argparse.ArgumentParser(description="Run BA issue tests.")

View File

@ -3,5 +3,17 @@
# Copyright (C) 2020 Intel Corporation. All rights reserved. # Copyright (C) 2020 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
/usr/bin/env python3 -m pip install --user -r ../build-scripts/requirements.txt TEMP_DIR=$(mktemp -d)
cleanup() {
local exit_code=$?
rm -rf "$TEMP_DIR"
exit $exit_code
}
trap cleanup EXIT INT TERM
/usr/bin/env python3 -m venv --clear "$TEMP_DIR"
source "$TEMP_DIR/bin/activate"
/usr/bin/env python3 -m pip install -r ../build-scripts/requirements.txt
/usr/bin/env python3 ../build-scripts/build_llvm.py "$@" /usr/bin/env python3 ../build-scripts/build_llvm.py "$@"

View File

@ -3,5 +3,5 @@
# Copyright (C) 2020 Intel Corporation. All rights reserved. # Copyright (C) 2020 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
/usr/bin/env python3 -m pip install --user -r ../build-scripts/requirements.txt SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
/usr/bin/env python3 ../build-scripts/build_llvm.py --platform arc "$@" $SCRIPT_DIR/build_llvm.sh --platform arc "$@"

View File

@ -3,5 +3,5 @@
# Copyright (C) 2020 Intel Corporation. All rights reserved. # Copyright (C) 2020 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
/usr/bin/env python3 -m pip install --user -r ../build-scripts/requirements.txt SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
/usr/bin/env python3 ../build-scripts/build_llvm.py --platform xtensa "$@" $SCRIPT_DIR/build_llvm.sh --platform xtensa "$@"