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

Avoid duplicating arrays #515

Open
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

majosm
Copy link
Collaborator

@majosm majosm commented Jul 12, 2024

Not quite ready yet, still draft for now.

Depends on #503 (merged), #512 (merged), #531 (merged), #549 (merged), #585, #583, and #550.

@majosm majosm force-pushed the avoid-array-duplication branch from e813eb2 to 1d49631 Compare July 15, 2024 20:20
@majosm majosm mentioned this pull request Jul 25, 2024
@majosm majosm force-pushed the avoid-array-duplication branch 2 times, most recently from a5dbc5a to c55dee2 Compare August 27, 2024 21:33
@majosm majosm force-pushed the avoid-array-duplication branch from c55dee2 to f6a3014 Compare September 24, 2024 20:36
@majosm majosm force-pushed the avoid-array-duplication branch 3 times, most recently from dd6cd37 to 8ac0b8d Compare February 7, 2025 04:13
…uper().rec usage in CachedMapAndCopyMapper

Here is a sketch of what happens with super().rec vs Mapper.rec for the previous implementation of
deduplicate_data_wrappers. Suppose we have 2 data wrappers a and b with the same data pointer.

With super().rec:

1) map_fn maps a to itself, then mapper copies a to a'; mapper caches a -> a' (twice, once in
   super().rec and then again in rec),
2) map_fn maps b to a, then mapper maps (via cache in super().rec call) a to a'; mapper caches
   b -> a'.

=> Only a' in output DAG.

With Mapper.rec:

1) map_fn maps a to itself, then mapper copies a to a'; caches a -> a',
2) map_fn maps b to a, then mapper copies a to a''; caches b -> a''.

=> Both a' and a'' in output DAG.
…nition_cache_key for extra args case

ambiguous due to the fact that any arg can be specified with/without keyword
apparently TypeVar(..., <type>) doesn't include subclasses of <type>
@majosm majosm force-pushed the avoid-array-duplication branch 2 times, most recently from 98ce162 to ae9c939 Compare February 28, 2025 01:11
@majosm majosm force-pushed the avoid-array-duplication branch from ae9c939 to 2ca7a65 Compare February 28, 2025 02:42
@majosm majosm marked this pull request as ready for review February 28, 2025 13:33
@majosm
Copy link
Collaborator Author

majosm commented Feb 28, 2025

Ready for a look after #585, #583, and #550. I've left the duplication checks turned off by default for now, because some things in arraycontext, grudge, etc. still duplicate.

@majosm majosm requested a review from inducer February 28, 2025 13:35
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.

None yet

1 participant