src: fix memory leaks using TACO runtime API from reference cycle
This commit fixes a memory leak in the TACO runtime that doesn't
allow for reclamation of memory used when tensors are allocated
by the TACO runtime. In particular, when accessing a tensor, the
resulting Access took an RC-pointer to the tensor, and then tensor
then stored this access within itself, causing a cycle.
This fails some tests where the assumption about lifetimes of TACO objects is somewhat backwards. The expr.storage and alloc.storage tests both assume that the created IndexExpr objects will outlive the tensor objects that they are constructed with, and thus cause an error when trying to recover the pointer to the tensor. These assumptions seem to be at odds with each other -- either index expr's are tied to the lifetime of a tensor, which allows us to collect tensors, or index exprs can have separate lifetimes, which doesn't allow us to eagerly collect tensors. @stephenchouca @weiya711 do either of you have thoughts on what to do here?
@lrubens, please patch this commit to fix the OOM's you have been seeing.