vllm.models.inkling2.nvidia.ops.dspark
¶
Kernels of the Inkling2 DSpark draft, matching the reference implementation.
Functions:
-
add_softcap–bf16
softcap * tanh(bf16(a + b) / softcap)of two bf16 2D tensors. -
markov_gate–The recurrent head's gating of the fp32
rnn_projoutputraw -
mix_rmsnorm–RMSNorm of the
alpha-weighted sum oftargets[:, i](fp32 math). -
qk_norm_rope_–In-place per-head Q/K RMSNorm (rounded to bf16) + neox RoPE on the
-
rope_–In-place neox RoPE on
xof shape(T, H, D)(fp32 math). -
silu_and_mul–silu(gate) * upin fp32 (precise exp/div), rounded once.
add_softcap(a, b, softcap)
¶
bf16 softcap * tanh(bf16(a + b) / softcap) of two bf16 2D tensors.
Source code in vllm/models/inkling2/nvidia/ops/dspark.py
markov_gate(raw, state)
¶
The recurrent head's gating of the fp32 rnn_proj output raw
(rounded to bf16 first), as the reference's bf16 torch ops: returns
(gate * state + (1 - gate) * tanh(cand), tanh(out)).
Source code in vllm/models/inkling2/nvidia/ops/dspark.py
mix_rmsnorm(targets, alpha, weight, eps)
¶
RMSNorm of the alpha-weighted sum of targets[:, i] (fp32 math).
targets is (rows, taps, hidden); the output has targets.dtype.
Source code in vllm/models/inkling2/nvidia/ops/dspark.py
qk_norm_rope_(qkv, positions, q_weight, k_weight, cos_sin_cache, num_q_heads, num_k_heads, eps)
¶
In-place per-head Q/K RMSNorm (rounded to bf16) + neox RoPE on the
leading num_q_heads + num_k_heads heads of the fused qkv.
Source code in vllm/models/inkling2/nvidia/ops/dspark.py
rope_(x, positions, cos_sin_cache)
¶
In-place neox RoPE on x of shape (T, H, D) (fp32 math).
Source code in vllm/models/inkling2/nvidia/ops/dspark.py
silu_and_mul(x)
¶
silu(gate) * up in fp32 (precise exp/div), rounded once.