style: apply rustfmt across all crates and demos

Consistent formatting pass: line wrapping, import sorting, trailing
whitespace removal, let-chain indentation, merged derive attributes,
and unsafe block reformatting.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This commit is contained in:
osobh
2026-04-12 07:01:58 -07:00
co-authored by Claude Opus 4.6
parent bc88a14fa1
commit 02d382d5f6
302 changed files with 1805 additions and 1590 deletions
@@ -89,7 +89,7 @@ impl Default for SageAttentionConfig {
impl SageAttentionConfig {
/// Create config for a specific model size
#[must_use]
#[must_use]
pub fn for_model(num_heads: usize, head_dim: usize) -> Self {
Self {
num_heads,
@@ -99,28 +99,28 @@ impl SageAttentionConfig {
}
/// Enable GQA with specified number of KV heads
#[must_use]
#[must_use]
pub fn with_gqa(mut self, num_kv_heads: usize) -> Self {
self.num_kv_heads = Some(num_kv_heads);
self
}
/// Enable MQA (single KV head)
#[must_use]
#[must_use]
pub fn with_mqa(mut self) -> Self {
self.num_kv_heads = Some(1);
self
}
/// Set causal masking
#[must_use]
#[must_use]
pub fn causal(mut self, causal: bool) -> Self {
self.causal = causal;
self
}
/// Disable smooth quantization for faster but less accurate inference
#[must_use]
#[must_use]
pub fn fast_mode(mut self) -> Self {
self.use_smooth_quant = false;
self.per_token_quant = false;
@@ -141,7 +141,7 @@ pub struct QuantParams {
impl QuantParams {
/// Create symmetric per-tensor quantization params
#[must_use]
#[must_use]
pub fn symmetric_per_tensor(scale: f32) -> Self {
Self {
scales: vec![scale],
@@ -151,7 +151,7 @@ impl QuantParams {
}
/// Create symmetric per-token quantization params
#[must_use]
#[must_use]
pub fn symmetric_per_token(scales: Vec<f32>) -> Self {
let zero_points = vec![0; scales.len()];
Self {
@@ -595,7 +595,7 @@ impl SageAttention {
}
/// Get configuration
#[must_use]
#[must_use]
pub fn config(&self) -> &SageAttentionConfig {
&self.config
}
@@ -619,7 +619,7 @@ pub struct SageAttentionBuilder {
impl SageAttentionBuilder {
/// Create a new builder with default config
#[must_use]
#[must_use]
pub fn new() -> Self {
Self {
config: SageAttentionConfig::default(),
@@ -627,35 +627,35 @@ impl SageAttentionBuilder {
}
/// Set number of heads
#[must_use]
#[must_use]
pub fn num_heads(mut self, num_heads: usize) -> Self {
self.config.num_heads = num_heads;
self
}
/// Set head dimension
#[must_use]
#[must_use]
pub fn head_dim(mut self, head_dim: usize) -> Self {
self.config.head_dim = head_dim;
self
}
/// Set number of KV heads for GQA
#[must_use]
#[must_use]
pub fn num_kv_heads(mut self, num_kv_heads: usize) -> Self {
self.config.num_kv_heads = Some(num_kv_heads);
self
}
/// Enable causal masking
#[must_use]
#[must_use]
pub fn causal(mut self, causal: bool) -> Self {
self.config.causal = causal;
self
}
/// Enable smooth quantization
#[must_use]
#[must_use]
pub fn smooth_quant(mut self, alpha: f32) -> Self {
self.config.use_smooth_quant = true;
self.config.smooth_alpha = alpha;
@@ -663,14 +663,14 @@ impl SageAttentionBuilder {
}
/// Set quantization bits
#[must_use]
#[must_use]
pub fn quant_bits(mut self, bits: u8) -> Self {
self.config.quant_bits = bits;
self
}
/// Use per-token quantization
#[must_use]
#[must_use]
pub fn per_token(mut self, per_token: bool) -> Self {
self.config.per_token_quant = per_token;
self