Skip to content

Commit

Permalink
[GR-58116] Filter JsonArrayRule datapoints, expand VmBenchmarkSuite i…
Browse files Browse the repository at this point in the history
…nterface to support parsing NI barista suite commands

PullRequest: mx/1845
  • Loading branch information
Andrija Kolic committed Oct 16, 2024
2 parents 1653fa4 + 2972efc commit aebcb43
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
18 changes: 9 additions & 9 deletions common.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"Jsonnet files should not include this file directly but use ci/common.jsonnet instead."
],

"mx_version": "7.32.2",
"mx_version": "7.33.0",

"COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet",
"jdks": {
"galahad-jdk": {"name": "jpg-jdk", "version": "24", "build_id": "jdk-24+18-2013", "platformspecific": true, "extrabundles": ["static-libs"]},
"galahad-jdk": {"name": "jpg-jdk", "version": "24", "build_id": "jdk-24+19-2105", "platformspecific": true, "extrabundles": ["static-libs"]},

"oraclejdk17": {"name": "jpg-jdk", "version": "17.0.7", "build_id": "jdk-17.0.7+8", "platformspecific": true, "extrabundles": ["static-libs"]},
"labsjdk-ce-17": {"name": "labsjdk", "version": "ce-17.0.7+4-jvmci-23.1-b02", "platformspecific": true },
Expand Down Expand Up @@ -45,13 +45,13 @@

"oraclejdk23": {"name": "jpg-jdk", "version": "23", "build_id": "jdk-23+37", "platformspecific": true, "extrabundles": ["static-libs"]},

"oraclejdk-latest": {"name": "jpg-jdk", "version": "24", "build_id": "jdk-24+18", "platformspecific": true, "extrabundles": ["static-libs"]},
"labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-24+18-jvmci-b01", "platformspecific": true },
"labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-24+18-jvmci-b01-debug", "platformspecific": true },
"labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-24+18-jvmci-b01-sulong", "platformspecific": true },
"labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-24+18-jvmci-b01", "platformspecific": true },
"labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-24+18-jvmci-b01-debug", "platformspecific": true },
"labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-24+18-jvmci-b01-sulong", "platformspecific": true }
"oraclejdk-latest": {"name": "jpg-jdk", "version": "24", "build_id": "jdk-24+19", "platformspecific": true, "extrabundles": ["static-libs"]},
"labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-24+19-jvmci-b01", "platformspecific": true },
"labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-24+19-jvmci-b01-debug", "platformspecific": true },
"labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-24+19-jvmci-b01-sulong", "platformspecific": true },
"labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-24+19-jvmci-b01", "platformspecific": true },
"labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-24+19-jvmci-b01-debug", "platformspecific": true },
"labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-24+19-jvmci-b01-sulong", "platformspecific": true }
},

"eclipse": {
Expand Down
2 changes: 1 addition & 1 deletion src/mx/_impl/mx.py
Original file line number Diff line number Diff line change
Expand Up @@ -18215,7 +18215,7 @@ def alarm_handler(signum, frame):
_CACHE_DIR = get_env('MX_CACHE_DIR', join(dot_mx_dir(), 'cache'))

# The version must be updated for every PR (checked in CI) and the comment should reflect the PR's issue
version = VersionSpec("7.33.0") # [GR-58951] Do not automatically export JVMCI packages
version = VersionSpec("7.33.1") # [GR-58116] Filter out incomplete JsonArrayRule datapoints, add all_command_line_args_are_vm_args to VmBenchmarkSuite

_mx_start_datetime = datetime.utcnow()

Expand Down
19 changes: 15 additions & 4 deletions src/mx/_impl/mx_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ class JsonArrayRule(JsonBaseRule):
"data": [[1, 2, 3], [4, 5, 6], [7, 8]]
}
"""
def __init__(self, replacement, keys: Collection[str], indexer_str: str = ".", list_to_flat_dict_converter: Callable[Dict[str, List]] = element_wise_product_converter):
def __init__(self, replacement, keys: Collection[str], indexer_str: str = ".", list_to_flat_dict_converter: Callable[[Dict[str, List]], List[Dict[str, str]]] = element_wise_product_converter):
"""
:param list_to_flat_dict_converter: Function that converts a dictionary of list values into a list of flat dictionaries,
defaults to `element_wise_product_converter`.
Expand All @@ -1229,7 +1229,10 @@ def resolve_keys(self, json_obj: dict) -> List[Dict[str, str]]:
"""
# The resolve_keys method of JsonBaseRule always returns a list of one dictionary
values = super().resolve_keys(json_obj)[0]
return self.list_to_flat_dict_converter(values)
flat_dict_list = self.list_to_flat_dict_converter(values)
# Filter out any dicts that do not contain a value for every key
filtered_flat_dict_list = list(filter(lambda flat_dict: all(key in flat_dict for key in self.keys), flat_dict_list))
return filtered_flat_dict_list

def resolve_key(self, json_obj: dict, key: str) -> List[str]:
"""Resolve a key and extract the corresponding value(s) from the json object.
Expand Down Expand Up @@ -1263,7 +1266,7 @@ def resolve_key(self, json_obj: dict, key: str) -> List[str]:
class JsonArrayStdOutFileRule(JsonArrayRule):
"""Rule that looks for JSON file names in the output of the benchmark."""

def __init__(self, pattern, match_name, replacement, keys, indexer_str: str = ".", list_to_flat_dict_converter: Callable[Dict[str, List]] = element_wise_product_converter):
def __init__(self, pattern, match_name, replacement, keys, indexer_str: str = ".", list_to_flat_dict_converter: Callable[[Dict[str, List]], List[Dict[str, str]]] = element_wise_product_converter):
super().__init__(replacement, keys, indexer_str, list_to_flat_dict_converter)
self.pattern = pattern
self.match_name = match_name
Expand All @@ -1275,7 +1278,7 @@ def getJsonFiles(self, text):
class JsonArrayFixedFileRule(JsonArrayRule):
"""Rule that parses a JSON file with a predefined name."""

def __init__(self, filename, replacement, keys, indexer_str: str = ".", list_to_flat_dict_converter: Callable[Dict[str, List]] = element_wise_product_converter):
def __init__(self, filename, replacement, keys, indexer_str: str = ".", list_to_flat_dict_converter: Callable[[Dict[str, List]], List[Dict[str, str]]] = element_wise_product_converter):
super().__init__(replacement, keys, indexer_str, list_to_flat_dict_converter)
self.filename = filename

Expand Down Expand Up @@ -1694,6 +1697,14 @@ def createVmCommandLineArgs(self, benchmarks, runArgs):
"""
raise NotImplementedError()

def all_command_line_args_are_vm_args(self):
"""Denotes if the arguments returned by ``createCommandLineArgs`` contain just VM arguments.
Useful for ``CustomHarnessBenchmarkSuite`` suites that perform command line manipulation at the very end,
and only provide VM arguments to the VM.
"""
return False

def setupProfilers(self, benchmarks, bmSuiteArgs):
if self.profilerNames(bmSuiteArgs) is not None:
for profilerName in self.profilerNames(bmSuiteArgs).split(','):
Expand Down

0 comments on commit aebcb43

Please sign in to comment.