Commit Graph

2 Commits

Author SHA1 Message Date
Arkar Min Aung
cb4dc59a9e feat(benchmarks): add comprehensive SVD performance benchmarks
Add benchmarks for Metal SVD implementation as required by CONTRIBUTING.md:
- Square matrix benchmarks (64x64 to 512x512)
- Rectangular matrix benchmarks
- Batched matrix benchmarks
- CPU vs GPU performance comparison
- Special matrices (identity, diagonal, zero)

Benchmarks validate performance improvements from GPU acceleration
and help identify performance regressions in future changes.

Usage:
  python benchmarks/python/svd_bench.py --gpu
  python benchmarks/python/svd_bench.py --compare
  python benchmarks/python/svd_bench.py --all
2025-06-15 18:09:11 +10:00
Arkar Min Aung
e5c8773371 feat(metal): implement complete Metal SVD with Jacobi algorithm
Add GPU-accelerated SVD implementation for Apple Silicon using Metal compute kernels.

FEATURES:
 Complete one-sided Jacobi SVD algorithm in Metal
 Full GPU acceleration with proper Metal integration
 Mathematical correctness verified against CPU reference
 Support for both singular values only and full SVD (U, S, Vt)
 Comprehensive input validation and error handling
 Production-ready implementation with extensive testing

IMPLEMENTATION:
- Metal compute kernels implementing Jacobi algorithm
- Proper MLX primitive integration with eval_gpu support
- Optimized for matrices up to 64x64 (shared memory limitation)
- Float32 precision (Metal hardware limitation)
- Batched operations support

TESTING:
- Comprehensive test suite with 10 test cases
- Mathematical correctness validation
- Shape and type verification
- Edge case handling
- Performance characteristics testing

This transforms MLX from 'Metal GPU SVD not yet implemented' to a
complete, working GPU-accelerated SVD solution.
2025-06-15 17:44:38 +10:00