-
Notifications
You must be signed in to change notification settings - Fork 13
Add ability to create custom model and pass them in to extract #357
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
Conversation
CodSpeed Instrumentation Performance ReportMerging #357 will degrade performances by 17.08%Comparing Summary
Benchmarks breakdown
|
|
@codex can you review this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for user-defined cost models in Python by implementing custom extractors that can use Python functions to determine extraction costs. The change enables users to define cost models as Python callable protocols that take an egraph, expression, and children costs, returning the total cost for extraction.
Key changes:
- Implement custom cost model infrastructure with
CostModelprotocol andExtractorclass - Add
Valuetype to bindings for representing egglog values - Simplify
TermDagimplementation using tuple struct pattern
Reviewed Changes
Copilot reviewed 26 out of 27 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/extract.rs | New module implementing custom cost models and extractors with Python bindings |
| src/egraph.rs | Add Value type and value conversion methods for different egglog sorts |
| src/termdag.rs | Refactor to use tuple struct pattern and remove redundant From implementations |
| python/egglog/egraph.py | Add cost model protocols, extraction overloads, and default/greedy cost models |
| python/egglog/declarations.py | Add GetCostDecl and ValueDecl expression types for cost model support |
Comments suppressed due to low confidence (1)
src/egraph.rs:1
- Debug print statement should be removed or converted to proper logging.
// Wrapper around EGraph type
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
|
@actions-user changelog |
This PR closes #241 by adding support for custom models in Python.