Skip to content

Commit

Permalink
Print the sha1 of the profiles in benchmarks
Browse files Browse the repository at this point in the history
Also, use API flags in benchmarks.
  • Loading branch information
vjovanov committed Apr 13, 2023
1 parent f44073d commit 975fbe9
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions vm/mx.vm/mx_vm_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def __init__(self, vm, bm_suite, args):
self.config_dir = os.path.join(self.output_dir, 'config')
self.log_dir = self.output_dir
self.base_image_build_args = [os.path.join(vm.home(), 'bin', 'native-image')]
self.base_image_build_args += ['--no-fallback', '-H:Debug=2'] # GR-43934
self.base_image_build_args += ['--no-fallback', '-g']
self.base_image_build_args += ['-H:+VerifyGraalGraphs', '-H:+VerifyPhases', '--diagnostics-mode'] if vm.is_gate else []
self.base_image_build_args += ['-H:+ReportExceptionStackTraces']
self.base_image_build_args += bm_suite.build_assertions(self.benchmark_name, vm.is_gate)
Expand All @@ -193,7 +193,7 @@ def __init__(self, vm, bm_suite, args):
if vm.gc:
self.base_image_build_args += ['--gc=' + vm.gc, '-H:+SpawnIsolates']
if vm.native_architecture:
self.base_image_build_args += ['-H:+NativeArchitecture']
self.base_image_build_args += ['-march=native']
if vm.analysis_context_sensitivity:
self.base_image_build_args += ['-H:AnalysisContextSensitivity=' + vm.analysis_context_sensitivity, '-H:-RemoveSaturatedTypeFlows', '-H:+AliasArrayTypeFlows']
if vm.no_inlining_before_analysis:
Expand Down Expand Up @@ -848,7 +848,7 @@ def run_stage_agent(self, config, stages):
s.execute_command()

def run_stage_instrument_image(self, config, stages, out, i, instrumentation_image_name, image_path, image_path_latest, instrumented_iterations):
executable_name_args = ['-H:Name=' + instrumentation_image_name, '-H:+UseOldDebugInfo'] # GR-43934
executable_name_args = ['-H:Name=' + instrumentation_image_name]
pgo_args = ['--pgo=' + config.latest_profile_path]
pgo_args += ['-H:' + ('+' if self.pgo_context_sensitive else '-') + 'PGOContextSensitivityEnabled']
instrument_args = ['--pgo-instrument'] + ([] if i == 0 else pgo_args)
Expand Down Expand Up @@ -882,10 +882,13 @@ def run_stage_instrument_run(self, config, stages, image_path, profile_path):
s.execute_command()
if s.exit_code == 0:
mx.copyfile(profile_path, config.latest_profile_path)
self._ensureSamplesAreInProfile(profile_path)
print(f"Profile file {config.latest_profile_path} sha1 is {mx.sha1OfFile(config.latest_profile_path)}")
self._ensureSamplesAreInProfile(config.latest_profile_path)
else:
print(f"Profile file {config.latest_profile_path} not dumped. Instrument run failed with exit code {s.exit_code}")

def run_stage_image(self, config, stages):
executable_name_args = ['-H:Name=' + config.final_image_name, '-H:+UseOldDebugInfo'] # GR-43934
executable_name_args = ['-H:Name=' + config.final_image_name]
pgo_args = ['--pgo=' + config.latest_profile_path]
pgo_args += ['-H:' + ('+' if self.pgo_context_sensitive else '-') + 'PGOContextSensitivityEnabled']
instrumented_iterations = self.pgo_instrumented_iterations if config.pgo_iteration_num is None else int(config.pgo_iteration_num)
Expand Down Expand Up @@ -939,7 +942,7 @@ def run_java(self, args, out=None, err=None, cwd=None, nonZeroIsFatal=False):
return super(NativeImageVM, self).run_java(args, out=out, err=err, cwd=cwd, nonZeroIsFatal=nonZeroIsFatal)

if self.bmSuite is None:
mx.abort("Benchmark suite was not registed.")
mx.abort("Benchmark suite was not registered.")

if not callable(getattr(self.bmSuite, "run_stage", None)):
mx.abort("Benchmark suite is not a NativeImageMixin.")
Expand Down

0 comments on commit 975fbe9

Please sign in to comment.