Skip to content

Commit 098eaa3

Browse files
committed
[GR-64689] Migrate polybenchmarks to unchained polybench.
PullRequest: graal/22053
2 parents a6cc74b + 3cb0be9 commit 098eaa3

File tree

4 files changed

+82
-14
lines changed

4 files changed

+82
-14
lines changed

truffle/mx.truffle/mx_polybench/model.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ class PolybenchBenchmarkSuiteEntry(NamedTuple):
151151
runner: Optional[PolybenchBenchmarkSuiteRunner]
152152
tags: Set[str]
153153
suppress_validation_warnings: bool
154+
additional_polybench_args: List[str]
154155

155156
def validate(self) -> Optional[str]:
156157
"""Ensures this suite can run. Returns an error string otherwise."""
@@ -436,7 +437,11 @@ def createCommandLineArgs(self, benchmarks, bmSuiteArgs):
436437
java_distributions = _get_java_distributions(resolved_benchmark)
437438
vm_args = mx.get_runtime_jvm_args(names=java_distributions) + self.vmArgs(bmSuiteArgs)
438439
mx_truffle.enable_truffle_native_access(vm_args)
439-
polybench_args = ["--path=" + resolved_benchmark.absolute_path] + self.runArgs(bmSuiteArgs)
440+
polybench_args = (
441+
["--path=" + resolved_benchmark.absolute_path]
442+
+ self.runArgs(bmSuiteArgs)
443+
+ resolved_benchmark.suite.additional_polybench_args
444+
)
440445
return vm_args + [PolybenchBenchmarkSuite.POLYBENCH_MAIN] + polybench_args
441446

442447
def runAndReturnStdOut(self, benchmarks, bmSuiteArgs):
@@ -707,6 +712,7 @@ def register_polybench_benchmark_suite(
707712
runner: Optional[PolybenchBenchmarkSuiteRunner] = None,
708713
tags: Optional[Set[str]] = None,
709714
suppress_validation_warnings: bool = False,
715+
additional_polybench_args: Optional[List[str]] = None,
710716
):
711717
"""
712718
Registers a suite of polybench benchmarks. A polybench suite declares a distribution of benchmark files and the
@@ -730,6 +736,8 @@ def register_polybench_benchmark_suite(
730736
input format as the "mx polybench" command).
731737
:param tags: The set of tags supported by the runner.
732738
:param suppress_validation_warnings: Whether to suppress warning messages when the suite specification does not validate.
739+
:param additional_polybench_args: An optional list of arguments to always pass to the benchmark launcher (e.g., to
740+
specify a load path for benchmark sources).
733741
"""
734742
check_late_registration(f"Polybench benchmark suite {name}")
735743
if isinstance(benchmark_file_filter, str):
@@ -750,6 +758,7 @@ def register_polybench_benchmark_suite(
750758
runner=runner,
751759
tags=tags if tags is not None else set(),
752760
suppress_validation_warnings=suppress_validation_warnings,
761+
additional_polybench_args=additional_polybench_args or [],
753762
)
754763
if name in _polybench_benchmark_suite_registry:
755764
mx.abort(

truffle/src/org.graalvm.polybench/src/org/graalvm/polybench/PolyBenchLauncher.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -260,24 +260,12 @@ protected void validateArguments(Map<String, String> polyglotOptions) {
260260
@Override
261261
protected void launch(Context.Builder contextBuilder) {
262262
if (config.isSingleEngine()) {
263-
setEnv(contextBuilder);
264263
runHarness(contextBuilder, config.evalSourceOnlyDefault, 0);
265264
} else {
266265
multiEngineLaunch(contextBuilder);
267266
}
268267
}
269268

270-
private void setEnv(Context.Builder contextBuilder) {
271-
if ("python".equals(getLanguageId(config.path))) {
272-
String pythonpath = System.getenv("POLYBENCH_PYTHONPATH");
273-
if (pythonpath != null) {
274-
contextBuilder.option("python.PythonPath", pythonpath);
275-
} else {
276-
log("WARNING: running Python benchmark but Python path was not set. Consider setting the POLYBENCH_PYTHONPATH environment variable.");
277-
}
278-
}
279-
}
280-
281269
private void multiEngineLaunch(Context.Builder contextBuilder) {
282270
if (config.multiEngine.sharedEngine) {
283271
contextBuilder.engine(Engine.newBuilder().allowExperimentalOptions(true).options(config.multiEngine.engineOptions).build());

vm/ci/ci_common/common-bench.jsonnet

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ local repo_config = import '../../../ci/repo-configuration.libsonnet';
102102
timelimit: '4:00:00',
103103
},
104104

105+
build_polybenchmarks: [
106+
['mx', '--env', '${VM_ENV}', '--dy', 'polybenchmarks', 'sforceimports'],
107+
['mx', '-p', '../../polybenchmarks', 'build_benchmarks'],
108+
['mx', '--dy', 'polybenchmarks', 'build', '--dependencies', 'POLYBENCHMARKS_BENCHMARKS']
109+
],
110+
105111
js_bench_compilation_throughput(pgo): self.vm_bench_common + common.heap.default + {
106112
local mx_libgraal = ["mx", "--env", repo_config.vm.mx_env.libgraal],
107113

@@ -311,8 +317,65 @@ local repo_config = import '../../../ci/repo-configuration.libsonnet';
311317
],
312318
notify_groups +: ['javascript'],
313319
}
320+
] + [
321+
# Polybenchmarks jobs
322+
self.polybench_vm_gate('linux', 'amd64', 'espresso', name='polybenchmarks') + {
323+
setup+: [
324+
['mx', '--dy', '/espresso', 'build']
325+
] + $.build_polybenchmarks,
326+
run+: [
327+
self.polybench_wrap(['mx', '--dy', '/espresso,polybenchmarks', '--java-home', '${POLYBENCH_JVM}', 'polybench', '--suite', 'polybenchmarks-espresso:gate']),
328+
],
329+
},
330+
self.polybench_vm_daily('linux', 'amd64', 'espresso', 'polybenchmarks') + {
331+
setup+: [
332+
['mx', '--dy', '/espresso', 'build']
333+
] + $.build_polybenchmarks,
334+
run+: [
335+
self.polybench_wrap(['mx', '--dy', '/espresso,polybenchmarks', '--java-home', '${POLYBENCH_JVM}', 'polybench', '--suite', 'polybenchmarks-espresso:benchmark']),
336+
],
337+
},
338+
339+
self.polybench_vm_gate('linux', 'amd64', 'python', name='polybenchmarks') + {
340+
setup+: [
341+
['mx', '--dy', 'graalpython', 'build']
342+
] + $.build_polybenchmarks,
343+
run+: [
344+
self.polybench_wrap(['mx', '--dy', 'graalpython,polybenchmarks', '--java-home', '${POLYBENCH_JVM}', 'polybench', '--suite', 'polybenchmarks-python:gate']),
345+
],
346+
},
347+
self.polybench_vm_daily('linux', 'amd64', 'python', 'polybenchmarks') + {
348+
setup+: [
349+
['mx', '--dy', 'graalpython', 'build']
350+
] + $.build_polybenchmarks,
351+
run+: [
352+
self.polybench_wrap(['mx', '--dy', 'graalpython,polybenchmarks', '--java-home', '${POLYBENCH_JVM}', 'polybench', '--suite', 'polybenchmarks-python:benchmark']),
353+
],
354+
},
355+
356+
self.polybench_vm_gate('linux', 'amd64', 'ruby', name='polybenchmarks') + common.deps.truffleruby + {
357+
environment+: {
358+
RUBY_BENCHMARKS: 'true',
359+
},
360+
setup+: [
361+
['mx', '--dy', 'truffleruby', 'build']
362+
] + $.build_polybenchmarks,
363+
run+: [
364+
self.polybench_wrap(['mx', '--dy', 'truffleruby,polybenchmarks', '--java-home', '${POLYBENCH_JVM}', 'polybench', '--suite', 'polybenchmarks-ruby:gate']),
365+
],
366+
},
367+
self.polybench_vm_daily('linux', 'amd64', 'ruby', 'polybenchmarks') + common.deps.truffleruby + {
368+
environment+: {
369+
RUBY_BENCHMARKS: 'true',
370+
},
371+
setup+: [
372+
['mx', '--dy', 'truffleruby', 'build']
373+
] + $.build_polybenchmarks,
374+
run+: [
375+
self.polybench_wrap(['mx', '--dy', 'truffleruby,polybenchmarks', '--java-home', '${POLYBENCH_JVM}', 'polybench', '--suite', 'polybenchmarks-ruby:benchmark']),
376+
],
377+
},
314378
],
315-
# TODO (GR-60584): reimplement polybenchmarks jobs once polybench is unchained
316379

317380
builds: utils.add_defined_in(builds, std.thisFile),
318381
}

vm/mx.vm/suite.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@
7171
{"url": "https://github.com/graalvm/graalpython.git", "kind": "git"},
7272
]
7373
},
74+
{
75+
"name": "polybenchmarks",
76+
"version": "f7c8e4d31ba21a353494adef2ef0b7da66114143",
77+
"dynamic": True,
78+
"urls": [
79+
{"url": "https://github.com/graalvm/polybenchmarks.git", "kind": "git"},
80+
]
81+
},
7482
]
7583
},
7684
"distributions": {

0 commit comments

Comments
 (0)