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

[FxImporter] remove weakref finalizer of reftracker #3995

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

Conversation

egebeysel
Copy link

Fixes iree-org/iree-turbine#281.

TL;DR:

The weakref.finalize objects cause the model parameters to be kept in memory in-between consecutive aot.export calls in the same process. We remove them to enable releasing the memory, this does not change the behavior of RefTracker or RefMapping classes anyhow else.

@egebeysel
Copy link
Author

egebeysel commented Feb 6, 2025

@stellaraccident could you please review/approve and merge if everything looks alright :) Thanks!

@penguin-wwy
Copy link
Collaborator

Could you comment out this section of code and add the issue link in the comments instead of deleting it directly?

@stellaraccident
Copy link
Collaborator

Could you comment out this section of code and add the issue link in the comments instead of deleting it directly?

This is a good idea: let's do that. I think this is safe to do, but this part was complicated. Let's plan for our future selves to have some context.

If changed as requested, then this lgtm

@egebeysel egebeysel force-pushed the beysel/fix-memory-leak-for-aot-export branch from f195978 to 2d3053b Compare February 7, 2025 13:17
Signed-off-by: Ege Beysel <beysel@roofline.ai>
@egebeysel egebeysel force-pushed the beysel/fix-memory-leak-for-aot-export branch from 2d3053b to 86cfbfb Compare February 7, 2025 13:20
@egebeysel
Copy link
Author

Could you comment out this section of code and add the issue link in the comments instead of deleting it directly?

This is a good idea: let's do that. I think this is safe to do, but this part was complicated. Let's plan for our future selves to have some context.

Makes sense, updated it 👍

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.

[aot.export] Potential Memory Leak
3 participants