Skip to content

Commit a589d16

Browse files
author
Andrija Kolic
committed
[GR-65089] Set the current bench stage for fallback mode benchmarks
PullRequest: graal/20850
2 parents 24dc829 + 888cbb0 commit a589d16

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

sdk/mx.sdk/mx_sdk_benchmark.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,25 +1608,31 @@ def fullname(cls):
16081608
assert not self.stages_info.failed, "In case of a failed benchmark, no further calls into the VM should be made"
16091609
assert self.stages_info.vm_used_for_stages == self, f"VM used to prepare stages ({self.stages_info.vm_used_for_stages}) cannot be different from the VM used to run the suite ({self})!"
16101610

1611-
self.config = NativeImageBenchmarkConfig(self, self.bmSuite, args)
1612-
self.stages = StagesContext(self, out, err, True if self.is_gate else nonZeroIsFatal,
1613-
os.path.abspath(cwd if cwd else os.getcwd()))
1614-
1615-
self.config.output_dir.mkdir(parents=True, exist_ok=True)
1616-
self.config.config_dir.mkdir(parents=True, exist_ok=True)
1617-
16181611
if self.stages_info.fallback_mode:
16191612
# In fallback mode, we have to run all requested stages in the same `run_java` invocation.
16201613
# We simply emulate the dispatching of the individual stages as in `NativeImageBenchmarkMixin.intercept_run`
1614+
first_stage = True
16211615
while self.stages_info.has_next_stage():
16221616
self.stages_info.next_stage()
1617+
if first_stage:
1618+
self._prepare_for_running(args, out, err, cwd, nonZeroIsFatal)
1619+
first_stage = False
16231620
self.run_single_stage()
16241621
else:
1622+
self._prepare_for_running(args, out, err, cwd, nonZeroIsFatal)
16251623
self.run_single_stage()
16261624

16271625
if self.stages_info.failed:
16281626
mx.abort('Exiting the benchmark due to the failure.')
16291627

1628+
def _prepare_for_running(self, args, out, err, cwd, nonZeroIsFatal):
1629+
"""Initialize the objects and directories necessary for stage running."""
1630+
self.config = NativeImageBenchmarkConfig(self, self.bmSuite, args)
1631+
self.stages = StagesContext(self, out, err, True if self.is_gate else nonZeroIsFatal,
1632+
os.path.abspath(cwd if cwd else os.getcwd()))
1633+
self.config.output_dir.mkdir(parents=True, exist_ok=True)
1634+
self.config.config_dir.mkdir(parents=True, exist_ok=True)
1635+
16301636
def get_stage_runner(self) -> StageRunner:
16311637
return StageRunner(self.stages)
16321638

0 commit comments

Comments
 (0)