Memory data dependencies should add token dependencies
Open
ir
optimizer
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 283
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 135
Description
Right now, the following C++
```
mem[idx] = 3;
const auto val = mem[idx];
```
could allow the read to be scheduled before the write. Memory accesses get lowered to sends and receives, so there is no explicit data dependency. There is a write completion channel, but it returns an empty tuple.
A pass similar to the data dependency pass should be added that adds token dependencies between operations on the same memory. These dependencies need not be added if the addresses can be proven to not be equal.
See also #861
Contributor guide
Assessment
This issue has not been assessed yet.