vllm.models.muse_spark.nvidia.specialized_decode.cutedsl.common.draft_boundary
¶
The DSpark draft's residual boundary, bitwise equal to the eager chain.
One boundary is the eager post -> connection -> pre chain: post_norm(branch)
rounded to BF16, the gated FP32 residual alpha * stream + beta * branch
with each product rounded, then the next pre-norm of the stream rounded to
BF16. The norms use the stock single-tile norm's order and roundings
(row_norm.py). The branch is read as is (-0.0, subnormals, NaN and
infinities included).
boundary_fragments is that arithmetic over one thread's 8-column
fragments, with the row sums supplied by the caller. Two kernels use it:
DraftBoundaryhere, for an already all-reduced branch: one CTA of 256 threads per row, each thread holding four fragments;- the boundary with the branch's all-reduce fused in
(
cutedsl/oproj/draft_all_reduce_boundary.py), one fragment per thread over a cluster of 8 CTAs.
Gates and norm weights load before the PDL wait for up to one row per SM, and
after it above that (late_gates). With PDL, every CTA releases its
dependents right after the wait; the next kernel waits for this grid's end
before it reads the output.
Classes:
-
BoundaryGates–One fragment's gates and norm gains (
[]where a norm has no -
BoundaryOperands–A boundary's constant operands, checked and viewed once: the gates
-
DraftBoundary–One draft boundary of an all-reduced branch, bound at build: its
-
DraftBoundaryConstants–Compile-time constants of one draft boundary (bound at build).
Functions:
-
boundary_fragments–One thread's fragments of a boundary:
x(the BF16 branch) and -
compile_draft_boundary–cute.compile one kernel; the row count is a runtime argument. Call:
-
draft_boundary_constants–The constants of the stock draft boundary
post->connection-> -
fake_weights–The compile-time post and pre norm weights of a boundary: an [8192]
-
load_gates–The gates and gains of the 8 columns from
column(traced inline).
BoundaryGates
¶
Bases: NamedTuple
One fragment's gates and norm gains ([] where a norm has no
weight), each 8 FP32.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/draft_boundary.py
BoundaryOperands
¶
A boundary's constant operands, checked and viewed once: the gates
(alpha, beta FP32 [8192]) and the norm weights, where the
constants have a gain center (else None: the kernels take none).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/draft_boundary.py
DraftBoundary
¶
One draft boundary of an all-reduced branch, bound at build: its
constants and its constant operands (BoundaryOperands), and its
kernel of each variant by (stream BF16, store stream, late gates: rows
above the device's SM count), compiled once per process and variant
(prepare them before CUDA graph capture).
Methods:
-
launch–runwithout its operand check, for rows the caller has -
prepare–The kernel of one variant, kept for the calls that launch it
-
run–(new_stream or None, out): the FP32 ``alpha * stream + beta * -
takes–Whether the kernel takes these rows: a dense BF16 [m, 8192] branch
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/draft_boundary.py
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 | |
launch(branch, stream, store_stream)
¶
run without its operand check, for rows the caller has
checked with takes.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/draft_boundary.py
prepare(stream_bf16, store_stream, late_gates=False)
¶
The kernel of one variant, kept for the calls that launch it
(compile_draft_boundary: compiled on its first use in the
process).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/draft_boundary.py
run(branch, stream, store_stream)
¶
(new_stream or None, out): the FP32 alpha * stream + beta *
post_norm(branch) and the BF16 pre_norm(new_stream.to(bf16)) of
rows takes accepts. Graph-capturable once prepared.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/draft_boundary.py
takes(branch, stream)
staticmethod
¶
Whether the kernel takes these rows: a dense BF16 [m, 8192] branch (m >= 1) and an FP32 or BF16 stream of its shape.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/draft_boundary.py
DraftBoundaryConstants
¶
Bases: NamedTuple
Compile-time constants of one draft boundary (bound at build).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/draft_boundary.py
_CtaRowSum
dataclass
¶
RowSum of a CTA that holds the row: sums 2 * WARPS FP32 of
shared memory (one round each).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/draft_boundary.py
_DraftBoundaryKernel
¶
Grid (m,), THREADS threads: CTA = row, thread t = reference thread t.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/draft_boundary.py
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | |
_StreamStore
dataclass
¶
Stores fragment k of the new stream (FP32 rows) of row offset row.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/draft_boundary.py
boundary_fragments(constants, x, stream, gates, row_sum, store_stream)
¶
One thread's fragments of a boundary: x (the BF16 branch) and
stream as lists of 8 FP32 per fragment, gates a BoundaryGates
per fragment. store_stream(k, values) stores fragment k's new stream
(None: not stored). Returns per fragment the output as 4 BF16x2 words.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/draft_boundary.py
compile_draft_boundary(*, constants, stream_bf16, store_stream, pdl, late_gates=False)
cached
¶
cute.compile one kernel; the row count is a runtime argument. Call:
(branch, stream_in, alpha, beta, post_weight, pre_weight, stream_out,
out, m, stream), a weight None where its norm has none and
stream_out None without store_stream; pdl: launched with
programmatic dependent launch (host.pdl_supported). Call before CUDA
graph capture.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/draft_boundary.py
draft_boundary_constants(post, connection, pre)
¶
The constants of the stock draft boundary post -> connection ->
pre (MuseSpark1xRMSNorm or its input-scaled variant,
MuseSpark1xNormPreservingResidualConnection), or ValueError where the
kernels do not reproduce it.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/draft_boundary.py
fake_weights(constants)
¶
The compile-time post and pre norm weights of a boundary: an [8192] FP32, FP16 or BF16 tensor, None where that norm has no weight.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/draft_boundary.py
load_gates(constants, alpha, beta, post_weight, pre_weight, column)
¶
The gates and gains of the 8 columns from column (traced inline).