Commit Graph

1327 Commits

Author SHA1 Message Date
ayakoakasaka
ed6b8efade
Avoid re-installing if Tensorflow is already installed for WASI-NN (#2148)
Since the Tensorflow library is already installed in many cases(especially in the
case of the embedded system), move the installation code to find_package.
2023-04-27 08:19:18 +08:00
Georgii Rylov
c1723b8f3e
libc_wasi_wrapper.c: Fix min func issue for size_t < 8 bytes on some platforms (#2152)
According to the 1999 ISO C standard (C99), size_t is an unsigned integer type of
at least 16 bit (see sections 7.17 and 7.18.3), it may be uint32 in 32-bit platforms:
https://en.cppreference.com/w/cpp/types/size_t

Calling function `size_t min(size_t, size_t)` with two uint64 arguments may get
invalid result.

Co-authored-by: Georgii Rylov <godjan@amazon.co.uk>
2023-04-26 21:03:02 +08:00
Wenyong Huang
5c497e5a14
Fix ems allocator unaligned memory access on riscv64 (#2140)
Make `hmu_tree_node` struct packed and add 4 padding bytes before `kfc_tree_root_buf`
field in `gc_heap_struct` struct to ensure the `left/right/parent` fields in `hmu_tree_node`
are 8-byte aligned on the 64-bit target which doesn't support unaligned memory access.

Fix the issue reported in #2136.
2023-04-26 18:13:11 +08:00
Zzzabiyaka
15139d2bb8
CI: Add ubsan checks to samples/wasm-c-api (#2147)
This PR adds ubsan checks with no alignment enabled to basic CI tests for
samples/wasm-c-api.

Co-authored-by: Maksim Litskevich <makslit@amazon.co.uk>
2023-04-26 09:16:29 +08:00
YAMAMOTO Takashi
8abb153546
VSCode-Extension: Download lldb built for ubuntu 20.04 (#2139)
This should allow users to use the vscode extension on ubuntu 20.04.

After https://github.com/bytecodealliance/wasm-micro-runtime/pull/2132 ,
our lldb binary for 20.04 works on ubuntu 22.04 as well.

On the other hand, lldb for 22.04 has no chance to work on ubuntu 20.04.
(because of glibc version requirement.)
2023-04-23 14:33:52 +08:00
Wenyong Huang
7e9bf9cdf5
Implement Fast JIT multi-threading feature (#2134)
- Translate all the opcodes of threads spec proposal for Fast JIT
- Add the atomic flag for Fast JIT load/store IRs to support atomic load/store
- Add new atomic related Fast JIT IRs and translate them in the codegen
- Add suspend_flags check in branch opcodes and before/after call function
- Modify CI to enable Fast JIT multi-threading test

Co-authored-by: TianlongLiang <tianlong.liang@intel.com>
2023-04-20 10:09:34 +08:00
YAMAMOTO Takashi
dfca21d239
build_wamr_vscode_ext.yml: vsce publish only on the official repo (#2130)
This makes it simpler to test workflow files on a fork.
2023-04-19 19:39:01 +08:00
YAMAMOTO Takashi
0158eea965
build_wamr_lldb.yml: sync lldb build options between ubuntu and macos (#2132)
Notably, this disables python scripting support on ubuntu:

* It isn't necessary for the primary purpose of this build. (that is, the vscode extension)
* It has been disabled in the macOS counterpart.
* It allows to use the same binary for 22.04 and 20.04. (note: 22.04 and 20.04 provide different versions of libpython)
2023-04-19 14:01:48 +08:00
YAMAMOTO Takashi
dac86af2f2
Update messages/comments to refer the new place of the version definition (#2133) 2023-04-18 21:09:18 +08:00
Daniel Mangum
2f879862ff
Update Zephyr docs to remove unsupported west subcommand (#2128)
Removes the `west espressif install` command which is no longer
supported.

https://github.com/zephyrproject-rtos/hal_espressif/pull/130

Also adds a reference to the Zephyr SDK, which will install the
necessary toolchains for all supported targets.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
2023-04-18 20:20:37 +08:00
John O'Connor
327b4a7f59
Update request.ts wasm_response_send signature (#2122)
Update wasm_response_send function signature to match api by returning
bool instead of void (was causing assemblyscript example to break)
2023-04-12 16:50:11 +08:00
Marcin Kolny
a2d4744a2b
Add test for validating linear memory size updates (#2078) 2023-04-08 19:07:20 +08:00
Wenyong Huang
4ca4f7913b
Update release notes (#2113) 2023-04-07 07:12:02 +08:00
Wenyong Huang
62fc486c20
Refine aot compiler check suspend_flags and fix issue of multi-tier jit (#2111)
In LLVM AOT/JIT compiler, only need to check the suspend_flags when memory is
a shared memory since the shared memory must be enabled for multi-threading,
so as not to impact the performance in non-multi-threading memory mode. Also
refine the LLVM IRs to check the suspend_flags.

And fix an issue of multi-tier jit for multi-threading, the instance of the child thread
should be removed from the instance list before it is de-instantiated.
2023-04-07 06:47:24 +08:00
Marcin Kolny
9adc6948d8
Enable CI build for gcc 4.8 on linux (#2106)
In #1928 we added support for GCC 4.8 but we don't continuously test if it's
working. This PR added a GitHub actions job to test compilation on GCC 4.8
for interpreters and Fast JIT (LLVM JIT/AOT might be added in the future).

The compilation is done using ubuntu 14.04 image as that's the simplest way
to get GCC 4.8 compiler. The job only compiles the code but does not run any
tests.
2023-04-06 10:10:07 +08:00
YAMAMOTO Takashi
e7b988e6ab
Document the summary of two pthread implementations (#2104)
And add `wasi-threads` to the key feature list in README.md.
2023-04-04 17:22:54 +08:00
Wenyong Huang
6af87855b4
Update version number and release notes (#2103)
And restore the CI vsce publish and change the wamride publisher name.
2023-04-04 12:13:40 +08:00
Wenyong Huang
5fc48e3584
Fix interpreter read linear memory size for multi-threading (#2088)
Load memory data size in each time memory access boundary check in
multi-threading mode since it may be changed by other threads when
memory growing.

And use `memory->memory_data_size` instead of
`memory->num_bytes_per_page * memory->cur_page_count` to refine
the code.
2023-04-04 09:05:52 +08:00
Wenyong Huang
e1d0c27ef9
Fix ref.func forward-declared function check (#2099)
When ref.func opcode refers to a function whose function index no smaller than
current function, the destination func should be forward-declared: it is declared
in the table element segments, or is declared in the export list.
2023-04-03 15:55:24 +08:00
Wenyong Huang
7701b379e4
Update documents (#2100)
Fix linkage error, update build wamr document, update socket and sample documents.
2023-04-03 15:54:44 +08:00
Wenyong Huang
24a7e5c1e6
Update sample workload tensorflow (#2101)
Auto download emsdk under core/deps and hack it, and fix multi-thread issues.
2023-04-03 14:56:46 +08:00
Wenyong Huang
5c201995f1
Fix sanitizer pointer overflow warning when perform pointer arithmetic (#2098)
Convert the pointer to intptr_t to perform arithmetic to avoid the warning.
2023-04-03 14:32:44 +08:00
Enrico Loparco
156318f0d4
Use wasi-sdk-20 to build wasi-threads cases in CI (#2095)
wasi-sdk-20 supports older versions of glibc and allow us to use it in the CI
with Ubuntu 20.04.

Refer to
  https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-20
And #2021 for previous upgrade to wasi-sdk-20 pre-release.
2023-04-03 08:43:11 +08:00
TianlongLiang
aaf671d688
Fix typo in Fast JIT's BUILD_COND_BR Macro (#2092) 2023-03-31 16:18:43 +08:00
liang.he
48429da29f
Fix compilation errors of workload xnnpack and meshoptimizer (#2081) 2023-03-30 21:15:21 +08:00
Marcin Kolny
403ccf02b7
ci: Enable WASI threads in CI (#2086) 2023-03-30 10:05:00 +08:00
zoraaver
eaf1897a70
Add support for universal binaries on OSX (#2060)
When building for multiple architectures on OSX, it's necessary to use
compiler macros to conditionally include architecture-specific code
rather than conditionally including architecture-specific assembly files
via cmake. See
  https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary
and
  https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_ARCHITECTURES.html
for more details.

Co-authored-by: Zoraaver Singh <zoraaver@amazon.co.uk>
2023-03-30 09:53:07 +08:00
Marcin Kolny
08a4a7cf08
ci: Refactor windows build definition (#2087) 2023-03-30 09:34:30 +08:00
Andy
5aa22d41e9
Fixing use after free when dumping call stack (#2084)
In multi-threading, this line will eventually call `wasm_cluster_wait_for_all_except_self`:
`DEINIT_VEC(store->instances, wasm_instance_vec_delete)`

As the threads are joining they can call `wasm_interp_dump_call_stack` which tries to
use the module frames but they were already freed by this line:
`DEINIT_VEC(store->modules, wasm_module_vec_delete)`

This PR swaps the order that these are deleted so module is deleted after the instances.

Co-authored-by: Andrew Chambers <ncham@amazon.com>
2023-03-30 09:01:16 +08:00
Wenyong Huang
b0736e2e88
Fix issues reported by Coverity (#2083)
Get exec_env_tls at the beginning of execute_post_instantiate_functions
to avoid it is uninitialized when is_sub_inst is false.
2023-03-29 19:40:52 +08:00
Huang Qi
19ab3b8812
spectest/nuttx: Increase stack size of iwasm task (#2082) 2023-03-29 17:24:44 +08:00
Wenyong Huang
10f1bf3af7
Fix module_malloc/module_free issues (#2072)
Try using existing exec_env to execute wasm app's malloc/free func and
execute post instantiation functions. Create a new exec_env only when
no existing exec_env was found.
2023-03-28 18:31:09 +08:00
Wenyong Huang
a35d39b353
Bump tensorflow from 2.9.2 to 2.11.1 in install_tensorflow.sh (#2076) 2023-03-28 17:25:36 +08:00
dependabot[bot]
0ce39a1368
Bump tensorflow in /core/iwasm/libraries/wasi-nn/test (#2061)
Bumps [tensorflow](https://github.com/tensorflow/tensorflow) from 2.10.1 to 2.11.1.
- [Release notes](https://github.com/tensorflow/tensorflow/releases)
- [Changelog](https://github.com/tensorflow/tensorflow/blob/master/RELEASE.md)
- [Commits](https://github.com/tensorflow/tensorflow/compare/v2.10.1...v2.11.1)

---
updated-dependencies:
- dependency-name: tensorflow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-28 16:36:59 +08:00
Wenyong Huang
8ee8ab3099
Limit the minimal size of bh_hashmap (#2073)
Limit the minimal size of bh_hashmap to avoid creating hashmap with size 0,
and `divide by zero` when calling bh_hash_map_find.

Reported by #2008.
2023-03-28 14:50:31 +08:00
Wang Ning
0a7994ac0a
wamr-ide: Modify Dockerfile to update base image version and fix build bug (#2068) 2023-03-28 14:21:32 +08:00
Marcin Kolny
ff4be24726
Fix bh_assert for 64-bit platforms (#2071)
In some cases, the memory address of some variables may have 4 least significant
bytes set to zero. Because we cast the pointer to int, we look only at 4 least
significant bytes; the assertion may fail because 4 least significant bytes are 0.

Change bh_assert implementation to cast the assert expr to int64_t and it works
well with 64-bit architectures.
2023-03-28 12:18:39 +08:00
Thomas Devoogdt
61369d48fd
libc-wasi/posix.c: Fix POLL{RD,WR}NORM in uClibc (#2069)
POLLRDNORM/POLLWRNORM may be not defined in uClibc, so replace them
with the equivalent POLLIN/POLLOUT.

Refer to https://www.man7.org/linux/man-pages/man2/poll.2.html
  POLLRDNORM Equivalent to POLLIN
  POLLWRNORM Equivalent to POLLOUT

Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
2023-03-28 11:20:31 +08:00
liang.he
d0fb2716b6
Fix several issues in CI binary releasing (#2064) 2023-03-26 12:19:45 +08:00
Enrico Loparco
0f73ce1076
Update wasi-libc version in CI and implement custom sync primitives (#2028)
Update wasi-libc version to resolve the hang issue when running wasi-threads cases.

Implement custom sync primitives as a counterpart of `pthread_barrier_wait` to
attempt to replace pthread sync primitives since they seem to cause data races
when running with the thread sanitizer.
2023-03-26 09:03:26 +08:00
Wenyong Huang
0faec7c96c
Update version to 1.2.0 and update release notes (#2062) 2023-03-25 20:25:54 +08:00
Wenyong Huang
605c8b07dc
Fix issue of Multi-tier JIT (#2056) 2023-03-25 11:15:05 +08:00
Wang Xin
b0f614d77a
Add architecture diagram for wasm globals and classic-interp stack frame (#2058) 2023-03-25 09:39:20 +08:00
Jämes Ménétrey
09a2698bba
Remove a file test outside of the specs and improve CI reporting (#2057)
Remove the test in the sample of file interaction that tries to extend the file
at the end, because this is not supported by the specifications of fseek.
The WASI exit code is now propagated by the runtime, so the CI will
indicate when a test is failing.
2023-03-24 21:24:23 +08:00
Wenyong Huang
c7cdb78394
Fix issues reported by Coverity (#2053)
Fix the potential dead lock issue reported by Coverity code analysis tool.
2023-03-24 14:05:17 +08:00
Wenyong Huang
3977f0b22a
Use pre-created exec_env for instantiation and module_malloc/free (#2047)
Use pre-created exec_env for instantiation and module_malloc/free,
use the same exec_env of the current thread to avoid potential
unexpected behavior.

And remove unnecessary shared_mem_lock in wasm_module_free,
which may cause dead lock.
2023-03-23 19:19:47 +08:00
Xu Jun
4c2d358980
Update document for source debugging (#2051) 2023-03-23 19:16:56 +08:00
dongheng
d975a1a82c
Enable platform support for esp-idf v5.0.1 (#2050) 2023-03-23 17:29:57 +08:00
Wang Xin
db2a4104b3
Add architecture document for wasm export (#2049) 2023-03-23 17:13:17 +08:00
Enrico Loparco
bfbe51e1b3
fix debugger: Set termination flags also when in debug mode (#2048)
When using multiple threads, termination flags are checked to stop the thread
if a `proc_exit` or trap occurs. They have to be set also in debug mode.

Tested using [WASI thread tests](https://github.com/bytecodealliance/wasm-micro-runtime/tree/main/core/iwasm/libraries/lib-wasi-threads/test).
2023-03-23 14:10:47 +08:00