style: cargo fmt --workspace (whitespace/wrapping only, no semantic change)
Whole-workspace rustfmt pass picked up while iterating on Mamba GPU backward work. Verified formatting-only via diff sampling; no logic changed. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
@@ -252,8 +252,8 @@ pub fn w4a16_matmul_cpu(
|
||||
// next_group_in_col = next_group_flat - weight_row_offset
|
||||
// (clamped to in_features)
|
||||
let next_group_flat = (group_idx + 1) * group_size;
|
||||
let next_in_col = (next_group_flat.saturating_sub(weight_row_offset))
|
||||
.min(in_features);
|
||||
let next_in_col =
|
||||
(next_group_flat.saturating_sub(weight_row_offset)).min(in_features);
|
||||
|
||||
let scale = weights.scales[group_idx];
|
||||
let zero = weights.zeros[group_idx] as f32;
|
||||
@@ -264,11 +264,7 @@ pub fn w4a16_matmul_cpu(
|
||||
|
||||
// Per-column activation scale (inverse of the activation-derived
|
||||
// scale applied during AWQ quantisation).
|
||||
let act_scale = weights
|
||||
.activation_scales
|
||||
.get(col)
|
||||
.copied()
|
||||
.unwrap_or(1.0);
|
||||
let act_scale = weights.activation_scales.get(col).copied().unwrap_or(1.0);
|
||||
|
||||
let w_fp32 = (q - zero) * scale * act_scale;
|
||||
let a_fp32 = activations[act_row_offset + col];
|
||||
@@ -624,9 +620,7 @@ mod tests {
|
||||
ref_result.len(),
|
||||
"output length mismatch"
|
||||
);
|
||||
for (idx, (&fused, &reference)) in
|
||||
fused_result.iter().zip(ref_result.iter()).enumerate()
|
||||
{
|
||||
for (idx, (&fused, &reference)) in fused_result.iter().zip(ref_result.iter()).enumerate() {
|
||||
let diff = (fused - reference).abs();
|
||||
assert!(
|
||||
diff <= tolerance,
|
||||
@@ -652,9 +646,7 @@ mod tests {
|
||||
// out[b, 0] = 2*b + 0*b = 2b
|
||||
// out[b, 1] = 0*b + 2*b = 2b
|
||||
let w = make_weight(2, 2, vec![2, 0, 0, 2], 1.0, 0, vec![1.0; 2]);
|
||||
let activations: Vec<f32> = (0..4)
|
||||
.flat_map(|b| vec![b as f32, b as f32])
|
||||
.collect();
|
||||
let activations: Vec<f32> = (0..4).flat_map(|b| vec![b as f32, b as f32]).collect();
|
||||
|
||||
let result = w4a16_matmul_cpu(&w, &activations, 4).unwrap();
|
||||
assert_eq!(result.len(), 8);
|
||||
|
||||
Reference in New Issue
Block a user