Skip to content

Commit d672ec9

Browse files
committed
Re-organize LLVM JIT mode implementation
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
1 parent 8283f9d commit d672ec9

17 files changed

+228
-712
lines changed

.github/workflows/compilation_on_android_ubuntu.yml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ env:
3434
AOT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
3535
CLASSIC_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
3636
FAST_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
37-
LAZY_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1"
38-
MC_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0"
37+
LAZY_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1"
3938
# LLVM
4039
LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex"
4140
# For Spec Test
@@ -185,7 +184,6 @@ jobs:
185184
$CLASSIC_INTERP_BUILD_OPTIONS,
186185
$FAST_INTERP_BUILD_OPTIONS,
187186
$LAZY_JIT_BUILD_OPTIONS,
188-
$MC_JIT_BUILD_OPTIONS,
189187
]
190188
make_options_feature: [
191189
# Features
@@ -214,8 +212,6 @@ jobs:
214212
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
215213
- make_options_run_mode: $AOT_BUILD_OPTIONS
216214
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
217-
- make_options_run_mode: $MC_JIT_BUILD_OPTIONS
218-
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
219215
# SIMD only on JIT/AOT mode
220216
- make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
221217
make_options_feature: "-DWAMR_BUILD_SIMD=1"
@@ -226,8 +222,6 @@ jobs:
226222
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
227223
- make_options_run_mode: $LAZY_JIT_BUILD_OPTIONS
228224
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
229-
- make_options_run_mode: $MC_JIT_BUILD_OPTIONS
230-
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
231225
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
232226
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
233227
# DEBUG_AOT only on JIT/AOT mode
@@ -238,15 +232,11 @@ jobs:
238232
# TODO: DEBUG_AOT on JIT
239233
- make_options_run_mode: $LAZY_JIT_BUILD_OPTIONS
240234
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
241-
- make_options_run_mode: $MC_JIT_BUILD_OPTIONS
242-
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
243235
# MINI_LOADER only on INTERP mode
244236
- make_options_run_mode: $AOT_BUILD_OPTIONS
245237
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
246238
- make_options_run_mode: $LAZY_JIT_BUILD_OPTIONS
247239
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
248-
- make_options_run_mode: $MC_JIT_BUILD_OPTIONS
249-
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
250240
include:
251241
- os: ubuntu-20.04
252242
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }}
@@ -296,7 +286,6 @@ jobs:
296286
$CLASSIC_INTERP_BUILD_OPTIONS,
297287
$FAST_INTERP_BUILD_OPTIONS,
298288
$LAZY_JIT_BUILD_OPTIONS,
299-
$MC_JIT_BUILD_OPTIONS,
300289
$AOT_BUILD_OPTIONS,
301290
]
302291
os: [ubuntu-20.04, ubuntu-22.04]

.github/workflows/compilation_on_macos.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ env:
3434
CLASSIC_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
3535
FAST_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
3636
LAZY_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1"
37-
MC_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0"
3837
LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex"
3938

4039
jobs:
@@ -161,7 +160,6 @@ jobs:
161160
$CLASSIC_INTERP_BUILD_OPTIONS,
162161
$FAST_INTERP_BUILD_OPTIONS,
163162
$LAZY_JIT_BUILD_OPTIONS,
164-
$MC_JIT_BUILD_OPTIONS,
165163
]
166164
make_options_feature: [
167165
# Features
@@ -191,8 +189,6 @@ jobs:
191189
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
192190
- make_options_run_mode: $AOT_BUILD_OPTIONS
193191
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
194-
- make_options_run_mode: $MC_JIT_BUILD_OPTIONS
195-
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
196192
# SIMD only on JIT/AOT mode
197193
- make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
198194
make_options_feature: "-DWAMR_BUILD_SIMD=1"
@@ -203,8 +199,6 @@ jobs:
203199
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
204200
- make_options_run_mode: $LAZY_JIT_BUILD_OPTIONS
205201
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
206-
- make_options_run_mode: $MC_JIT_BUILD_OPTIONS
207-
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
208202
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
209203
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
210204
# DEBUG_AOT only on JIT/AOT mode
@@ -215,15 +209,11 @@ jobs:
215209
# TODO: DEBUG_AOT on JIT
216210
- make_options_run_mode: $LAZY_JIT_BUILD_OPTIONS
217211
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
218-
- make_options_run_mode: $MC_JIT_BUILD_OPTIONS
219-
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
220212
# MINI_LOADER only on INTERP mode
221213
- make_options_run_mode: $AOT_BUILD_OPTIONS
222214
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
223215
- make_options_run_mode: $LAZY_JIT_BUILD_OPTIONS
224216
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
225-
- make_options_run_mode: $MC_JIT_BUILD_OPTIONS
226-
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
227217
include:
228218
- os: macos-latest
229219
light: ${{ needs.check_repo.outputs.traffic_light }}
@@ -272,7 +262,6 @@ jobs:
272262
$FAST_INTERP_BUILD_OPTIONS,
273263
# doesn't support
274264
#$LAZY_JIT_BUILD_OPTIONS,
275-
#$MC_JIT_BUILD_OPTIONS,
276265
#$AOT_BUILD_OPTIONS,
277266
]
278267
os: [macos-latest]

.github/workflows/compilation_on_sgx.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ env:
3434
CLASSIC_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
3535
FAST_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
3636
LAZY_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1"
37-
MC_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0"
3837
LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex"
3938

4039
jobs:
@@ -120,7 +119,6 @@ jobs:
120119
$FAST_INTERP_BUILD_OPTIONS,
121120
# doesn't support
122121
# $LAZY_JIT_BUILD_OPTIONS,
123-
# $MC_JIT_BUILD_OPTIONS,
124122
]
125123
make_options_feature: [
126124
# Features
@@ -251,7 +249,6 @@ jobs:
251249
$FAST_INTERP_BUILD_OPTIONS,
252250
# doesn't support
253251
#$LAZY_JIT_BUILD_OPTIONS,
254-
#$MC_JIT_BUILD_OPTIONS,
255252
#$AOT_BUILD_OPTIONS,
256253
]
257254
os: [ubuntu-20.04]

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,6 @@ tests/wamr-test-suites/workspace
2727

2828
samples/socket-api/wasm-src/inc/pthread.h
2929

30-
**/__pycache__
30+
**/__pycache__
31+
32+
tests/benchmarks/coremark/coremark*

build-scripts/config_common.cmake

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,11 @@ endif ()
8686

8787
if (WAMR_BUILD_JIT EQUAL 1)
8888
if (WAMR_BUILD_AOT EQUAL 1)
89-
add_definitions("-DWASM_ENABLE_JIT=1")
90-
if (NOT WAMR_BUILD_LAZY_JIT EQUAL 0)
89+
if (NOT DEFINED WAMR_BUILD_LAZY_JIT)
9190
# Enable Lazy JIT by default
9291
set (WAMR_BUILD_LAZY_JIT 1)
93-
add_definitions("-DWASM_ENABLE_LAZY_JIT=1")
9492
endif ()
93+
9594
if (NOT DEFINED LLVM_DIR)
9695
set (LLVM_SRC_ROOT "${WAMR_ROOT_DIR}/core/deps/llvm")
9796
set (LLVM_BUILD_ROOT "${LLVM_SRC_ROOT}/build")
@@ -108,6 +107,10 @@ if (WAMR_BUILD_JIT EQUAL 1)
108107
add_definitions(${LLVM_DEFINITIONS})
109108
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
110109
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
110+
111+
if (${LLVM_PACKAGE_VERSION} VERSION_LESS 12.0.0 )
112+
message(FATAL_ERROR "The minimum required version should be 12.0.0")
113+
endif ()
111114
else ()
112115
set (WAMR_BUILD_JIT 0)
113116
message ("-- WAMR JIT disabled due to WAMR AOT is disabled")
@@ -151,15 +154,25 @@ else ()
151154
message (" WAMR AOT disabled")
152155
endif ()
153156
if (WAMR_BUILD_JIT EQUAL 1)
157+
message (" WAMR LLVM JIT enabled with ORC")
158+
add_definitions("-DWASM_ENABLE_JIT=1")
154159
if (WAMR_BUILD_LAZY_JIT EQUAL 1)
155-
message (" WAMR LLVM Orc Lazy JIT enabled")
160+
message (" WAMR LLVM JIT with Lazy Compilation")
161+
add_definitions("-DWASM_ENABLE_LAZY_JIT=1")
156162
else ()
157-
message (" WAMR LLVM MC JIT enabled")
163+
message (" WAMR LLVM JIT with Eagle Compilation")
164+
add_definitions("-DWASM_ENABLE_LAZY_JIT=0")
158165
endif ()
159-
elseif (WAMR_BUILD_FAST_JIT EQUAL 1)
166+
else ()
167+
message (" WAMR LLVM JIT disabled")
168+
add_definitions("-DWASM_ENABLE_JIT=0")
169+
endif ()
170+
if (WAMR_BUILD_FAST_JIT EQUAL 1)
160171
message (" WAMR Fast JIT enabled")
172+
add_definitions("-DWASM_ENABLE_FAST_JIT=1")
161173
else ()
162-
message (" WAMR JIT disabled")
174+
message (" WAMR Fast JIT disabled")
175+
add_definitions("-DWASM_ENABLE_FAST_JIT=0")
163176
endif ()
164177
if (WAMR_BUILD_LIBC_BUILTIN EQUAL 1)
165178
message (" Libc builtin enabled")

core/config.h

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@
8181
#define WASM_ENABLE_LAZY_JIT 0
8282
#endif
8383

84-
#ifndef WASM_LAZY_JIT_COMPILE_THREAD_NUM
85-
#define WASM_LAZY_JIT_COMPILE_THREAD_NUM 4
84+
#ifndef WASM_ORC_JIT_COMPILE_THREAD_NUM
85+
#define WASM_ORC_JIT_COMPILE_THREAD_NUM 4
8686
#endif
8787

8888
#if (WASM_ENABLE_AOT == 0) && (WASM_ENABLE_JIT != 0)
89-
/* LazyJIT or MCJIT can only be enabled when AOT is enabled */
89+
/* LLVM JIT can only be enabled when AOT is enabled */
9090
#undef WASM_ENABLE_JIT
9191
#define WASM_ENABLE_JIT 0
9292

@@ -110,14 +110,6 @@
110110
#define WASM_ENABLE_WAMR_COMPILER 0
111111
#endif
112112

113-
#if WASM_ENABLE_WAMR_COMPILER != 0
114-
#ifndef WASM_ENABLE_LLVM_LEGACY_PM
115-
/* Whether to use LLVM legacy pass manager when building wamrc,
116-
by default it is disabled and LLVM new pass manager is used */
117-
#define WASM_ENABLE_LLVM_LEGACY_PM 0
118-
#endif
119-
#endif
120-
121113
#ifndef WASM_ENABLE_LIBC_BUILTIN
122114
#define WASM_ENABLE_LIBC_BUILTIN 0
123115
#endif

0 commit comments

Comments
 (0)