Conversation
e813eb2 to
1d49631
Compare
a5dbc5a to
c55dee2
Compare
c55dee2 to
f6a3014
Compare
dd6cd37 to
8ac0b8d
Compare
ae9c939 to
2ca7a65
Compare
8bb1a1e to
8789290
Compare
8789290 to
e00662b
Compare
| # Must disable collision/duplication checking because we're combining | ||
| # expressions that were previously in two different call stack frames | ||
| # (and were thus cached separately) |
There was a problem hiding this comment.
Add to doc: Inliner may produce DAGs with duplicates.
| """ | ||
| mapper = EinsumWithNoBroadcastsRewriter() | ||
| return cast("MappedT", mapper(expr)) | ||
| return cast("MappedT", mapper(expr, None)) |
There was a problem hiding this comment.
return cast("MappedT", mapper(expr, ())
and save the None checking above?
| expr.redn_axis_to_redn_descr, | ||
| tags=expr.tags, | ||
| axes=expr.axes,) | ||
| if ( |
There was a problem hiding this comment.
Took a stab at it. Seemed to work out OK.
e00662b to
d21de9d
Compare
pytato/transform/__init__.py
Outdated
| return all(b_i is a_i for a_i, b_i in zip(a, b, strict=True)) | ||
|
|
||
|
|
||
| class IdentityMappingHelperMixin: |
There was a problem hiding this comment.
It struck me that it would likely be better to bake these into the node type. (I.e. Placeholder._if_modified(self, other).) We can probably generate them automatically, too. As it stands, dispatch is name-based, even though it's only "single", i.e. based on the type of the node.
There was a problem hiding this comment.
How does 69c4e3c look?
I'm not sure how to make it work for DictOfNamedArrays, though. See here:
pytato/pytato/transform/__init__.py
Lines 881 to 883 in 69c4e3c
There was a problem hiding this comment.
Special-casing DictOfNamedArrays is OK, for the reason you mention.
I'm OK with the approach, though I think I'd prefer generated code for this, since it's bound to be a fairly hot code path. There's already some code generation in @array_dataclass, it should be straightforward to add there.
There was a problem hiding this comment.
I attempted to implement this in a687544, but in doing so I've seemingly triggered a bunch of unrelated(?) mypy errors. I fixed some in d27da88, but some of the errors that remain don't make a lot of sense. I've also triggered some new pylint errors with my fixes. Any idea what's going on here?
Edit: I guess this is similar to the issues encountered in #598?
There was a problem hiding this comment.
Edit: I guess this is similar to the issues encountered in #598?
I don't think the errors you're seeing here are all that related. Some just outright don't make any sense, IMO. For example:
pytato/transform/__init__.py:1115:25: error: Invalid index type "str" for "Call"; expected type "Call" [index]
I can't make heads or tails of that.
The Pylint issues are similarly weird, maybe it's time to drop Pylint, too?
I think the best proposal I've got is to switch to pyright (the "based" version, to avoid drowning in noise). I've pushed changes that do that. At least most of what pyright has to say seems to make some sense.
There was a problem hiding this comment.
Unfortunately, the "baseline" feature of basedpyright seems a bit imperfect, too. It seems to complain about errors that are already contained in the baseline. I don't see this locally, but it does seem to happen in CI. 🤔
4af1241 to
d27da88
Compare
d98c27d to
a36694e
Compare
add note about Inliner duplication deduplicate in inline_calls
now inherits from CachedMapper add comments explaining result deduplication to MPMSMaterializerCache
simplify EinsumWithNoBroadcastsRewriter by using () instead of None
…lication avoidance logic move duplication-preventing boilerplate into array types move replace_if_different code into array_dataclass
a36694e to
20bd9f0
Compare
Depends on
#503(merged),#512(merged),#531(merged),#549(merged),#585(merged),#583(merged), and#550(merged).@inducer note to self: Reviewed up to (but not including) "tweak Inliner/PlaceholderSubstitutor implementations".Draft because:
Closes #590.