-
Notifications
You must be signed in to change notification settings - Fork 16
add PytatoKeyBuilder, persistent_dict test #459
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
b2d71a3 to
caa5a75
Compare
pytato/analysis/__init__.py
Outdated
| def update_for_pymbolic_expression(self, key_hash: Any, key: Any) -> None: | ||
| if key is None: | ||
| self.update_for_NoneType(key_hash, key) # type: ignore[no-untyped-call] | ||
| else: | ||
| PersistentHashWalkMapper(key_hash)(key) | ||
|
|
||
| update_for_Product = update_for_pymbolic_expression # noqa: N815 | ||
| update_for_Sum = update_for_pymbolic_expression # noqa: N815 | ||
| update_for_If = update_for_pymbolic_expression # noqa: N815 | ||
| update_for_LogicalOr = update_for_pymbolic_expression # noqa: N815 | ||
| update_for_Call = update_for_pymbolic_expression # noqa: N815 | ||
| update_for_Comparison = update_for_pymbolic_expression # noqa: N815 | ||
| update_for_Quotient = update_for_pymbolic_expression # noqa: N815 | ||
| update_for_Power = update_for_pymbolic_expression # noqa: N815 |
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.
This could probably be improved, but I'm not sure how.
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.
Perhaps inducer/pymbolic#125 resolves it.
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'm guessing this PR is waiting for inducer/pymbolic#125 ?
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.
Yep, inducer/pymbolic#125 has resolved this, this bit should no longer be necessary. 😁
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.
Removed in 70a6887
72e5569 to
b31657f
Compare
b31657f to
88989de
Compare
88989de to
78003e1
Compare
78003e1 to
cd167af
Compare
|
This is ready for review @inducer. The current version is able to hash the DAG of a 2-rank |
e9c2855 to
3fd38a1
Compare
6238242 to
8fc6620
Compare
8fc6620 to
51aeba0
Compare
51aeba0 to
0687a4c
Compare
0687a4c to
0a2e7be
Compare
|
See also #547. |
pytato/analysis/__init__.py
Outdated
| # CL Array | ||
| self.rec(key_hash, key.get()) |
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.
Could you use an isinstance check to make sure that this only hashes the intended types?
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.
Added in 70a6887
pytato/analysis/__init__.py
Outdated
| def update_for_pymbolic_expression(self, key_hash: Any, key: Any) -> None: | ||
| if key is None: | ||
| self.update_for_NoneType(key_hash, key) # type: ignore[no-untyped-call] | ||
| else: | ||
| PersistentHashWalkMapper(key_hash)(key) | ||
|
|
||
| update_for_Product = update_for_pymbolic_expression # noqa: N815 | ||
| update_for_Sum = update_for_pymbolic_expression # noqa: N815 | ||
| update_for_If = update_for_pymbolic_expression # noqa: N815 | ||
| update_for_LogicalOr = update_for_pymbolic_expression # noqa: N815 | ||
| update_for_Call = update_for_pymbolic_expression # noqa: N815 | ||
| update_for_Comparison = update_for_pymbolic_expression # noqa: N815 | ||
| update_for_Quotient = update_for_pymbolic_expression # noqa: N815 | ||
| update_for_Power = update_for_pymbolic_expression # noqa: N815 |
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.
Yep, inducer/pymbolic#125 has resolved this, this bit should no longer be necessary. 😁
pytato/analysis/__init__.py
Outdated
| update_for_BitwiseAnd = LoopyKeyBuilder.update_for_pymbolic_expression # noqa: N815 | ||
| update_for_BitwiseNot = LoopyKeyBuilder.update_for_pymbolic_expression # noqa: N815 | ||
| update_for_BitwiseOr = LoopyKeyBuilder.update_for_pymbolic_expression # noqa: N815 | ||
| update_for_BitwiseXor = LoopyKeyBuilder.update_for_pymbolic_expression # noqa: N815 | ||
| update_for_Call = LoopyKeyBuilder.update_for_pymbolic_expression # noqa: N815 | ||
| update_for_CallWithKwargs = LoopyKeyBuilder.update_for_pymbolic_expression # noqa: N815 | ||
| update_for_Comparison = LoopyKeyBuilder.update_for_pymbolic_expression # noqa: N815 | ||
| update_for_If = LoopyKeyBuilder.update_for_pymbolic_expression # noqa: N815 | ||
| update_for_FloorDiv = LoopyKeyBuilder.update_for_pymbolic_expression # noqa: N815 | ||
| update_for_LeftShift = LoopyKeyBuilder.update_for_pymbolic_expression # noqa: N815 | ||
| update_for_LogicalAnd = LoopyKeyBuilder.update_for_pymbolic_expression # noqa: N815 | ||
| update_for_LogicalNot = LoopyKeyBuilder.update_for_pymbolic_expression # noqa: N815 | ||
| update_for_LogicalOr = LoopyKeyBuilder.update_for_pymbolic_expression # noqa: N815 | ||
| update_for_Lookup = LoopyKeyBuilder.update_for_pymbolic_expression # noqa: N815 | ||
| update_for_Power = LoopyKeyBuilder.update_for_pymbolic_expression # noqa: N815 | ||
| update_for_Product = LoopyKeyBuilder.update_for_pymbolic_expression # noqa: N815 | ||
| update_for_Quotient = LoopyKeyBuilder.update_for_pymbolic_expression # noqa: N815 | ||
| update_for_Remainder = LoopyKeyBuilder.update_for_pymbolic_expression # noqa: N815 | ||
| update_for_RightShift = LoopyKeyBuilder.update_for_pymbolic_expression # noqa: N815 | ||
| update_for_Subscript = LoopyKeyBuilder.update_for_pymbolic_expression # noqa: N815 | ||
| update_for_Sum = LoopyKeyBuilder.update_for_pymbolic_expression # noqa: N815 | ||
| update_for_Variable = LoopyKeyBuilder.update_for_pymbolic_expression # noqa: N815 |
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.
All this can go now that inducer/pymbolic#125 is in.
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.
Removed in 70a6887
fa5e716 to
cffda36
Compare
|
This is ready for another review @inducer . |
|
Thanks! |
Alternative to #457.
See #547 for a more in-depth discussion.
Please squash