Commit fc9b5d2
feat(multimodal): CUDA-graph bucket ladder (Dynamo-side target_bucket) + Qwen3-VL ViT example
PR4 of the custom vision-encoder series, stacked on PR3. Introduces bucket-wise
graph support on the Dynamo side and a real graphed encoder example.
- ThreadedMicroBatcher: optional `buckets` ladder. When set, the batcher rounds a
batch's packed sum(cost) UP to the nearest rung and passes it as `target_bucket`
to fn(items, target_bucket). With max_batch_cost=None it derives the ceiling as
max(buckets); buckets=None stays eager / pass-through (PR3 behavior unchanged).
- AsyncVisionEncoder passes backend.buckets to the batcher.
- Qwen3VLViTEncoder example: loads the real Qwen3-VL vision tower (build(model_id),
picks its own device), captures one CUDA graph per rung via
torch.compile(reduce-overhead), and in forward_batch pads sum(cost) up to
target_bucket, replays, slices the real images back out (CPU). Hardcodes
image_token_id via the Qwen base.
The author owns padding; Dynamo only picks the rung. `buckets`/`target_bucket`
were forward-compat in the contract since PR1; this PR makes them live.
Tests: target_bucket rounding (boundary + eager None + buckets-derive +
ladder-covers-budget). Graph smoke validated on the integration branch.
Deepstack limitation: Qwen3-VL deepstack features are not carried by the
one-tensor-per-image contract — this exercises the mechanism, not accuracy.
Note: based on the series' validated merge-base; rebase onto main before merge.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 4f361b7 commit fc9b5d2
5 files changed
Lines changed: 377 additions & 36 deletions
File tree
- components/src/dynamo/vllm
- multimodal_utils
- tests/multimodal_utils
- examples/custom_encoder
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | | - | |
92 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
| |||
Lines changed: 61 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
22 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
23 | 29 | | |
24 | 30 | | |
25 | 31 | | |
| |||
56 | 62 | | |
57 | 63 | | |
58 | 64 | | |
59 | | - | |
| 65 | + | |
60 | 66 | | |
61 | 67 | | |
62 | 68 | | |
| |||
113 | 119 | | |
114 | 120 | | |
115 | 121 | | |
116 | | - | |
117 | | - | |
| 122 | + | |
| 123 | + | |
118 | 124 | | |
119 | 125 | | |
120 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
121 | 129 | | |
122 | 130 | | |
123 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
124 | 136 | | |
125 | 137 | | |
126 | 138 | | |
127 | | - | |
| 139 | + | |
| 140 | + | |
128 | 141 | | |
129 | 142 | | |
130 | 143 | | |
| |||
136 | 149 | | |
137 | 150 | | |
138 | 151 | | |
139 | | - | |
| 152 | + | |
140 | 153 | | |
141 | 154 | | |
| 155 | + | |
142 | 156 | | |
143 | 157 | | |
144 | 158 | | |
| |||
150 | 164 | | |
151 | 165 | | |
152 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
153 | 172 | | |
154 | 173 | | |
155 | 174 | | |
| |||
173 | 192 | | |
174 | 193 | | |
175 | 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 | + | |
176 | 226 | | |
177 | 227 | | |
178 | 228 | | |
| |||
457 | 507 | | |
458 | 508 | | |
459 | 509 | | |
| 510 | + | |
460 | 511 | | |
461 | | - | |
| 512 | + | |
462 | 513 | | |
463 | 514 | | |
464 | 515 | | |
| |||
Lines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | | - | |
| 177 | + | |
178 | 178 | | |
179 | | - | |
180 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
181 | 182 | | |
182 | | - | |
183 | | - | |
| 183 | + | |
| 184 | + | |
184 | 185 | | |
185 | 186 | | |
186 | 187 | | |
Lines changed: 60 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
54 | | - | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| |||
117 | 119 | | |
118 | 120 | | |
119 | 121 | | |
120 | | - | |
| 122 | + | |
121 | 123 | | |
122 | 124 | | |
123 | 125 | | |
| |||
155 | 157 | | |
156 | 158 | | |
157 | 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 | + | |
158 | 199 | | |
159 | 200 | | |
160 | | - | |
| 201 | + | |
161 | 202 | | |
162 | 203 | | |
163 | 204 | | |
| |||
166 | 207 | | |
167 | 208 | | |
168 | 209 | | |
| 210 | + | |
169 | 211 | | |
170 | 212 | | |
171 | 213 | | |
172 | 214 | | |
173 | 215 | | |
174 | | - | |
| 216 | + | |
175 | 217 | | |
176 | 218 | | |
177 | 219 | | |
| |||
186 | 228 | | |
187 | 229 | | |
188 | 230 | | |
189 | | - | |
| 231 | + | |
190 | 232 | | |
191 | 233 | | |
192 | 234 | | |
| |||
233 | 275 | | |
234 | 276 | | |
235 | 277 | | |
236 | | - | |
| 278 | + | |
237 | 279 | | |
238 | 280 | | |
239 | 281 | | |
| |||
275 | 317 | | |
276 | 318 | | |
277 | 319 | | |
278 | | - | |
| 320 | + | |
279 | 321 | | |
280 | 322 | | |
281 | 323 | | |
| |||
309 | 351 | | |
310 | 352 | | |
311 | 353 | | |
312 | | - | |
| 354 | + | |
313 | 355 | | |
314 | 356 | | |
315 | 357 | | |
| |||
379 | 421 | | |
380 | 422 | | |
381 | 423 | | |
382 | | - | |
| 424 | + | |
383 | 425 | | |
384 | 426 | | |
385 | 427 | | |
| |||
407 | 449 | | |
408 | 450 | | |
409 | 451 | | |
410 | | - | |
| 452 | + | |
411 | 453 | | |
412 | 454 | | |
413 | 455 | | |
| |||
0 commit comments