rope_mrope_interleaved

Function rope_mrope_interleaved 

Source
pub fn rope_mrope_interleaved(
    gpu: &dyn GpuBackend,
    kernel: KernelHandle,
    q: DevicePtr,
    k: DevicePtr,
    pos_t: DevicePtr,
    pos_h: DevicePtr,
    pos_w: DevicePtr,
    seq_len: u32,
    num_q_heads: u32,
    num_kv_heads: u32,
    head_dim: u32,
    rotary_dim: u32,
    theta: f32,
    stream: u64,
) -> Result<()>
Expand description

MRoPE (interleaved multi-modal rotary) for Qwen3.6.

Applies rotary embedding using three separate position-ID streams (pos_t, pos_h, pos_w). Each rotary pair is owned by one of the three sections, chosen by pair_idx % 3 (round-robin). For text-only serving pass the same pointer for all three streams — the result is bit-identical to scalar RoPE.

Kernel: rope_forward_mrope_interleaved