Skip to content

Commit c2b7858

Browse files
author
Andrija Kolic
committed
[GR-63032] [GR-61454] Enable using the 'energy' tracker on Barista
PullRequest: graal/20535
2 parents ec16e70 + 131af3b commit c2b7858

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

compiler/ci/ci_common/benchmark-suites.libsonnet

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129

130130
barista_template(suite_version=null, suite_name="barista", max_jdk_version=null, cmd_app_prefix=["hwloc-bind --cpubind node:0.core:0-3.pu:0 --membind node:0"], non_prefix_barista_args=[]):: cc.compiler_benchmark + {
131131
suite:: suite_name,
132-
local barista_version = "v0.3.4",
132+
local barista_version = "v0.4.1",
133133
local suite_version_args = if suite_version != null then ["--bench-suite-version=" + suite_version] else [],
134134
local prefix_barista_arg = if std.length(cmd_app_prefix) > 0 then [std.format("--cmd-app-prefix=%s", std.join(" ", cmd_app_prefix))] else [],
135135
local all_barista_args = prefix_barista_arg + non_prefix_barista_args,

sdk/mx.sdk/mx_sdk_benchmark.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -2712,6 +2712,7 @@ def __init__(self, custom_harness_command: mx_benchmark.CustomHarnessCommand = N
27122712
super().__init__(custom_harness_command)
27132713
self._version = None
27142714
self._context = None
2715+
self._extra_run_options = []
27152716

27162717
@property
27172718
def context(self):
@@ -2800,6 +2801,19 @@ def register_tracker(self, name, tracker_type):
28002801
if tracker_type in _baristaConfig["disable_trackers"]:
28012802
mx.log(f"Ignoring the registration of '{name}' tracker as it was disabled for {self.__class__.__name__}.")
28022803
return
2804+
if name == "energy":
2805+
if self.version() < "0.4.1":
2806+
mx.abort(
2807+
"The 'energy' tracker is not supported for barista benchmarks before Barista version '0.4.1'."
2808+
" Please update your Barista repository in order to use the 'energy' tracker! Aborting!"
2809+
)
2810+
# Allow for the baseline measurement before looking up the app process
2811+
self._extra_run_options += ["--cmd-app-prefix-init-timelimit", f"{tracker_type(self).baseline_duration + 5}"]
2812+
# Ensure that the workload is independent from the performance of the VM
2813+
# We want to track the energy needed for a set amount of work
2814+
self._extra_run_options += ["--startup-iteration-count", "0"]
2815+
self._extra_run_options += ["--warmup-iteration-count", "0"]
2816+
self._extra_run_options += ["--throughput-iteration-count", "0"]
28032817
super().register_tracker(name, tracker_type)
28042818

28052819
def createCommandLineArgs(self, benchmarks, bmSuiteArgs):
@@ -3033,7 +3047,7 @@ def produceHarnessCommand(self, cmd, suite):
30333047
jvm_vm_options = jvm_cmd[index_of_java_exe + 1:]
30343048

30353049
# Verify that the run arguments don't already contain a "--mode" option
3036-
run_args = suite.runArgs(suite.context.bmSuiteArgs)
3050+
run_args = suite.runArgs(suite.context.bmSuiteArgs) + suite._extra_run_options
30373051
mode_pattern = r"^(?:-m|--mode)(=.*)?$"
30383052
mode_match = self._regexFindInCommand(run_args, mode_pattern)
30393053
if mode_match:

substratevm/mx.substratevm/mx_substratevm_benchmark.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,10 @@ def _short_load_testing_phases(self):
394394
"--startup-iteration-count", "1",
395395
"--warmup-iteration-count", "1",
396396
"--warmup-duration", "5",
397-
"--throughput-iteration-count", "0",
398-
"--latency-iteration-count", "0",
397+
"--throughput-iteration-count", "1",
398+
"--throughput-duration", "5",
399+
"--latency-iteration-count", "1",
400+
"--latency-duration", "5",
399401
]
400402

401403
def _get_built_app_image(self, suite, stage):
@@ -439,6 +441,7 @@ def produceHarnessCommand(self, cmd, suite):
439441
# Make agent run short
440442
cmd += self._short_load_testing_phases()
441443
# Add explicit agent stage args
444+
cmd += suite._extra_run_options
442445
cmd += mx_sdk_benchmark.parse_prefixed_args("-Dnative-image.benchmark.extra-jvm-arg=", suite.context.bmSuiteArgs)
443446
cmd += mx_sdk_benchmark.parse_prefixed_args("-Dnative-image.benchmark.extra-agent-run-arg=", suite.context.bmSuiteArgs)
444447
return cmd
@@ -461,7 +464,7 @@ def produceHarnessCommand(self, cmd, suite):
461464
ni_barista_cmd = [suite.baristaHarnessPath(), "--mode", "native", "--app-executable", app_image]
462465
if barista_workload is not None:
463466
ni_barista_cmd.append(f"--config={barista_workload}")
464-
ni_barista_cmd += suite.runArgs(suite.context.bmSuiteArgs)
467+
ni_barista_cmd += suite.runArgs(suite.context.bmSuiteArgs) + suite._extra_run_options
465468
ni_barista_cmd += mx_sdk_benchmark.parse_prefixed_args("-Dnative-image.benchmark.extra-jvm-arg=", suite.context.bmSuiteArgs)
466469
if stage == mx_sdk_benchmark.Stage.INSTRUMENT_RUN:
467470
# Make instrument run short

0 commit comments

Comments
 (0)