-
Notifications
You must be signed in to change notification settings - Fork 733
Re-organize LLVM JIT mode implementation #1450
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
Re-organize LLVM JIT mode implementation #1450
Conversation
d672ec9 to
d3035ab
Compare
d10091e to
ea04105
Compare
| /* LLVM execution engine required by JIT */ | ||
| #if WASM_ENABLE_LAZY_JIT != 0 | ||
| LLVMOrcLLJITRef orc_lazyjit; | ||
| LLVMOrcLLJITRef orc_jit; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that we don't use the WAMR_BUILD_JIT macro to control the fields and the code in core/iwasm/compilation?
11a468d to
79273ef
Compare
It includes:
- Remove code with MCJIT APIs. Embrance ORC.
- WASM_ENABLE_LAZY_JIT only represent lazy compilation. It won't specify
ORC or MCJIT
- Remove runtime ORC compilation threads and move all aot functions
into one module
- Current LLVM ORC JIT implements eagel compilation. Will add lazy
compilation later
- JIT and AOT both apply the new pass manager
- All JIT passes are in IRTransferLayer
P.S.
| Varient impl. | Norm. Score | Norm. (ms) |
| ----------------------- | ----------- | ---------- |
| Original | 1.0 | 1.0 |
| Apply the new PM | 1.01 | 1.007 |
| Opt in IRTransformLayer | 0.997 | 1.04 |
79273ef to
772f6ee
Compare
| } | ||
| } | ||
| else { | ||
| #if WASM_ENABLE_LAZY_JIT == 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not remove the code of if branch, which is the operation of AOT compiler mode and eager JIT mode. Removing the code may impact the performance of AOT.
How about adding a flag:
bool is_lazy_jit = false;
#if WASM_ENABLE_LAZY_JIT != 0
if (comp_ctx->is_jit_mode) {
is_lazy_jit = true;
}
#endif
if (!is_lazy_jit) {
func = func_ctxes[func_idx - import_func_count]->func;
}
else {
code of original #else branch
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right.
Second thoughts, there will be only one module even in 'lazy compilation' and the code of original #else branch may not be necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not very sure, how about keeping the code currently and testing it when implementing ORCv2?
1. Register the `AAManager` and `buildDefaultAAPipeline` 2. Use function pointers in `aot_compile_op_call` and `aot_compile_op_indirect_call` instead of `lookup_orcjit_func` CoreMark Score: | Varient impl. | Norm. Score | Norm. (ms) | | ----------------------- | ----------- | ---------- | | Original | 1.0 | 1.0 | | Apply the new PM | 1.01 | 1.007 | | Opt in IRTransformLayer | 0.997 | 1.04 | | Tuning#1 | 1.01 | 0.83 |
|
I have uploaded a new improvement which includes:
If it is OK, I will remove |
It includes:
ORC or MCJIT
into one module
compilation later