Skip to content

Commit fcc91a5

Browse files
authored
Use implicit strategy as fallback when no strategy is available (#72)
1 parent d458c8a commit fcc91a5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

autoparallel/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from torch.distributed.tensor.placement_types import Replicate
1818
from torch.utils._pytree import tree_flatten, tree_map_only
1919

20-
from .dtensor_util import get_op_strategy
20+
from .dtensor_util import get_op_strategy, with_implicit_strategies
2121
from .propagation_rules import (
2222
TENSOR_FACTORY_OPS,
2323
_op_partial_rules,
@@ -169,7 +169,8 @@ def get_placement_options(mesh, op, specs, user_args, user_kwargs):
169169
if op in _op_partial_rules:
170170
out_strat = _op_partial_rules[op](mesh, op_schema)
171171
else:
172-
out_strat = get_op_strategy(op, op_schema)
172+
with with_implicit_strategies():
173+
out_strat = get_op_strategy(op, op_schema)
173174

174175
propagate_tensor_meta(op, user_args, user_kwargs, out_strat)
175176
fill_missing_redistribute_cost(op, specs, out_strat)

0 commit comments

Comments
 (0)