-
Notifications
You must be signed in to change notification settings - Fork 73
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 Tree implementation #694
Conversation
The authorship information on the commits is incorrect. For the tree, this should show Kaushik as the author, and you as the committer. For the tests, that should show you as the author, i.e. you need a minimum of two commits. |
15a9057
to
4aacaf5
Compare
I think this should be fixed now. |
This is ready for review |
loopy/schedule/tree.py
Outdated
@@ -0,0 +1,269 @@ | |||
__copyright__ = "Copyright (C) 2022 Kaushik Kulkarni" |
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.
It's hard for me to see here how this was changed vs. the original.
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.
I've split up the commits into Kaushik's original implementation (7f50179), followed by my changes on top of that initial commit. Does that make the changes clearer?
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.
Thanks!
cd4ada9
to
1574154
Compare
I will absorb this into #785, closing here. |
inducer#694 Co-authored-by: Matthias Diener <[email protected]> Co-authored-by: Andreas Kloeckner <[email protected]>
If you want, you can also cherry-pick the memoization PR we are using in our production version: illinois-ceesd@e886189 (illinois-ceesd#4). |
@@ -164,34 +164,31 @@ def replace_node(self, node: NodeT, new_id: NodeT) -> "Tree[NodeT]": | |||
|
|||
# {{{ update child to parent | |||
|
|||
new_child_to_parent = (self._child_to_parent.delete(node) | |||
.set(new_id, parent)) | |||
child_to_parent_mut = self._child_to_parent.mutate() |
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.
Because of mutate
, this now requires the use of immutables.Map
. Could you just use a normal dict
for the mutation?
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.
Since the internal immutables.Map
s don't seem to be exposed to the user, maybe it is sufficient to just use dict
everywhere in this class?
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.
With dict
, immutables
allows this to remain immutables
is justified (whereas just about everywhere else, it's just a glorified read-only dict, which is total overkill).
Could you talk about how important those are in terms of cost? |
We had seen a ~5% speedup of overall compile time with that PR on a prediction run. |
#694 Co-authored-by: Matthias Diener <[email protected]> Co-authored-by: Andreas Kloeckner <[email protected]>
#694 Co-authored-by: Matthias Diener <[email protected]> Co-authored-by: Andreas Kloeckner <[email protected]>
I'll add those. |
#694 Co-authored-by: Matthias Diener <[email protected]> Co-authored-by: Andreas Kloeckner <[email protected]>
#694 Co-authored-by: Matthias Diener <[email protected]> Co-authored-by: Andreas Kloeckner <[email protected]>
based on #350 / #690