tvm
ccl.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
24 #ifndef TVM_RELAX_ATTRS_CCL_H_
25 #define TVM_RELAX_ATTRS_CCL_H_
26 
27 #include <tvm/relax/expr.h>
28 
29 namespace tvm {
30 namespace relax {
31 
33 struct AllReduceAttrs : public tvm::AttrsNode<AllReduceAttrs> {
35  bool in_group;
36 
37  TVM_DECLARE_ATTRS(AllReduceAttrs, "relax.attrs.AllReduceAttrs") {
38  TVM_ATTR_FIELD(op_type).describe(
39  "The type of reduction operation to be applied to the input data. Now only sum is "
40  "supported.");
41  TVM_ATTR_FIELD(in_group).describe(
42  "Whether the reduction operation performs in group or globally or in group as default.");
43  }
44 }; // struct AllReduceAttrs
45 
47 struct AllGatherAttrs : public tvm::AttrsNode<AllGatherAttrs> {
49  bool in_group;
50 
51  TVM_DECLARE_ATTRS(AllGatherAttrs, "relax.attrs.AllGatherAttrs") {
53  .describe(
54  "The number of workers, also the number of parts the given buffer should be chunked "
55  "into.");
56  TVM_ATTR_FIELD(in_group).describe(
57  "Whether the allgather operation performs in group or globally or in group as default.");
58  }
59 }; // struct AllGatherAttrs
60 
62 struct ScatterCollectiveAttrs : public tvm::AttrsNode<ScatterCollectiveAttrs> {
64  int axis;
65 
66  TVM_DECLARE_ATTRS(ScatterCollectiveAttrs, "relax.attrs.ScatterCollectiveAttrs") {
68  .describe(
69  "The number of workers, also the number of parts the given buffer should be chunked "
70  "into.");
71  TVM_ATTR_FIELD(axis).describe(
72  "The axis of the tensor to be scattered. The tensor will be chunked along "
73  "this axis.");
74  }
75 }; // struct ScatterCollectiveAttrs
76 
77 } // namespace relax
78 } // namespace tvm
79 
80 #endif // TVM_RELAX_ATTRS_CCL_H_
The base class of the all the Use "curiously recurring template pattern".
Definition: attrs.h:870
Reference to string objects.
Definition: string.h:98
#define TVM_ATTR_FIELD(FieldName)
Declare an attribute field.
Definition: attrs.h:76
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
Attributes used in allgather operators.
Definition: ccl.h:47
TVM_DECLARE_ATTRS(AllGatherAttrs, "relax.attrs.AllGatherAttrs")
Definition: ccl.h:51
int num_workers
Definition: ccl.h:48
bool in_group
Definition: ccl.h:49
Attributes used in allreduce operators.
Definition: ccl.h:33
bool in_group
Definition: ccl.h:35
String op_type
Definition: ccl.h:34
TVM_DECLARE_ATTRS(AllReduceAttrs, "relax.attrs.AllReduceAttrs")
Definition: ccl.h:37
Attributes used in scatter operators.
Definition: ccl.h:62
int num_workers
Definition: ccl.h:63
int axis
Definition: ccl.h:64
TVM_DECLARE_ATTRS(ScatterCollectiveAttrs, "relax.attrs.ScatterCollectiveAttrs")
Definition: ccl.h:66