Hello, I am looking into this project to learn what you have done in this work.
I tried to run scrypt benchmark in the repository, by running the following commands(see build.sh in the attachment).
cd benchmark/scrypt
cargo build --release
cargo run --release -- --ip=0.0.0.0 --heap=3145728 --stack=262144 --hcallsize=131072 --partition=false --serverless=true --vmcount=4096 --vmgroups=1 --interleave=1 --pinput=true --fastreply=true --lgroup=64 --nvidia=true --input=benchmarks/scrypt/target/wasm32-wasi/release/scrypt.wasm
The generated opencl code failed to compile, with some messasges like this(full log is in compilation_failed.txt):
<kernel>:157873:37: error: redefinition of '__func_func_getenv'
<kernel>:168648:37: error: redefinition of '__func_func__ZN3std5alloc8rust_oom17hb466c6b0b424784eE'
<kernel>:176935:37: error: redefinition of '__func_func__ZN3std3sys4wasi4once4Once4call17h43619e2953d53b25E'
<kernel>:179098:37: error: redefinition of '__func_func__ZN4core6option13expect_failed17h8f72e66e0b3163c7E'
<kernel>:181066:37: error: redefinition of '__func_func__ZN72_$LT$sha2sha256Sha256$u20$as$u20$digestfixedFixedOutputDirty$GT$19finalize_into_dirty17h563df1210a5950c5E'
<kernel>:181743:37: error: redefinition of '__func_func__ZN4sha26sha2569Engine2566update17hcb501717ee07d7caE'
<kernel>:234127:37: error: redefinition of '__func_func__ZN3std3sys4wasi4once4Once4call17hee18ac680eb799ccE'
<kernel>:238120:37: error: redefinition of '__func_func___main_void'
I think this is because some functions appear in more than one partitions, and the modification as follow(cfg_optimizer.rs in the attachment) seems to solve the problem.
diff --git a/src/opencl_writer/cfg_optimizer.rs b/src/opencl_writer/cfg_optimizer.rs
index 9a5e6a5..2bb119c 100644
--- a/src/opencl_writer/cfg_optimizer.rs
+++ b/src/opencl_writer/cfg_optimizer.rs
@@ -254,6 +254,9 @@ pub fn form_partitions(
current_partition.insert(String::from(f_name.clone()));
+ let func_copies = include_limit.get(&f_name).cloned().unwrap_or(0);
+ include_limit.insert(f_name.clone(), func_copies + 1);
+
let (loop_called_fns, called_fns) = get_called_funcs(
writer_ctx,
&indirect_call_mapping_formatted,
I'm not sure if this is what the function intend to perform(the function seems to support more than one function copies, how would the other components handle that?).
By the way, does the --partition parameter have something to do with this? I previously run similar commands without disabling partition seems to pass the compilation, but result in some memory access violation.
With the patch, the vm started. Then I execute
go run run_scrypt.go 127.0.0.1 8000 1 1 300 256
to start the test. But nothing happened. The log is in the attachment(run.txt).
The line Set entry point: ["func_strncmp"]
seems strange, I think it would be something like __start or main.
With other configurations, I received illegal memory access or unsupported hypercall errors.
The attachment include the scrypt.wasm generated by cargo.
Do you have some advice? Thank you.
Attach_20230925.tar.gz