Skip to content

Conversation

a-r-r-o-w
Copy link
Contributor

@a-r-r-o-w a-r-r-o-w commented Jul 24, 2025

If compiling with fullgraph=True, we first need to remove the torch.compiler.disable calls we have. Once this is done, Dynamo will error out on the logger statements because they can't be traced. We can conditionally log them to fix this error (what this PR does). We will then hit an error because of using context manager for pinning tensors. We can move the body of that function into the functions directly to avoid using context managers. We will then error out on the call to tensor.is_pinned() because Dynamo cannot trace it, which seems like a problem that needs to be fixed on pytorch-side.

If compiling with fullgraph=False, we add a lot of unnecessary guards and have some more graph breaks. By only conditionally doing the logging, we can avoid some of them.

See this comment: #11960 (comment)

@a-r-r-o-w a-r-r-o-w requested a review from yiyixuxu July 24, 2025 20:02
@a-r-r-o-w a-r-r-o-w changed the title [compile] logger statements error during dynamo tracing, so conditionally log if compiling [compile] logger statements create unnecessary guards during dynamo tracing Jul 24, 2025
@a-r-r-o-w a-r-r-o-w requested review from sayakpaul and removed request for yiyixuxu July 24, 2025 20:15
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@a-r-r-o-w a-r-r-o-w merged commit 3d2f8ae into main Jul 25, 2025
14 of 15 checks passed
@a-r-r-o-w a-r-r-o-w deleted the group-offloading-logger-compile branch July 25, 2025 18:58
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.

3 participants