Skip to content

[GR-63032] [GR-61454] Enable using the 'energy' tracker on Barista #11127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/ci/ci_common/benchmark-suites.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@

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 + {
suite:: suite_name,
local barista_version = "v0.3.4",
local barista_version = "v0.4.1",
local suite_version_args = if suite_version != null then ["--bench-suite-version=" + suite_version] else [],
local prefix_barista_arg = if std.length(cmd_app_prefix) > 0 then [std.format("--cmd-app-prefix=%s", std.join(" ", cmd_app_prefix))] else [],
local all_barista_args = prefix_barista_arg + non_prefix_barista_args,
Expand Down
16 changes: 15 additions & 1 deletion sdk/mx.sdk/mx_sdk_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -2711,6 +2711,7 @@ def __init__(self, custom_harness_command: mx_benchmark.CustomHarnessCommand = N
super().__init__(custom_harness_command)
self._version = None
self._context = None
self._extra_run_options = []

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

def createCommandLineArgs(self, benchmarks, bmSuiteArgs):
Expand Down Expand Up @@ -3024,7 +3038,7 @@ def produceHarnessCommand(self, cmd, suite):
jvm_vm_options = jvm_cmd[index_of_java_exe + 1:]

# Verify that the run arguments don't already contain a "--mode" option
run_args = suite.runArgs(suite.context.bmSuiteArgs)
run_args = suite.runArgs(suite.context.bmSuiteArgs) + suite._extra_run_options
mode_pattern = r"^(?:-m|--mode)(=.*)?$"
mode_match = self._regexFindInCommand(run_args, mode_pattern)
if mode_match:
Expand Down
9 changes: 6 additions & 3 deletions substratevm/mx.substratevm/mx_substratevm_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,10 @@ def _short_load_testing_phases(self):
"--startup-iteration-count", "1",
"--warmup-iteration-count", "1",
"--warmup-duration", "5",
"--throughput-iteration-count", "0",
"--latency-iteration-count", "0",
"--throughput-iteration-count", "1",
"--throughput-duration", "5",
"--latency-iteration-count", "1",
"--latency-duration", "5",
]

def _get_built_app_image(self, suite, stage):
Expand Down Expand Up @@ -439,6 +441,7 @@ def produceHarnessCommand(self, cmd, suite):
# Make agent run short
cmd += self._short_load_testing_phases()
# Add explicit agent stage args
cmd += suite._extra_run_options
cmd += mx_sdk_benchmark.parse_prefixed_args("-Dnative-image.benchmark.extra-jvm-arg=", suite.context.bmSuiteArgs)
cmd += mx_sdk_benchmark.parse_prefixed_args("-Dnative-image.benchmark.extra-agent-run-arg=", suite.context.bmSuiteArgs)
return cmd
Expand All @@ -461,7 +464,7 @@ def produceHarnessCommand(self, cmd, suite):
ni_barista_cmd = [suite.baristaHarnessPath(), "--mode", "native", "--app-executable", app_image]
if barista_workload is not None:
ni_barista_cmd.append(f"--config={barista_workload}")
ni_barista_cmd += suite.runArgs(suite.context.bmSuiteArgs)
ni_barista_cmd += suite.runArgs(suite.context.bmSuiteArgs) + suite._extra_run_options
ni_barista_cmd += mx_sdk_benchmark.parse_prefixed_args("-Dnative-image.benchmark.extra-jvm-arg=", suite.context.bmSuiteArgs)
if stage == mx_sdk_benchmark.Stage.INSTRUMENT_RUN:
# Make instrument run short
Expand Down
Loading