-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathpyproject.toml
More file actions
229 lines (216 loc) · 8.79 KB
/
Copy pathpyproject.toml
File metadata and controls
229 lines (216 loc) · 8.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# Copyright (c) 2024 by FlashInfer team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
[project]
name = "flashinfer-python"
dynamic = ["version", "dependencies"]
description = "FlashInfer: Kernel Library for LLM Serving"
# Keep the lower bound in sync with .python-version.
requires-python = ">=3.10,<4.0"
authors = [{ name = "FlashInfer team" }]
license = "Apache-2.0"
readme = "README.md"
urls = { Homepage = "https://github.com/flashinfer-ai/flashinfer" }
license-files = ["LICENSE", "LICENSE*.txt"]
[project.optional-dependencies]
# Keep these CUDA-extra floors in sync with ci/cuda-versions.json.
cu12 = ["nvidia-cutlass-dsl>=4.7.0a0"]
cu13 = ["nvidia-cutlass-dsl[cu13]>=4.7.0a0"]
# DEPRECATED alias, kept so existing `pip install ".[nvep]"` commands keep
# working. The moe_ep runtime deps (cuda-python, nccl-extensions) are now part of the
# BASE dependencies (requirements.txt) and the NIXL-EP submodule build runs by
# default (best-effort) on `pip install .` — see the moe_ep section at the top
# of build_backend.py. libnccl comes from torch's own nvidia-nccl-cu13 pin;
# the >=2.30.7 B200 floor is enforced at runtime (moe_ep/core/validation/
# common.py) and upgraded --no-deps by the build hook on source installs. Opt
# out of the native build with BUILD_NVEP=0 (or BUILD_NIXL_EP=0 / BUILD_NCCL_EP=0).
nvep = []
[project.scripts]
flashinfer = "flashinfer.__main__:cli"
[build-system]
requires = ["setuptools>=77", "packaging>=24", "apache-tvm-ffi>=0.1.11,<0.2"]
build-backend = "build_backend"
backend-path = ["."]
[tool.codespell]
ignore-words-list = "3nd"
skip = ["build", "3rdparty", "dist", ".venv"]
[tool.setuptools]
include-package-data = false
py-modules = ["build_backend", "build_utils"]
[tool.setuptools.dynamic]
version = { attr = "flashinfer._build_meta.__version__" }
dependencies = { file = ["requirements.txt"] }
[tool.setuptools.packages.find]
where = ["."]
include = ["flashinfer*"]
exclude = ["flashinfer-jit-cache*", "flashinfer-cubin*"]
[tool.setuptools.package-dir]
"flashinfer.data" = "."
"flashinfer.data.cutlass" = "3rdparty/cutlass"
"flashinfer.data.spdlog" = "3rdparty/spdlog"
"flashinfer.data.cccl" = "3rdparty/cccl"
[tool.setuptools.package-data]
"flashinfer" = ["_build_meta.py"]
"flashinfer.prims_ts.moe" = ["prims_ts_moe_configs.json"]
# Workload registry of the experimental fused GDN decode backends, loaded at
# runtime via importlib.resources.
"flashinfer.gdn_kernels.experimental" = ["*.json"]
# Their in-package JIT kernel source, compiled on demand by
# flashinfer/jit/gdn_fused_decode.py.
"flashinfer.gdn_kernels.experimental.kernel" = ["*.cu"]
# Generated sources for the experimental exact-SM103a MXFP8 MegaMoE backend.
"flashinfer.experimental.cake_mxfp8_megamoe_ep16" = ["csrc/**"]
# Generated sources for the experimental exact-SM110 GQA decode backend.
"flashinfer.experimental.sm110_gqa_decode" = ["csrc/**"]
# Raw CUDA sources for the SM90 push-style FP8 mega-MoE drop, JIT-compiled at
# runtime; registered so non-editable installs ship them (PR #4069).
"flashinfer.moe_ep.kernel_src.sm90.push_style_megamoe" = [
"*.md",
"src/a2a/*.cu",
"src/a2a/*.cuh",
"src/fp8_gemm/*.cu",
"src/fp8_gemm/*.cuh",
]
# Generated SM100 BF16 rank-major mega-MoE CUDA bundle. The runtime validates
# the manifest checksum before compiling the source on demand.
"flashinfer.moe_ep.kernel_src.blackwell_bf16_rank_major" = [
"*.md",
"src/*.cu",
"src/*.json",
]
"flashinfer.data" = ["csrc/**", "include/**"]
"flashinfer.data.cutlass" = ["include/**", "tools/util/include/**"]
"flashinfer.data.spdlog" = ["include/**"]
"flashinfer.data.cccl" = ["cub/cub/**", "libcudacxx/include/**", "thrust/thrust/**"]
# EP backend shared libraries built in-tree from 3rdparty/nixl by default
# during `pip install` (opt out with BUILD_NIXL_EP=0). The .so files live under
# flashinfer/moe_ep/backends/split/comm/{nccl,nixl}_ep/_libs/ (gitignored;
# populated by build_backend._build_nvep_if_enabled).
"flashinfer.moe_ep.backends.split.comm.nixl_ep" = ["_libs/**", "_vendored/**"]
"flashinfer.moe_ep.backends.split.comm.nccl_ep" = ["_libs/*.so*"]
[tool.mypy]
files = ["flashinfer"]
# Keep this literal in sync with .python-version.
python_version = "3.10"
ignore_missing_imports = true
show_column_numbers = true
show_error_context = true
follow_imports = "skip"
ignore_errors = false
strict_optional = false
exclude = [
"flashinfer-cubin/",
"flashinfer-jit-cache/",
# CUTLASS DSL kernel bodies are compiler-lowered rather than ordinary Python.
"flashinfer/attention/prims_ts/kernels/",
"3rdparty/",
"flashinfer/data/cutlass/",
"flashinfer/cute_dsl/attention/fmha/fmha.py",
"flashinfer/cute_dsl/attention/fmha/fmha_blockscaled.py",
"flashinfer/cute_dsl/attention/fmha/helpers/",
"flashinfer/prims_ts/",
"flashinfer/moe_ep/kernel_src/cutedsl_megamoe/src/",
"flashinfer/moe_ep/kernel_src/sm90/pull_style_cutedsl_megakernel/src/",
"flashinfer/moe_ep/kernel_src/sm120/swapab_cutedsl_megakernel/src/",
"flashinfer/gemm/kernels/dense_blockscaled_gemm_sm107.py",
"flashinfer/fused_moe/cute_dsl/rubin/blockscaled_contiguous_gather_grouped_gemm_swiglu_fusion.py",
"flashinfer/fused_moe/cute_dsl/rubin/blockscaled_contiguous_grouped_gemm_finalize_fusion.py",
# DKG filtered top-k kernels, vendored verbatim from dynamic-kernel-generator
# (see the provenance header in each file). Kept byte-faithful so upstream
# fixes can be re-applied by re-vendoring. The two reported errors are typing
# artifacts, not defects: `_get_num_sms` memoises via a function attribute,
# and `compiled_filter_topk_dict` is an untyped dict holding two distinct key
# shapes that cannot collide (each leads with a different wrapper-mode string
# and they differ in length).
"flashinfer/topk_varlen/kernels/filtered_topk_util.py",
"flashinfer/topk_varlen/kernels/filtered_topk_decode.py",
# Self-sampling GVR V2: verbatim TRT-LLM drops (see the ruff exclude note).
"flashinfer/topk_varlen/kernels/gvr2_topk_decode.py",
"flashinfer/topk_varlen/kernels/gvr2_topk_host.py",
"build/",
]
# CuTe DSL FMHA kernels from TRTLLM VisualGen; kept as-is for clean re-sync.
# cutedsl_megamoe/src kernels are maintained upstream and re-dropped
# periodically; excluded so lint churn doesn't block syncs. The shim/ layer
# next to it is ours and stays linted.
# The GVR top-k kernels are CuTe-DSL device code ported verbatim from
# TensorRT-LLM. Exclude them from ruff (both lint and format) so the port stays
# byte-faithful to upstream and future syncs stay clean -- reflowing or
# "simplifying" DSL code can also change traced semantics (e.g. SIM109's
# `x in (a, b)` yields a Python bool, not the DSL Boolean predicate that
# `x == a or x == b` produces).
[tool.ruff]
# Ruff infers the target from project.requires-python.
extend-exclude = [
"flashinfer/cute_dsl/attention/fmha/fmha.py",
"flashinfer/cute_dsl/attention/fmha/fmha_blockscaled.py",
"flashinfer/cute_dsl/attention/fmha/helpers",
"flashinfer/moe_ep/kernel_src/cutedsl_megamoe/src",
"flashinfer/topk_varlen/kernels/gvr_topk_decode.py",
"flashinfer/topk_varlen/kernels/gvr_topk_decode_lb.py",
"flashinfer/topk_varlen/kernels/gvr2_topk_decode.py",
"flashinfer/topk_varlen/kernels/gvr2_topk_host.py",
"flashinfer/topk_varlen/kernels/block_scan.py",
"flashinfer/moe_ep/kernel_src/sm90/pull_style_cutedsl_megakernel/src",
"flashinfer/moe_ep/kernel_src/sm120/swapab_cutedsl_megakernel/src",
"flashinfer/gemm/kernels/dense_blockscaled_gemm_sm107.py",
"flashinfer/fused_moe/cute_dsl/rubin/blockscaled_contiguous_gather_grouped_gemm_swiglu_fusion.py",
"flashinfer/fused_moe/cute_dsl/rubin/blockscaled_contiguous_grouped_gemm_finalize_fusion.py",
]
force-exclude = true
[tool.ruff.lint]
select = [
# pycodestyle
"E",
# Pyflakes
"F",
# pyupgrade
# "UP",
# flake8-bugbear
"B",
# flake8-simplify
"SIM",
# isort
# "I",
]
ignore = [
# Module level import not at top of file
"E402",
# star imports
"F405",
"F403",
# ambiguous name
"E741",
# line too long
"E501",
# key in dict.keys()
"SIM118",
# memory leaks
"B019",
# No such file or directory
"E902",
# nested `if` statements
"SIM102",
# `if`-`else`-block
"SIM108",
# assign `lambda` expressions
"E731",
# Loop control variable overrides iterable it iterates
"B020",
# Return te negated condition directly
"SIM103",
# Function definition does not bind loop variable
"B023",
]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]