Skip to content

Commit

Permalink
bench wasm engines appears to work now
Browse files Browse the repository at this point in the history
  • Loading branch information
jwasinger committed Oct 26, 2020
1 parent c3146fe commit 5790f00
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 625 deletions.
Binary file not shown.
Binary file removed wasm-engines/fluence_bencher/.settings.py.swp
Binary file not shown.
33 changes: 0 additions & 33 deletions wasm-engines/fluence_bencher/VMDescriptor.py

This file was deleted.

534 changes: 0 additions & 534 deletions wasm-engines/fluence_bencher/WasmVMBencher.py

This file was deleted.

Empty file.
51 changes: 0 additions & 51 deletions wasm-engines/fluence_bencher/settings.py

This file was deleted.

11 changes: 10 additions & 1 deletion wasm-engines/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ docker cp $(docker run -d -t ewasm/vanilla-wabt:1 sleep 3s):/vanilla-wabt/build/
docker cp $(docker run -d -t ewasm/wabt:1 sleep 3s):/wabt/build/wasm-interp $WASM_ENGINE_BIN_DIR/wabt
docker cp $(docker run -d -t ewasm/wagon:1 sleep 3s):/wagon/cmd/wasm-run/wasm-run $WASM_ENGINE_BIN_DIR/wagon

docker cp $(docker run -d -t ewasm/wamr:1 sleep 3s):/wasm-micro-runtime/product-mini/platforms/linux/build_interp/iwasm $WASM_ENGINE_BIN_DIR/wamr-interp
docker cp $(docker run -d -t ewasm/wamr:1 sleep 3s):/wasm-micro-runtime/product-mini/platforms/linux/build_interp/iwasm $WASM_ENGINE_BIN_DIR/iwasm
docker cp $(docker run -d -t ewasm/wamr:1 sleep 3s):/wasm-micro-runtime/wamr-compiler/build/wamrc $WASM_ENGINE_BIN_DIR/wamrc

docker cp $(docker run -d -t ewasm/wasm3:1 sleep 3s):/wasm3/build/wasm3 $WASM_ENGINE_BIN_DIR/wasm3
Expand All @@ -49,6 +49,13 @@ docker cp $(docker run -d -t ewasm/wavm:1 sleep 3s):/wavm-build/bin/wavm-compile
docker cp $(docker run -d -t ewasm/wavm:1 sleep 3s):/wavm-build/bin/wavm-run $WASM_ENGINE_BIN_DIR/wavm-run

docker run -v $RUST_BIN_DIR:/rust-bin -v $INPUT_VECTORS_DIR:/inputvectors -v $RESULTS_DIR:/results -v $(pwd)/rust-code:/rust-code -v $(pwd)/scripts:/scripts -it ewasm/bench-build-base:1 bash /scripts/fill_rust.sh

ln -s $(which node) $WASM_ENGINE_BIN_DIR/node

# copy scripts which invoke engines to wasm_bin_dir (fizzy and wamr-aot)
cp scripts/fizzy.sh $WASM_ENGINE_BIN_DIR/
cp scripts/wamr-aot.sh $WASM_ENGINE_BIN_DIR/

sudo chown -R 1000:1000 $RESULTS_DIR

echo "TODO minify rust wasm"
Expand All @@ -59,6 +66,8 @@ python3 scripts/bench_native.py --rustbindir=$RUST_BIN_DIR --csvresults=$RESULTS

# run wasm benchmarks

python3 scripts/bench_wasm.py --wasmenginedir $WASM_ENGINE_BIN_DIR --csvfile $RESULTS_DIR/wasm_engines.csv --wasmdir $WASM_FILE_DIR

echo "TODO run rust native benchmarks"

# do stuff with the output
1 change: 0 additions & 1 deletion wasm-engines/scripts/bench_native.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def main():
result_times = ",".join(list(map(lambda x: str(x), result_times)))
results.append({"test_name": os.path.basename(binary).strip("_native"), "elapsed_times": result_times})

import pdb; pdb.set_trace()
write_output_to_csv(results, os.path.join(args['csvresults'], "native_benchmarks.csv"))

if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
parser.add_argument('--wasmdir', help='full path of dir containing wasm files')
parser.add_argument('--csvfile', help='name of csv result file')
parser.add_argument('--engines', help='comma-separated list of engines to benchmark')
parser.add_argument('--wasmenginedir', help='directory containing executables for all wasm engines')

args = vars(parser.parse_args())

Expand Down Expand Up @@ -77,6 +78,7 @@ def main():
wasm_dir = args['wasmdir']
csv_file_path = args['csvfile']
engines_to_run = args['engines']
engine_bin_dir = args['wasmenginedir']
# "wagon,wabt,v8-liftoff,v8-turbofan,v8-interpreter,wasmtime,wavm,life-polymerase,life,wasmi,asmble"
vms_to_run = {}
if engines_to_run is not None:
Expand All @@ -87,13 +89,15 @@ def main():
vms_to_run = vm_descriptors

print("vms_to_run:", vms_to_run)
## TODO: print version of each engine

vm_bencher = WasmVMBencher()
test_descriptors = getTestDescriptors(wasm_dir)
test_results = vm_bencher.run_tests(test_descriptors, vms_to_run)
# TODO no hardcode script path here
test_results = vm_bencher.run_tests(test_descriptors, engine_bin_dir, vms_to_run)
print("test_results:")
print(test_results)

import pdb; pdb.set_trace()
save_test_results(csv_file_path, test_results)


Expand Down
4 changes: 3 additions & 1 deletion wasm-engines/scripts/fizzy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ set -e
# $1 = function name
# $2 = wasm file

CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

# Create input file
echo test > testcase.inputs # 1. Test name
echo $1 >> testcase.inputs # 2. Function name
Expand All @@ -17,6 +19,6 @@ echo $'\n' >> testcase.inputs # 7. Expected memory
# Copy wasm file
cp $2 ./testcase.wasm

/engines/fizzy/fizzy-bench --benchmark_filter=fizzy/* --benchmark_color=false ./ | sed 's/\([0-9][0-9]*\)\s\([nm]s\)/\1\2/g'
$CWD/fizzy-bench --benchmark_filter=fizzy/* --benchmark_color=false ./ | sed 's/\([0-9][0-9]*\)\s\([nm]s\)/\1\2/g'

rm -f testcase.inputs testcase.wasm
1 change: 1 addition & 0 deletions wasm-engines/scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
durationpy==0.5
Jinja2==2.11.2
MarkupSafe==1.1.1
numpy==1.19.2
Expand Down
6 changes: 4 additions & 2 deletions wasm-engines/scripts/wamr_aot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

set -e

/engines/wamr/wamrc -o wasm.aot $2
/engines/wamr/iwasm -f $1 wasm.aot
CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

$CWD/wamrc -o wasm.aot $2
$CWD/iwasm -f $1 wasm.aot

0 comments on commit 5790f00

Please sign in to comment.