pytorch
fee01640 - Make DDPOptimizer handle subgraphs without outputs (#103488)

Commit
1 year ago
Make DDPOptimizer handle subgraphs without outputs (#103488) Subgraphs are partitions cut out of a whole graph. Outputs of a subgraph are either global outputs of the original graph, or can be outputs of a partition that feed inputs of the subsequent partition. Subgraphs are created using the fx utility 'passes.split_module', which requires that each partition have at least one output node. In cases where DDPOptimizer asked the partitioner to cut the graph around a set of nodes which only performed inplace mutation, the partitioner could be left trying to create a subgraph with no output nodes, violating its assumptions. To circumvent this, DDPOptimizer can expand the set of nodes marked for inclusion in a subgraph that has no outputs until it includes a node that is an output for that subgraph. It still traverses nodes of the original graph in reverse order and only considers widening a subgraph by iterating further in reverse order than it would have ordinarily done (past the cut point dictated by paramter count). It may still be possible the subgraph reaches the input node of the graph without satisfying the subgraph-output condition, in which case an error would still be raised by the partitioner. Fixes #103385 Pull Request resolved: https://github.com/pytorch/pytorch/pull/103488 Approved by: https://github.com/anijain2305
Author
Committer
Parents
Loading