苹果M3 Ultra上的实时扩散模型推断系统优化
Systematic Optimization of Real-Time Diffusion Model Inference on Apple M3 Ultra
AI总结:
本文针对苹果M3 Ultra平台系统性优化扩散模型实时推断,通过多种技术结合实现22.7 FPS的实时图像转换,揭示了与NVIDIA GPU不同的优化特性。
摘要:
尽管扩散模型在NVIDIA GPU上的实时图像生成技术迅速发展,但针对非CUDA平台如苹果硅芯片的系统性优化研究极为有限。本文在苹果M3 Ultra(60核心GPU,512GB统一内存)上进行了10个阶段的全面优化实验,目标是实现实时摄像头img2img转换。我们探索了包括CoreML转换、量化、令牌合并、神经引擎利用、紧凑模型探索、帧内插、基于kNN搜索的合成、pix2pix-turbo、光学流帧跳过和知识蒸馏等多种技术,并定量评估了每种方法的有效性。最终,通过结合CoreML转换的蒸馏专用模型SDXS-512与三线程摄像头流水线,在512x512分辨率下实现了22.7 FPS的实时摄像头img2img转换。本文的主要贡献是系统地证明了在CUDA上建立的优化见解不一定适用于苹果硅芯片的统一内存架构。我们揭示了一个与NVIDIA GPU截然不同的优化景观,包括量化无提速、并行推断无效以及神经引擎不适合大规模模型等特性,并为苹果硅芯片上的扩散模型推断提供了实用指南。
英文摘要:
While real-time image generation using diffusion models has advanced rapidly on NVIDIA GPUs, systematic optimization research on non-CUDA platforms such as Apple Silicon remains extremely limited. In this study, we conducted comprehensive optimization experiments across 10 phases targeting the Apple M3 Ultra (60-core GPU, 512 GB unified memory) with the goal of achieving real-time camera img2img transformation. We explored a wide range of techniques including CoreML conversion, quantization, Token Merging, Neural Engine utilization, compact model exploration, frame interpolation, kNN search-based synthesis, pix2pix-turbo, optical flow frame skipping, and knowledge distillation, quantitatively evaluating the effectiveness of each approach. Ultimately, by combining CoreML conversion of the distillation-specialized model SDXS-512 with a 3-thread camera pipeline, we achieved real-time camera img2img transformation at 22.7 FPS at 512x512 resolution. The primary contribution of this work is the systematic demonstration that optimization insights established for CUDA are not necessarily effective on Apple Silicon's unified memory architecture. We reveal an optimization landscape fundamentally different from that of NVIDIA GPUs -- including the absence of speedup from quantization, the ineffectiveness of parallel inference, and the unsuitability of the Neural Engine for large-scale models -- and provide practical guidelines for diffusion model inference on Apple Silicon.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。