• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/* Copyright 2022 The TensorFlow Authors. All Rights Reserved.
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7    http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is distributed on an "AS IS" BASIS,
11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12See the License for the specific language governing permissions and
13limitations under the License.
14==============================================================================*/
15
16syntax = "proto3";
17
18package tensorflow.dtensor;
19
20// Defines a sharding spec over a tensor.
21// A sharding spec can either be a mesh dimension of the associated mesh or the
22// special values scalar, or not_sharded.
23message ShardingSpec {
24  // Field 1 was deleted, therefore we reserve it for back-compatibility.
25  reserved 1;
26  // If set, the mesh dimension this tensor dimension is sharded over.
27  string sharding_spec = 2;
28}
29
30message MeshDimensionProto {
31  // Name of mesh dimension, required to create Mesh.
32  string name = 1;
33  // Length of mesh dimension.
34  int64 size = 2;
35}
36
37// Proto representation of a Layout.
38message LayoutProto {
39  repeated ShardingSpec sharding_specs = 1;
40  MeshProto mesh_config = 2;
41}
42
43// Proto representation of a Mesh.
44// TODO(allenl): Add a unique mesh ID so we have an efficient way to identify
45// meshes in mappings.
46message MeshProto {
47  repeated MeshDimensionProto mesh_dimensions = 1;
48
49  // A list of global devices ids.
50  repeated int64 global_device_ids = 2;
51
52  // Devices ids handled by the local process.
53  repeated int64 local_device_ids = 4;
54
55  // Devices handled by the local process.
56  repeated string local_devices = 5;
57
58  // Global device names (Optional). Set when multiple device meshes are in use.
59  repeated string global_devices = 6;
60
61  // Required name which uniquely identifies this mesh in a program.
62  string name = 3;
63}
64