Skip to content

Commit aa1f8a3

Browse files
committed
Add dynamic extra iterations to ensure average of a steady state
1 parent 98dac2d commit aa1f8a3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

mx.graalpython/mx_graalpython_benchmark.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,9 @@ def rules(self, output, benchmarks, bm_suite_args):
375375
]
376376

377377
def runAndReturnStdOut(self, benchmarks, bmSuiteArgs):
378-
# host-vm rewrite rules
379378
ret_code, out, dims = super(PythonBenchmarkSuite, self).runAndReturnStdOut(benchmarks, bmSuiteArgs)
380379

380+
# host-vm rewrite rules
381381
def _replace_host_vm(key):
382382
host_vm = dims.get("host-vm")
383383
if host_vm and host_vm.startswith(key):
@@ -450,10 +450,20 @@ def createVmCommandLineArgs(self, benchmarks, bmSuiteArgs):
450450

451451
if "-i" not in run_args:
452452
run_args += self._benchmarks[benchmark]
453+
num_iterations = self.defaultIterations(benchmark) + self.getExtraIterationCount(self.defaultIterations(benchmark))
454+
run_args[run_args.index("-i") + 1] = str(num_iterations)
453455
vm_options, run_args = self.postprocess_run_args(run_args)
454456
cmd_args.extend(run_args)
455457
return vm_options + vm_args + cmd_args
456458

459+
def defaultIterations(self, bm):
460+
default_bench_args = self._benchmarks[bm]
461+
if "-i" in default_bench_args:
462+
bench_idx = default_bench_args.index("-i")
463+
if bench_idx + 1 < len(default_bench_args):
464+
return int(default_bench_args[bench_idx + 1])
465+
return DEFAULT_ITERATIONS
466+
457467
def benchmarkList(self, bm_suite_args):
458468
return list(self._benchmarks.keys())
459469

0 commit comments

Comments
 (0)