Skip to content

Commit 1da3e87

Browse files
committed
final
Signed-off-by: Yang Wang <[email protected]>
1 parent 3b4047f commit 1da3e87

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

.ci/scripts/benchmark_tooling/get_benchmark_analysis_data.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
"iphone": "ip",
6969
"xnnpackq8": "xnnq8",
7070
}
71-
7271
def abbreviate(s):
7372
for full, abbr in ABBREVIATIONS.items():
7473
s = s.replace(full, abbr)
@@ -205,7 +204,6 @@ def run(
205204
end_time: ISO8601 formatted end time (YYYY-MM-DDTHH:MM:SS)
206205
privateDeviceMatchings: List of keyword lists for matching private devices
207206
publicDeviceMatchings: List of keyword lists for matching public devices
208-
209207
Returns:
210208
Tuple containing (private_device_results, public_device_results)
211209
"""
@@ -369,6 +367,10 @@ def print_all_names(self) -> None:
369367
for name in private_ones:
370368
logging.info(name)
371369

370+
def _generate_table_name(self, group_info:dict, fields: list[str]) -> str:
371+
name = "|".join(group_info[k] for k in fields if k in group_info and group_info[k])
372+
return self.normalize_string(name)
373+
372374
def _process(self, data: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
373375
"""
374376
Process raw benchmark data.
@@ -386,16 +388,15 @@ def _process(self, data: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
386388
Processed benchmark data
387389
"""
388390
for item in data:
389-
group = item.get("groupInfo", {})
391+
# normalized string values in groupInfo
390392
item["groupInfo"] = {
391393
k: self.normalize_string(v)
392-
for k, v in group.items()
394+
for k, v in item.get("groupInfo", {}).items()
393395
if v is not None and isinstance(v, str)
394396
}
395-
name = (
396-
f"{group['model']}|{group['backend']}|{group['device']}|{group['arch']}"
397-
)
398-
name = self.normalize_string(name)
397+
group = item.get("groupInfo", {})
398+
name = self._generate_table_name(group, self.query_group_table_by_fields)
399+
399400
# Add full name joined by the group key fields
400401
item["table_name"] = name
401402

@@ -404,7 +405,7 @@ def _process(self, data: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
404405
item["groupInfo"]["aws_type"] = "private"
405406
else:
406407
item["groupInfo"]["aws_type"] = "public"
407-
# Sort by table name
408+
408409
data.sort(key=lambda x: x["table_name"])
409410
logging.info(f"fetched {len(data)} table views")
410411
return data
@@ -458,12 +459,13 @@ def find_target_tables(self, keywords, is_private) -> List[Any]:
458459
item.get("groupInfo", {}).get("aws_type", "") == "private"
459460
)
460461
if is_private is not is_item_private:
461-
continue
462+
continue # skip if not matching private/public device
463+
464+
# generate short name for each table data
462465
item["short_name"] = self.generate_short_name(
463466
norm_keywords, len(match)
464467
)
465468
match.append(key)
466-
# avoid duplicates
467469
results[key] = item
468470
matchings.append((keyword_list, match))
469471
if not self.disable_logging:

0 commit comments

Comments
 (0)