-
Notifications
You must be signed in to change notification settings - Fork 627
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
Merge branch main into dev/rust_sdk #3003
Merged
Merged
Conversation
This file contains 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
Loggers (e.g. glog) usually come with instrumentation to add timestamp and other information when reporting. That results in the timestamp being reported twice, making the output confusing.
Expose API `void wasm_runtime_set_log_level(log_level_t level)`.
Fixes typo in docstrings for boundary check in the AOT compiler context. Signed-off-by: Daniel Mangum <[email protected]>
Refine params_to_argv, argv_to_results, wasm_func_param_arity, wasm_func_result_arity to fasten the wasm-c-api call wasm function process.
It improves performance for some cases. And add several vectorize related passes for JIT mode.
The host embedder may also want to terminate the wasm instance for single-threading mode, and it should work by setting exception to the wasm instance.
At least it's sometimes useful for nuttx sim. eg. (modified a bit to avoid github autolinks) ``` spacetanuki% lldb ./nuttx (lldb) target create "./nuttx" Current executable set to '/Users/yamamoto/git/nuttx/nuttx/nuttx' (x86_64). (lldb) settings set plugin.jit-loader.gdb.enable on (lldb) b foo Breakpoint 1: no locations (pending). WARNING: Unable to resolve breakpoint to any actual locations. (lldb) r Process 37011 launched: '/Users/yamamoto/git/nuttx/nuttx/nuttx' (x86_64) NuttShell (NSH) NuttX-10.4.0 nsh> mount -t hostfs -o fs=/tmp/wasm /mnt nsh> iwasm /mnt/test.aot 1 location added to breakpoint 1 Process 37011 stopped * thread #_1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 frame #_0: 0x0000000105800673 JIT(0x1058002d4)`foo(exenv=0x0000000101284280) at test.c:5 2 3 __attribute__((noinline)) 4 void foo() -> 5 { 6 printf("hello from %s\n", __func__); 7 } 8 Target 0: (nuttx) stopped. (lldb) bt * thread #_1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 * frame #_0: 0x0000000105800673 JIT(0x1058002d4)`foo(exenv=0x0000000101284280) at test.c:5 frame #_1: 0x000000010580077a JIT(0x1058002d4)`bar(exenv=0x0000000101284280) at test.c:12:2 frame #_2: 0x000000010580086a JIT(0x1058002d4)`baz(exenv=0x0000000101284280) at test.c:19:2 frame #_3: 0x0000000105800972 JIT(0x1058002d4)`__main_argc_argv(exenv=<unavailable>, argc=<unavailable>, argv=<unavailable>) at test.c:26:3 frame #_4: 0x00000001058061aa JIT(0x1058002d4)`aot_func#14 + 278 ... ```
The original file was confusing as it contains both of interpreter and aot debugging information intermixed.
…ns (#2928) Allow to control built-in libraries for wamrc from command line options: ```bash cmake -DWAMR_BUILD_LIBC_WASI=1/0 cmake -DWAMR_BUILD_LIBC_BUILTIN=1/0 cmake -DWAMR_BUILD_LIB_PTHREAD=1/0 cmake -DWAMR_BUILD_LIB_WASI_THREADS=1/0 ``` And add some messages to show the status.
As a pre_compiled wasm plugin for Envoy: https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/wasm/v3/wasm.proto
And refactor the original perf support - use WAMR_BUILD_LINUX_PERF as the cmake compilation control - use WASM_ENABLE_LINUX_PERF as the compiler macro - use `wamrc --enable-linux-perf` to generate aot file which contains fp operations - use `iwasm --enable-linux-perf` to create perf map for `perf record`
…#2968) This PR addresses the issue with building the sgx-ra sample when the enclave under the path product-mini/platforms/linux-sgx/enclave-sample is built beforehand. When the enclave is built without librats ahead, an error occurs as the following without the changes: ```bash ... CP libvmlib.a <= /home/haoxuan/wasm-micro-runtime/samples/sgx-ra/build/libvmlib.a /usr/local/bin/ld: libvmlib.a(lib_rats_wrapper.c.o): in function `librats_collect_wrapper': lib_rats_wrapper.c:(.text.librats_collect_wrapper+0x4a): undefined reference to `wasm_runtime_get_module_hash' collect2: error: ld returned 1 exit status ```
before the change, only support wasm app exit like: ```c void *thread_routine(void *arg) { printf("Enter thread\n"); return NULL; } ``` if call pthread_exit, it will crash: ```c void *thread_routine(void *arg) { printf("Enter thread\n"); pthread_exit(NULL); return NULL; } ``` This commit lets both upstairs work correctly, test pass on stm32f103 mcu.
- Don't allocate the implicit/unused frame when calling the LLVM JIT function - Don't set exec_env's thread handle and stack boundary in the recursive calling from host, since they have been set in the first time calling - Fix frame not freed in llvm_jit_call_func_bytecode
Don't set exec_env's thread handle and stack boundary in the recursive calling from host, since they have been initialized in the first time calling.
Add an API to set segue flags for wasm-c-api LLVM JIT mode: ```C wasm_config_t * wasm_config_set_segue_flags(wasm_config_t *config, uint32 segue_flags); ```
The forward-declare function reference in ref.func can be declared in table element segments, no matter whether the segment mode is passive, active or declarative. Reported in #2944.
Potential recursive lock occurs in: ``` pthread_create_wrapper (acquire exec_env->wait_lock) => wasm_cluster_create_thread => allocate_aux_stack => wasm_runtime_module_malloc_internal => wasm_call_function => wasm_exec_env_set_thread_info (acquire exec_env->wait_lock again) ``` Allocate aux stack before calling wasm_cluster_create_thread to resolve it. Reported in #2977.
Note: This commit includes copy-and-paste from LLVM and thus adds the LLVM copyright notice. cf. llvm/llvm-project@0a1aa6c cf. llvm/llvm-project@a1e9777 cf. llvm/llvm-project@56c72c7
Reported in #2989.
On macOS, by default, the first 4GB is occupied by the pagezero. While it can be controlled with link time options, as we are an library, we usually don't have a control on how to link an executable.
…2978) In some scenarios there may be lots of callings to AOT/JIT functions from the host embedder, which expects good performance for the calling process, while in the current implementation, runtime calls the wasm_runtime_invoke_native to prepare the array of registers and stacks for the invokeNative assemble code, and the latter then puts the elements in the array to physical registers and native stacks and calls the AOT/JIT function, there may be many data copying and handlings which impact the performance. This PR registers some quick AOT/JIT entries for some simple wasm signatures, and let runtime call the entry to directly invoke the AOT/JIT function instead of calling wasm_runtime_invoke_native, which speedups the calling process. We may extend the mechanism next to allow the developer to register his quick AOT/JIT entries to speedup the calling process of invoking the AOT/JIT functions for some specific signatures.
Allow to invoke the quick call entry wasm_runtime_quick_invoke_c_api_import to call the wasm-c-api import functions to speedup the calling process, which reduces the data copying. Use `wamrc --invoke-c-api-import` to generate the optimized AOT code, and set `jit_options->quick_invoke_c_api_import` true in wasm_engine_new when LLVM JIT is enabled.
When using the wasm-c-api and there's a trap, `wasm_func_call()` returns a `wasm_trap_t *` object. No matter which thread crashes, the trap contains the stack frames of the main thread. With this PR, when there's an exception, the stack frames of the thread where the exception occurs are stored into the thread cluster. `wasm_func_call()` can then return those stack frames.
`pthread_jit_write_protect_np` is only available on macOS, and `sys_icache_invalidate` is available on both iOS and macOS and has no restrictions on ARM architecture.
The content in custom name section is changed after loaded since the strings are adjusted with '\0' appended, the emitted AOT file then cannot be loaded. The PR disables changing the content for AOT compiler to resolve it. And disable emitting custom name section for `wamrc --enable-dump-call-stack`, instead, use `wamrc --emit-custom-sections=name` to emit it.
Compilation error was reported when `cmake -DWAMR_BUILD_LIBC_WASI=0` on linux-sgx platform: ``` core/shared/platform/linux-sgx/sgx_socket.c:8:10: fatal error: libc_errno.h: No such file or directory 8 | #include "libc_errno.h" | ^~~~~~~~~~~~~~ ``` After fixing, both `cmake -DWAMR_BUILD_LIBC_WASI=1` and `WAMR_BUILD_LIBC_WASI=0` work good.
Currently we are using "ant compiler", which is a bit historical. This commit changes it to use "WAMR AoT compiler" instead.
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.