vllm.ir.ops.rotary_embedding
¶
vLLM IR ops for rotary positional embedding (RoPE).
The rotary dimension is the width of cos_sin_cache, matching the vLLM C
kernel. Keeping it out of the signature lets fusion patterns match partial
rotary layers.
Functions:
-
rotary_embedding–Rotate the first
cos_sin_cache.shape[-1]channels of each head. -
rotary_embedding_query_only–RoPE over query only, for layers that reuse another layer's KV cache.
_rotate(x, cos, sin, is_neox)
¶
Rotate contiguous halves (NeoX) or interleaved pairs (GPT-J).
Source code in vllm/ir/ops/rotary_embedding.py
rotary_embedding(positions, query, key, head_size, cos_sin_cache, is_neox)
¶
Rotate the first cos_sin_cache.shape[-1] channels of each head.
Source code in vllm/ir/ops/rotary_embedding.py
rotary_embedding_query_only(positions, query, head_size, cos_sin_cache, is_neox)
¶
RoPE over query only, for layers that reuse another layer's KV cache.