Skip to content

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Tools/scripts/summarize_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@


TOTAL = "specialization.hit", "specialization.miss", "execution_count"
UOPS_EXECUTED_LABEL = "Uops executed"


def pretty(name: str) -> str:
Expand Down Expand Up @@ -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]]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also unrelated, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 {}

Expand Down Expand Up @@ -507,7 +508,7 @@ def get_optimization_stats(self) -> dict[str, tuple[int, int | None]]:
None,
),
Doc(
"Uops executed",
UOPS_EXECUTED_LABEL,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? It only had two uses.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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,
Expand Down Expand Up @@ -1143,11 +1144,11 @@ def calc_optimization_table(stats: Stats) -> Rows:

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:
Expand Down
Loading