Skip to content

Commit 9c1865f

Browse files
committed
[GR-26822] Add polybench harness for Truffle interpreter performance tracking.
PullRequest: graal/7389
2 parents ea5c40a + ffa0c4c commit 9c1865f

File tree

25 files changed

+810
-36
lines changed

25 files changed

+810
-36
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
How to build these benchmarks.
3+
4+
```
5+
~/bin/emsdk/emscripten/emscripten-1.39.13/emcc -s EXPORTED_FUNCTIONS='["_main", "_run"]' \
6+
-o benchmarks/wasm/interpreter/sieve.wasm \
7+
benchmarks/wasm/interpreter/sieve.c
8+
```

vm/benchmarks/interpreter/sieve.c

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
26+
int run() {
27+
int i;
28+
int number = 600000;
29+
int primes[number + 1];
30+
31+
for (i = 2; i <= number; i++) {
32+
primes[i] = i;
33+
}
34+
35+
i = 2;
36+
while ((i * i) <= number) {
37+
if (primes[i] != 0) {
38+
for(int j = 2; j < number; j++) {
39+
if (primes[i] * j > number)
40+
break;
41+
else
42+
primes[primes[i] * j] = 0;
43+
}
44+
}
45+
i++;
46+
}
47+
48+
return primes[number];
49+
}
50+
51+
int main() {
52+
return run();
53+
}
54+

vm/benchmarks/interpreter/sieve.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
26+
function run() {
27+
let i;
28+
let number = 600000;
29+
let primes = new Array(number + 1);
30+
31+
for (i = 2; i <= number; i++) {
32+
primes[i] = i;
33+
}
34+
35+
i = 2;
36+
while ((i * i) <= number) {
37+
if (primes[i] != 0) {
38+
for (let j = 2; j < number; j++) {
39+
if (primes[i] * j > number)
40+
break;
41+
else
42+
primes[primes[i] * j] = 0;
43+
}
44+
}
45+
i++;
46+
}
47+
48+
return primes[number];
49+
}
50+

vm/benchmarks/interpreter/sieve.rb

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
2+
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3+
#
4+
# This code is free software; you can redistribute it and/or modify it
5+
# under the terms of the GNU General Public License version 2 only, as
6+
# published by the Free Software Foundation. Oracle designates this
7+
# particular file as subject to the "Classpath" exception as provided
8+
# by Oracle in the LICENSE file that accompanied this code.
9+
#
10+
# This code is distributed in the hope that it will be useful, but WITHOUT
11+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13+
# version 2 for more details (a copy is included in the LICENSE file that
14+
# accompanied this code).
15+
#
16+
# You should have received a copy of the GNU General Public License version
17+
# 2 along with this work; if not, write to the Free Software Foundation,
18+
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19+
#
20+
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21+
# or visit www.oracle.com if you need additional information or have any
22+
# questions.
23+
24+
def run()
25+
number = 600000
26+
27+
primes = Array.new(number + 1)
28+
29+
for i in 2..number
30+
primes[i] = i
31+
end
32+
33+
i = 2
34+
while i * i <= number do
35+
if primes[i] != 0 then
36+
for j in 2..(number - 1)
37+
if primes[i] * j > number then
38+
break
39+
else
40+
primes[primes[i] * j] = 0
41+
end
42+
end
43+
end
44+
i += 1
45+
end
46+
47+
return primes[number]
48+
end
49+

vm/ci_common/common-bench.hocon

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,59 @@
1-
bench_js_linux: ${vm_java_8} ${svm-common-linux-amd64} ${sulong_linux} ${custom_vm_linux} {
1+
vm_bench_common: {
22
result_file: results.json
3-
upload: [bench-uploader.py, ${bench_js_linux.result_file}]
4-
cmd_base: ${mx_vm_common} [--dynamicimports, js-benchmarks, benchmark, --results-file, ${bench_js_linux.result_file}]
3+
upload: [bench-uploader.py, ${vm_bench_common.result_file}]
4+
capabilities: [no_frequency_scaling, tmpfs25g, x52, linux, amd64]
5+
targets: [bench]
6+
timelimit: "1:00:00"
7+
}
8+
9+
vm_bench_js_linux: ${vm_bench_common} ${vm_java_8} ${svm-common-linux-amd64} ${sulong_linux} ${custom_vm_linux} {
10+
cmd_base: ${mx_vm_common} [--dynamicimports, js-benchmarks, benchmark, --results-file, ${vm_bench_common.result_file}]
511
config_base: ["--js-vm=graal-js", "--js-vm-config=default", "--jvm=graalvm-${VM_ENV}"]
6-
cmd: ${bench_js_linux.cmd_base} ["${BENCH_SUITE}:*", --] ${bench_js_linux.config_base}
12+
cmd: ${vm_bench_js_linux.cmd_base} ["${BENCH_SUITE}:*", --] ${vm_bench_js_linux.config_base}
713
setup: ${common_vm.setup} [
814
${mx_vm_common} [build]
915
[git, clone, --depth, "1", [mx, urlrewrite, "https://github.com/graalvm/js-benchmarks.git"], ../../js-benchmarks]
1016
]
1117
run: [
12-
${bench_js_linux.cmd} ["--jvm-config=jvm"]
13-
${bench_js_linux.upload}
14-
${bench_js_linux.cmd} ["--jvm-config=native"]
15-
${bench_js_linux.upload}
18+
${vm_bench_js_linux.cmd} ["--jvm-config=jvm-interpreter"]
19+
${vm_bench_common.upload}
20+
${vm_bench_js_linux.cmd} ["--jvm-config=native-interpreter"]
21+
${vm_bench_common.upload}
22+
]
23+
}
24+
25+
vm_bench_polybench_linux: ${vm_bench_common} ${vm_java_8} ${svm-common-linux-amd64} ${truffleruby_linux} ${custom_vm_linux} {
26+
base_cmd: [mx, --env, "polybench-${VM_ENV}"]
27+
bench_cmd: ${vm_bench_polybench_linux.base_cmd} [benchmark, "polybench:*", --results-file, ${vm_bench_polybench_linux.result_file}, --, "--polybench-vm=graalvm-${VM_ENV}"]
28+
setup: ${common_vm.setup} [
29+
${vm_bench_polybench_linux.base_cmd} [build]
30+
]
31+
run: [
32+
${vm_bench_polybench_linux.bench_cmd} ["--polybench-vm-config=jvm-interpreter"]
33+
${vm_bench_common.upload}
34+
${vm_bench_polybench_linux.bench_cmd} ["--polybench-vm-config=native-interpreter"]
35+
${vm_bench_common.upload}
1636
]
17-
capabilities: [no_frequency_scaling, tmpfs25g, x52, linux, amd64]
18-
targets: [bench]
19-
timelimit: "1:00:00"
2037
}
2138

2239
builds += [
2340
# We need to expand `${common_vm_linux}` here to work around some limitations in the version of pyhocon that we use in the CI
24-
${common_vm_linux} ${bench_js_linux} { environment: { BENCH_SUITE: octane }, name: bench-vm-${vm_setup.short_name}-js-octane-linux},
25-
${common_vm_linux} ${bench_js_linux} { environment: { BENCH_SUITE: jetstream }, name: bench-vm-${vm_setup.short_name}-js-jetstream-linux}
26-
${common_vm_linux} ${bench_js_linux} { environment: { BENCH_SUITE: jetstream2}, name: bench-vm-${vm_setup.short_name}-js-jetstream2-linux}
27-
${common_vm_linux} ${bench_js_linux} { environment: { BENCH_SUITE: micro }, name: bench-vm-${vm_setup.short_name}-js-micro-linux}
28-
${common_vm_linux} ${bench_js_linux} { environment: { BENCH_SUITE: v8js }, name: bench-vm-${vm_setup.short_name}-js-v8js-linux}
29-
${common_vm_linux} ${bench_js_linux} { environment: { BENCH_SUITE: misc }, name: bench-vm-${vm_setup.short_name}-js-misc-linux}
30-
${common_vm_linux} ${bench_js_linux} { environment: { BENCH_SUITE: npm-regex }, name: bench-vm-${vm_setup.short_name}-js-npm-regex-linux}
41+
${common_vm_linux} ${vm_bench_js_linux} { environment: { BENCH_SUITE: octane }, name: bench-vm-${vm_setup.short_name}-js-octane-linux},
42+
${common_vm_linux} ${vm_bench_js_linux} { environment: { BENCH_SUITE: jetstream }, name: bench-vm-${vm_setup.short_name}-js-jetstream-linux}
43+
${common_vm_linux} ${vm_bench_js_linux} { environment: { BENCH_SUITE: jetstream2}, name: bench-vm-${vm_setup.short_name}-js-jetstream2-linux}
44+
${common_vm_linux} ${vm_bench_js_linux} { environment: { BENCH_SUITE: micro }, name: bench-vm-${vm_setup.short_name}-js-micro-linux}
45+
${common_vm_linux} ${vm_bench_js_linux} { environment: { BENCH_SUITE: v8js }, name: bench-vm-${vm_setup.short_name}-js-v8js-linux}
46+
${common_vm_linux} ${vm_bench_js_linux} { environment: { BENCH_SUITE: misc }, name: bench-vm-${vm_setup.short_name}-js-misc-linux}
47+
${common_vm_linux} ${vm_bench_js_linux} { environment: { BENCH_SUITE: npm-regex }, name: bench-vm-${vm_setup.short_name}-js-npm-regex-linux}
48+
49+
${common_vm_linux} ${vm_bench_polybench_linux} {name: bench-vm-${vm_setup.short_name}-polybench-linux}
3150

32-
${bench_daily_vm_linux} ${bench_js_linux} {
51+
${bench_daily_vm_linux} ${vm_bench_js_linux} {
3352
run: [
34-
${mx_vm_common} [benchmark, --results-file, ${bench_js_linux.result_file}, "agentscript-graal-js:*", --, "--jvm=graalvm-${VM_ENV}", "--jvm-config=jvm", "--js=graal-js", "--js-config=default"]
35-
${bench_js_linux.upload}
36-
${mx_vm_common} [benchmark, --results-file, ${bench_js_linux.result_file}, "agentscript-graal-js:*", --, "--jvm=graalvm-${VM_ENV}", "--jvm-config=native", "--js=graal-js", "--js-config=default"]
37-
${bench_js_linux.upload}
53+
${mx_vm_common} [benchmark, --results-file, ${vm_bench_js_linux.result_file}, "agentscript-graal-js:*", --, "--jvm=graalvm-${VM_ENV}", "--jvm-config=jvm", "--js=graal-js", "--js-config=default"]
54+
${vm_bench_common.upload}
55+
${mx_vm_common} [benchmark, --results-file, ${vm_bench_js_linux.result_file}, "agentscript-graal-js:*", --, "--jvm=graalvm-${VM_ENV}", "--jvm-config=native", "--js=graal-js", "--js-config=default"]
56+
${vm_bench_common.upload}
3857
]
3958
timelimit: "45:00"
4059
name: bench-vm-${vm_setup.short_name}-agentscript-js-java8-linux-amd64

vm/ci_includes/vm-bench.hocon

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
builds += [
2-
${bench_vm_linux} ${bench_js_linux} {
2+
${bench_vm_linux} ${vm_bench_js_linux} {
33
setup: ${common_vm.setup} [
44
[set-export, VM_ENV, "${VM_ENV}-no_native"]
55
${mx_vm_common} [build]
66
]
77
run: [
8-
${mx_vm_common} [benchmark, --results-file, ${bench_js_linux.result_file}, "gu:*"]
9-
${bench_js_linux.upload}
8+
${mx_vm_common} [benchmark, --results-file, ${vm_bench_common.result_file}, "gu:*"]
9+
${vm_bench_common.upload}
1010
]
1111
name: bench-vm-ce-no-native-gu-linux
1212
timelimit: "1:00:00"

vm/ci_includes/vm.hocon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ custom_vm_darwin: {}
1919
vm_profiles: []
2020
collect_profiles: []
2121

22-
non-product-vm-components: "nju,nic,dis"
22+
non-product-vm-components: "nju,nic,dis,pbm"
2323
non-product-vm-components-windows: ${non-product-vm-components}",llp"
24-
non-product-native-launchers: "RMain"
24+
non-product-native-launchers: "RMain,polybench"
2525

2626
vm_setup: {
2727
short_name: ce

vm/mx.vm/ce

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
DYNAMIC_IMPORTS=/substratevm,/tools,/sulong,/graal-nodejs
2-
EXCLUDE_COMPONENTS=nju,nic,ni,nil,llp,dis
2+
EXCLUDE_COMPONENTS=nju,nic,ni,nil,llp,dis,pbm
33
FORCE_BASH_LAUNCHERS=polyglot

vm/mx.vm/ce-complete

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
DYNAMIC_IMPORTS=/substratevm,/tools,/sulong,/graal-nodejs,truffleruby,graalpython,/wasm
22
DISABLE_INSTALLABLES=true
3-
EXCLUDE_COMPONENTS=nju,nic,dis
3+
EXCLUDE_COMPONENTS=nju,nic,dis,pbm
44
FORCE_BASH_LAUNCHERS=polyglot

vm/mx.vm/ce-no_native

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ DYNAMIC_IMPORTS=/substratevm,/tools,/sulong,/graal-nodejs
22
DISABLE_INSTALLABLES=ni,nil
33
FORCE_BASH_LAUNCHERS=true
44
SKIP_LIBRARIES=true
5-
EXCLUDE_COMPONENTS=nju,nic,llp,lg,dis
5+
EXCLUDE_COMPONENTS=nju,nic,llp,lg,dis,pbm

0 commit comments

Comments
 (0)