|
20 | 20 | # or visit www.oracle.com if you need additional information or have any
|
21 | 21 | # questions.
|
22 | 22 | #
|
| 23 | +import os |
23 | 24 | import re
|
24 | 25 | from abc import ABCMeta, abstractmethod
|
25 | 26 |
|
26 | 27 | import mx
|
27 | 28 | import mx_benchmark
|
28 | 29 | import mx_espresso
|
| 30 | +import mx_jardistribution |
| 31 | +import mx_polybench |
29 | 32 |
|
30 | 33 | from mx_benchmark import GuestVm, JavaVm, OutputCapturingJavaVm
|
31 | 34 | from mx_sdk_benchmark import _daCapoScalaConfig
|
32 | 35 |
|
33 | 36 | _suite = mx.suite('espresso')
|
34 | 37 |
|
35 | 38 |
|
| 39 | +def mx_register_dynamic_suite_constituents(register_project, register_distribution): |
| 40 | + benchmark_dist = _suite.dependency("ESPRESSO_POLYBENCH_BENCHMARKS") |
| 41 | + polybench_benchmarks = os.path.join(_suite.dir, 'benchmarks', 'interpreter') |
| 42 | + for f in os.listdir(polybench_benchmarks): |
| 43 | + if os.path.isdir(os.path.join(polybench_benchmarks, f)) and not f.startswith("."): |
| 44 | + main_class = os.path.basename(f) |
| 45 | + simple_name = main_class.split(".")[-1] |
| 46 | + |
| 47 | + project_name = 'benchmarks.interpreter.espresso.' + simple_name.lower() |
| 48 | + register_project(mx.JavaProject( |
| 49 | + suite=_suite, |
| 50 | + subDir=None, |
| 51 | + srcDirs=[os.path.join(_suite.dir, 'benchmarks', 'interpreter', main_class)], |
| 52 | + deps=[], |
| 53 | + name=project_name, |
| 54 | + d=os.path.join(_suite.dir, 'benchmarks', 'interpreter', main_class), |
| 55 | + javaCompliance='11+', |
| 56 | + workingSets=None, |
| 57 | + testProject=True, |
| 58 | + eclipseformat=False, |
| 59 | + skipVerifyImports=True, |
| 60 | + # javac and JDT both produce warnings on these sources. suppress javac warnings and avoid JDT. |
| 61 | + forceJavac=True, |
| 62 | + checkstyleProj=project_name, |
| 63 | + **{ |
| 64 | + "javac.lint.overrides": "none", |
| 65 | + } |
| 66 | + )) |
| 67 | + |
| 68 | + dist_name = 'ESPRESSO_POLYBENCH_BENCHMARK_' + simple_name.upper() |
| 69 | + jar_dist = mx_jardistribution.JARDistribution( |
| 70 | + suite=_suite, |
| 71 | + subDir=None, |
| 72 | + srcDirs=[''], |
| 73 | + sourcesPath=None, |
| 74 | + deps=[project_name], |
| 75 | + mainClass=main_class, |
| 76 | + name=dist_name, |
| 77 | + path='', |
| 78 | + platformDependent=False, |
| 79 | + distDependencies=[], |
| 80 | + javaCompliance='11+', |
| 81 | + excludedLibs=[], |
| 82 | + workingSets=None, |
| 83 | + theLicense=None, |
| 84 | + testDistribution=True, |
| 85 | + maven=False, |
| 86 | + ) |
| 87 | + register_distribution(jar_dist) |
| 88 | + |
| 89 | + benchmark_dist.layout[f'./interpreter/{simple_name}.jar'] = [ |
| 90 | + f'dependency:{dist_name}/*.jar'] |
| 91 | + benchmark_dist.buildDependencies.append(dist_name) |
| 92 | + |
| 93 | + espresso_runtime_resources_distribution = mx_espresso.espresso_runtime_resources_distribution() |
| 94 | + mx_polybench.register_polybench_language(mx_suite=_suite, language="espresso", |
| 95 | + distributions=["ESPRESSO", "ESPRESSO_LIBS_RESOURCES", |
| 96 | + espresso_runtime_resources_distribution, "truffle:TRUFFLE_NFI_LIBFFI"]) |
| 97 | + |
| 98 | + def espresso_polybench_runner(polybench_run: mx_polybench.PolybenchRunFunction, tags) -> None: |
| 99 | + if "gate" in tags: |
| 100 | + polybench_run(["--jvm", "interpreter/*.jar", "--experimental-options", "--engine.Compilation=false", "-w", "1", "-i", "1"]) |
| 101 | + polybench_run(["--native", "interpreter/*.jar", "--experimental-options", "--engine.Compilation=false", "-w", "1", "-i", "1"]) |
| 102 | + if "benchmark" in tags: |
| 103 | + polybench_run(["--jvm", "interpreter/*.jar", "--experimental-options", "--engine.Compilation=false"]) |
| 104 | + polybench_run(["--native", "interpreter/*.jar", "--experimental-options", "--engine.Compilation=false"]) |
| 105 | + polybench_run(["--jvm", "interpreter/*.jar"]) |
| 106 | + polybench_run(["--native", "interpreter/*.jar"]) |
| 107 | + polybench_run(["--jvm", "interpreter/*.jar", "--metric=metaspace-memory"]) |
| 108 | + polybench_run(["--jvm", "interpreter/*.jar", "--metric=application-memory"]) |
| 109 | + polybench_run(["--jvm", "interpreter/*.jar", "--metric=allocated-bytes", "-w", "40", "-i", "10", "--experimental-options", "--engine.Compilation=false"]) |
| 110 | + polybench_run(["--native", "interpreter/*.jar", "--metric=allocated-bytes", "-w", "40", "-i", "10", "--experimental-options", "--engine.Compilation=false"]) |
| 111 | + polybench_run(["--jvm", "interpreter/*.jar", "--metric=allocated-bytes", "-w", "40", "-i", "10"]) |
| 112 | + polybench_run(["--native", "interpreter/*.jar", "--metric=allocated-bytes", "-w", "40", "-i", "10"]) |
| 113 | + if "instructions" in tags: |
| 114 | + assert mx_polybench.is_enterprise() |
| 115 | + fork_count_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "polybench-fork-counts.json") |
| 116 | + polybench_run(["--native", "interpreter/*.jar", "--metric=instructions", "--experimental-options", "--engine.Compilation=false", |
| 117 | + "--mx-benchmark-args", "--fork-count-file", fork_count_file]) |
| 118 | + |
| 119 | + mx_polybench.register_polybench_benchmark_suite(mx_suite=_suite, name="espresso", languages=["espresso"], |
| 120 | + benchmark_distribution=benchmark_dist.name, |
| 121 | + benchmark_file_filter=".*jar", runner=espresso_polybench_runner, |
| 122 | + tags={"gate", "benchmark", "instructions"}) |
| 123 | + |
| 124 | + |
36 | 125 | class EspressoStandaloneVm(OutputCapturingJavaVm, metaclass=ABCMeta):
|
37 | 126 | def __init__(self, config_name, options):
|
38 | 127 | super().__init__()
|
|
0 commit comments