diff --git a/CMakeLists.txt b/CMakeLists.txt index 88668aa..219845e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -244,14 +244,16 @@ target_include_directories(252.eon PRIVATE target_compile_options(252.eon PRIVATE -DSPEC_CPU2000_LP64 -DUSE_STRERROR -Wno-register) +target_link_options(252.eon PRIVATE + --rtlib=compiler-rt) + target_link_libraries(252.eon PRIVATE - c++ m) -if (ANDROID_WASM) - target_link_libraries(252.eon PRIVATE - clang_rt.builtins) -endif() +#if (ANDROID_WASM) +# target_link_libraries(252.eon PRIVATE +# clang_rt.builtins) +#endif() add_executable(255.vortex ${SPEC_255_VORTEX_PATH}/bitvec.c diff --git a/all-progs b/all-progs new file mode 100644 index 0000000..623ea2b --- /dev/null +++ b/all-progs @@ -0,0 +1,7 @@ +gzip c +vpr c +mcf c +parser c +eon c++ +vortex c +bzip2 c diff --git a/push-all b/push-all new file mode 100755 index 0000000..5d0d3a5 --- /dev/null +++ b/push-all @@ -0,0 +1,53 @@ +#!/bin/sh + +need_libcxx=false +dst=/data/local/tmp + +adb shell rm -rf $dst/run +adb push run $dst >/dev/null + +progs= +need_libcxx=false +while read p lang; do + progs="${progs} ${p}" + if [ $lang = c++ ]; then + need_libcxx=true + fi +done /dev/null + np=build_native/*.$p + if [ -r $np ]; then + echo -n native... + adb push $np $dst/$p-native >/dev/null + fi + pg=$p.pfg + if [ -r build_wasm/$pg ]; then + echo -n profgen... + adb push build_wasm/$pg $dst/$pg >/dev/null + fi + pgo=$p.pgo + if [ -r build_wasm/$pgo ]; then + echo -n pgo... + adb push build_wasm/$pgo $dst/$pgo >/dev/null + fi + echo -n data... + adb shell rm -rf $dst/$p.data + adb push benchspec/CINT2000/*.$p/data $dst/$p.data >/dev/null + echo done. + else + echo skipped. + fi +done + +if [ $need_libcxx = true ]; then + echo libc++... + adb push \ + $ANDROID_CLANG_TOOLCHAIN/android_libc++/ndk/aarch64/lib/libc++_shared.so \ + $dst/libc++_shared.so >/dev/null + echo done. +fi diff --git a/run/run.bzip2 b/run/run.bzip2 new file mode 100755 index 0000000..f4c340a --- /dev/null +++ b/run/run.bzip2 @@ -0,0 +1,58 @@ +#!/bin/sh + +p=bzip2 +verify=no +iter=2 +t=test + +while [ $# -gt 0 ]; do + case $1 in + --native) + p=${p}-native + ;; + --verify) + verify=yes + ;; + --profgen) + p=${p}.pfg + ;; + --pgo) + p=${p}.pgo + ;; + test) + t=test + iter=2 + ;; + train) + t=train + iter=8 + ;; + ref) + t=ref + iter=58 + ;; + *) + echo Unknown argument $1. + exit 1 + ;; + esac + shift +done + +rm -f *.out + +echo Running $p on corpus $t with $iter iterations... +for f in bzip2.data/$t/input/input.*; do + bf=`basename $f` + printf '%-20s: ' $bf + time ./$p $f $iter >$bf.out 2>stderr.$bf.out +done + +if [ $verify = yes ]; then + echo VERIFY + for o in input.*.out; do + cmp $o bzip2.data/$t/output/$o + done +fi + +echo OK diff --git a/run/run.gzip b/run/run.gzip new file mode 100755 index 0000000..4142442 --- /dev/null +++ b/run/run.gzip @@ -0,0 +1,58 @@ +#!/bin/sh + +p=gzip +verify=no +iter=2 +t=test + +while [ $# -gt 0 ]; do + case $1 in + --native) + p=${p}-native + ;; + --verify) + verify=yes + ;; + --profgen) + p=${p}.pfg + ;; + --pgo) + p=${p}.pgo + ;; + test) + t=test + iter=2 + ;; + train) + t=train + iter=32 + ;; + ref) + t=ref + iter=60 + ;; + *) + echo Unknown argument $1. + exit 1 + ;; + esac + shift +done + +rm -f *.out + +echo Running $p on corpus $t with $iter iterations... +for f in gzip.data/$t/input/input.*; do + bf=`basename $f` + printf '%-20s: ' $bf + time ./$p $f $iter >$bf.out 2>stderr.$bf.out +done + +if [ $verify = yes ]; then + echo VERIFY + for o in input.*.out; do + cmp $o gzip.data/$t/output/$o + done +fi + +echo OK diff --git a/run/run.mcf b/run/run.mcf new file mode 100755 index 0000000..e9e1ab2 --- /dev/null +++ b/run/run.mcf @@ -0,0 +1,43 @@ +#!/bin/sh + +p=mcf +verify=no +t=test + +while [ $# -gt 0 ]; do + case $1 in + --native) + p=${p}-native + ;; + --verify) + verify=yes + ;; + --profgen) + p=${p}.pfg + ;; + --pgo) + p=${p}.pgo + ;; + test|train|ref) + t=$1 + ;; + *) + echo Unknown argument $1. + exit 1 + ;; + esac + shift +done + +rm -f *.out + +echo Running $p on corpus $t... +time ./$p mcf.data/$t/input/inp.in >stdout.out 2>stderr.out + +if [ $verify = yes ]; then + echo VERIFY + cmp stdout.out mcf.data/$t/output/inp.out + cmp mcf.out mcf.data/$t/output/mcf.out +fi + +echo OK diff --git a/run/run.parser b/run/run.parser new file mode 100755 index 0000000..53618c1 --- /dev/null +++ b/run/run.parser @@ -0,0 +1,48 @@ +#!/bin/sh + +p=parser +verify=no +t=test + +while [ $# -gt 0 ]; do + case $1 in + --native) + p=${p}-native + ;; + --verify) + verify=yes + ;; + --profgen) + p=${p}.pfg + ;; + --pgo) + p=${p}.pgo + ;; + test|train|ref) + t=$1 + ;; + *) + echo Unknown argument $1. + exit 1 + ;; + esac + shift +done + +rm -f *.out +rm -rf 2.1.dict words +cp parser.data/all/input/2.1.dict 2.1.dict +cp -r parser.data/all/input/words words + +echo Running $p on corpus $t... +time ./$p 2.1.dict -batch \ + stdout.out 2>stderr.out + +if [ $verify = yes ]; then + echo VERIFY + diff stdout.out parser.data/$t/output/$t.out +fi + +rm -rf 2.1.dict words + +echo OK diff --git a/run/run.vpr b/run/run.vpr new file mode 100755 index 0000000..b7d8c4d --- /dev/null +++ b/run/run.vpr @@ -0,0 +1,58 @@ +#!/bin/sh + +ARGS1="-nodisp -place_only -init_t 5 -exit_t 0.005 -alpha_t 0.9412 -inner_num 2" +ARGS2="-nodisp -route_only -route_chan_width 15 -pres_fac_mult 2" +ARGS2="${ARGS2} -acc_fac 1 -first_iter_pres_fac 4 -initial_pres_fac 8" + +p=vpr +verify=no +t=test + +while [ $# -gt 0 ]; do + case $1 in + --native) + p=${p}-native + ;; + --verify) + verify=yes + ;; + --profgen) + p=${p}.pfg + ;; + --pgo) + p=${p}.pgo + ;; + test|train|ref) + t=$1 + ;; + *) + echo Unknown argument $1. + exit 1 + ;; + esac + shift +done + +rm -f *.in +rm -f *.out +rm -f test* + +cp vpr.data/$t/input/* . + +echo Running $p... +echo -n "place: " +time ./$p net.in arch.in place.out dum.out ${ARGS1} >place_log.out 2>stderr1.out +echo -n "route: " +time ./$p net.in arch.in place.in route.out ${ARGS2} >route_log.out 2>stderr2.out + +if [ $verify = yes ]; then + echo VERIFY + for i in place_log.out route_log.out costs.out route.out; do + if ! diff $i vpr.data/$t/output/$i ; then + echo "" + echo "Diff in $i might be within the tolerance" + fi + done +fi + +echo OK diff --git a/wasm-to-bin b/wasm-to-bin deleted file mode 100755 index a3ba1c7..0000000 --- a/wasm-to-bin +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -for p in "$@"; do - np=*.$p - echo -n $p... - if [ $np -nt $p ] ; then - $WABT_HOME/bin/wasm2c --experimental --enable-memory64 --disable-sandbox $np -o $p.wasm.c - $ANDROID_CLANG_TOOLCHAIN/bin/clang -Wno-incompatible-library-redeclaration -Wno-builtin-requires-header -I $WABT_HOME/wasm2c --target=aarch64-linux-android29 --sysroot=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/sysroot -mcpu=cortex-x3 -O3 -lm -lc++ -g $p.wasm.c -o $p - echo done - else - echo up to date - fi -done diff --git a/wasm-to-bin-all b/wasm-to-bin-all index 5139d40..bc71ae4 100755 --- a/wasm-to-bin-all +++ b/wasm-to-bin-all @@ -1,7 +1,46 @@ #!/bin/sh -PROGS='gzip vpr mcf parser eon vortex bzip2' - d=`dirname $0` -$d/wasm-to-bin $PROGS +sfx='' +if [ $# -gt 0 -a x$1 = x--profgen ]; then + sfx='.pfg' + shift +elif [ $# -gt 0 -a x$1 = x--pgo ]; then + sfx='.pgo' + shift +fi + +while read p lang; do + np=*.$p + echo -n $p "($lang)"... + if [ $np -nt $p$sfx ] ; then + $WABT_HOME/bin/wasm2c --experimental --enable-memory64 --disable-sandbox $np -o $p.wasm.c + echo -n "converted..." + LIBCXX= + if [ $lang = c++ ]; then + LIBCXX=-lc++ + fi + if [ x$sfx = x.pfg ]; then + PROFGEN="-fprofile-generate=${p}.profraw" + elif [ x$sfx = x.pgo ]; then + PROFGEN="-fprofile-use=${d}/${p}.profdata" + else + PROFGEN='' + fi + $ANDROID_CLANG_TOOLCHAIN/bin/clang \ + -Wno-incompatible-library-redeclaration \ + -Wno-builtin-requires-header \ + -I $WABT_HOME/wasm2c \ + --target=aarch64-linux-android29 \ + --sysroot=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/sysroot \ + -mcpu=cortex-x3 \ + $PROFGEN \ + -O3 \ + -lm $LIBCXX \ + -g $p.wasm.c -o $p$sfx + echo done + else + echo up to date + fi +done <$d/all-progs