Repository navigation
Expand file tree
/
Copy pathCargo.toml
More file actions
293 lines (258 loc) · 10.7 KB
/
Copy pathCargo.toml
File metadata and controls
293 lines (258 loc) · 10.7 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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
[workspace]
members = ["model_gateway", "model_gateway/test_harness", "crates/protocols", "crates/reasoning_parser", "crates/response_template", "crates/tool_parser", "crates/symphony", "crates/workflow", "crates/tokenizer", "crates/auth", "crates/mcp",
"crates/external_router", "crates/kv_index", "crates/data_connector", "crates/multimodal", "crates/mm_rdma", "crates/wasm", "crates/mesh", "crates/grpc_client", "crates/engine_zmq_client", "crates/engine_zmq_adapter", "crates/engine_servicer", "bindings/python", "bindings/golang", "clients/rust", "clients/openapi-gen", "crates/mock_worker", "crates/rl", "crates/radix_tree"]
resolver = "2"
[workspace.package]
# The oldest toolchain the workspace builds with; rust-toolchain.toml pins the same release.
rust-version = "1.98"
[workspace.dependencies]
# Internal workspace crates
openai-protocol = { version = "1.16.0", path = "crates/protocols" }
smg-mm-rdma = { version = "0.1.1", path = "crates/mm_rdma" }
reasoning-parser = { version = "1.10.0", path = "crates/reasoning_parser" }
smg-response-template = { version = "0.1.0", path = "crates/response_template" }
tool-parser = { version = "1.10.0", path = "crates/tool_parser" }
smg-symphony = { version = "0.1.0", path = "crates/symphony" }
wfaas = { version = "1.1.0", path = "crates/workflow" }
llm-tokenizer = { version = "1.10.0", path = "crates/tokenizer" }
smg-auth = { version = "1.2.4", path = "crates/auth" }
smg-mcp = { version = "2.3.5", path = "crates/mcp" }
# Members build it with its default features (none); a member-side `default-features = false` is ignored for an entry without one.
smg-external-router = { version = "0.3.0", path = "crates/external_router" }
kv-index = { version = "2.0.0", path = "crates/kv_index" }
smg-radix-tree = { version = "0.1.0", path = "crates/radix_tree" }
smg-data-connector = { version = "2.4.0", path = "crates/data_connector", package = "data-connector" }
# Members build it with its default features (`hf-hub`): the gateway asks for `hf-hub` itself and the Python binding depends on the crate directly, taking the default.
llm-multimodal = { version = "1.14.0", path = "crates/multimodal" }
smg-wasm = { version = "1.1.4", path = "crates/wasm", package = "smg-wasm" }
smg-mesh = { version = "1.4.4", path = "crates/mesh", package = "smg-mesh" }
smg-grpc-client = { version = "1.15.0", path = "crates/grpc_client" }
engine-zmq-client = { version = "0.3.1", path = "crates/engine_zmq_client" }
engine-zmq-adapter = { version = "0.1.1", path = "crates/engine_zmq_adapter" }
engine-servicer = { version = "0.2.0", path = "crates/engine_servicer" }
smg-rl = { version = "0.2.0", path = "crates/rl" }
# Shared dependencies
anyhow = "1.0"
async-trait = "0.1"
futures = "0.3"
prost = "0.14.4"
prost-types = "0.14.4"
tonic = { version = "0.14.6", features = ["gzip", "transport"] }
tonic-prost = "0.14.6"
tonic-health = "0.14.6"
axum = { version = "0.8.9" }
blake3 = "1.8"
notify = "8.2"
bytemuck = { version = "1.25" }
byteorder = "1.5.0"
bytes = "1.12.0"
half = { version = "2.7.1", features = ["bytemuck"] }
rmp-serde = "1.3.1"
rmpv = { version = "1.3.1", features = ["with-serde"] }
serde_default = "0.2.0"
serde_repr = "0.1.20"
serde_tuple = "1.1.3"
zeromq = { git = "https://github.com/zeromq/zmq.rs", rev = "67dcba97559ebe8e8206dab753710d8b9cb07591", default-features = false, features = ["tokio-runtime", "all-transport"] }
chrono = { version = "0.4" }
dashmap = "6.2.1"
tikv-jemallocator = { version = "0.6", default-features = false, features = ["background_threads_runtime_support"] }
tikv-jemalloc-ctl = { version = "0.6", default-features = false }
http = "1.4.2"
lru = "0.18.0"
memchr = "2"
num-traits = "0.2"
parking_lot = "0.12.5"
rand = "0.10.1"
reqwest = { version = "0.13.4", default-features = false }
serde = { version = "1.0" }
serde_json = { version = "1.0", features = ["preserve_order"] }
serde_with = { version = "3", features = ["macros"] }
subtle = "2.6"
thiserror = "2.0.18"
tokio = { version = "1.54.1" }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "json", "chrono"] }
uuid = { version = "1.23", features = ["v7", "serde"] }
# The wasm runtime's default feature set as of wasmtime 49, named explicitly and without `cache`:
# nothing configures wasmtime's compilation cache (no `Config::cache` call anywhere), and that
# cache crate was the only path by which zstd 0.13 reached the lockfile. A wasmtime bump re-reads
# the `default` list in its Cargo.toml and adds a new default here on purpose, not by inheritance.
wasmtime = { version = "49.0", default-features = false, features = [
"anyhow",
"async",
"backtrace",
"gc",
"gc-copying",
"gc-drc",
"gc-null",
"wat",
"profiling",
"parallel-compilation",
"cranelift",
"pooling-allocator",
"demangle",
"addr2line",
"coredump",
"debug-builtins",
"runtime",
"component-model",
"component-model-async",
"threads",
"stack-switching",
"std",
"debug",
"compile-time-builtins",
"wit-parser",
] }
wasmtime-wasi = "49.0"
tokio-util = { version = "0.7", features = ["rt"] }
tokio-tungstenite = { version = "0.30", features = ["rustls-tls-native-roots"] }
webpki-roots = "1.0"
multer = "3"
str0m = { version = "0.24", default-features = false, features = ["openssl"] }
scopeguard = "1.2"
bitflags = "2.13.0"
schemars = "1.2"
[workspace.lints.rust]
unsafe_code = "deny"
unused_qualifications = "warn"
[workspace.lints.clippy]
# Deny unwrap in production code (tests exempted via clippy.toml)
unwrap_used = "deny"
# Warn for now — promote to deny after cleanup (99 expect, 82 panic violations)
expect_used = "warn"
panic = "warn"
# Deny debug/placeholder macros (currently zero violations)
dbg_macro = "deny"
todo = "deny"
unimplemented = "deny"
unreachable = "deny"
# Print macros — use tracing instead (58 existing violations, warn for now)
print_stdout = "warn"
print_stderr = "warn"
# Enforce #[expect] over #[allow] for better lint tracking (92 existing violations, warn for now)
allow_attributes = "warn"
# Disallowed methods (see clippy.toml for the list) — warn for now, promote after audit
disallowed_methods = "warn"
# Code quality lints — warn initially, promote to deny after cleanup
explicit_iter_loop = "warn"
explicit_into_iter_loop = "warn"
semicolon_if_nothing_returned = "warn"
uninlined_format_args = "warn"
manual_assert = "warn"
manual_string_new = "warn"
inconsistent_struct_constructor = "warn"
needless_raw_string_hashes = "warn"
cloned_instead_of_copied = "warn"
inefficient_to_string = "warn"
assigning_clones = "warn"
stable_sort_primitive = "warn"
unnecessary_wraps = "warn"
unused_self = "warn"
unused_async = "warn"
if_not_else = "warn"
match_bool = "warn"
match_wildcard_for_single_variants = "warn"
trivially_copy_pass_by_ref = "warn"
or_fun_call = "warn"
ignored_unit_patterns = "warn"
ref_option = "warn"
large_futures = "warn"
# Import hygiene
single_component_path_imports = "warn"
absolute_paths = "warn"
# These pedantic lints are explicitly allowed to give authors discretion
default_trait_access = "allow"
match_same_arms = "allow"
must_use_candidate = "allow"
single_match_else = "allow"
doc_lazy_continuation = "allow"
[profile.release]
# Speed over size. Built for size (opt-level "z") the gateway spent a
# quarter to a third of its cycles under load in MachineOutliner stubs and
# size-first call chains on AArch64; at opt-level 3 the same source costs
# half the CPU per request and 40 % less per streamed frame on the gRPC
# router path, for a stripped binary half again as large (53 to 80 MB).
# opt-level 2 measured the same CPU and a 2 MB smaller binary.
opt-level = 3
lto = "fat" # Full LTO: cross-crate inlining, dead code removed
codegen-units = 1 # Better optimization, slower compile
strip = false # Keep symbols so production CPU profiles/flamegraphs are readable (#1575)
# The compute-heavy crates: image preprocessing (resize kernels, patch
# gather, wire serialization, base64 and hashing of inline images), the
# tokenizer path (encode, per-token decode, stop-sequence scan) and the
# cache-aware routing trees. Built for size they ran 25-50% slower; the
# binary grew by about 1.5 MB (measured in #2768). With the profile itself
# at opt-level 3 these entries change nothing; they stay so that the crates
# keep their speed if the profile's level is lowered for size again. Note
# that generic functions are compiled in the crate that instantiates them,
# at that crate's opt-level: a kv-index entry point generic over a caller
# closure only benefits once it hands the work to a non-generic inner
# function.
[profile.release.package.llm-multimodal]
opt-level = 3
[profile.release.package.image]
opt-level = 3
[profile.release.package.zune-jpeg]
opt-level = 3
[profile.release.package.png]
opt-level = 3
[profile.release.package.fast_image_resize]
opt-level = 3
[profile.release.package.base64]
opt-level = 3
[profile.release.package.blake3]
opt-level = 3
[profile.release.package.llm-tokenizer]
opt-level = 3
[profile.release.package.tokenizers]
opt-level = 3
# v1 moves the encode hot path out of the tokenizers umbrella crate.
[profile.release.package.tk-encode]
opt-level = 3
[profile.release.package.bitcannon]
opt-level = 3
[profile.release.package.aho-corasick]
opt-level = 3
[profile.release.package.onig_sys]
opt-level = 3
# The cache-aware routing trees, walked on every request (the fused
# match-and-insert walk is made non-generic in #2766 so it is built here).
[profile.release.package.kv-index]
opt-level = 3
# The response-template parser runs on every streamed chunk, so it is built
# like the other hot crates (#2768): 0.36 to 0.76 of the time it took at
# opt-level "z", 15 KB larger.
[profile.release.package.smg-response-template]
opt-level = 3
[profile.ci]
inherits = "release"
opt-level = 2 # Lighter optimization (still fast runtime, much faster compile)
lto = "thin" # Thin LTO - good balance
codegen-units = 16 # More parallelization for faster builds
strip = true
[profile.dev]
opt-level = 0
# Line tables only: what a panic location or a backtrace needs to name a
# file and line, and all that anything in this repository reads from a
# debug build. The `limited` level adds per-function scope records that
# nothing consumes; with split debuginfo they land in the `.dwo` files and
# the rlibs, not the executables. `cargo test` builds with the test profile,
# which inherits this.
debug = "line-tables-only"
split-debuginfo = "unpacked"
incremental = true
codegen-units = 256
[profile.dev.package."*"]
opt-level = 2
debug = false
[profile.dev.build-override]
opt-level = 3
codegen-units = 1
[profile.dev-opt]
inherits = "dev"
opt-level = 1
[profile.bench]
opt-level = 3 # Max speed for benchmarks (as the release profile)
lto = "thin" # Good balance of speed and compile time
codegen-units = 1 # Better optimization