Skip to main content

RopeMultiMode

Enum RopeMultiMode 

Source
#[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_p

local_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 with Mrope / Imrope).
  • positions buffer length still 4 * seq_len; only axes 0 and 1 are read.

Trait Implementations§

Source§

impl Clone for RopeMultiMode

Source§

fn clone(&self) -> RopeMultiMode

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RopeMultiMode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for RopeMultiMode

Source§

fn eq(&self, other: &RopeMultiMode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for RopeMultiMode

Source§

impl Eq for RopeMultiMode

Source§

impl StructuralPartialEq for RopeMultiMode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.