8000 defer to aot eager instead of skip frame by eellison · Pull Request #153409 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

defer to aot eager instead of skip frame #153409

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

Open
eellison wants to merge 1 commit into
base: gh/eellison/789/base
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions torch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2290,7 +2290,7 @@ def compiled_with_cxx11_abi() -> builtins.bool:
from torch.utils.dlpack import from_dlpack, to_dlpack


def skip_frame_if_max_graphs() -> None:
def has_hit_max_graphs() -> bool:
"""
If we have hit a user specified max number of graphs, skip this frame.
"""
Expand All @@ -2301,8 +2301,8 @@ def skip_frame_if_max_graphs() -> None:
return

GraphsCompiledState.increment()
if GraphsCompiledState.get_num_graphs() > builtins.int(max_graphs):
raise torch._dynamo.exc.SkipFrame(f"Hit max graph limit: {max_graphs}")
return GraphsCompiledState.get_num_graphs() > builtins.int(max_graphs)
# raise torch._dynamo.exc.SkipFrame(f"Hit max graph limit: {max_graphs}")


class _TorchCompileInductorWrapper:
Expand Down Expand Up @@ -2377,7 +2377,9 @@ def apply_options(self, options: _Optional[dict[str, _Any]]):
def __call__(self, model_, inputs_):
from torch._inductor.compile_fx import compile_fx

skip_frame_if_max_graphs()
if has_hit_max_graphs():
return _TorchCompileWrapper("aot_eager", "default", {}, self.dynamic).__call__(model_, inputs_)

return compile_fx(model_, inputs_, config_patches=self.config)

def get_compiler_config(self):
Expand Down Expand Up @@ -2423,7 +2425,6 @@ def __eq__(self, other):
)

def __call__(self, model_, inputs_):
skip_frame_if_max_graphs()
return self.compiler_fn(model_, inputs_, **self.kwargs)

def reset(self):
Expand Down
Loading
0