Skip to content

Commit 226af61

Browse files
authored
setup build/lint system. add rms_norm as first op to verify functionality (#1)
* setup build system, add rms_norm as first kernel Signed-off-by: Kunshang Ji <[email protected]> * fix Signed-off-by: Kunshang Ji <[email protected]> * add readme Signed-off-by: Kunshang Ji <[email protected]> * add uts Signed-off-by: Kunshang Ji <[email protected]> * fix Signed-off-by: Kunshang Ji <[email protected]> * add benchmark Signed-off-by: Kunshang Ji <[email protected]> * update Signed-off-by: Kunshang Ji <[email protected]> * fix Signed-off-by: Kunshang Ji <[email protected]> fix Signed-off-by: Kunshang Ji <[email protected]> remove const Signed-off-by: Kunshang Ji <[email protected]> fix Signed-off-by: Kunshang Ji <[email protected]> * port dispatch utils Signed-off-by: Kunshang Ji <[email protected]> --------- Signed-off-by: Kunshang Ji <[email protected]>
1 parent c978195 commit 226af61

28 files changed

+3006
-0
lines changed

.clang-format

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
BasedOnStyle: Google
2+
UseTab: Never
3+
IndentWidth: 2
4+
ColumnLimit: 80
5+
6+
# Force pointers to the type for C++.
7+
DerivePointerAlignment: false
8+
PointerAlignment: Left
9+
10+
# Reordering #include statements can (and currently will) introduce errors
11+
SortIncludes: false
12+
13+
# Style choices
14+
AlignConsecutiveAssignments: false
15+
AlignConsecutiveDeclarations: false
16+
IndentPPDirectives: BeforeHash
17+
18+
IncludeCategories:
19+
- Regex: '^<'
20+
Priority: 4
21+
- Regex: '^"(llvm|llvm-c|clang|clang-c|mlir|mlir-c)/'
22+
Priority: 3
23+
- Regex: '^"(qoda|\.\.)/'
24+
Priority: 2
25+
- Regex: '.*'
26+
Priority: 1

.gitignore

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
# version file generated by setuptools-scm
2+
/vllm/_version.py
3+
4+
# vllm-flash-attn built from source
5+
vllm/vllm_flash_attn/*
6+
7+
# Byte-compiled / optimized / DLL files
8+
__pycache__/
9+
*.py[cod]
10+
*$py.class
11+
12+
# C extensions
13+
*.so
14+
15+
# Distribution / packaging
16+
.Python
17+
build/
18+
cmake-build-*/
19+
CMakeUserPresets.json
20+
develop-eggs/
21+
dist/
22+
downloads/
23+
eggs/
24+
.eggs/
25+
lib/
26+
lib64/
27+
parts/
28+
sdist/
29+
var/
30+
wheels/
31+
share/python-wheels/
32+
*.egg-info/
33+
.installed.cfg
34+
*.egg
35+
MANIFEST
36+
/.deps/
37+
38+
# PyInstaller
39+
# Usually these files are written by a python script from a template
40+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
41+
*.manifest
42+
*.spec
43+
44+
# Installer logs
45+
pip-log.txt
46+
pip-delete-this-directory.txt
47+
48+
# Unit test / coverage reports
49+
htmlcov/
50+
.tox/
51+
.nox/
52+
.coverage
53+
.coverage.*
54+
.cache
55+
nosetests.xml
56+
coverage.xml
57+
*.cover
58+
*.py,cover
59+
.hypothesis/
60+
.pytest_cache/
61+
cover/
62+
63+
# Translations
64+
*.mo
65+
*.pot
66+
67+
# Django stuff:
68+
*.log
69+
local_settings.py
70+
db.sqlite3
71+
db.sqlite3-journal
72+
73+
# Flask stuff:
74+
instance/
75+
.webassets-cache
76+
77+
# Scrapy stuff:
78+
.scrapy
79+
80+
# PyBuilder
81+
.pybuilder/
82+
target/
83+
84+
# Jupyter Notebook
85+
.ipynb_checkpoints
86+
87+
# IPython
88+
profile_default/
89+
ipython_config.py
90+
91+
# generated files
92+
**/generated/**
93+
94+
# pyenv
95+
# For a library or package, you might want to ignore these files since the code is
96+
# intended to run in multiple environments; otherwise, check them in:
97+
# .python-version
98+
99+
# pipenv
100+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
101+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
102+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
103+
# install all needed dependencies.
104+
#Pipfile.lock
105+
106+
# poetry
107+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
108+
# This is especially recommended for binary packages to ensure reproducibility, and is more
109+
# commonly ignored for libraries.
110+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
111+
#poetry.lock
112+
113+
# pdm
114+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
115+
#pdm.lock
116+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
117+
# in version control.
118+
# https://pdm.fming.dev/#use-with-ide
119+
.pdm.toml
120+
121+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
122+
__pypackages__/
123+
124+
# Celery stuff
125+
celerybeat-schedule
126+
celerybeat.pid
127+
128+
# SageMath parsed files
129+
*.sage.py
130+
131+
# Environments
132+
.env
133+
.venv
134+
env/
135+
venv/
136+
ENV/
137+
env.bak/
138+
venv.bak/
139+
140+
# Spyder project settings
141+
.spyderproject
142+
.spyproject
143+
144+
# Rope project settings
145+
.ropeproject
146+
147+
# mkdocs documentation
148+
/site
149+
docs/examples
150+
151+
# mypy
152+
.mypy_cache/
153+
.dmypy.json
154+
dmypy.json
155+
156+
# Pyre type checker
157+
.pyre/
158+
159+
# pytype static type analyzer
160+
.pytype/
161+
162+
# Cython debug symbols
163+
cython_debug/
164+
165+
# PyCharm
166+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
167+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
168+
# and can be added to the global gitignore or merged into this file. For a more nuclear
169+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
170+
.idea/
171+
172+
# VSCode
173+
.vscode/
174+
175+
# DS Store
176+
.DS_Store
177+
178+
# Results
179+
*.csv
180+
181+
# Python pickle files
182+
*.pkl
183+
184+
# Sphinx documentation
185+
_build/
186+
187+
# vim swap files
188+
*.swo
189+
*.swp
190+
191+
# hip files generated by PyTorch
192+
*.hip
193+
*_hip*
194+
hip_compat.h
195+
196+
# Benchmark dataset
197+
benchmarks/**/*.json
198+
199+
# Linting
200+
actionlint
201+
shellcheck*/
202+
203+
# benchmark kernel config
204+
configs

.pre-commit-config.yaml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
default_install_hook_types:
2+
- pre-commit
3+
- commit-msg
4+
default_stages:
5+
- pre-commit # Run locally
6+
- manual # Run in CI
7+
exclude: 'vllm/third_party/.*'
8+
repos:
9+
- repo: https://github.com/google/yapf
10+
rev: v0.43.0
11+
hooks:
12+
- id: yapf
13+
args: [--in-place, --verbose]
14+
- repo: https://github.com/astral-sh/ruff-pre-commit
15+
rev: v0.11.7
16+
hooks:
17+
- id: ruff
18+
args: [--output-format, github, --fix]
19+
- id: ruff-format
20+
files: ^(.buildkite|benchmarks|examples)/.*
21+
- repo: https://github.com/codespell-project/codespell
22+
rev: v2.4.1
23+
hooks:
24+
- id: codespell
25+
additional_dependencies: ['tomli']
26+
args: ['--toml', 'pyproject.toml']
27+
- repo: https://github.com/PyCQA/isort
28+
rev: 6.0.1
29+
hooks:
30+
- id: isort
31+
- repo: https://github.com/pre-commit/mirrors-clang-format
32+
rev: v20.1.3
33+
hooks:
34+
- id: clang-format
35+
types_or: [c++, cuda]
36+
args: [--style=file, --verbose]
37+
- repo: https://github.com/jackdewinter/pymarkdown
38+
rev: v0.9.29
39+
hooks:
40+
- id: pymarkdown
41+
exclude: '.*\.inc\.md'
42+
args: [fix]
43+
- repo: https://github.com/rhysd/actionlint
44+
rev: v1.7.7
45+
hooks:
46+
- id: actionlint
47+
- repo: https://github.com/astral-sh/uv-pre-commit
48+
rev: 0.6.17
49+
hooks:
50+
- id: pip-compile
51+
args: [requirements/test.in, -o, requirements/test.txt, --index-strategy, unsafe-best-match, --torch-backend, cu128]
52+
files: ^requirements/test\.(in|txt)$
53+
- repo: local
54+
hooks:
55+
- id: mypy-local
56+
name: Run mypy for local Python installation
57+
entry: tools/mypy.sh 0 "local"
58+
language: python
59+
types: [python]
60+
additional_dependencies: &mypy_deps [mypy==1.11.1, types-cachetools, types-setuptools, types-PyYAML, types-requests]
61+
stages: [pre-commit] # Don't run in CI
62+
- id: mypy-3.9 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
63+
name: Run mypy for Python 3.9
64+
entry: tools/mypy.sh 1 "3.9"
65+
language: python
66+
types: [python]
67+
additional_dependencies: *mypy_deps
68+
stages: [manual] # Only run in CI
69+
- id: mypy-3.10 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
70+
name: Run mypy for Python 3.10
71+
entry: tools/mypy.sh 1 "3.10"
72+
language: python
73+
types: [python]
74+
additional_dependencies: *mypy_deps
75+
stages: [manual] # Only run in CI
76+
- id: mypy-3.11 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
77+
name: Run mypy for Python 3.11
78+
entry: tools/mypy.sh 1 "3.11"
79+
language: python
80+
types: [python]
81+
additional_dependencies: *mypy_deps
82+
stages: [manual] # Only run in CI
83+
- id: mypy-3.12 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
84+
name: Run mypy for Python 3.12
85+
entry: tools/mypy.sh 1 "3.12"
86+
language: python
87+
types: [python]
88+
additional_dependencies: *mypy_deps
89+
stages: [manual] # Only run in CI
90+
- id: shellcheck
91+
name: Lint shell scripts
92+
entry: tools/shellcheck.sh
93+
language: script
94+
types: [shell]
95+
- id: png-lint
96+
name: Lint PNG exports from excalidraw
97+
entry: tools/png-lint.sh
98+
language: script
99+
types: [png]
100+
- id: signoff-commit
101+
name: Sign-off Commit
102+
entry: bash
103+
args:
104+
- -c
105+
- |
106+
if ! grep -q "^Signed-off-by: $(git config user.name) <$(git config user.email)>" "$(git rev-parse --git-path COMMIT_EDITMSG)"; then
107+
printf "\nSigned-off-by: $(git config user.name) <$(git config user.email)>\n" >> "$(git rev-parse --git-path COMMIT_EDITMSG)"
108+
fi
109+
language: system
110+
verbose: true
111+
stages: [commit-msg]
112+
- id: check-spdx-header
113+
name: Check SPDX headers
114+
entry: python tools/check_spdx_header.py
115+
language: python
116+
types: [python]
117+
- id: check-filenames
118+
name: Check for spaces in all filenames
119+
entry: bash
120+
args:
121+
- -c
122+
- 'git ls-files | grep " " && echo "Filenames should not contain spaces!" && exit 1 || exit 0'
123+
language: system
124+
always_run: true
125+
pass_filenames: false
126+
- id: enforce-import-regex-instead-of-re
127+
name: Enforce import regex as re
128+
entry: python tools/enforce_regex_import.py
129+
language: python
130+
types: [python]
131+
pass_filenames: false
132+
additional_dependencies: [regex]
133+
134+
- id: suggestion
135+
name: Suggestion
136+
entry: bash -c 'echo "To bypass pre-commit hooks, add --no-verify to git commit."'
137+
language: system
138+
verbose: true
139+
pass_filenames: false
140+
# Insert new entries above the `suggestion` entry

0 commit comments

Comments
 (0)