Skip to content

Commit b15071a

Browse files
committed
ci: add lintrunner for clang and pyrefly
1 parent 7d1788b commit b15071a

File tree

16 files changed

+725
-2
lines changed

16 files changed

+725
-2
lines changed

.clang-format

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# The primary clang-format config file.
2+
# TODO(afuller): Set these settings when they aren't broken:
3+
# - AllowShortBlocksOnASingleLine: Empty
4+
---
5+
AccessModifierOffset: -1
6+
AlignAfterOpenBracket: AlwaysBreak
7+
AlignConsecutiveMacros: false
8+
AlignConsecutiveAssignments: false
9+
AlignConsecutiveBitFields: false
10+
AlignConsecutiveDeclarations: false
11+
AlignEscapedNewlines: Left
12+
AlignOperands: DontAlign
13+
AlignTrailingComments: false
14+
AllowAllArgumentsOnNextLine: true
15+
AllowAllConstructorInitializersOnNextLine: true
16+
AllowAllParametersOfDeclarationOnNextLine: false
17+
AllowShortEnumsOnASingleLine: true
18+
AllowShortBlocksOnASingleLine: Never
19+
AllowShortCaseLabelsOnASingleLine: false
20+
AllowShortFunctionsOnASingleLine: Empty
21+
AllowShortLambdasOnASingleLine: All
22+
AllowShortIfStatementsOnASingleLine: Never
23+
AllowShortLoopsOnASingleLine: false
24+
AlwaysBreakAfterReturnType: None
25+
AlwaysBreakBeforeMultilineStrings: true
26+
AlwaysBreakTemplateDeclarations: Yes
27+
BinPackArguments: false
28+
BinPackParameters: false
29+
BreakBeforeBinaryOperators: None
30+
BreakBeforeBraces: Attach
31+
BreakInheritanceList: BeforeColon
32+
BreakBeforeTernaryOperators: true
33+
BreakConstructorInitializers: BeforeColon
34+
BreakAfterJavaFieldAnnotations: false
35+
BreakStringLiterals: false
36+
ColumnLimit: 80
37+
CommentPragmas: '^ IWYU pragma:'
38+
CompactNamespaces: false
39+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
40+
ConstructorInitializerIndentWidth: 4
41+
ContinuationIndentWidth: 4
42+
Cpp11BracedListStyle: true
43+
DeriveLineEnding: true
44+
DerivePointerAlignment: false
45+
DisableFormat: false
46+
FixNamespaceComments: true
47+
ForEachMacros:
48+
- FOR_EACH
49+
- FOR_EACH_R
50+
- FOR_EACH_RANGE
51+
IncludeBlocks: Preserve
52+
IncludeCategories:
53+
- Regex: '^<.*\.h(pp)?>'
54+
Priority: 1
55+
- Regex: '^<.*'
56+
Priority: 2
57+
- Regex: '.*'
58+
Priority: 3
59+
IndentCaseLabels: true
60+
IndentCaseBlocks: false
61+
IndentGotoLabels: true
62+
IndentPPDirectives: None
63+
IndentExternBlock: AfterExternBlock
64+
IndentWidth: 2
65+
IndentWrappedFunctionNames: false
66+
InsertTrailingCommas: None
67+
JavaScriptQuotes: Leave
68+
JavaScriptWrapImports: true
69+
KeepEmptyLinesAtTheStartOfBlocks: false
70+
MacroBlockBegin: ''
71+
MacroBlockEnd: ''
72+
MaxEmptyLinesToKeep: 1
73+
NamespaceIndentation: None
74+
ObjCBinPackProtocolList: Auto
75+
ObjCBlockIndentWidth: 2
76+
ObjCBreakBeforeNestedBlockParam: true
77+
ObjCSpaceAfterProperty: false
78+
ObjCSpaceBeforeProtocolList: false
79+
PenaltyBreakAssignment: 2
80+
PenaltyBreakBeforeFirstCallParameter: 1
81+
PenaltyBreakComment: 300
82+
PenaltyBreakFirstLessLess: 120
83+
PenaltyBreakString: 1000
84+
PenaltyBreakTemplateDeclaration: 10
85+
PenaltyExcessCharacter: 1000000
86+
PenaltyReturnTypeOnItsOwnLine: 200
87+
PointerAlignment: Left
88+
ReflowComments: true
89+
SortIncludes: true
90+
SortUsingDeclarations: true
91+
SpaceAfterCStyleCast: false
92+
SpaceAfterLogicalNot: false
93+
SpaceAfterTemplateKeyword: true
94+
SpaceBeforeAssignmentOperators: true
95+
SpaceBeforeCpp11BracedList: false
96+
SpaceBeforeCtorInitializerColon: true
97+
SpaceBeforeInheritanceColon: true
98+
SpaceBeforeParens: ControlStatements
99+
SpaceBeforeRangeBasedForLoopColon: true
100+
SpaceInEmptyBlock: false
101+
SpaceInEmptyParentheses: false
102+
SpacesBeforeTrailingComments: 1
103+
SpacesInAngles: false
104+
SpacesInConditionalStatement: false
105+
SpacesInContainerLiterals: true
106+
SpacesInCStyleCastParentheses: false
107+
SpacesInParentheses: false
108+
SpacesInSquareBrackets: false
109+
SpaceBeforeSquareBrackets: false
110+
Standard: Latest
111+
TabWidth: 8
112+
UseCRLF: false
113+
UseTab: Never
114+
...

.github/workflows/docs.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
build-docs:
1111
if: github.repository_owner == 'meta-pytorch'
1212
name: Build Documentation
13-
runs-on: linux.g5.12xlarge.nvidia.gpu
13+
runs-on: linux.12xlarge
1414
container:
1515
image: nvidia/cuda:12.8.1-devel-ubuntu24.04
1616
timeout-minutes: 30
@@ -72,7 +72,7 @@ jobs:
7272
path: docs/build/html/
7373

7474
upload:
75-
runs-on: linux.g5.4xlarge.nvidia.gpu
75+
runs-on: linux.12xlarge
7676
permissions:
7777
# Grant write permission here so that the doc can be pushed to gh-pages branch
7878
contents: write

.github/workflows/lint.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
lint:
11+
if: github.repository_owner == 'meta-pytorch'
12+
name: lintrunner
13+
runs-on: linux.12xlarge
14+
container:
15+
image: nvidia/cuda:12.8.1-devel-ubuntu24.04
16+
timeout-minutes: 30
17+
steps:
18+
- name: Setup git
19+
shell: bash -l {0}
20+
run: |
21+
set -eux
22+
23+
apt-get update
24+
apt-get install -y git
25+
26+
# git doesn't like mixed ownership, override it
27+
chown -R root:root .
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
- name: Setup conda env
31+
uses: conda-incubator/setup-miniconda@v2
32+
with:
33+
auto-update-conda: true
34+
miniconda-version: "latest"
35+
activate-environment: test
36+
python-version: '3.14'
37+
auto-activate: false
38+
- name: Verify conda environment
39+
shell: bash -l {0}
40+
run: |
41+
conda info
42+
which python
43+
which conda
44+
- name: Update pip
45+
shell: bash -l {0}
46+
run: python -m pip install --upgrade pip
47+
- name: Install pytorch
48+
shell: bash -l {0}
49+
run: pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128
50+
- name: Install Dependencies
51+
shell: bash -l {0}
52+
run: |
53+
set -eux
54+
55+
conda install -y git
56+
conda install -y -c conda-forge glog==0.4.0 gflags fmt
57+
pip install cmake
58+
export USE_NCCL=0
59+
export USE_NCCLX=0
60+
export USE_GLOO=0
61+
export USE_SYSTEM_LIBS=1
62+
pip install --no-build-isolation .[dev] -v
63+
- name: Install Lint Dependencies
64+
shell: bash -l {0}
65+
run: |
66+
set -eux
67+
68+
lintrunner init
69+
- name: Lint
70+
shell: bash -l {0}
71+
run: |
72+
set -eux
73+
74+
# for lintrunner debugging
75+
export RUST_BACKTRACE=1
76+
77+
lintrunner --force-color --all-files -v

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ third-party/
44
__pycache__/
55
*.so
66
dist/
7+
.lintbin/
8+
.pyre/

.lintrunner.toml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
[[linter]]
2+
code = "CLANGFORMAT"
3+
include_patterns = [
4+
"comms/torchcomms/**/*.hpp",
5+
"comms/torchcomms/**/*.cpp",
6+
]
7+
exclude_patterns = []
8+
init_command = [
9+
"python3",
10+
"tools/linter/adapters/pip_init.py",
11+
"--dry-run={{DRYRUN}}",
12+
"clang-format==21.1.2",
13+
]
14+
command = [
15+
"python3",
16+
"tools/linter/adapters/clangformat_linter.py",
17+
"--",
18+
"@{{PATHSFILE}}",
19+
]
20+
is_formatter = true
21+
22+
[[linter]]
23+
code = 'PYRE'
24+
include_patterns = [
25+
"comms/torchcomms/**/*.py",
26+
"comms/torchcomms/**/*.pyi",
27+
]
28+
command = [
29+
'python3',
30+
'tools/linter/adapters/pyre_linter.py',
31+
'--',
32+
'@{{PATHSFILE}}'
33+
]
34+
init_command = [
35+
'bash',
36+
'scripts/setup_pyre.sh',
37+
'--dry-run={{DRYRUN}}',
38+
]
39+
is_formatter = false

.pyre_configuration

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"exclude": [
3+
".*/build/.*",
4+
".*/docs/.*",
5+
".*/setup.py",
6+
".*/third-party/.*",
7+
".*/comms/rcclx/.*",
8+
".*/comms/ncclx/.*",
9+
".*/comms/utils/.*"
10+
],
11+
"ignore_all_errors": [
12+
],
13+
"site_package_search_strategy": "all",
14+
"source_directories": [
15+
"scripts",
16+
"comms"
17+
],
18+
"strict": false,
19+
"version": "0.0.101749035478"
20+
}

comms/torchcomms/_comms_gloo.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
gloo/_comms_gloo.pyi

comms/torchcomms/_comms_nccl.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nccl/_comms_nccl.pyi

comms/torchcomms/_comms_ncclx.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ncclx/_comms_ncclx.pyi

comms/torchcomms/_comms_rccl.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rccl/_comms_rccl.pyi

0 commit comments

Comments
 (0)