Closed rtjoa closed 7 months ago
I think that we should make the allocations have unique ids in rust, not egglog
That way we don't need i64-fresh!
I'd also be a lot happier if we found a way to not have unique ids on the allocations, and use the expression that generated that allocation instead. But we'd need to think carefully about that
I think that we should make the allocations have unique ids in rust, not egglog That way we don't need
i64-fresh!
I originally did it from rust by adding a next_alloc_id: i64
field to DagTranslator
. However, we then have no way to atomically get the next id in egglog, which to create Alloc
s in Subst
/DoAddContext
.
I'd also be a lot happier if we found a way to not have unique ids on the allocations, and use the expression that generated that allocation instead. But we'd need to think carefully about that
We could refer to allocs in a child context or a func call with this cell datatype:
type cell = InSameContext expr | InLoop in out expr | InFuncCall fn args expr
but we'd need another Context node type to refer to allocs in a parent context.
For now, I think unique ids is easiest and our current plan as of last memory meeting.
Per discussion on Slack, assigned ids in Rust, as it's actually sound to have multiple ids per e-class: it just makes the analysis less precise.
Add an
i64
field toAlloc
, which should be uniquely assigned during translation.