-
Notifications
You must be signed in to change notification settings - Fork 71
WAMR upgrade #734
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
WAMR upgrade #734
Changes from all commits
e32b5a3
0aafc27
bdc8be8
6a0c681
2f78cca
621b69c
fc5dbd9
52e6359
39e3aad
aa635c7
8e8ef52
43afe74
984a128
b59dde1
f2e5214
547982d
e16c25b
7ebdf88
7c831f1
19d5930
5125114
5c36f74
3bf0fc6
dbdddb3
eabc039
8d34fca
73217d6
df956ed
5a170c9
55283cf
681af88
5a2b525
858450a
af147eb
94661aa
dc75e2b
c203496
83aa7c4
5a11817
974c53b
92ad6d8
fa74c2a
b2a3c3f
e9660e4
287e740
9e3725b
be3d081
692ba7e
0bb6b1a
6691075
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.9.5 | ||
0.9.6 |
+2 −2 | .env | |
+1 −1 | .github/workflows/tests.yml | |
+1 −1 | VERSION | |
+2 −1 | faasmtools/build.py | |
+1 −0 | libfaasm/CMakeLists.txt | |
+2 −0 | libfaasm/faasm/core.h | |
+17 −0 | libfaasm/faasm/memory.h | |
+1 −1 | third-party/wasi-libc |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#pragma once | ||
|
||
namespace wasm { | ||
void doMigrationPoint(int32_t entrypointFuncWasmOffset, | ||
const std::string& entrypointFuncArg); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,26 +60,30 @@ bool EnclaveWasmModule::loadWasm(void* wasmOpCodePtr, uint32_t wasmOpCodeSize) | |
|
||
bool EnclaveWasmModule::callFunction(uint32_t argcIn, char** argvIn) | ||
{ | ||
prepareArgcArgv(argcIn, argvIn); | ||
|
||
WASMExecEnv* execEnv = wasm_runtime_get_exec_env_singleton(moduleInstance); | ||
if (execEnv == nullptr) { | ||
ocallLogError("Failed to create WAMR exec env"); | ||
throw std::runtime_error("Failed to create WAMR exec env"); | ||
} | ||
|
||
WASMFunctionInstanceCommon* func = | ||
wasm_runtime_lookup_function(moduleInstance, WASM_ENTRY_FUNC, nullptr); | ||
|
||
prepareArgcArgv(argcIn, argvIn); | ||
if (func == nullptr) { | ||
ocallLogError("Did not find named WASM function"); | ||
throw std::runtime_error("Did not find named wasm function"); | ||
} | ||
|
||
// Set dummy argv to capture return value | ||
std::vector<uint32_t> argv = { 0 }; | ||
|
||
bool success = | ||
aot_create_exec_env_and_call_function((AOTModuleInstance*)moduleInstance, | ||
(AOTFunctionInstance*)func, | ||
0x0, | ||
argv.data()); | ||
bool success = wasm_runtime_call_wasm(execEnv, func, 0, argv.data()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The only reason I change this here is because |
||
uint32_t returnValue = argv[0]; | ||
|
||
if (success) { | ||
ocallLogDebug("Success calling WASM function"); | ||
} else { | ||
std::string errorMessage( | ||
((AOTModuleInstance*)moduleInstance)->cur_exception); | ||
// TODO - better logging | ||
std::string errorMessage(wasm_runtime_get_exception(moduleInstance)); | ||
std::string errorText = | ||
"Caught WASM runtime exception: " + errorMessage; | ||
ocallLogError(errorText.c_str()); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,13 +17,9 @@ int doRunner(int argc, char* argv[]) | |
|
||
if (vm.count("input-data")) { | ||
msg.set_inputdata(vm["input-data"].as<std::string>()); | ||
SPDLOG_INFO("Adding input data: {}", | ||
vm["input-data"].as<std::string>()); | ||
} | ||
if (vm.count("cmdline")) { | ||
msg.set_cmdline(vm["cmdline"].as<std::string>()); | ||
SPDLOG_INFO("Adding command line arguments: {}", | ||
vm["cmdline"].as<std::string>()); | ||
} | ||
|
||
faabric::scheduler::Scheduler& sch = faabric::scheduler::getScheduler(); | ||
|
@@ -32,7 +28,7 @@ int doRunner(int argc, char* argv[]) | |
usleep(1000 * 500); | ||
|
||
for (const auto& m : req->messages()) { | ||
faabric::Message result = sch.getFunctionResult(m.id(), 20000); | ||
faabric::Message result = sch.getFunctionResult(m.id(), 20000 * 100); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the local pool runner it makes sense to have longer timeouts, as we may want to run some longer running functions for debug purposes. As a reminder, the local pool runner is a WASM_VM=wamr inv run.pool lammps main --cmdline '-in faasm://lammps-data/in.controller.wall' |
||
if (result.returnvalue() != 0) { | ||
SPDLOG_ERROR("Message ({}) returned error code: {}", | ||
m.id(), | ||
|
@@ -53,6 +49,13 @@ int main(int argc, char* argv[]) | |
sch.shutdown(); | ||
sch.addHostToGlobalSet(); | ||
|
||
// Set timeout to ensure longer functions can finish | ||
faabric::util::SystemConfig& conf = faabric::util::getSystemConfig(); | ||
conf::FaasmConfig& faasmConf = conf::getFaasmConfig(); | ||
conf.boundTimeout = 120000 * 100; | ||
conf.globalMessageTimeout = 120000 * 100; | ||
faasmConf.chainedCallTimeout = 120000 * 100; | ||
|
||
// WARNING: All 0MQ-related operations must take place in a self-contined | ||
// scope to ensure all sockets are destructed before closing the context. | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ set(WAMR_BUILD_SPEC_TEST 0) | |
add_definitions(-DWAMR_FAASM=1) | ||
|
||
# Set AOT mode and JIT for code generation | ||
set(WAMR_BUILD_INTERPRETER 1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was set by default implicitly through setting |
||
set(WAMR_BUILD_AOT 1) | ||
set(WAMR_BUILD_JIT 1) | ||
set(WAMR_BUILD_LAZY_JIT 0) | ||
|
@@ -74,12 +75,11 @@ llvm_map_components_to_libnames( | |
# Link everything together | ||
faasm_private_lib(wamrmodule | ||
WAMRWasmModule.cpp | ||
chaining.cpp | ||
codegen.cpp | ||
dynlink.cpp | ||
env.cpp | ||
faasm.cpp | ||
filesystem.cpp | ||
funcs.cpp | ||
memory.cpp | ||
mpi.cpp | ||
native.cpp | ||
|
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.
This essentially calls the
malloc
symbol inwasi-libc
. Hence why we need to export it here.