Skip to main content

Module alibi

Module alibi 

Source
Expand description

ALiBi (Attention with Linear Biases) kernel.

Matches alibi-kernel-v1.yaml. scores[i,j] += -m_h * |i - j| where m_h = 2^(-8h/H).

Each function provides one of three backends:

  • fn alibi_bias_scalar(...) – Pure Rust scalar reference (ground truth)
  • unsafe fn alibi_bias_avx2(...) – AVX2 SIMD implementation
  • fn alibi_ptx() -> &'static str – PTX assembly source string

Functions§

alibi_bias_avx2
AVX2 ALiBi bias – delegates to scalar.
alibi_bias_scalar
Add ALiBi bias to attention scores (scalar reference).
alibi_ptx
PTX assembly for ALiBi bias addition.
alibi_slope
Compute ALiBi slope for head h of num_heads total.