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

transformations: (eqsat) add pass to convert non-eclass functions to eclass #3189

Merged
merged 6 commits into from
Oct 21, 2024

Conversation

jianyicheng
Copy link
Collaborator

This PR addresses #3170:

  • Added initial front end pass eqsat-create-eclasses for the minimal example
  • Added an initial test case for the pass

@jianyicheng jianyicheng added the transformations Changes or adds a transformatio label Sep 18, 2024
@jianyicheng jianyicheng self-assigned this Sep 18, 2024
Comment on lines 3 to 9
func.func @test(%x : index) -> (index) {
%c2 = arith.constant 2 : index
%res = arith.muli %x, %c2 : index
func.return %res : index
}

// CHECK: Error while applying pattern: Ops with non-single results not handled
Copy link
Member

Choose a reason for hiding this comment

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

Oh interesting, I forgot about function returns, they seem useful enough to have from the get-go, could you please change the check to rather be len(results) > 1? I would then recommend using the test dialect in filecheck, to make sure we're testing exactly what we mean to test:

Suggested change
func.func @test(%x : index) -> (index) {
%c2 = arith.constant 2 : index
%res = arith.muli %x, %c2 : index
func.return %res : index
}
// CHECK: Error while applying pattern: Ops with non-single results not handled
func.func @test(%x : index) -> (index) {
%r0, %r1 = "test.op"() : () -> (index, index)
}
// CHECK: Error while applying pattern: Only single-result operations can be converted to eclasses, got 2 results

(I also changed the message do include the length of the results, should hopefully help debug this in the future)

Copy link
Member

@superlopuh superlopuh left a comment

Choose a reason for hiding this comment

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

Could you please add a test with a successful transform also?

Copy link

codecov bot commented Oct 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.04%. Comparing base (364be97) to head (884a4e0).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3189   +/-   ##
=======================================
  Coverage   90.03%   90.04%           
=======================================
  Files         445      446    +1     
  Lines       56205    56239   +34     
  Branches     5399     5403    +4     
=======================================
+ Hits        50606    50639   +33     
+ Misses       4180     4177    -3     
- Partials     1419     1423    +4     

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

Copy link
Member

@superlopuh superlopuh left a comment

Choose a reason for hiding this comment

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

Perfect, thank you!

@jianyicheng jianyicheng merged commit 002fc52 into main Oct 21, 2024
14 checks passed
@jianyicheng jianyicheng deleted the jianyi/eqsat/frontend branch October 21, 2024 16:40
EdmundGoodman pushed a commit to EdmundGoodman/xdsl that referenced this pull request Dec 6, 2024
…eclass (xdslproject#3189)

This PR addresses xdslproject#3170:

- [x] Added initial front end pass `eqsat-create-eclasses` for the
minimal example
- [x] Added an initial test case for the pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
transformations Changes or adds a transformatio
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants