-
Notifications
You must be signed in to change notification settings - Fork 715
Merge branch main into dev/gc_refactor #2114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In the WASI thread test modified in this PR, malloc was used in multiple threads without a lock. But wasi-libc implementation of malloc is not thread-safe.
Fix a data race for test main_proc_exit_wait.c from #1963. And fix atomic_wait logic that was wrong before: - a thread 1 started executing wasm instruction wasm_atomic_wait but hasn't reached waiting on condition variable - a main thread calls proc_exit and notifies all the threads that reached waiting on condition variable Which leads to thread 1 hang on waiting on condition variable after that Now it's atomically checked whether proc_exit was already called.
- Remove notify_stale_threads_on_exception and change atomic.wait to be interruptible by keep waiting and checking every one second, like the implementation of poll_oneoff in libc-wasi - Wait all other threads exit and then get wasi exit_code to avoid getting invalid value - Inherit suspend_flags of parent thread while creating new thread to avoid terminated flag isn't set for new thread - Fix wasi-threads test case update_shared_data_and_alloc_heap - Add "Lib wasi-threads enabled" prompt for cmake - Fix aot get exception, use aot_copy_exception instead
How to python language binding test cases: ``` $ cd <wamr_dir>/language-bindings/python $ python -m pip install -e . $ cd wasm-c-api $ python -m unittest tests/test_basic.py $ python -m unittest tests/test_advanced.py ```
`wasi-sdk-20` pre-release can be used to avoid building `wasi-libc` to enable threads. It's not possible to use `wasi-sdk-20` pre-release on Ubuntu 20.04 because of incompatibility with the glibc version: ```bash /opt/wasi-sdk/bin/clang: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /opt/wasi-sdk/bin/clang) ```
Use the shared memory's shared_mem_lock to lock the whole atomic.wait and atomic.notify processes, and use it for os_cond_reltimedwait and os_cond_notify, so as to make the whole processes actual atomic operations: the original implementation accesses the wait address with shared_mem_lock and uses wait_node->wait_lock for os_cond_reltimedwait, which is not an atomic operation. And remove the unnecessary wait_map_lock and wait_lock, since the whole processes are already locked by shared_mem_lock.
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).
Fix the potential dead lock issue reported by Coverity code analysis tool.
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.
…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.
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 <[email protected]>
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.
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.
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](tensorflow/tensorflow@v2.10.1...v2.11.1) --- updated-dependencies: - dependency-name: tensorflow dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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.
Get exec_env_tls at the beginning of execute_post_instantiate_functions to avoid it is uninitialized when is_sub_inst is false.
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 <[email protected]>
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 <[email protected]>
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.
#2098) Convert the pointer to intptr_t to perform arithmetic to avoid the warning.
Auto download emsdk under core/deps and hack it, and fix multi-thread issues.
Fix linkage error, update build wamr document, update socket and sample documents.
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.
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.
And restore the CI vsce publish and change the wamride publisher name.
And add `wasi-threads` to the key feature list in README.md.
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.
…it (#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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.