Skip to content

Commit b6af368

Browse files
committed
[GR-35954] Renaissance 0.14.0.
PullRequest: graal/10915
2 parents 23647a8 + 1da7b3a commit b6af368

File tree

4 files changed

+56
-32
lines changed

4 files changed

+56
-32
lines changed

java-benchmarks/mx.java-benchmarks/mx_java_benchmarks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1879,7 +1879,7 @@ def renaissanceIterations(self):
18791879
del benchmarks["naive-bayes"]
18801880
del benchmarks["page-rank"]
18811881

1882-
if mx.get_arch() != "amd64" or mx.get_jdk().javaCompliance > '11':
1882+
if self.version() in ["0.9.0", "0.10.0", "0.11.0", "0.12.0", "0.13.0"] and mx.get_arch() != "amd64" or mx.get_jdk().javaCompliance > '11':
18831883
# GR-33879
18841884
# JNA libraries needed are currently limited to amd64: renaissance-benchmarks/renaissance #153
18851885
del benchmarks["db-shootout"]
@@ -1900,7 +1900,7 @@ def defaultSuiteVersion(self):
19001900
return "0.11.0" # stick to 0.11.0 for both JIT and AOT until Native Image is compatible with 0.13.0 (GR-34147)
19011901

19021902
def availableSuiteVersions(self):
1903-
return ["0.9.0", "0.10.0", "0.11.0", "0.12.0", "0.13.0"]
1903+
return ["0.9.0", "0.10.0", "0.11.0", "0.12.0", "0.13.0", "0.14.0"]
19041904

19051905
def renaissancePath(self):
19061906
lib = mx.library(self.renaissanceLibraryName())
@@ -1926,7 +1926,7 @@ def postprocessRunArgs(self, benchname, runArgs):
19261926

19271927
def vmArgs(self, bmSuiteArgs):
19281928
vm_args = super(RenaissanceBenchmarkSuite, self).vmArgs(bmSuiteArgs)
1929-
# The --add-opens flag will be available in the next Renaissance release (> 0.13.0).
1929+
# Those --add-opens flags are specified in the manifest as of renaissance 0.14.0
19301930
if java_home_jdk().javaCompliance > '16' and self.version() in ["0.9.0", "0.10.0", "0.11.0", "0.12.0",
19311931
"0.13.0"]:
19321932
vm_args += ["--add-opens", "java.management/sun.management=ALL-UNNAMED"]

java-benchmarks/mx.java-benchmarks/suite.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@
8686
"urls" : ["https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/renaissance/renaissance-gpl-0.13.0.jar"],
8787
"sha1" : "65eaca6ec6ba4c7293b82644bbdefd5cb2178825",
8888
},
89+
90+
"RENAISSANCE_0.14.0" : {
91+
"urls" : ["https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/renaissance/renaissance-gpl-0.14.0.jar"],
92+
"sha1" : "d83a508c593a2389880936cbf9aa034bc86e7ef2",
93+
},
8994

9095
"UBENCH_AGENT_DIST" : {
9196
"urls" : ["https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/java-ubench-agent-2e5becaf97afcf64fd8aef3ac84fc05a3157bff5.zip"],

substratevm/mx.substratevm/mx_substratevm_benchmark.py

Lines changed: 43 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def list_jars(path):
9999
]
100100
}
101101

102-
_renaissance_config = {
102+
_renaissance_pre014_config = {
103103
"akka-uct": {
104104
"group": "actors-akka",
105105
"legacy-group": "actors",
@@ -196,15 +196,15 @@ def list_jars(path):
196196
}
197197

198198

199-
def benchmark_group(benchmark, suite_version):
199+
def pre014_benchmark_group(benchmark, suite_version):
200200
if suite_version in ["0.9.0", "0.10.0", "0.11.0"]:
201-
return _renaissance_config[benchmark].get("legacy-group", _renaissance_config[benchmark]["group"])
201+
return _renaissance_pre014_config[benchmark].get("legacy-group", _renaissance_pre014_config[benchmark]["group"])
202202
else:
203-
return _renaissance_config[benchmark]["group"]
203+
return _renaissance_pre014_config[benchmark]["group"]
204204

205205

206-
def requires_recompiled_harness(benchmark, suite_version):
207-
requires_harness = _renaissance_config[benchmark].get("requires-recompiled-harness", False)
206+
def pre014_requires_recompiled_harness(benchmark, suite_version):
207+
requires_harness = _renaissance_pre014_config[benchmark].get("requires-recompiled-harness", False)
208208
if isinstance(requires_harness, list):
209209
return suite_version in requires_harness
210210
return requires_harness
@@ -215,10 +215,10 @@ class RenaissanceNativeImageBenchmarkSuite(mx_java_benchmarks.RenaissanceBenchma
215215
Building an image for a renaissance benchmark requires all libraries for the group this benchmark belongs to
216216
and a harness project compiled with the same scala version as the benchmark.
217217
Since we don't support building an image from fat-jars, we extract them to create project dependencies.
218-
Depending on the benchmark's scala version we create corresponding renaissance harness and benchmark projects,
219-
we set this harness project as a dependency for the benchmark project and collect project's classpath.
220-
For each renaissance benchmark we store an information about the group and scala version in _renaissance-config.
221-
We build an image from renaissance jar with the classpath as previously described, provided configurations and extra arguments while neccessary.
218+
219+
On recent renaissance versions (>= 0.14.0), it's only necessary to extract the fatjar and run the standalone jar
220+
of a given benchmark. Those standalone jars define the minimal classpath and include the matching harness for the
221+
scala version needed by the benchmark.
222222
"""
223223

224224
def name(self):
@@ -228,24 +228,35 @@ def benchSuiteName(self, bmSuiteArgs=None):
228228
return 'renaissance'
229229

230230
def renaissance_harness_lib_name(self):
231+
# Before Renaissance 0.14.0, we had to cross-compile the Renaissance harness to ensure we have a matching
232+
# harness for each project compiled with different scala versions.
233+
# As of Renaissance 0.14.0, we use the standalone mode of renaissance which already creates a native-image
234+
# friendly classpath and already bundles all harness versions needed.
231235
version_to_run = self.version()
232-
version_end_index = str(version_to_run).rindex('.')
233-
return 'RENAISSANCE_HARNESS_v' + str(version_to_run)[0:version_end_index]
236+
if version_to_run in ["0.9.0", "0.10.0", "0.11.0", "0.12.0", "0.13.0"]:
237+
version_end_index = str(version_to_run).rindex('.')
238+
return 'RENAISSANCE_HARNESS_v' + str(version_to_run)[0:version_end_index]
239+
else:
240+
return None
234241

235242
def harness_path(self):
236-
lib = mx.library(self.renaissance_harness_lib_name())
237-
if lib:
238-
return lib.get_path(True)
243+
harness_lib = self.renaissance_harness_lib_name()
244+
if harness_lib is not None:
245+
lib = mx.library(harness_lib)
246+
if lib:
247+
return lib.get_path(True)
239248
return None
240249

241-
# Before supporting new Renaissance versions, we must cross-compile Renaissance harness project
242-
# with scala 11 for benchmarks compiled with this version of Scala.
243250
def availableSuiteVersions(self):
244-
return ["0.9.0", "0.10.0", "0.11.0", "0.12.0", "0.13.0"]
251+
return ["0.9.0", "0.10.0", "0.11.0", "0.12.0", "0.13.0", "0.14.0"]
245252

246253
def renaissance_unpacked(self):
247254
return extract_archive(self.renaissancePath(), 'renaissance.extracted')
248255

256+
def standalone_jar_path(self, benchmark_name):
257+
standalone_jars_directory = "single"
258+
return os.path.join(self.renaissance_unpacked(), standalone_jars_directory, "{}.jar".format(benchmark_name))
259+
249260
def renaissance_additional_lib(self, lib):
250261
return mx.library(lib).get_path(True)
251262

@@ -284,20 +295,24 @@ def createCommandLineArgs(self, benchmarks, bmSuiteArgs):
284295
self.benchmark_name = benchmarks[0]
285296
run_args = self.postprocessRunArgs(self.benchmarkName(), self.runArgs(bmSuiteArgs))
286297
vm_args = self.vmArgs(bmSuiteArgs)
287-
return ['-cp', self.create_classpath(self.benchmarkName())] + vm_args + ['-jar', self.renaissancePath()] + run_args + [self.benchmarkName()]
298+
if self.version() in ["0.9.0", "0.10.0", "0.11.0", "0.12.0", "0.13.0"]:
299+
return ['-cp', self.create_pre014_classpath(self.benchmarkName())] + vm_args + ['-jar', self.renaissancePath()] + run_args + [self.benchmarkName()]
300+
else:
301+
# use renaissance standalone mode as of renaissance 0.14.0
302+
return vm_args + ["-jar", self.standalone_jar_path(self.benchmarkName())] + run_args + [self.benchmarkName()]
288303

289304
def successPatterns(self):
290305
return super(RenaissanceNativeImageBenchmarkSuite, self).successPatterns() + [
291306
_successful_stage_pattern
292307
]
293308

294-
def create_classpath(self, benchmarkName):
295-
custom_harness = requires_recompiled_harness(benchmarkName, self.version())
296-
harness_project = RenaissanceNativeImageBenchmarkSuite.RenaissanceProject('harness', custom_harness, self)
297-
group_project = RenaissanceNativeImageBenchmarkSuite.RenaissanceProject(benchmark_group(benchmarkName, self.version()), custom_harness, self, harness_project)
309+
def create_pre014_classpath(self, benchmarkName):
310+
custom_harness = pre014_requires_recompiled_harness(benchmarkName, self.version())
311+
harness_project = RenaissanceNativeImageBenchmarkSuite.RenaissancePre014Project('harness', custom_harness, self)
312+
group_project = RenaissanceNativeImageBenchmarkSuite.RenaissancePre014Project(pre014_benchmark_group(benchmarkName, self.version()), custom_harness, self, harness_project)
298313
return ':'.join([mx.classpath(harness_project), mx.classpath(group_project)])
299314

300-
class RenaissanceDependency(mx.ClasspathDependency):
315+
class RenaissancePre014Dependency(mx.ClasspathDependency):
301316
def __init__(self, name, path): # pylint: disable=super-init-not-called
302317
mx.Dependency.__init__(self, _suite, name, None)
303318
self.path = path
@@ -308,7 +323,7 @@ def classpath_repr(self, resolve=True):
308323
def _walk_deps_visit_edges(self, *args, **kwargs):
309324
pass
310325

311-
class RenaissanceProject(mx.ClasspathDependency):
326+
class RenaissancePre014Project(mx.ClasspathDependency):
312327
def __init__(self, group, requires_recompiled_harness, renaissance_suite, dep_project=None): # pylint: disable=super-init-not-called
313328
mx.Dependency.__init__(self, _suite, group, None)
314329
self.suite = renaissance_suite
@@ -326,17 +341,17 @@ def classpath_repr(self, resolve=True):
326341
def get_dependencies(self, path, group):
327342
deps = []
328343
for jar in list_jars(path):
329-
deps.append(RenaissanceNativeImageBenchmarkSuite.RenaissanceDependency(os.path.basename(jar), mx.join(path, jar)))
344+
deps.append(RenaissanceNativeImageBenchmarkSuite.RenaissancePre014Dependency(os.path.basename(jar), mx.join(path, jar)))
330345

331346
if self.suite.version() in ["0.9.0", "0.10.0", "0.11.0"]:
332347
if group == 'apache-spark':
333348
# breeze jar is replaced with a patched jar because of IncompatibleClassChange errors due to a bug in the Scala compiler
334349
invalid_bytecode_jar = 'breeze_2.11-0.11.2.jar'
335-
lib_dep = RenaissanceNativeImageBenchmarkSuite.RenaissanceDependency(invalid_bytecode_jar, mx.join(path, invalid_bytecode_jar))
350+
lib_dep = RenaissanceNativeImageBenchmarkSuite.RenaissancePre014Dependency(invalid_bytecode_jar, mx.join(path, invalid_bytecode_jar))
336351
if lib_dep in deps:
337352
deps.remove(lib_dep)
338353
lib_path = RenaissanceNativeImageBenchmarkSuite.renaissance_additional_lib(self.suite, 'SPARK_BREEZE_PATCHED')
339-
deps.append(RenaissanceNativeImageBenchmarkSuite.RenaissanceDependency(os.path.basename(lib_path), lib_path))
354+
deps.append(RenaissanceNativeImageBenchmarkSuite.RenaissancePre014Dependency(os.path.basename(lib_path), lib_path))
340355
return deps
341356

342357
def collect_group_dependencies(self, group, requires_recompiled_harness):

substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/reports/StatisticsPrinter.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
import java.io.File;
2828
import java.io.PrintWriter;
29+
import java.text.NumberFormat;
30+
import java.util.Locale;
2931
import java.util.Map;
3032
import java.util.function.Consumer;
3133

@@ -106,7 +108,9 @@ public static void print(PrintWriter out, String key, long value) {
106108
}
107109

108110
public static void print(PrintWriter out, String key, double value) {
109-
out.format("%s\"%s\": %.2f,%n", INDENT, key, value);
111+
NumberFormat nf = NumberFormat.getInstance(Locale.ENGLISH);
112+
nf.setGroupingUsed(false);
113+
out.format("%s\"%s\": %s,%n", INDENT, key, nf.format(value));
110114
}
111115

112116
public static void printLast(PrintWriter out, String key, long value) {

0 commit comments

Comments
 (0)