add PytatoKeyBuilder, persistent_dict test#459
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.
This could probably be improved, but I'm not sure how.
There was a problem hiding this comment.
Perhaps inducer/pymbolic#125 resolves it.
There was a problem hiding this comment.
I'm guessing this PR is waiting for inducer/pymbolic#125 ?
There was a problem hiding this comment.
Yep, inducer/pymbolic#125 has resolved this, this bit should no longer be necessary. 😁
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.
Could you use an isinstance check to make sure that this only hashes the intended types?
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.
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 |
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