8000 [pytree][1/N] change pytree usages to implementation agnostic: `torch.distributed` by XuehaiPan · Pull Request #144332 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

[pytree][1/N] change pytree usages to implementation agnostic: torch.distributed #144332

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

Closed
wants to merge 18 commits into from
Prev Previous commit
Next Next commit
Update
[ghstack-poisoned]
  • Loading branch information
XuehaiPan committed Feb 4, 2025
commit bd8994ee579054d6529e873bd0361b3f7fc8faa3
6 changes: 3 additions & 3 deletions torch/distributed/_tools/sac_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,9 @@ def __torch_dispatch__( # type: ignore[no-untyped-def]
# 1. Get the runtime estimate
out, op_time = self._estimate_runtime(func, args, kwargs)
flat_outs = tree_iter(out)
out_storages_cuda: Set[UntypedStorage] = set()
out_storages_cpu: Set[UntypedStorage] = set()
cuda_devices: Set[torch.device] = set()
out_storages_cuda: set[UntypedStorage] = set()
out_storages_cpu: set[UntypedStorage] = set()
cuda_devices: set[torch.device] = set()
for o in flat_outs:
if isinstance(o, torch.Tensor):
if o.device.type == "cuda":
Expand Down
4 changes: 2 additions & 2 deletions torch/distributed/tensor/_op_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from collections.abc import Sequence
from dataclasses import dataclass
from functools import cached_property
from typing import Any, Dict, List, Optional, Sequence, TYPE_CHECKING, Union
from typing import Any, Optional, TYPE_CHECKING, Union

import torch
from torch._ops import OpOverload
Expand Down Expand Up @@ -446,7 +446,7 @@ class OpInfo:
schema: OpSchema
flat_args_schema: list[object]
local_args: Sequence[object]
local_kwargs: Dict[str, object]
local_kwargs: dict[str, object]
args_tree_spec: Optional["PyTreeSpec"] = None

# the output sharding info
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.
0