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

Print new top level expressions to human-readable rule trace #568

Merged
merged 4 commits into from
Jan 8, 2025

Conversation

niklasdewally
Copy link
Collaborator

@niklasdewally niklasdewally commented Jan 6, 2025

  • fix(rewrite_naive): remove duplicate log print for rule application
  • rewriter: log new top level vars to human rule trace

@niklasdewally niklasdewally self-assigned this Jan 6, 2025
@niklasdewally niklasdewally marked this pull request as draft January 6, 2025 12:50
@niklasdewally niklasdewally force-pushed the nik/pr/print-top-level-exprs branch 2 times, most recently from 111551d to d7f3d95 Compare January 6, 2025 12:57
@niklasdewally niklasdewally marked this pull request as ready for review January 6, 2025 12:58
@niklasdewally niklasdewally force-pushed the nik/pr/print-top-level-exprs branch from d7f3d95 to a1b5753 Compare January 6, 2025 13:04
@ozgurakgun
Copy link
Contributor

The outputs look good! We also want the domains of the new aux variables though, is this easy to do? I think these should be in the symbols field.

(a != SafeDiv(b, c)), 
   ~~> flatten_binop ([("Minion", 4400)]) 
(a != __0) 
with new declarations:
  find __0 : some domain
with new constraints:
  __0 =aux SafeDiv(b, c)

@niklasdewally
Copy link
Collaborator Author

Added symbol table logs @Soph1514 @ozgurakgun

@niklasdewally
Copy link
Collaborator Author

Closes #526

@niklasdewally niklasdewally linked an issue Jan 7, 2025 that may be closed by this pull request
@niklasdewally niklasdewally force-pushed the nik/pr/print-top-level-exprs branch from 3c05625 to e33101b Compare January 7, 2025 18:15
@niklasdewally niklasdewally force-pushed the nik/pr/print-top-level-exprs branch from e33101b to 929108a Compare January 7, 2025 18:23
This was referenced Jan 7, 2025
@ozgurakgun
Copy link
Contributor

I am fiddling with the output slightly, will push to this branch in a minute.

I noticed you talk about removed variables. I don't think we will remove variables in these local rules per se, instead that might be a global pass once all expressions are rewritten. Variables that are not referenced from any expression can be dropped, for example.

Removing in a local rule is tricky since you need to know if the same var is used in other places or not before you can remove it...

@ozgurakgun
Copy link
Contributor

Updating the domain, on the other hand, should be possible.

@ozgurakgun
Copy link
Contributor

I now notice something I had missed. The symbols field in Reduction copies all the symbols in the original model. I thought it would only contain the new symbols, like new_top.

Just noting for now that an alternative would be to only store the new symbols in the Reduction and extend the model once a rule is applied. I won't change the current behaviour.

@niklasdewally
Copy link
Collaborator Author

I noticed you talk about removed variables. I don't think we will remove variables in these local rules per se, instead that might be a global pass once all expressions are rewritten. Variables that are not referenced from any expression can be dropped, for example.

Removing in a local rule is tricky since you need to know if the same var is used in other places or not before you can remove it...

My assumption was that we can use the same APIs for both local and global rules (as discussed on Teams)

@ozgurakgun
Copy link
Contributor

I guess we will have to think about these global rules at some point :)

@ozgurakgun ozgurakgun merged commit e57091f into main Jan 8, 2025
14 checks passed
@niklasdewally niklasdewally deleted the nik/pr/print-top-level-exprs branch January 8, 2025 12:21
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.

Log symbol table changes in the rule trace
2 participants