From CUDA to MLX: How K-Search Brings Decades of Kernel Expertise to Apple Silicon
Apple
NVIDIA
Google/DeepMind
Researchers from UC Berkeley Sky Lab extended the K-Search evolutionary kernel optimization framework with an MLX backend for Apple Silicon. They developed a structured CUDA-to-MLX translation layer that transfers decades of CUDA optimization expertise to Apple GPUs, achieving near-expert performance on attention and Mamba SSM kernels.
Researchers from UC Berkeley Sky Lab built on K-Search, an evolutionary kernel search framework that uses AI to optimize GPU kernels, and extended it with a backend for Apple's MLX framework. They developed a novel structured CUDA-to-MLX translation layer that converts existing CUDA kernels into high-quality kernels for Apple Silicon. The approach reached 0.97x speedup compared to native MLX Attention kernel and up to 20x prefill speedup over community mlx-lm implementation on the Mamba SSM kernel. K-Search uses an iterative optimization loop where an LLM reasons about optimizations, generates candidate kernels, compiles and benchmarks them on real hardware. The translation layer includes concept mapping tables, MLX-specific hints, and reusable assertions that preserve expert kernel behaviors. The work demonstrates that AI-driven kernel search can transfer optimization knowledge across hardware ecosystems without starting from scratch.
- Сокращения
- MLX = Machine Learning eXtensions
- CUDA = Compute Unified Device Architecture
- GPU = Graphics Processing Unit
- SSM = State Space Model
- GQA = Grouped Query Attention
- MLA = Multi-head Latent Attention
- MoE = Mixture of Experts
- LLM = Large Language Model
- HBM = High Bandwidth Memory
- MMA = Matrix Multiply-Accumulate
Source: BAIR (Berkeley AI) —
original
