Skip to content

Commit 01575fc

Browse files
authored
Download jetstream src from github instead of browserbench.org (#3196)
Downloading benchmark jetstream's source files one by one from https://browserbench.org by using wget is time consuming and not stable, this PR updates the scripts to download the files from https://github.com/mozilla/perf-automation.
1 parent cd63b3b commit 01575fc

File tree

3 files changed

+68
-80
lines changed

3 files changed

+68
-80
lines changed

tests/benchmarks/jetstream/build.sh

Lines changed: 21 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ source /opt/emsdk/emsdk_env.sh
77

88
PLATFORM=$(uname -s | tr A-Z a-z)
99

10+
WORK_DIR=$PWD
1011
OUT_DIR=$PWD/out
1112
WAMRC_CMD=$PWD/../../../wamr-compiler/build/wamrc
13+
JETSTREAM_DIR=$PWD/perf-automation/benchmarks/JetStream2/wasm
1214

13-
mkdir -p jetstream
14-
mkdir -p tsf-src
1515
mkdir -p ${OUT_DIR}
1616

1717
if [[ $1 != "--no-simd" ]];then
@@ -22,20 +22,16 @@ else
2222
WASM_SIMD_FLAGS=""
2323
fi
2424

25-
cd jetstream
26-
27-
echo "Download source files .."
28-
wget -N https://browserbench.org/JetStream/wasm/gcc-loops.cpp
29-
wget -N https://browserbench.org/JetStream/wasm/quicksort.c
30-
wget -N https://browserbench.org/JetStream/wasm/HashSet.cpp
31-
wget -N https://browserbench.org/JetStream/simple/float-mm.c
32-
33-
if [[ $? != 0 ]]; then
34-
exit
25+
if [ ! -d perf-automation ]; then
26+
git clone https://github.com/mozilla/perf-automation.git
27+
echo "Patch source files .."
28+
cd perf-automation
29+
patch -p1 -N < ../jetstream.patch
3530
fi
3631

37-
echo "Patch source files .."
38-
patch -p1 -N < ../jetstream.patch
32+
cd ${JETSTREAM_DIR}
33+
34+
# Build gcc-loops
3935

4036
echo "Build gcc-loops with g++ .."
4137
g++ -O3 ${NATIVE_SIMD_FLAGS} -o ${OUT_DIR}/gcc-loops_native gcc-loops.cpp
@@ -56,6 +52,8 @@ if [[ ${PLATFORM} == "linux" ]]; then
5652
${WAMRC_CMD} --enable-segue -o ${OUT_DIR}/gcc-loops_segue.aot ${OUT_DIR}/gcc-loops.wasm
5753
fi
5854

55+
# Build quicksort
56+
5957
echo "Build quicksort with gcc .."
6058
gcc -O3 ${NATIVE_SIMD_FLAGS} -o ${OUT_DIR}/quicksort_native quicksort.c
6159

@@ -74,6 +72,8 @@ if [[ ${PLATFORM} == "linux" ]]; then
7472
${WAMRC_CMD} --enable-segue -o ${OUT_DIR}/quicksort_segue.aot ${OUT_DIR}/quicksort.wasm
7573
fi
7674

75+
# Build HashSet
76+
7777
echo "Build HashSet with g++ .."
7878
g++ -O3 ${NATIVE_SIMD_FLAGS} -o ${OUT_DIR}/HashSet_native HashSet.cpp \
7979
-lstdc++
@@ -93,6 +93,10 @@ if [[ ${PLATFORM} == "linux" ]]; then
9393
${WAMRC_CMD} --enable-segue -o ${OUT_DIR}/HashSet_segue.aot ${OUT_DIR}/HashSet.wasm
9494
fi
9595

96+
# Build float-mm
97+
98+
cd ${JETSTREAM_DIR}/../simple
99+
96100
echo "Build float-mm with gcc .."
97101
gcc -O3 ${NATIVE_SIMD_FLAGS} -o ${OUT_DIR}/float-mm_native float-mm.c
98102

@@ -111,7 +115,9 @@ if [[ ${PLATFORM} == "linux" ]]; then
111115
${WAMRC_CMD} --enable-segue -o ${OUT_DIR}/float-mm_segue.aot ${OUT_DIR}/float-mm.wasm
112116
fi
113117

114-
cd ../tsf-src
118+
# Build tsf
119+
120+
cd ${JETSTREAM_DIR}/TSF
115121

116122
tsf_srcs="tsf_asprintf.c tsf_buffer.c tsf_error.c tsf_reflect.c tsf_st.c \
117123
tsf_type.c tsf_io.c tsf_native.c tsf_generator.c tsf_st_typetable.c \
@@ -127,28 +133,6 @@ tsf_srcs="tsf_asprintf.c tsf_buffer.c tsf_error.c tsf_reflect.c tsf_st.c \
127133
tsf_fsdb.c tsf_fsdb_protocol.c tsf_define_helpers.c tsf_ir.c \
128134
tsf_ir_different.c tsf_ir_speed.c"
129135

130-
tsf_files="${tsf_srcs} config.h gpc_worklist.h \
131-
tsf_config_stub.h tsf.h tsf_internal.h tsf_region.h tsf_types.h \
132-
gpc.h tsf_atomics.h tsf_define_helpers.h tsf_indent.h tsf_inttypes.h \
133-
tsf_serial_protocol.h tsf_util.h gpc_int_common.h tsf_build_defines.h \
134-
tsf_format.h tsf_internal_config.h tsf_ir_different.h tsf_sha1.h \
135-
tsf_zip_abstract.h gpc_internal.h tsf_config.h tsf_fsdb_protocol.h \
136-
tsf_internal_config_stub.h tsf_ir.h tsf_st.h \
137-
gpc_instruction_dispatch.gen gpc_instruction_stack_effects.gen \
138-
gpc_instruction_to_string.gen gpc_instruction_size.gen \
139-
gpc_instruction_static_size.gen gpc_interpreter.gen"
140-
141-
echo "Download tsf source files .."
142-
for t in ${tsf_files}
143-
do
144-
wget -N "https://browserbench.org/JetStream/wasm/TSF/${t}"
145-
if [[ $? != 0 ]]; then
146-
exit
147-
fi
148-
done
149-
150-
patch -p1 -N < ../tsf.patch
151-
152136
echo "Build tsf with gcc .."
153137
gcc \
154138
-o ${OUT_DIR}/tsf_native -O3 ${NATIVE_SIMD_FLAGS} \
Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,63 @@
1-
diff -urN jetstream-org/HashSet.cpp jetstream/HashSet.cpp
2-
--- jetstream-org/HashSet.cpp 2020-10-30 04:12:42.000000000 +0800
3-
+++ jetstream/HashSet.cpp 2022-01-24 17:11:08.619831711 +0800
1+
diff --git a/benchmarks/JetStream2/wasm/HashSet.cpp b/benchmarks/JetStream2/wasm/HashSet.cpp
2+
index eca979b0..d1bf4d3d 100644
3+
--- a/benchmarks/JetStream2/wasm/HashSet.cpp
4+
+++ b/benchmarks/JetStream2/wasm/HashSet.cpp
45
@@ -22,8 +22,10 @@
5-
6+
67
#include <algorithm>
78
#include <memory>
89
+#include <limits>
910
#include <stdio.h>
1011
#include <stdlib.h>
1112
+#include <string.h>
1213
#include <sys/time.h>
13-
14+
1415
// Compile with: xcrun clang++ -o HashSet HashSet.cpp -O2 -W -framework Foundation -licucore -std=c++11 -fvisibility=hidden -DNDEBUG=1
15-
@@ -76,7 +78,7 @@
16+
@@ -76,7 +78,7 @@ template<typename ToType, typename FromType>
1617
inline ToType bitwise_cast(FromType from)
1718
{
1819
typename std::remove_const<ToType>::type to { };
1920
- std::memcpy(&to, &from, sizeof(to));
2021
+ memcpy(&to, &from, sizeof(to));
2122
return to;
2223
}
23-
24+
25+
diff --git a/benchmarks/JetStream2/wasm/TSF/gpc_code_gen_util.c b/benchmarks/JetStream2/wasm/TSF/gpc_code_gen_util.c
26+
index 56220fa7..7e3a365b 100644
27+
--- a/benchmarks/JetStream2/wasm/TSF/gpc_code_gen_util.c
28+
+++ b/benchmarks/JetStream2/wasm/TSF/gpc_code_gen_util.c
29+
@@ -34,6 +34,8 @@
30+
#include <errno.h>
31+
#include <dirent.h>
32+
33+
+int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
34+
+
35+
/* code generation debugging */
36+
37+
/* NOTE: It is now the case that the count may be incremented multiple times,
38+
diff --git a/benchmarks/JetStream2/wasm/TSF/tsf_internal.h b/benchmarks/JetStream2/wasm/TSF/tsf_internal.h
39+
index 225a248b..ae39d3d3 100644
40+
--- a/benchmarks/JetStream2/wasm/TSF/tsf_internal.h
41+
+++ b/benchmarks/JetStream2/wasm/TSF/tsf_internal.h
42+
@@ -429,6 +429,7 @@ struct tsf_fsdb {
43+
#endif
44+
tsf_fsdb_connection_t *connection;
45+
#endif
46+
+ uint32_t __padding;
47+
} remote;
48+
} u;
49+
tsf_limits_t *limits;
50+
diff --git a/benchmarks/JetStream2/wasm/TSF/tsf_ir_speed.c b/benchmarks/JetStream2/wasm/TSF/tsf_ir_speed.c
51+
index dd75c43e..79435c42 100644
52+
--- a/benchmarks/JetStream2/wasm/TSF/tsf_ir_speed.c
53+
+++ b/benchmarks/JetStream2/wasm/TSF/tsf_ir_speed.c
54+
@@ -63,6 +63,9 @@ static void writeTest(const char *filename,
55+
Program_t *program;
56+
unsigned elementIndex;
57+
58+
+ if (!(programIndex % 100))
59+
+ printf("##programIndex: %u\n", programIndex);
60+
+
61+
CS(program = tsf_region_create(sizeof(Program_t)));
62+
63+
program->globals.len = numDecls + numDefns;

tests/benchmarks/jetstream/tsf.patch

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)