#[repr(u32)]pub enum RopeMultiMode {
Mrope = 8,
Imrope = 40,
Vision = 24,
}Expand description
MROPE variant. Wire-level values match the ggml GGML_ROPE_TYPE_* enum.
Variants§
Mrope = 8
Standard multi-section RoPE; contiguous sections.
Imrope = 40
Interleaved multi-section RoPE; sector % 3 cycles through 3 axes.
Used by Qwen3.5 / Qwen3.6.
Vision = 24
Vision multi-section RoPE for ViT 2-D positions (Qwen3-VL ViT block).
Mode value 24 matches GGML_ROPE_TYPE_VISION in
/opt/llama.cpp/ggml/include/ggml.h:253 and the per-section
[yyyyxxxx] layout described at ggml.h:1840-1846.
§Layout
Only the first two section counts (s0 = y, s1 = x) are used; the
last two are ignored. With n_dims = head_dim / 2 and sect_dims = s0 + s1 = n_dims, the rotated pairs partition as:
pair_idx in [0, s0) -> axis 0 (y), local_p = pair_idx
pair_idx in [s0, s0 + s1) -> axis 1 (x), local_p = pair_idx - s0§Per-section theta
Unlike Mrope / Imrope which use a unified theta sequence across
all sections (theta = pos[axis] * freq_base^(-2*pair_idx/rope_dim)),
vision rope restarts the theta exponent at every section boundary:
theta_scale = freq_base^(-2 / n_dims) where n_dims = head_dim/2
theta = pos[axis] * theta_scale^local_plocal_p is the index of the pair within its section, not the
global pair_idx. This per-section restart is what produces the
[0123][0123] exponent pattern documented at ggml.h:1845-1846.
§No partial-rotary tail
The CPU reference at ggml-cpu/ops.cpp:5860 calls
rotate_pairs(ne0, n_dims, ...) (rotating all head_dim/2 pairs)
and at :5866 skips the partial-rotary fill loop when is_vision,
so the caller MUST supply rope_dim == head_dim.
§Caller-side requirements
rope_dim == head_dim(validated; no partial-rotary support).sections[0] + sections[1] == head_dim / 2(validated; the last two sections are ignored but must be present in the buffer for binary-layout uniformity withMrope/Imrope).positionsbuffer length still4 * seq_len; only axes 0 and 1 are read.
Trait Implementations§
Source§impl Clone for RopeMultiMode
impl Clone for RopeMultiMode
Source§fn clone(&self) -> RopeMultiMode
fn clone(&self) -> RopeMultiMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RopeMultiMode
impl Debug for RopeMultiMode
Source§impl PartialEq for RopeMultiMode
impl PartialEq for RopeMultiMode
Source§fn eq(&self, other: &RopeMultiMode) -> bool
fn eq(&self, other: &RopeMultiMode) -> bool
self and other values to be equal, and is used by ==.