Daily Tech Briefing
AI 科技速览
每天 5 分钟内学习 AI。获取最新的人工智能新闻,理解其重要性,并学习如何将其应用于您的工作。
BAIR Blog · 2026/7/29 09:00:00

From CUDA to MLX: How K-Search Brings Decades of Kernel Expertise to Apple Silicon
AI 中文解读
核心亮点:IBM和伯克利团队把CUDA显卡编程专家积累几十年的优化经验,自动“翻译”给苹果芯片用,让AI在Mac上跑出接近专业显卡的性能。
通俗解读:GPU芯片有各自的“方言”,CUDA是英伟达家的老牌方言,积累了大量高手写好的加速技巧;苹果芯片用MLX这门新方言,很多技巧得从头摸索。这次科学家开发了一个叫K-Search的“智能翻译官”,它看懂CUDA代码里的优化思路后,不是逐行复制,而是按苹果芯片的脾气重新改写,相当于把老工程师的绝活直接教给新徒弟。结果显示,翻译后的注意力算法能达到原版97%的性能,某些模型提速约20倍。
实际影响:以后Mac用户跑AI大模型,不用再羡慕英伟达显卡了。本地运行的AI助手、图像生成、文档处理会更快更省电,普通人用苹果笔记本也能流畅玩转复杂AI应用。更长远看,这种“跨芯片经验移植”的技术成熟后,各种新芯片都能快速获得成熟优化,AI设备选择更多样,成本也可能下降。这对开发者是福音——写一次代码,就能高效跑在多种硬件上,不用重复造轮子。
<!-- twitter -->
<meta name="twitter:title" content="From CUDA to MLX: How K-Search Brings Decades of Kernel Expertise to Apple Silicon" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image" content="https://bair.berkeley.edu/static/blog/cuda-to-mlx-k-search/cover.png" />
<meta name="keywords" content="CUDA, MLX, Apple Silicon, kernel optimization, evolutionary search, K-Search, FlashAttention, Mamba, state space models, Metal" />
<meta name="description" content="IBM Research extends K-Search, the evolutionary kernel search framework from Berkeley Sky Lab, with a CUDA-to-MLX translation layer that transfers expert kernel knowledge to Apple Silicon, reaching 97% of FlashAttention performance and a ~20x faster Mamba SSM prefill." />
<meta name="author" content="Shiyi Cao, Gal Bloch, Assaf Toledo, Michael Factor, Gil Vernik, Joseph E. Gonzalez" />
<p class="center">
<img src="https://bair.berkeley.edu/static/blog/cuda-to-mlx-k-search/cover.svg" alt="Kernel knowledge transfer from CUDA to MLX" /><br />
</p>
<p class="cuda-mlx-fig-caption"><strong>Figure 1: CUDA-to-MLX optimization translation map.</strong> CUDA optimization knowledge can be translated into architecture-native MLX strategies rather than copied instruction-for-instruction.</p>
<p>We face a new epoch in computing. Hardware is changing rapidly — not just faster GPUs, but a growing range of chips from different vendors, each with its own architecture and often tailored to specific AI workloads. Software is changing just as fast, and AI coding tools now generate in minutes what took months of effort a few years ago.</p>
<!--more-->
<p>With so much of computing now centered on AI, GPU kernels are a crucial component of its success. These are the low-level programs that run inside the GPU, and writing efficient ones is far from obvious — it takes years of expertise to get right. Transferring a kernel from one vendor’s hardware to another is harder still, and often means rediscovering the same optimizations from scratch. The CUDA ecosystem, for example, has accumulated decades of hard-won kernel expertise: hand-tuned implementations of attention, state space models, and other critical operations representing thousands of engineering hours. Newer hardware ecosystems (Apple Silicon, custom AI accelerators, and others) are growing fast but lack this depth.</p>
<p>In this work we ask whether that expertise can be transferred automatically. We built on <a href="https://arxiv.org/abs/2602.19128">K-Search</a>, an evolutionary kernel search framework introduced by Cao et al. at Berkeley Sky Lab that uses AI to optimize GPU kernels, and extended it with a backend for MLX — Apple’s machine-learning framework for its own Apple Silicon chips. We developed a novel structured CUDA-to-MLX translation layer that lets K-Search take existing CUDA kernels as a knowledge base and adapt them into high-quality GPU kernels for Apple Silicon, rather than rebuilding from scratch.</p>
<p>We show that our approach reaches near-expert level performance on Apple Silicon with 0.97x speedup compared to the native MLX Attention kernel, and up to a 20x prefill speedup over the community mlx-lm implementation on the Mamba SSM kernel; we report the numbers, and how much of the gain comes from the translation layer, in the sections below. Although we focus on MLX kernels for Apple Silicon, the method is not specific to MLX and applies to any ecosystem where CUDA expertise is transferable.</p>
<h2 id="why-mlx">Why MLX?</h2>
<p>Apple’s MLX framework has seen remarkable adoption since late 2023. With Apple Silicon in hundreds of millions of MacBooks and Mac Studios, MLX enables local AI inference without cloud costs. The unified memory architecture makes it especially attractive for mid-sized models (7B–70B parameters on M series chips).</p>
<p>Yet beneath this momentum lies a significant gap: many performance-critical kernels that the NVIDIA ecosystem takes fo
分享
阅读原文 ↗