vllm.models.inkling2.nvidia.ops.vision
¶
Triton kernels for the Inkling2 vision encoder.
Rows are tokens of the packed images (a CLS row, then the native patches in
row-major order). Row metadata is int32 [T, 4]: native (y, x) and the
native grid (height, width), with y = x = -1 on CLS rows. Outputs are
rounded to bf16 at the same points as the eager PyTorch ops they replace.
Functions:
-
apply_rotary_qk_–In-place interleaved 2D RoPE on the q and k thirds of
qkv [T, 3D]. -
embed_tokens–Returns
(hidden, ln_1(hidden))withhidden = ln_pre(embeddings). -
gather_patches–Native patches of raw
[N, side, side, 3]pixels as bf16 rows of -
scaled_residual_norm_–hidden += update * gammain place; returnsnorm(hidden).
apply_rotary_qk_(qkv, meta, num_heads)
¶
In-place interleaved 2D RoPE on the q and k thirds of qkv [T, 3D].
Source code in vllm/models/inkling2/nvidia/ops/vision.py
embed_tokens(patch_embeds, patch_rows, position_grid, meta, class_embedding, cls_position_embedding, ln_pre, ln_1)
¶
Returns (hidden, ln_1(hidden)) with hidden = ln_pre(embeddings).
Token row i takes patch embedding patch_embeds[patch_rows[i]]; CLS rows
(patch_rows unused) take the class embedding.
Source code in vllm/models/inkling2/nvidia/ops/vision.py
gather_patches(pixels, offsets, patch_size, mean, clip_std, std)
¶
Native patches of raw [N, side, side, 3] pixels as bf16 rows of
(py, px, c) values in [-1, 1].
Each value is 2 * (bf16((v / 255 - mean) / clip_std) * std + mean) - 1.
offsets[i] is the element offset of row i's top-left pixel.
Source code in vllm/models/inkling2/nvidia/ops/vision.py
scaled_residual_norm_(hidden, update, gamma, norm)
¶
hidden += update * gamma in place; returns norm(hidden).