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

Add RVSDG subst functions #41

Merged
merged 5 commits into from
Sep 29, 2023
Merged

Add RVSDG subst functions #41

merged 5 commits into from
Sep 29, 2023

Conversation

rtjoa
Copy link
Collaborator

@rtjoa rtjoa commented Sep 28, 2023

Summary

Adds the following functions, for use in writing passes over RVSDG

;;                   e  [ x -> v ]
(function SubstExpr (Expr i64 Operand) Expr)
(function SubstOperand (Operand i64 Operand) Operand)
(function SubstBody (Body i64 Operand) Body)
(function SubstVecOperand (VecOperand i64 Operand) VecOperand)
(function SubstVecVecOperand (VecVecOperand i64 Operand) VecVecOperand)

Updated the egglog revision we depend on as this feature relies on vec-set: egraphs-good/egglog#239

Testing

Added tests to src/rvsdg/tests.rs

@rtjoa rtjoa marked this pull request as ready for review September 28, 2023 23:33
Copy link
Member

@oflatt oflatt left a comment

Choose a reason for hiding this comment

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

Requested some changes, this is very close to what we want!

src/rvsdg/schema.egg Show resolved Hide resolved
)
(
(union (SubstVecVecOperandHelper (VVO vec) x v i) (VVO vec))
))

Copy link
Member

Choose a reason for hiding this comment

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

Can you add a ruleset for the subst rules to make it more usable?
I'd also like the existing egglog encoding to run this ruleset to saturation in-between runs of the normal ruleset.

Copy link
Collaborator Author

@rtjoa rtjoa Sep 29, 2023

Choose a reason for hiding this comment

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

Added all rules to the subst ruleset, added the existing rules to constant-fold +/* to the cfold ruleset, and made the schedule the following:

let schedule = format!("(run-schedule (repeat {} cfold (saturate subst)))", self.num_iters);```

src/rvsdg/schema.egg Show resolved Hide resolved
@rtjoa rtjoa requested a review from oflatt September 29, 2023 20:08
Copy link
Member

@oflatt oflatt left a comment

Choose a reason for hiding this comment

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

good job!

@oflatt oflatt merged commit 9350796 into egraphs-good:main Sep 29, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants