Skip to content

Commit 94eee2b

Browse files
committed
code refactor
1 parent e05d632 commit 94eee2b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+29313
-1282
lines changed

Slime/.clang-format

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Adapted from LMDeploy
2+
Language: Cpp
3+
AccessModifierOffset: -4
4+
AlignAfterOpenBracket: Align
5+
AllowShortEnumsOnASingleLine: false
6+
AlignConsecutiveAssignments: true
7+
AlignConsecutiveDeclarations: true
8+
AlignEscapedNewlines: Right
9+
AlignOperands: true
10+
AlignTrailingComments: true
11+
AllowAllParametersOfDeclarationOnNextLine: true
12+
AllowAllArgumentsOnNextLine: true
13+
AllowShortBlocksOnASingleLine: Empty
14+
AllowShortCaseLabelsOnASingleLine: false
15+
AllowShortFunctionsOnASingleLine: Empty
16+
AllowShortIfStatementsOnASingleLine: Never
17+
AllowShortLoopsOnASingleLine: false
18+
AlwaysBreakAfterReturnType: None
19+
AlwaysBreakBeforeMultilineStrings: false
20+
AlwaysBreakTemplateDeclarations: true
21+
BinPackArguments: false
22+
BinPackParameters: false
23+
BreakBeforeBinaryOperators: NonAssignment
24+
BreakBeforeBraces: Stroustrup
25+
BreakBeforeTernaryOperators: false
26+
BreakConstructorInitializers: AfterColon
27+
BreakInheritanceList: AfterColon
28+
BreakStringLiterals: false
29+
ColumnLimit: 120
30+
CompactNamespaces: false
31+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
32+
ConstructorInitializerIndentWidth: 4
33+
ContinuationIndentWidth: 4
34+
Cpp11BracedListStyle: true
35+
DerivePointerAlignment: false
36+
FixNamespaceComments: true
37+
IndentCaseLabels: true
38+
IndentPPDirectives: None
39+
IndentWidth: 4
40+
IndentWrappedFunctionNames: false
41+
KeepEmptyLinesAtTheStartOfBlocks: true
42+
MaxEmptyLinesToKeep: 1
43+
NamespaceIndentation: None
44+
PointerAlignment: Left
45+
ReflowComments: true
46+
SortIncludes: true
47+
SortUsingDeclarations: false
48+
SpaceAfterCStyleCast: false
49+
SpaceAfterTemplateKeyword: false
50+
SpaceBeforeAssignmentOperators: true
51+
SpaceBeforeCtorInitializerColon: false
52+
SpaceBeforeInheritanceColon: false
53+
SpaceBeforeParens: ControlStatements
54+
SpaceInEmptyParentheses: false
55+
SpacesBeforeTrailingComments: 2
56+
SpacesInAngles: false
57+
SpacesInCStyleCastParentheses: false
58+
SpacesInContainerLiterals: false
59+
SpacesInParentheses: false
60+
SpacesInSquareBrackets: false
61+
Standard: c++17
62+
TabWidth: 4
63+
UseTab: Never

Slime/.gitignore

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

Slime/CMakeLists.txt

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
cmake_minimum_required(VERSION 3.10)
2+
3+
project(_slime C CXX CUDA)
4+
5+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
6+
7+
option(BUILD_BENCH "Build transfer engine benchmark" OFF)
8+
option(BUILD_PYTHON "Build python wrapper" ON)
9+
option(BUILD_TEST "Build test" OFF)
10+
11+
include_directories(csrc)
12+
add_subdirectory(csrc)
13+
14+
if (BUILD_BENCH)
15+
add_subdirectory(bench)
16+
endif (BUILD_BENCH)
17+
18+
if (BUILD_TEST)
19+
add_subdirectory(tests/cpp)
20+
endif (BUILD_TEST)

Slime/LICENSE

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2024, DeepLink
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
1. Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
11+
2. Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
15+
3. Neither the name of the copyright holder nor the names of its
16+
contributors may be used to endorse or promote products derived from
17+
this software without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)