Skip to content
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

bench: pattern rewriting microbenchmarks #4079

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

EdmundGoodman
Copy link
Collaborator

Add microbenchmarks for pattern rewriting. Using pyinstrument, we can get a breakdown of the worst offending functions (shown below, with sections collapsed to highlight the interesting bits)

image

From this, we write a number of microbenchmarks to exercise these bottlenecking functions for pattern rewriting in general and the RemoveUnusedOperations, CanonicalizationRewritePattern, and region_dce functions of constant folding.

Peeled off from tracking PR #4008.

@EdmundGoodman EdmundGoodman added the bench Benchmark related changes label Mar 19, 2025
@EdmundGoodman EdmundGoodman self-assigned this Mar 19, 2025
Copy link

codecov bot commented Mar 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.04%. Comparing base (d26edcd) to head (e4fa184).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4079      +/-   ##
==========================================
- Coverage   89.05%   89.04%   -0.01%     
==========================================
  Files         318      318              
  Lines       43407    43405       -2     
  Branches     5408     5408              
==========================================
- Hits        38655    38652       -3     
- Misses       3408     3409       +1     
  Partials     1344     1344              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


def time_insert_point_before(self) -> None:
"""Time `InsertPoint.before`."""
InsertPoint.before(self.add_op)
Copy link
Member

Choose a reason for hiding this comment

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

this doesn't do anything

Copy link
Collaborator

@compor compor left a comment

Choose a reason for hiding this comment

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

Does this give "self" time/percentage similar to gprof for example?

Comment on lines +54 to +56
WORKLOAD_CONSTANT_20 = parse_module(CTX, WorkloadBuilder.constant_folding(20))
WORKLOAD_CONSTANT_100 = parse_module(CTX, WorkloadBuilder.constant_folding(100))
WORKLOAD_CONSTANT_1000 = parse_module(CTX, WorkloadBuilder.constant_folding(1_000))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this have to be hardcoded here? Can it be dynamic (i.e., configured as such down in main?).
I have the feeling that I've asked about this before, but I might be wrong :)

integer_type: IntegerType

def setup(self) -> None:
"""Setup the benchmarks."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would you mind adding the sketch for this IR is some sort of pseudocode?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bench Benchmark related changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants