pytorch
7e9bf2ed - When nopython=True, Dynamo can't allow graph breaks. (#90970)

Commit
2 years ago
When nopython=True, Dynamo can't allow graph breaks. (#90970) I count the number of sub-graphs (for tiny-GPT2 in huggingface) by ``` class GraphCaptureCompiler: def __init__(self): self.captured_graphs = [] def compile(self, gm, example_inputs): self.captured_graphs.append(gm) return gm compiler = GraphCaptureCompiler() torch._dynamo.optimize(compiler, nopython=True)(Wrapper(fn))(*args) ``` Although `len(compiler.captured_graphs)` is 2, no error was thrown during the compilation. This observation conflicts with `nopython=True`. After some digging, I found a check is missed before making graph break. This PR adds it. Pull Request resolved: https://github.com/pytorch/pytorch/pull/90970 Approved by: https://github.com/ezyang, https://github.com/jansel
Author
Committer
Parents
Loading