Skip to content

Commit 80dfc4e

Browse files
c-p-i-ofacebook-github-bot
authored andcommitted
fix various linter errors
Summary: Fix lints coming from clang-format Differential Revision: D69251706
1 parent b67ecd8 commit 80dfc4e

File tree

15 files changed

+379
-61
lines changed

15 files changed

+379
-61
lines changed

.github/config/lint/.clang-format

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
---
2+
AccessModifierOffset: -1
3+
AlignAfterOpenBracket: AlwaysBreak
4+
AlignConsecutiveAssignments: false
5+
AlignConsecutiveDeclarations: false
6+
AlignEscapedNewlinesLeft: true
7+
AlignOperands: false
8+
AlignTrailingComments: false
9+
AllowAllParametersOfDeclarationOnNextLine: false
10+
AllowShortBlocksOnASingleLine: false
11+
AllowShortCaseLabelsOnASingleLine: false
12+
AllowShortFunctionsOnASingleLine: Empty
13+
AllowShortIfStatementsOnASingleLine: false
14+
AllowShortLoopsOnASingleLine: false
15+
AlwaysBreakAfterReturnType: None
16+
AlwaysBreakBeforeMultilineStrings: true
17+
AlwaysBreakTemplateDeclarations: true
18+
BinPackArguments: false
19+
BinPackParameters: false
20+
BraceWrapping:
21+
AfterClass: false
22+
AfterControlStatement: false
23+
AfterEnum: false
24+
AfterFunction: false
25+
AfterNamespace: false
26+
AfterObjCDeclaration: false
27+
AfterStruct: false
28+
AfterUnion: false
29+
BeforeCatch: false
30+
BeforeElse: false
31+
IndentBraces: false
32+
BreakBeforeBinaryOperators: None
33+
BreakBeforeBraces: Attach
34+
BreakBeforeTernaryOperators: true
35+
BreakConstructorInitializersBeforeComma: false
36+
BreakAfterJavaFieldAnnotations: false
37+
BreakStringLiterals: false
38+
ColumnLimit: 80
39+
CommentPragmas: '^ IWYU pragma:'
40+
CompactNamespaces: false
41+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
42+
ConstructorInitializerIndentWidth: 4
43+
ContinuationIndentWidth: 4
44+
Cpp11BracedListStyle: true
45+
DerivePointerAlignment: false
46+
DisableFormat: false
47+
ForEachMacros:
48+
- FOR_EACH_RANGE
49+
- FOR_EACH
50+
IncludeCategories:
51+
- Regex: '^<.*\.h(pp)?>'
52+
Priority: 1
53+
- Regex: '^<.*'
54+
Priority: 2
55+
- Regex: '.*'
56+
Priority: 3
57+
IndentCaseLabels: true
58+
IndentWidth: 2
59+
IndentWrappedFunctionNames: false
60+
KeepEmptyLinesAtTheStartOfBlocks: false
61+
MacroBlockBegin: ''
62+
MacroBlockEnd: ''
63+
Macros:
64+
- >-
65+
PyObject_HEAD_INIT(type)={
66+
/* this is not exactly match with PyObject_HEAD_INIT in Python source code
67+
* but it is enough for clang-format */
68+
{ 0xFFFFFFFF },
69+
(type)
70+
},
71+
- >-
72+
PyVarObject_HEAD_INIT(type, size)={
73+
{
74+
/* manually expand PyObject_HEAD_INIT(type) above
75+
* because clang-format do not support recursive expansion */
76+
{ 0xFFFFFFFF },
77+
(type)
78+
},
79+
(size)
80+
},
81+
MaxEmptyLinesToKeep: 1
82+
NamespaceIndentation: None
83+
PenaltyBreakBeforeFirstCallParameter: 1
84+
PenaltyBreakComment: 300
85+
PenaltyBreakFirstLessLess: 120
86+
PenaltyBreakString: 1000
87+
PenaltyExcessCharacter: 1000000
88+
PenaltyReturnTypeOnItsOwnLine: 2000000
89+
PointerAlignment: Left
90+
ReflowComments: true
91+
SortIncludes: true
92+
SpaceAfterCStyleCast: false
93+
SpaceBeforeAssignmentOperators: true
94+
SpaceBeforeParens: ControlStatements
95+
SpaceInEmptyParentheses: false
96+
SpacesBeforeTrailingComments: 1
97+
SpacesInAngles: false
98+
SpacesInContainerLiterals: true
99+
SpacesInCStyleCastParentheses: false
100+
SpacesInParentheses: false
101+
SpacesInSquareBrackets: false
102+
Standard: c++17
103+
StatementMacros:
104+
- C10_DEFINE_bool
105+
- C10_DEFINE_int
106+
- C10_DEFINE_int32
107+
- C10_DEFINE_int64
108+
- C10_DEFINE_string
109+
- C10_DEFINE_REGISTRY_WITHOUT_WARNING
110+
- C10_REGISTER_CREATOR
111+
- DEFINE_BINARY
112+
- PyObject_HEAD
113+
- PyObject_VAR_HEAD
114+
- PyException_HEAD
115+
- TORCH_DECLARE_bool
116+
117+
TabWidth: 8
118+
UseTab: Never
119+
---
120+
Language: ObjC
121+
ColumnLimit: 120
122+
AlignAfterOpenBracket: Align
123+
ObjCBlockIndentWidth: 2
124+
ObjCSpaceAfterProperty: false
125+
ObjCSpaceBeforeProtocolList: false
126+
...

gloo/.clang-format

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
---
2+
AccessModifierOffset: -1
3+
AlignAfterOpenBracket: AlwaysBreak
4+
AlignConsecutiveAssignments: false
5+
AlignConsecutiveDeclarations: false
6+
AlignEscapedNewlinesLeft: true
7+
AlignOperands: false
8+
AlignTrailingComments: false
9+
AllowAllParametersOfDeclarationOnNextLine: false
10+
AllowShortBlocksOnASingleLine: false
11+
AllowShortCaseLabelsOnASingleLine: false
12+
AllowShortFunctionsOnASingleLine: Empty
13+
AllowShortIfStatementsOnASingleLine: false
14+
AllowShortLoopsOnASingleLine: false
15+
AlwaysBreakAfterReturnType: None
16+
AlwaysBreakBeforeMultilineStrings: true
17+
AlwaysBreakTemplateDeclarations: true
18+
BinPackArguments: false
19+
BinPackParameters: false
20+
BraceWrapping:
21+
AfterClass: false
22+
AfterControlStatement: false
23+
AfterEnum: false
24+
AfterFunction: false
25+
AfterNamespace: false
26+
AfterObjCDeclaration: false
27+
AfterStruct: false
28+
AfterUnion: false
29+
BeforeCatch: false
30+
BeforeElse: false
31+
IndentBraces: false
32+
BreakBeforeBinaryOperators: None
33+
BreakBeforeBraces: Attach
34+
BreakBeforeTernaryOperators: true
35+
BreakConstructorInitializersBeforeComma: false
36+
BreakAfterJavaFieldAnnotations: false
37+
BreakStringLiterals: false
38+
ColumnLimit: 80
39+
CommentPragmas: '^ IWYU pragma:'
40+
CompactNamespaces: false
41+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
42+
ConstructorInitializerIndentWidth: 4
43+
ContinuationIndentWidth: 4
44+
Cpp11BracedListStyle: true
45+
DerivePointerAlignment: false
46+
DisableFormat: false
47+
ForEachMacros:
48+
- FOR_EACH_RANGE
49+
- FOR_EACH
50+
IncludeCategories:
51+
- Regex: '^<.*\.h(pp)?>'
52+
Priority: 1
53+
- Regex: '^<.*'
54+
Priority: 2
55+
- Regex: '.*'
56+
Priority: 3
57+
IndentCaseLabels: true
58+
IndentWidth: 2
59+
IndentWrappedFunctionNames: false
60+
KeepEmptyLinesAtTheStartOfBlocks: false
61+
MacroBlockBegin: ''
62+
MacroBlockEnd: ''
63+
Macros:
64+
- >-
65+
PyObject_HEAD_INIT(type)={
66+
/* this is not exactly match with PyObject_HEAD_INIT in Python source code
67+
* but it is enough for clang-format */
68+
{ 0xFFFFFFFF },
69+
(type)
70+
},
71+
- >-
72+
PyVarObject_HEAD_INIT(type, size)={
73+
{
74+
/* manually expand PyObject_HEAD_INIT(type) above
75+
* because clang-format do not support recursive expansion */
76+
{ 0xFFFFFFFF },
77+
(type)
78+
},
79+
(size)
80+
},
81+
MaxEmptyLinesToKeep: 1
82+
NamespaceIndentation: None
83+
PenaltyBreakBeforeFirstCallParameter: 1
84+
PenaltyBreakComment: 300
85+
PenaltyBreakFirstLessLess: 120
86+
PenaltyBreakString: 1000
87+
PenaltyExcessCharacter: 1000000
88+
PenaltyReturnTypeOnItsOwnLine: 2000000
89+
PointerAlignment: Left
90+
ReflowComments: true
91+
SortIncludes: true
92+
SpaceAfterCStyleCast: false
93+
SpaceBeforeAssignmentOperators: true
94+
SpaceBeforeParens: ControlStatements
95+
SpaceInEmptyParentheses: false
96+
SpacesBeforeTrailingComments: 1
97+
SpacesInAngles: false
98+
SpacesInContainerLiterals: true
99+
SpacesInCStyleCastParentheses: false
100+
SpacesInParentheses: false
101+
SpacesInSquareBrackets: false
102+
Standard: c++17
103+
StatementMacros:
104+
- C10_DEFINE_bool
105+
- C10_DEFINE_int
106+
- C10_DEFINE_int32
107+
- C10_DEFINE_int64
108+
- C10_DEFINE_string
109+
- C10_DEFINE_REGISTRY_WITHOUT_WARNING
110+
- C10_REGISTER_CREATOR
111+
- DEFINE_BINARY
112+
- PyObject_HEAD
113+
- PyObject_VAR_HEAD
114+
- PyException_HEAD
115+
- TORCH_DECLARE_bool
116+
117+
TabWidth: 8
118+
UseTab: Never
119+
---
120+
Language: ObjC
121+
ColumnLimit: 120
122+
AlignAfterOpenBracket: Align
123+
ObjCBlockIndentWidth: 2
124+
ObjCSpaceAfterProperty: false
125+
ObjCSpaceBeforeProtocolList: false
126+
...

gloo/allreduce_bcube.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,11 @@ class Group {
214214
* @count The total number of elements to be processed by this node
215215
* @return The number of elements to be processed by this group
216216
*/
217-
static int
218-
computeNumElems(int step, const Node& firstNode, int peers, int count) {
217+
static int computeNumElems(
218+
int step,
219+
const Node& firstNode,
220+
int peers,
221+
int count) {
219222
int groupCount =
220223
(0 == step) ? count : firstNode.getNumElemsPerStep(step - 1);
221224
return std::max(groupCount, peers);
@@ -226,8 +229,11 @@ class Group {
226229
* group
227230
* @return List of ranks of nodes in the group
228231
*/
229-
std::vector<int>
230-
getNodeRanks(int firstNodeRank, int peerDistance, int base, int nodes) const {
232+
std::vector<int> getNodeRanks(
233+
int firstNodeRank,
234+
int peerDistance,
235+
int base,
236+
int nodes) const {
231237
std::vector<int> groupPeers;
232238
for (int i = 0; i < base; ++i) {
233239
int peerRank = firstNodeRank + i * peerDistance;

gloo/alltoallv.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@ class AlltoallvOptions {
7878
size_t elementSize);
7979

8080
// Untemplated implementation of setInput on opaque pointer.
81-
void
82-
setInput(void* ptr, std::vector<int64_t> elementsPerRank, size_t elementSize);
81+
void setInput(
82+
void* ptr,
83+
std::vector<int64_t> elementsPerRank,
84+
size_t elementSize);
8385

8486
// Untemplated implementation of setOutput on unbound buffer.
8587
void setOutput(

gloo/common/string.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ inline void MakeStringInternal(
2828
}
2929

3030
template <typename T, typename... Args>
31-
inline void
32-
MakeStringInternal(std::stringstream& ss, const T& t, const Args&... args) {
31+
inline void MakeStringInternal(
32+
std::stringstream& ss,
33+
const T& t,
34+
const Args&... args) {
3335
MakeStringInternal(ss, t);
3436
MakeStringInternal(ss, args...);
3537
}

gloo/cuda_allreduce_bcube.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,16 +389,22 @@ class Group {
389389
* @count The total number of elements to be processed by this node
390390
* @return The number of elements to be processed by this group
391391
*/
392-
static int
393-
computeNumElems(int step, const Node& firstNode, int peers, int count);
392+
static int computeNumElems(
393+
int step,
394+
const Node& firstNode,
395+
int peers,
396+
int count);
394397
/**
395398
* Determines all the nodes in a group in a particular step
396399
* @param peerDistance This is the distance between rank of each peer in the
397400
* group
398401
* @return List of ranks of nodes in the group
399402
*/
400-
std::vector<int>
401-
getNodeRanks(int firstNodeRank, int peerDistance, int base, int nodes) const;
403+
std::vector<int> getNodeRanks(
404+
int firstNodeRank,
405+
int peerDistance,
406+
int base,
407+
int nodes) const;
402408
};
403409

404410
} // namespace bcube

gloo/math.h

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,23 +98,35 @@ inline uint32_t log2ceil(uint32_t value) {
9898

9999
template <>
100100
void sum<float16>(void* c, const void* a, const void* b, size_t n);
101-
extern template void
102-
sum<float16>(void* c, const void* a, const void* b, size_t n);
101+
extern template void sum<float16>(
102+
void* c,
103+
const void* a,
104+
const void* b,
105+
size_t n);
103106

104107
template <>
105108
void product<float16>(void* c, const void* a, const void* b, size_t n);
106-
extern template void
107-
product<float16>(void* c, const void* a, const void* b, size_t n);
109+
extern template void product<float16>(
110+
void* c,
111+
const void* a,
112+
const void* b,
113+
size_t n);
108114

109115
template <>
110116
void max<float16>(void* c, const void* a, const void* b, size_t n);
111-
extern template void
112-
max<float16>(void* c, const void* a, const void* b, size_t n);
117+
extern template void max<float16>(
118+
void* c,
119+
const void* a,
120+
const void* b,
121+
size_t n);
113122

114123
template <>
115124
void min<float16>(void* c, const void* a, const void* b, size_t n);
116-
extern template void
117-
min<float16>(void* c, const void* a, const void* b, size_t n);
125+
extern template void min<float16>(
126+
void* c,
127+
const void* a,
128+
const void* b,
129+
size_t n);
118130

119131
#endif
120132

0 commit comments

Comments
 (0)