Skip to content

ruvector-cnn: SIMD optimizations were stubbed, backbone forward() was broken #251

@ruvnet

Description

@ruvnet

Summary

Deep code review revealed critical issues in ruvector-cnn:

🚨 Critical Issues Found

1. SIMD Functions Were Stubs (Calling Scalar)

The following "SIMD-optimized" functions were actually calling scalar fallbacks:

Function Platform Status Before
conv_3x3_avx2 x86 ❌ Scalar fallback
conv_3x3_avx2_fma x86 ❌ Scalar fallback
depthwise_conv_3x3_avx2 x86 ❌ Scalar fallback
global_avg_pool_avx2 x86 ❌ Scalar fallback
max_pool_2x2_avx2 x86 ❌ Scalar fallback
conv_3x3_wasm WASM ❌ Scalar fallback
depthwise_conv_3x3_wasm WASM ❌ Scalar fallback

Impact: Users expecting SIMD acceleration were getting scalar performance.

2. MobileNetV3Small/Large Forward Pass Broken

// This was the actual code - blocks were not processed!
for _block in &self.blocks {
    // Each block would process here
    // For simplicity, we just pass through  <-- STUB!
}

Impact: Network produced incorrect outputs (stem only, skipping all blocks).

3. Dead Code Warnings

  • Unused momentum field in BatchNorm
  • Unused rng field in ContrastiveAugmentation
  • Unused rand::Rng import
  • Undefined parallel feature reference

✅ Fixed In This PR

  1. Implemented real AVX2 SIMD for all 5 stubbed functions
  2. Implemented real WASM SIMD for 2 stubbed functions
  3. Deprecated MobileNetV3Small/Large (recommend unified MobileNetV3)
  4. Implemented actual block processing in forward() methods
  5. Fixed all dead code warnings

Test Results

All 36 tests pass ✅


Discovered via 4-agent parallel code review swarm

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingperformancePerformance optimization and benchmarks

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions