forked from bytecodealliance/wasm-micro-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
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
[refactoring] extract reading leb numbers to a separate file, share t… #4
Open
loganek
wants to merge
50
commits into
main
Choose a base branch
from
loganek/dyn-link-loading
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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
And enable merged os_mmap for aot data and text sections except on platform nuttx and esp-idf. Fix issue that aarch64 AOT module fails to load on android: bytecodealliance#2274
…ween loader and mini loader (bytecodealliance#3701) There's probably a number of other places where the bh_leb_read could be used (e.g. aot loader) but I'm making the change as small as possible. Further refactoring can be done later.
…ealliance#3704) As reported in bytecodealliance#3500, when debug interpreter is enabled, the classic interpreter performs a lock operation to read `exec_env->current_status->signal_flag` and do further handling before fetching next opcode, which makes the interpreter run slower. This PR atomic loads the `exec_env->current_status->signal_flag` without mutex lock when 32-bit atomic load is supported, and only adding lock for further handling when the signal_flag is WAMR_SIG_SINGSTEP, which improves the performance.
Compilation warnings were reported on mac: ``` core/shared/mem-alloc/ems/ems_gc.c:454:22: warning: passing arguments to 'wasm_runtime_gc_prepare' without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype] gct_vm_gc_prepare(NULL); ^ core/shared/mem-alloc/ems/ems_gc.c:466:23: warning: passing arguments to 'wasm_runtime_gc_finalize' without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype] gct_vm_gc_finished(NULL); ^ 2 warnings generated. ```
And fix a typo in ATTRIBUTIONS.md.
…ance#3717) These symbols had been removed from NuttX in 2022, so it's time to remove references to them.
loganek
force-pushed
the
loganek/dyn-link-loading
branch
3 times, most recently
from
August 15, 2024 12:29
8f9a1ce
to
4dd97a3
Compare
Merge branch main into dev/dynamic_linking
loganek
force-pushed
the
loganek/dyn-link-loading
branch
3 times, most recently
from
August 15, 2024 15:48
d87d621
to
9bd2e16
Compare
…iance#3695) Any use of a table index that isn't exactly a null byte (`0x00`) means that the module makes use of the reference types proposal. This is important to track because `aot_compiler.c` will blindly assume that all table indices are a single byte long otherwise. This fixes a crash in WAMR for modules that contain multi-byte encodings of table indices in `call_indirect` but make no other use of reference types features.
…ytecodealliance#3721) If the value of a float constant is an NaN, the aot compiler creates an alloca, stores the converted i32 const into it and then loads f32 from it again, which may introduce a relocation in the AOT file and is not allowed for XIP mode.
loganek
force-pushed
the
loganek/dyn-link-loading
branch
from
August 16, 2024 12:24
9bd2e16
to
f111cec
Compare
…ecodealliance#3726) The table index in the call_indirect/return_call_indirect opcode should be one byte 0x00 when ref-types/GC isn't enabled, and should be treated as leb u32 when ref-types/GC is enabled. And make aot compiler bail out if ref-types/GC is disabled by command line argument while ref-types instructions are used.
…codealliance#3732) For JIT, we naturally use mach-o on macOS, where the section name we currently use is not valid and ends up with the errors like: ``` LLVM ERROR: Global variable '__orc_lcl.aot_stack_sizes.0' has an invalid section specifier '.aot_stack_sizes': mach-o section specifier requires a segment and section separated by a comma. ``` Because the dedicated section is not necessary for JIT, this commit simply stops using it. Fixes: bytecodealliance#3730
…iance#3734) When AOT isn't enabled and the input is a wasm file, wasm_runtime_load doesn't report error. Same when interpreter isn't enabled and the input is AOT file. This PR makes wasm_runtime_load report error "magic header not detected" for such situations.
…ealliance#3742) Implement multi-memory for classic-interpreter. Support core spec (and bulk memory) opcodes now, and will support atomic opcodes, and add multi-memory export APIs in the future. PS: Multi-memory spec test patched a lot for linking test to adapt for multi-module implementation.
…iance#3743) Enable merged os_mmap for aot data sections first, and try enabling merged os_mmap for them and aot text except on platform nuttx and esp-idf. This fixes the issue that aarch64 AOT module fails to load on android: bytecodealliance#2274 And also refine os_mmap related code.
Merge branch main into dev/dynamic_linking
Make wamrc normalize "arm64" to "aarch64v8". Previously the only way to make the "arm64" target was to not specify a target on 64 bit arm-based mac builds. Now arm64 and aarch64v8 are treated as the same. Make aot_loader accept "aarch64v8" on arm-based apple (as well as accepting legacy "arm64" based aot targets). This also removes __APPLE__ and __MACH__ from the block that defaults size_level to 1 since it doesn't seem to be supported for aarch64: `LLVM ERROR: Only small, tiny and large code models are allowed on AArch64`
…3756) Fix the compilation error of this CI: https://github.com/bytecodealliance/wasm-micro-runtime/actions/runs/10575515238 ``` /__w/wasm-micro-runtime/wasm-micro-runtime/bloaty/third_party/abseil-cpp/absl/debugging/failure_signal_handler.cc:139:32: error: no matching function for call to 'max(long int, int)' 139 | size_t stack_size = (std::max(SIGSTKSZ, 65536) + page_mask) & ~page_mask; | ~~~~~~~~^~~~~~~~~~~~~~~~~ ```
…rge_aot_data_text Merge branch dev/merge_aot_data_text into main to keep the commit history.
…ck is enabled (bytecodealliance#3754) In the AOT compiler, allow the user to control stack boundary check when the boundary check is enabled (e.g. `wamrc --bounds-checks=1`). Now the code logic is: 1. When `--stack-bounds-checks` is not set, it will be the same value as `--bounds-checks`. 2. When `--stack-bounds-checks` is set, it will be the option value no matter what the status of `--bounds-checks` is.
…64 or riscv64 (bytecodealliance#3755) Mac on aarch64 uses posix_memmap.c os_mmap which doesn't do anything with the flag MMAP_MAP_32BIT for that build so this condition ends up asserting unless the mapping ends up in the first 4 gigs worth of addressable space. Thsi PR changes to call os_mmap with MMAP_MAP_32BIT flag only when the target is x86-64 or riscv64, and the macro __APPLE__ isn't enabled. The behavior is similar to what the posix os_mmap does.
The specific commit has been deleted, I am pointing to the same commit in the main branch though.
- Only retry on EAGAIN, ENOMEM or EINTR. - On EINTR, don't count it against the retry budget, just keep retrying. EINTR can happen in bursts. - Log the errno on failure, and don't conditionalize that logging on BH_ENABLE_TRACE_MMAP. In other parts of the code, error logging is not conditional on that define, while turning on that tracing define makes things overly verbose.
…ce#3763) Those parameters can be used to reduce the size of the AOT code. There's going to be more changes related to AOT code size reduction, this is just the initial step. p.s. bytecodealliance#3758
…iance#3762) Fixes to enable building iwasm_shared and iwasm_static libraries on win32.
loganek
force-pushed
the
loganek/dyn-link-loading
branch
3 times, most recently
from
September 9, 2024 10:46
0bb5a01
to
8895f54
Compare
…ealliance#3709) Minimum support: - [x] accept (WasmEdge) customized model parameters. metadata. - [x] Target [wasmedge-ggml examples](https://github.com/second-state/WasmEdge-WASINN-examples/tree/master/wasmedge-ggml) - [x] basic - [x] chatml - [x] gemma - [x] llama - [x] qwen --- In the future, to support if required: - [ ] Target [wasmedge-ggml examples](https://github.com/second-state/WasmEdge-WASINN-examples/tree/master/wasmedge-ggml) - [ ] command-r. (>70G memory requirement) - [ ] embedding. (embedding mode) - [ ] grammar. (use the grammar option to constrain the model to generate the JSON output) - [ ] llama-stream. (new APIS `compute_single`, `get_output_single`, `fini_single`) - [ ] llava. (image representation) - [ ] llava-base64-stream. (image representation) - [ ] multimodel. (image representation) - [ ] Target [llamaedge](https://github.com/LlamaEdge/LlamaEdge)
- Implement TINY / STANDARD frame modes - tiny mode is only able to keep track on the IP and func idx, STANDARD mode provides more capabilities (parameters, stack pointer etc.). - Implement FRAME_PER_FUNCTION / FRAME_PER_CALL modes - frame per function adds code at the beginning and at the end of each function for allocating / deallocating stack frame, whereas in per-call mode the frame is allocated before each call. The exception is call to the imported function, where frame-per-function mode also allocates the stack before the `call` instruction (as it can't instrument the imported function). At the moment TINY + FRAME_PER_FUNCTION is automatically enabled in case GC and perf profiling are disabled and `values` call stack feature is not requested. In all the other cases STANDARD + FRAME_PER_CALL is used. STANDARD + FRAME_PER_FUNCTION and TINY + FRAME_PER_CALL are currently not implemented but possible, and might be enabled in the future. ps. bytecodealliance#3758
…nce#3777) It seems failing too frequently. cf. bytecodealliance#3776
Merge branch main into dev/dynamic_linking
loganek
force-pushed
the
loganek/dyn-link-loading
branch
from
September 10, 2024 08:26
8895f54
to
39175be
Compare
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.
…he code between loader and mini loader
There's probably a number of other places where the bh_leb_read could be used (e.g. aot loader)
but I'm making the change as small as possible. Further refactoring can be done
later.