Coverage for / home / jenkins / .local / lib / python3.10 / site-packages / hyper_parallel / distributed / __init__.py: 100%
8 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-12-05 05:12 +0800
« prev ^ index » next coverage.py v7.13.1, created at 2026-12-05 05:12 +0800
1# Copyright 2025-2026 Huawei Technologies Co., Ltd
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14# ============================================================================
15# pylint: disable=missing-apache-license-header
16"""distributed: model-level DTensor sharding plan and recipe contract.
18Public surface (migration plan §7.1): the model-level ``ShardingPlan``, the
19recipe input contract (``ModuleShardingSpec`` / ``NamedPlacement`` /
20``MeshAxisName`` / placement DSL parsers) and the public template type
21``ShardingTemplate``, plan construction (``ShardingPlanner`` /
22``validate_model_compatibility``) and the injection decorators
23(``forward_replacement`` / ``local_compute`` / ``inner_wrapper``) and plan application
24(``apply_sharding_plan``).
25"""
27from hyper_parallel.distributed.apply import (
28 apply_sharding_plan,
29)
30from hyper_parallel.distributed.plan import ShardingPlan
31from hyper_parallel.distributed._builder.planner import (
32 ShardingPlanner,
33 validate_model_compatibility,
34)
35from hyper_parallel.distributed.recipe_spec import (
36 CP,
37 DP,
38 EP,
39 TP,
40 MeshAxisName,
41 ModuleShardingSpec,
42 NamedPlacement,
43 PlacementMismatchError,
44 forward_replacement,
45 inner_wrapper,
46 local_compute,
47 parse_named_placement,
48 parse_placement,
49 resolve_placements,
50)
51from hyper_parallel.distributed._builder.default_templates import (
52 ShardingTemplate,
53)
54from hyper_parallel.distributed.activation_checkpoint import (
55 _apply_activation_checkpointing,
56)
57from hyper_parallel.distributed.compile import (
58 apply_compile,
59 get_compile_layers,
60 resolve_compile_kwargs,
61)
63__all__ = [
64 "CP",
65 "DP",
66 "EP",
67 "TP",
68 "MeshAxisName",
69 "ModuleShardingSpec",
70 "NamedPlacement",
71 "PlacementMismatchError",
72 "ShardingPlan",
73 "ShardingPlanner",
74 "ShardingTemplate",
75 "forward_replacement",
76 "inner_wrapper",
77 "local_compute",
78 "parse_named_placement",
79 "parse_placement",
80 "resolve_placements",
81 "apply_sharding_plan",
82 "validate_model_compatibility",
83 "_apply_activation_checkpointing",
84 "apply_compile",
85 "get_compile_layers",
86 "resolve_compile_kwargs",
87]