spmd_types 0.1.0__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.1.0/LICENSE +28 -0
- spmd_types-0.1.0/PKG-INFO +19 -0
- spmd_types-0.1.0/pyproject.toml +36 -0
- spmd_types-0.1.0/setup.cfg +4 -0
- spmd_types-0.1.0/sixlib/__init__.py +0 -0
- spmd_types-0.1.0/sixlib/spmd_types/__init__.py +92 -0
- spmd_types-0.1.0/sixlib/spmd_types/_checker.py +2387 -0
- spmd_types-0.1.0/sixlib/spmd_types/_collectives.py +959 -0
- spmd_types-0.1.0/sixlib/spmd_types/_dist.py +25 -0
- spmd_types-0.1.0/sixlib/spmd_types/_dtensor.py +256 -0
- spmd_types-0.1.0/sixlib/spmd_types/_frame.py +62 -0
- spmd_types-0.1.0/sixlib/spmd_types/_local.py +973 -0
- spmd_types-0.1.0/sixlib/spmd_types/_mesh.py +53 -0
- spmd_types-0.1.0/sixlib/spmd_types/_mesh_axis.py +276 -0
- spmd_types-0.1.0/sixlib/spmd_types/_raw_dist.py +223 -0
- spmd_types-0.1.0/sixlib/spmd_types/_scalar.py +273 -0
- spmd_types-0.1.0/sixlib/spmd_types/_state.py +35 -0
- spmd_types-0.1.0/sixlib/spmd_types/_test_utils.py +257 -0
- spmd_types-0.1.0/sixlib/spmd_types/_testing.py +24 -0
- spmd_types-0.1.0/sixlib/spmd_types/_traceback.py +207 -0
- spmd_types-0.1.0/sixlib/spmd_types/_type_attr.py +67 -0
- spmd_types-0.1.0/sixlib/spmd_types/_vmap.py +111 -0
- spmd_types-0.1.0/sixlib/spmd_types/api_test.py +493 -0
- spmd_types-0.1.0/sixlib/spmd_types/checker_test.py +2349 -0
- spmd_types-0.1.0/sixlib/spmd_types/collectives_test.py +892 -0
- spmd_types-0.1.0/sixlib/spmd_types/dtensor_test.py +593 -0
- spmd_types-0.1.0/sixlib/spmd_types/global_spmd_test.py +288 -0
- spmd_types-0.1.0/sixlib/spmd_types/local_test.py +420 -0
- spmd_types-0.1.0/sixlib/spmd_types/mesh_axis_test.py +416 -0
- spmd_types-0.1.0/sixlib/spmd_types/py.typed +0 -0
- spmd_types-0.1.0/sixlib/spmd_types/traceback_test.py +367 -0
- spmd_types-0.1.0/sixlib/spmd_types/types.py +516 -0
- spmd_types-0.1.0/sixlib/spmd_types/types_test.py +227 -0
- spmd_types-0.1.0/sixlib/spmd_types/vmap_test.py +118 -0
- spmd_types-0.1.0/spmd_types.egg-info/PKG-INFO +19 -0
- spmd_types-0.1.0/spmd_types.egg-info/SOURCES.txt +37 -0
- spmd_types-0.1.0/spmd_types.egg-info/dependency_links.txt +1 -0
- spmd_types-0.1.0/spmd_types.egg-info/requires.txt +1 -0
- spmd_types-0.1.0/spmd_types.egg-info/top_level.txt +1 -0
spmd_types-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, Edward Z. Yang
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: spmd_types
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A type system for distributed (SPMD) tensor computations in PyTorch
|
|
5
|
+
Author-email: "Edward Z. Yang" <ezyang@mit.edu>
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
|
+
Project-URL: Homepage, https://github.com/ezyang/spmd_types
|
|
8
|
+
Project-URL: Repository, https://github.com/ezyang/spmd_types
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: torch
|
|
19
|
+
Dynamic: license-file
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "spmd_types"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A type system for distributed (SPMD) tensor computations in PyTorch"
|
|
9
|
+
requires-python = ">=3.10"
|
|
10
|
+
license = "BSD-3-Clause"
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "Edward Z. Yang", email = "ezyang@mit.edu" },
|
|
13
|
+
]
|
|
14
|
+
dependencies = [
|
|
15
|
+
"torch",
|
|
16
|
+
]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 3 - Alpha",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
Homepage = "https://github.com/ezyang/spmd_types"
|
|
29
|
+
Repository = "https://github.com/ezyang/spmd_types"
|
|
30
|
+
|
|
31
|
+
[tool.setuptools.packages.find]
|
|
32
|
+
include = ["sixlib*"]
|
|
33
|
+
exclude = ["sixlib.spmd_types.*_test*", "sixlib.spmd_types.eval*"]
|
|
34
|
+
|
|
35
|
+
[tool.setuptools.package-data]
|
|
36
|
+
"sixlib.spmd_types" = ["py.typed"]
|
|
File without changes
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# spmd_types package
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import sys
|
|
5
|
+
from types import ModuleType
|
|
6
|
+
|
|
7
|
+
# Collectives and operations
|
|
8
|
+
from sixlib.spmd_types._checker import ( # noqa: F401
|
|
9
|
+
_SpmdTypeBackwardCompatibleMode as SpmdTypeMode,
|
|
10
|
+
assert_local_type,
|
|
11
|
+
assert_type,
|
|
12
|
+
is_type_checking,
|
|
13
|
+
mutate_type,
|
|
14
|
+
no_typecheck,
|
|
15
|
+
register_autograd_function,
|
|
16
|
+
register_local_autograd_function,
|
|
17
|
+
trace,
|
|
18
|
+
typecheck,
|
|
19
|
+
)
|
|
20
|
+
from sixlib.spmd_types._collectives import ( # noqa: F401
|
|
21
|
+
all_gather,
|
|
22
|
+
all_reduce,
|
|
23
|
+
all_to_all,
|
|
24
|
+
redistribute,
|
|
25
|
+
reduce_scatter,
|
|
26
|
+
unshard,
|
|
27
|
+
)
|
|
28
|
+
from sixlib.spmd_types._dist import set_dist # noqa: F401
|
|
29
|
+
from sixlib.spmd_types._dtensor import ( # noqa: F401
|
|
30
|
+
dtensor_placement_to_spmd_type,
|
|
31
|
+
spmd_redistribute,
|
|
32
|
+
spmd_type_to_dtensor_placement,
|
|
33
|
+
)
|
|
34
|
+
from sixlib.spmd_types._local import ( # noqa: F401
|
|
35
|
+
convert,
|
|
36
|
+
invariant_to_replicate,
|
|
37
|
+
reinterpret,
|
|
38
|
+
shard,
|
|
39
|
+
)
|
|
40
|
+
from sixlib.spmd_types._mesh_axis import MeshAxis # noqa: F401
|
|
41
|
+
from sixlib.spmd_types._scalar import Scalar # noqa: F401
|
|
42
|
+
from sixlib.spmd_types._traceback import traceback_filtering # noqa: F401
|
|
43
|
+
from sixlib.spmd_types._type_attr import get_local_type # noqa: F401
|
|
44
|
+
|
|
45
|
+
# Types
|
|
46
|
+
from sixlib.spmd_types.types import ( # noqa: F401
|
|
47
|
+
DimSharding,
|
|
48
|
+
I,
|
|
49
|
+
Invariant,
|
|
50
|
+
LocalSpmdType,
|
|
51
|
+
normalize_axis,
|
|
52
|
+
P,
|
|
53
|
+
Partial,
|
|
54
|
+
PartitionSpec,
|
|
55
|
+
PerMeshAxisLocalSpmdType,
|
|
56
|
+
PerMeshAxisSpmdType,
|
|
57
|
+
PerMeshAxisSpmdTypes,
|
|
58
|
+
R,
|
|
59
|
+
Replicate,
|
|
60
|
+
S,
|
|
61
|
+
Shard,
|
|
62
|
+
SpmdTypeError,
|
|
63
|
+
TensorSharding,
|
|
64
|
+
V,
|
|
65
|
+
Varying,
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class _SpmdTypesModule(ModuleType):
|
|
70
|
+
"""Module wrapper that provides TYPE_CHECKING as a dynamic attribute.
|
|
71
|
+
|
|
72
|
+
Accessing ``sixlib.spmd_types.TYPE_CHECKING`` returns True when a
|
|
73
|
+
``typecheck()`` context is active and False otherwise. This uses the
|
|
74
|
+
sys.modules replacement trick (same pattern as torch._dynamo.config)
|
|
75
|
+
so that a simple attribute read works like a function call.
|
|
76
|
+
"""
|
|
77
|
+
|
|
78
|
+
@property
|
|
79
|
+
def TYPE_CHECKING(self) -> bool:
|
|
80
|
+
return is_type_checking()
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
# Replace this module in sys.modules so that attribute access on the
|
|
84
|
+
# module object goes through _SpmdTypesModule.__getattr__ / properties.
|
|
85
|
+
_self = sys.modules[__name__]
|
|
86
|
+
_obj = _SpmdTypesModule(__name__)
|
|
87
|
+
_obj.__dict__.update(_self.__dict__)
|
|
88
|
+
_obj.__file__ = _self.__file__
|
|
89
|
+
_obj.__package__ = _self.__package__
|
|
90
|
+
_obj.__path__ = _self.__path__ # type: ignore[attr-defined]
|
|
91
|
+
_obj.__spec__ = _self.__spec__
|
|
92
|
+
sys.modules[__name__] = _obj
|