Avoid recompiling for equivalent kernels
- Dominant language
- Python
- Stars
- 15
- Forks
- 16
- Avg merge
- 17m
- Merged PRs (30d)
- 1
Description
## Problem
```python
import pytato as pt
ns = pt.Namespace()
x = pt..make_placeholder(ns, shape=(10, 4), dtype=float, name="x")
y = pt..make_placeholder(ns, shape=(10, 4), dtype=float, name="y")
knl1 = pt.generate_loopy(2*x).program
knl2 = pt.generate_loopy(2*y).program
assert knl1 == knl2 # fails
```
I.e we recompile kernels which happen to be equivalent functions.
## Proposal
Pass some options to `generate_loopy` so that the generated BoundProgram holds a naming maps so that in both the above cases we generate identical kernels. This option would be by default turned on if we run using `python -O`.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at generate_loopy and the BoundProgram representation, then reproduce the two-placeholder example from the issue. Determine how naming maps and the optimization-mode default should be passed and stored. Done means equivalent kernels compare identically without unnecessary recompilation, while the requested option behavior remains defined.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100