Skip to content

Commit

Permalink
update bench and test scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
zapashcanon committed Oct 24, 2024
1 parent c9dfdf3 commit 8bf478f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
18 changes: 10 additions & 8 deletions wasm/test/bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ bench() {
../../ocamlopt $UNSAFE -O3 ./${2}.ml > /dev/null
# optimize wasocaml code
cat a.out.wat | grep -v "^ (export" > a.out.noexport.wat
WASMOPT="wasm-opt --enable-gc --enable-reference-types --enable-multivalue --enable-tail-call --enable-nontrapping-float-to-int --traps-never-happen -O3 --abstract-type-refining --cfp --coalesce-locals --closed-world --type-ssa --gufa-optimizing --type-merging --strip-debug --strip-dwarf --strip-producers --strip-target-features --type-refining --unsubtyping --vacuum --tuple-optimization --ssa --simplify-locals --simplify-globals-optimizing --signature-refining --signature-pruning --roundtrip --reorder-locals --reorder-globals --reorder-functions --remove-unused-types --remove-unused-names --remove-unused-module-elements --remove-unused-brs --remove-memory --precompute --optimize-instructions --optimize-casts --once-reduction --monomorphize --minimize-rec-groups --merge-similar-functions --merge-locals --merge-blocks --local-subtyping --local-cse --licm --intrinsic-lowering --inlining-optimizing --heap-store-optimization --gto --gsi --global-refining --duplicate-import-elimination --duplicate-function-elimination --directize --dce --dae-optimizing"
WASMOPT="wasm-opt --enable-gc --enable-reference-types --enable-multivalue --enable-tail-call --enable-nontrapping-float-to-int --traps-never-happen -O3 --abstract-type-refining --cfp --coalesce-locals --closed-world --type-ssa --gufa-optimizing --type-merging --strip-debug --strip-dwarf --strip-producers --strip-target-features --type-refining --unsubtyping --vacuum --tuple-optimization --ssa --simplify-locals --simplify-globals-optimizing --signature-refining --signature-pruning --roundtrip --reorder-locals --reorder-globals --reorder-functions --remove-unused-types --remove-unused-names --remove-unused-module-elements --remove-unused-brs --remove-memory --precompute --optimize-instructions --optimize-casts --once-reduction --monomorphize --minimize-rec-groups --merge-similar-functions --merge-locals --merge-blocks --local-subtyping --local-cse --licm --intrinsic-lowering --inlining-optimizing --heap-store-optimization --gto --gsi --global-refining --duplicate-import-elimination --duplicate-function-elimination --directize --dce --dae-optimizing -O3 -O3 --gufa -O3 -O3 --gufa -O3 -O3 --converge --abstract-type-refining --cfp --coalesce-locals --closed-world --type-ssa --gufa-optimizing --type-merging --strip-debug --strip-dwarf --strip-producers --strip-target-features --type-refining --unsubtyping --vacuum --tuple-optimization --ssa --simplify-locals --simplify-globals-optimizing --signature-refining --signature-pruning --roundtrip --reorder-locals --reorder-globals --reorder-functions --remove-unused-types --remove-unused-names --remove-unused-module-elements --remove-unused-brs --remove-memory --precompute --optimize-instructions --optimize-casts --once-reduction --monomorphize --minimize-rec-groups --merge-similar-functions --merge-locals --merge-blocks --local-subtyping --local-cse --licm --intrinsic-lowering --inlining-optimizing --heap-store-optimization --gto --gsi --global-refining --duplicate-import-elimination --duplicate-function-elimination --directize --dce --dae-optimizing -O3 -O3 --gufa -O3 -O3 -O3 -O3 -O3 -O3 -O3"
# TODO: try --flatten ; --rereloop ; --precompute-propagate ; --dfo
$WASMOPT -o a.out.wasm a.out.noexport.wat
# compile bytecode
Expand All @@ -42,25 +42,27 @@ bench() {
}


#bench "Almabench" "almabench" # global init must have correct type
#bench "Boyer" "boyer" # unreachable
#bench "Boyer no exceptions" "boyer_no_exc" # unreachable
#bench "Fast Fourier Transform" "fft" # unreachable
#bench "Boyer" "boyer" # unreachable: caml_compare_blocks
#bench "Boyer no exceptions" "boyer_no_exc" # unreachable: caml_compare_blocks
#bench "Hamming" "hamming" # missing value let-rec
#bench "Ray-Trace" "raytrace" # global init must have correct type
#bench "Splay Tree" "splay" # wrong result

#bench "Splay Tree" "splay" # string_of_float is not supported

bench "Binary Decision Diagram" "bdd"
bench "Binary Trees" "binary_trees" # seems wrong if we uncomment the check print in loop_depths ?
bench "Fibonacci" "fib"
bench "Knuth-Bendix" "kb"
bench "Knuth-Bendix (no exception)" "kb_no_exc"
bench "Loop" "loop"
#bench "Nucleic" "nucleic" # wsoo crash on this one..
bench "Nucleic" "nucleic"
bench "Pfannkuchen" "fannkuch"
bench "Pfannkuchen 2" "fannkuch2"
bench "Quicksort" "quicksort"
bench "Soli" "soli"
bench "Takc" "takc"
bench "Taku" "taku"

# bench "Almabench" "almabench" # requires --disable-flat-float-array, otherwise: global init must have correct type
# bench "Fast Fourier Transform" "fft" # requires --disable-flat-float-array illegal cast on float array, see comment in file

# bench "Pascal" "pascal" # not part of the wsoo bench suite
14 changes: 8 additions & 6 deletions wasm/test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ bench_wasocaml_opt() {
echo -n " Wasocaml + wasm-opt (node): "
../../ocamlopt $UNSAFE -O3 ./${2}.ml > /dev/null
cat a.out.wat | grep -v "^ (export" > a.out.noexport.wat
WASMOPT="wasm-opt --enable-gc --enable-reference-types --enable-multivalue --enable-tail-call --enable-nontrapping-float-to-int --traps-never-happen -O3 --abstract-type-refining --cfp --coalesce-locals --closed-world --type-ssa --gufa-optimizing --type-merging --strip-debug --strip-dwarf --strip-producers --strip-target-features --type-refining --unsubtyping --vacuum --tuple-optimization --ssa --simplify-locals --simplify-globals-optimizing --signature-refining --signature-pruning --roundtrip --reorder-locals --reorder-globals --reorder-functions --remove-unused-types --remove-unused-names --remove-unused-module-elements --remove-unused-brs --remove-memory --precompute --optimize-instructions --optimize-casts --once-reduction --monomorphize --minimize-rec-groups --merge-similar-functions --merge-locals --merge-blocks --local-subtyping --local-cse --licm --intrinsic-lowering --inlining-optimizing --heap-store-optimization --gto --gsi --global-refining --duplicate-import-elimination --duplicate-function-elimination --directize --dce --dae-optimizing"
WASMOPT="wasm-opt --enable-gc --enable-reference-types --enable-multivalue --enable-tail-call --enable-nontrapping-float-to-int --traps-never-happen -O3 --abstract-type-refining --cfp --coalesce-locals --closed-world --type-ssa --gufa-optimizing --type-merging --strip-debug --strip-dwarf --strip-producers --strip-target-features --type-refining --unsubtyping --vacuum --tuple-optimization --ssa --simplify-locals --simplify-globals-optimizing --signature-refining --signature-pruning --roundtrip --reorder-locals --reorder-globals --reorder-functions --remove-unused-types --remove-unused-names --remove-unused-module-elements --remove-unused-brs --remove-memory --precompute --optimize-instructions --optimize-casts --once-reduction --monomorphize --minimize-rec-groups --merge-similar-functions --merge-locals --merge-blocks --local-subtyping --local-cse --licm --intrinsic-lowering --inlining-optimizing --heap-store-optimization --gto --gsi --global-refining --duplicate-import-elimination --duplicate-function-elimination --directize --dce --dae-optimizing -O3 -O3 --gufa -O3 -O3 --gufa -O3 -O3 --converge --abstract-type-refining --cfp --coalesce-locals --closed-world --type-ssa --gufa-optimizing --type-merging --strip-debug --strip-dwarf --strip-producers --strip-target-features --type-refining --unsubtyping --vacuum --tuple-optimization --ssa --simplify-locals --simplify-globals-optimizing --signature-refining --signature-pruning --roundtrip --reorder-locals --reorder-globals --reorder-functions --remove-unused-types --remove-unused-names --remove-unused-module-elements --remove-unused-brs --remove-memory --precompute --optimize-instructions --optimize-casts --once-reduction --monomorphize --minimize-rec-groups --merge-similar-functions --merge-locals --merge-blocks --local-subtyping --local-cse --licm --intrinsic-lowering --inlining-optimizing --heap-store-optimization --gto --gsi --global-refining --duplicate-import-elimination --duplicate-function-elimination --directize --dce --dae-optimizing -O3 -O3 --gufa -O3 -O3 -O3 -O3 -O3 -O3 -O3"
# TODO: try --flatten ; --rereloop ; --precompute-propagate ; --dfo
$WASMOPT -o a.out.wasm a.out.noexport.wat
$WASMOPT -S -o a.out.wat a.out.wasm
$WASMOPT --print-stack-ir -o a.out.bis.wat a.out.wasm > a.out.wat
time $NODE ./main_node.mjs > output_${2}_wasocaml_opt.txt
diff output_${2}_ocaml_native.txt output_${2}_wasocaml_opt.txt
}
Expand Down Expand Up @@ -77,11 +77,8 @@ bench() {
echo ""
}

#bench "Pascal" "pascal"
#bench "Almabench" "almabench" # global init must have correct type
#bench "Boyer" "boyer" # unreachable: caml_compare_blocks
#bench "Boyer no exceptions" "boyer_no_exc" # unreachable: caml_compare_blocks
#bench "Fast Fourier Transform" "fft" # illegal cast on float array, see comment in file
#bench "Hamming" "hamming" # missing value let-rec
#bench "Ray-Trace" "raytrace" # global init must have correct type
#bench "Splay Tree" "splay" # string_of_float is not supported
Expand All @@ -92,10 +89,15 @@ bench "Fibonacci" "fib"
bench "Knuth-Bendix" "kb"
bench "Knuth-Bendix (no exception)" "kb_no_exc"
bench "Loop" "loop"
#bench "Nucleic" "nucleic" # wsoo crash on this one..
bench "Nucleic" "nucleic"
bench "Pfannkuchen" "fannkuch"
bench "Pfannkuchen 2" "fannkuch2"
bench "Quicksort" "quicksort"
bench "Soli" "soli"
bench "Takc" "takc"
bench "Taku" "taku"

# bench "Almabench" "almabench" # requires --disable-flat-float-array, otherwise: global init must have correct type
# bench "Fast Fourier Transform" "fft" # requires --disable-flat-float-array illegal cast on float array, see comment in file

# bench "Pascal" "pascal" # not part of the wsoo bench suite

0 comments on commit 8bf478f

Please sign in to comment.