From 92cea858d608b5fb9bdd688198ba2e0b80bcc0ce Mon Sep 17 00:00:00 2001 From: Milan Cugurovic Date: Fri, 7 Nov 2025 12:26:26 +0100 Subject: [PATCH] Support the profile-inference-call-count-{conservative,aggressive}-ee JVM configs. --- sdk/mx.sdk/mx_sdk_benchmark.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/sdk/mx.sdk/mx_sdk_benchmark.py b/sdk/mx.sdk/mx_sdk_benchmark.py index 19d3564e688c..c47b2c730310 100644 --- a/sdk/mx.sdk/mx_sdk_benchmark.py +++ b/sdk/mx.sdk/mx_sdk_benchmark.py @@ -888,6 +888,7 @@ def __init__(self, name, config_name, extra_java_args=None, extra_launcher_args= self.profile_inference_call_count = False self.force_profile_inference = False self.profile_inference_debug = False + self.ml_callcount_threshold = None self.analysis_context_sensitivity = None self.optimization_level = None self._configure_comma_separated_configs(config_name) @@ -972,7 +973,15 @@ def config_name(self): if self.profile_inference_feature_extraction is True: config += ["profile-inference-feature-extraction"] if self.profile_inference_call_count is True: - config += ["profile-inference-call-count"] + if self.ml_callcount_threshold is not None: + if self.ml_callcount_threshold == 0.1: + config += ["profile-inference-call-count", 'conservative'] + elif self.ml_callcount_threshold == 0.7: + config += ["profile-inference-call-count", 'aggressive'] + else: + mx.abort(f"Unsupported ml_callcount_threshold value: {self.ml_callcount_threshold}. Allowed values are 0.1 (conservative) or 0.7 (aggressive).") + else: + config += ["profile-inference-call-count"] if self.pgo_instrumentation is True and self.force_profile_inference is True: if self.pgo_exclude_conditional is True: config += ["profile-inference-pgo"] @@ -1008,7 +1017,8 @@ def _configure_from_name(self, config_name): r'(?Pfuture-defaults-all-)?(?Pgate-)?(?Pupx-)?(?Pquickbuild-)?(?Pg1gc-)?' \ r'(?Pllvm-)?(?Ppgo-|pgo-sampler-|pgo-perf-sampler-invoke-multiple-|pgo-perf-sampler-invoke-|pgo-perf-sampler-)?(?Pinline-)?' \ r'(?Pinsens-|allocsens-|1obj-|2obj1h-|3obj2h-|4obj3h-)?(?Pjdk-profiles-collect-|adopted-jdk-pgo-)?' \ - r'(?Pprofile-inference-feature-extraction-|profile-inference-call-count-|profile-inference-pgo-|profile-inference-debug-)?(?Psafepoint-sampler-|async-sampler-)?(?PO0-|O1-|O2-|O3-|Os-)?(default-)?(?Pce-|ee-)?$' + r'(?Pprofile-inference-feature-extraction-|profile-inference-call-count-|profile-inference-call-count-conservative-|profile-inference-call-count-aggressive-|profile-inference-pgo-|profile-inference-debug-)?' \ + r'(?Psafepoint-sampler-|async-sampler-)?(?PO0-|O1-|O2-|O3-|Os-)?(default-)?(?Pce-|ee-)?$' mx.logv(f"== Registering configuration: {config_name}") match_name = f"{config_name}-" # adding trailing dash to simplify the regex @@ -1156,6 +1166,12 @@ def generate_profiling_package_prefixes(): self.pgo_instrumentation = True # extract code features elif profile_inference_config == 'profile-inference-call-count': self.profile_inference_call_count = True + elif profile_inference_config == 'profile-inference-call-count-conservative': + self.profile_inference_call_count = True + self.ml_callcount_threshold = 0.1 + elif profile_inference_config == 'profile-inference-call-count-aggressive': + self.profile_inference_call_count = True + self.ml_callcount_threshold = 0.7 elif profile_inference_config == "profile-inference-pgo": # We need to run instrumentation as the profile-inference-pgo JVM config requires dynamically collected # profiles to combine with the ML-inferred branch probabilities. @@ -1832,6 +1848,8 @@ def run_stage_image(self): dump_file_flag)) elif self.profile_inference_call_count: ml_args = svm_experimental_options(['-H:+MLCallCountProfileInference']) + if self.ml_callcount_threshold is not None: + ml_args += svm_experimental_options([f'-H:MLCallCountProfileInferenceClassificationThreshold={self.ml_callcount_threshold:.2f}']) elif self.force_profile_inference: ml_args = svm_experimental_options(['-H:+MLGraphFeaturesExtraction', '-H:+MLProfileInference']) else: