Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: fix memory leaks using TACO runtime API from reference cycle #520

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rohany
Copy link
Contributor

@rohany rohany commented Apr 12, 2022

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 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.
@rohany
Copy link
Contributor Author

rohany commented Apr 12, 2022

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.

Ectras added a commit to Ectras/taco that referenced this pull request Feb 1, 2023
This commit is taken from an umerged PR in taco
(tensor-compiler#520).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant