spmd_types 0.2.4__tar.gz → 0.2.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {spmd_types-0.2.4/spmd_types.egg-info → spmd_types-0.2.5}/PKG-INFO +1 -1
- {spmd_types-0.2.4 → spmd_types-0.2.5}/pyproject.toml +8 -1
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/_collectives.py +10 -28
- {spmd_types-0.2.4 → spmd_types-0.2.5/spmd_types.egg-info}/PKG-INFO +1 -1
- {spmd_types-0.2.4 → spmd_types-0.2.5}/LICENSE +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/README.md +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/setup.cfg +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/__init__.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/_backward_hooks.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/_checker/__init__.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/_dist.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/_dtensor.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/_dtensor_checker.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/_dtype_utils.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/_frame.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/_local.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/_local_registration.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/_mesh.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/_mesh_axis.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/_mesh_region.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/_raw_dist.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/_reinterpret_mesh.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/_scalar.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/_scalar_sentinel.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/_state.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/_test_utils.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/_testing.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/_traceback.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/_type_attr.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/_vmap.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/checker.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/runtime.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types/types.py +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types.egg-info/SOURCES.txt +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types.egg-info/dependency_links.txt +0 -0
- {spmd_types-0.2.4 → spmd_types-0.2.5}/spmd_types.egg-info/top_level.txt +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "spmd_types"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.5"
|
|
8
8
|
description = "A type system for distributed (SPMD) tensor computations in PyTorch"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = {file = "LICENSE"}
|
|
@@ -48,3 +48,10 @@ quote-style = "double"
|
|
|
48
48
|
[tool.pytest.ini_options]
|
|
49
49
|
testpaths = ["tests"]
|
|
50
50
|
python_files = ["*_test.py"]
|
|
51
|
+
|
|
52
|
+
[tool.test-selector.extra-deps]
|
|
53
|
+
|
|
54
|
+
# BEGIN GENERATED buck-manual-deps -- do not edit by hand
|
|
55
|
+
# Regenerate: export_buck_manual_deps.py
|
|
56
|
+
"spmd_types/__init__.py" = ["../ops/interfaces/attn/triton_attention_fp32.py", "../ops/interfaces/gemm/gemm.py"]
|
|
57
|
+
# END GENERATED buck-manual-deps
|
|
@@ -11,6 +11,7 @@ from __future__ import annotations
|
|
|
11
11
|
from typing import List, Optional
|
|
12
12
|
|
|
13
13
|
import torch
|
|
14
|
+
import torch.distributed._functional_collectives as funcol
|
|
14
15
|
from spmd_types import _dist
|
|
15
16
|
from spmd_types._dtype_utils import (
|
|
16
17
|
_apply_op_dtype,
|
|
@@ -67,8 +68,9 @@ class _AllReduce(torch.autograd.Function):
|
|
|
67
68
|
ctx.mark_dirty(x)
|
|
68
69
|
result = x
|
|
69
70
|
else:
|
|
70
|
-
result =
|
|
71
|
-
|
|
71
|
+
result = funcol.all_reduce(x, "sum", pg)
|
|
72
|
+
if isinstance(result, funcol.AsyncCollectiveTensor):
|
|
73
|
+
result = result.wait()
|
|
72
74
|
if inplace:
|
|
73
75
|
assert dtype_options.out_dtype == result.dtype
|
|
74
76
|
return result
|
|
@@ -300,16 +302,9 @@ class _AllGatherShard(torch.autograd.Function):
|
|
|
300
302
|
x = _apply_op_dtype(x, dtype_options.op_dtype)
|
|
301
303
|
pg = axis
|
|
302
304
|
x = x.contiguous()
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
out = torch.empty(out_shape, device=x.device, dtype=x.dtype)
|
|
307
|
-
_dist.dist.all_gather_into_tensor(out, x, group=pg)
|
|
308
|
-
if gather_dim == 0:
|
|
309
|
-
result = out
|
|
310
|
-
else:
|
|
311
|
-
chunks = out.chunk(world_size, dim=0)
|
|
312
|
-
result = torch.cat(chunks, dim=gather_dim)
|
|
305
|
+
result = funcol.all_gather_tensor(x, gather_dim, pg)
|
|
306
|
+
if isinstance(result, funcol.AsyncCollectiveTensor):
|
|
307
|
+
result = result.wait()
|
|
313
308
|
return _apply_out_dtype(result, dtype_options.out_dtype)
|
|
314
309
|
|
|
315
310
|
@staticmethod
|
|
@@ -635,22 +630,9 @@ class _ReduceScatterShard(torch.autograd.Function):
|
|
|
635
630
|
ctx.backward_options = dtype_options.backward_options
|
|
636
631
|
x = _apply_op_dtype(x, dtype_options.op_dtype)
|
|
637
632
|
pg = axis
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
needs_permute = scatter_dim != 0
|
|
642
|
-
if needs_permute:
|
|
643
|
-
x = x.movedim(scatter_dim, 0).contiguous()
|
|
644
|
-
|
|
645
|
-
output_shape = list(x.shape)
|
|
646
|
-
output_shape[0] //= world_size
|
|
647
|
-
result = x.new_empty(output_shape)
|
|
648
|
-
_dist.dist.reduce_scatter_tensor(
|
|
649
|
-
result, x, op=_dist.dist.ReduceOp.SUM, group=pg
|
|
650
|
-
)
|
|
651
|
-
|
|
652
|
-
if needs_permute:
|
|
653
|
-
result = result.movedim(0, scatter_dim)
|
|
633
|
+
result = funcol.reduce_scatter_tensor(x, "sum", scatter_dim, pg)
|
|
634
|
+
if isinstance(result, funcol.AsyncCollectiveTensor):
|
|
635
|
+
result = result.wait()
|
|
654
636
|
return _apply_out_dtype(result, dtype_options.out_dtype)
|
|
655
637
|
|
|
656
638
|
@staticmethod
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|