-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
gh-127389 - fix 'Uops Executed' display in summarize_stats.py #127396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 4 commits
6645fb5
152a74a
c336e18
21b8c83
de807d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,7 @@ | |
|
|
||
|
|
||
| TOTAL = "specialization.hit", "specialization.miss", "execution_count" | ||
| UOPS_EXECUTED_LABEL = "Uops executed" | ||
|
|
||
|
|
||
| def pretty(name: str) -> str: | ||
|
|
@@ -313,7 +314,7 @@ def kind_to_text(kind: int, opcode: str): | |
| def is_specializable(self, opcode: str) -> bool: | ||
| return "specializable" in self._get_stats_for_opcode(opcode) | ||
|
|
||
| def get_specialized_total_counts(self) -> tuple[int, int, int]: | ||
| def get_specialized_total_counts(self) -> tuple[int, int, int, int]: | ||
| basic = 0 | ||
| specialized_hits = 0 | ||
| specialized_misses = 0 | ||
|
|
@@ -442,7 +443,7 @@ def get_gc_stats(self) -> list[dict[str, int]]: | |
| gc_stats[gen_n][name] = value | ||
| return gc_stats | ||
|
|
||
| def get_optimization_stats(self) -> dict[str, tuple[int, int | None]]: | ||
| def get_optimization_stats(self) -> dict[Doc, tuple[int, int | None]]: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is also unrelated, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe it is related, as the fix for the issue is to treat the value returned from this function as a doc and not a str, so it makes the patch clearer |
||
| if "Optimization attempts" not in self._data: | ||
| return {} | ||
|
|
||
|
|
@@ -507,15 +508,15 @@ def get_optimization_stats(self) -> dict[str, tuple[int, int | None]]: | |
| None, | ||
| ), | ||
| Doc( | ||
| "Uops executed", | ||
| UOPS_EXECUTED_LABEL, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why? It only had two uses. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the code to work correctly the 2 instances must match - its not just any string, its used as an identifier. Is there any con in moving to a const? |
||
| "The total number of uops (micro-operations) that were executed", | ||
| ): ( | ||
| uops, | ||
| executed, | ||
| ), | ||
| } | ||
|
|
||
| def get_optimizer_stats(self) -> dict[str, tuple[int, int | None]]: | ||
| def get_optimizer_stats(self) -> dict[Doc, tuple[int, int | None]]: | ||
| attempts = self._data["Optimization optimizer attempts"] | ||
| successes = self._data["Optimization optimizer successes"] | ||
| no_memory = self._data["Optimization optimizer failure no memory"] | ||
|
|
@@ -1140,14 +1141,13 @@ def calc_gc_stats(stats: Stats) -> Rows: | |
| def optimization_section() -> Section: | ||
| def calc_optimization_table(stats: Stats) -> Rows: | ||
| optimization_stats = stats.get_optimization_stats() | ||
|
|
||
| return [ | ||
| ( | ||
| label, | ||
| doc, | ||
| Count(value), | ||
| Ratio(value, den, percentage=label != "Uops executed"), | ||
| Ratio(value, den, percentage=doc.text != UOPS_EXECUTED_LABEL), | ||
| ) | ||
| for label, (value, den) in optimization_stats.items() | ||
| for doc, (value, den) in optimization_stats.items() | ||
| ] | ||
|
|
||
| def calc_optimizer_table(stats: Stats) -> Rows: | ||
|
|
@@ -1264,7 +1264,7 @@ def iter_optimization_tables(base_stats: Stats, head_stats: Stats | None = None) | |
|
|
||
|
|
||
| def rare_event_section() -> Section: | ||
| def calc_rare_event_table(stats: Stats) -> Table: | ||
| def calc_rare_event_table(stats: Stats) -> Rows: | ||
| DOCS = { | ||
| "set class": "Setting an object's class, `obj.__class__ = ...`", | ||
| "set bases": "Setting the bases of a class, `cls.__bases__ = ...`", | ||
|
|
@@ -1395,7 +1395,7 @@ def to_markdown(x): | |
| print("Stats gathered on:", date.today(), file=out) | ||
|
|
||
|
|
||
| def output_stats(inputs: list[Path], json_output=str | None): | ||
| def output_stats(inputs: list[Path], json_output: str | None): | ||
| match len(inputs): | ||
| case 1: | ||
| data = load_raw_data(Path(inputs[0])) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.