inducer / inducer/pytato

Guarantees around recomputation of common subexpressions

Open
#232 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
15
Forks
16
Avg merge
17m
Merged PRs (30d)
1

Description

Here's a potentially useful bit of functionality that I dreamed up, but I'm not yet entirely sure it can be realized in a well-defined manner.

Roughly, the goal is to allow an application to encode redundant computation (i.e. include the same subtree in a DAG multiple times) while having some certainty that it won't be recomputed unnecessarily. In mirgecom, this would be helpful because it allows, e.g., redundant evaluation of boundary conditions. This issue is mainly about the "having some certainty about avoiding recomputation" bit, and what mechanisms might be appropriate for ensuring this.

A simple but likely not-yet-fully-baked scheme that I was able to come up with is to tag arrays with something that says "I am a common subexpression, raise an error if I am evaluated more than once." This tag could come with an identifier to specify that if two or more expressions with the same identifier are evaluated in the same "evaluation", then raise an error.

One main thing that's a bit unclear here is the word "evaluation": what is that? I.e. what is the scope of the "only-evaluate-me-once" assertion? A simple-but-ill-defined thing would be "whatever is being fed to a single code generation".

I think, generally, such an assertion, if it can be defined soundly, could ease application developers' lives, because not all paths of data reuse need be encoded as explicit data flow in the application code. (E.g. without this, boundary conditions need to be evaluated exactly once and then passed (as parameters) into lots of situations in which they are used.) And life without the assertion is too uncertain: The DAG contains lots of redundant work, and there are no guarantees that this redundant work isn't actually performed.

cc @mtcam @kaushikcfd

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.