[Transform API] Simple tiling can be tedious to implement
- Dominant language
- Python
- Stars
- 636
- Forks
- 81
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 7
Description
Consider the simple batched matvec example:
```python
knl = lp.make_kernel(
"{[e,i,j]: 0<=e<1000 and 0<=i,j<10}",
"""
out[e, i] = sum(j, D[i, j] * u[e, j])
""",
[lp.GlobalArg("u,D,out", "float64", lp.auto)])
# Tile "j"+prefetch to reduce the cache reuse distance of "D"
knl = lp.split_iname(knl, "j", 5)
knl = lp.add_prefetch(knl, "D", sweep_inames=["i", "j_inner"])
print(lp.generate_code_v2(knl).device_code())
```
This results in a linearization error with:
```
* Duplicate j_outer within instructions (id:insn_j_outer_j_inner_update)
* Duplicate i within instructions (id:insn_j_outer_j_inner_init or id:insn)
```
Notice how the duplication options force us to realize the reduction. Making this simple transformation quite tedious to implement. We should have some interface to make this transformation easier as (at least in the context of einsums) this is a pretty common transformation.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.