Skip to content

Avoid recompilation caused by scan_layers #9367

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

Merged
merged 1 commit into from
Jun 16, 2025

Conversation

tengyifei
Copy link
Collaborator

deepcopy(first_layer) creates temporary lazy tensors that, despite going out of scope at the end of the function, may not be garbage collected. Those tensors non-deterministically add to the graph captured by torch_xla.sync() and cause recompilations.

TEST: torchprime E2E tests are red before this PR and goes back to green at this PR.

`deepcopy(first_layer)` creates temporary lazy tensors that, despite
going out of scope at the end of the function, may not be garbage
collected. Those tensors non-deterministically add to the graph
captured by `torch_xla.sync()` and cause recompilations.

TEST: torchprime E2E tests are red before this PR and goes back to green
at this PR.
@tengyifei tengyifei marked this pull request as ready for review June 16, 2025 19:43
@tengyifei tengyifei requested review from qihqi and bhavya01 June 16, 2025 19:43
@tengyifei tengyifei enabled auto-merge (squash) June 16, 2025 19:50
@tengyifei tengyifei merged commit 41b9e45 into master Jun 16, 2025
24 checks passed
@bfolie bfolie mentioned this pull request Jun 16, 2025
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.

2 participants