joelberkeley/spidr

Support not-sharing

Closed this issue · 0 comments

By adding a Var : Nat -> Expr constructor to Expr, we can support both sharing and not-sharing in our graph. If we also make not-sharing the default it could drastically simplify client code as most function results aren't shared, and likely more performant as we'd do away with most of the monadic function calls.

We might be able to prevent accidental re-use of uncached tensors by using linearity. All tensors are linear until they're shared, at which point they have unrestricted quantity.

It's possible that with much less sharing, we could use linearity and do away entirely with monads, giving us a significant performance boost.