用一套编译器实现消费级显卡的训练与推理,跨平台性能接近主流框架。
Meganeura: Portable GPU Training and Inference through Vulkan and Metal

- 基于Vulkan和Metal的统一编译器,支持静态图与自动微分。
- 96%的测试组合通过严格浮点与快速路径验证,训练延迟中位数为1.8倍。
- 适合需要跨设备部署的开发者,尤其移动端和异构硬件场景。
训练与推理常需跨导出、转换及平台特定运行时边界。Meganeura探讨是否可通过一个轻量级原生编译器在消费级GPU上覆盖两个阶段。其类型化静态图、自动微分、优化器、检查点、内存规划器与运行时通过Vulkan和Metal降低专用程序。我们在NVIDIA和AMD独立显卡、AMD APU、Apple Silicon及Intel iGPU上对比了五个匹配工作负载与PyTorch的表现。协议将严格f32与验证快路径分离,并独立控制前向与反向。50个设备-工作负载-模式组合中48个通过双关卡;另两个在新支持的APU上存在一个未解决的反向引用分歧。在严格f32下,Meganeura在20个参考GPU的最小延迟单元中胜出12个,训练有效差距中位数为1.8倍。在离散AMD GPU上,五个推理工作负载中有四个在1.10倍内,三个训练工作负载更快。加速合约下最差训练差距为4.6倍。编译耗时0.1-2.4秒,远低于支持路径上torch.compile的6-96秒;剥离后二进制仅13 MiB。调度分析定位最大差距来自卷积导数与注意力反向。一个真实安卓XR案例将Meganeura训练的解码器迁移至Adreno/OpenXR应用,共享图形队列。结果表明,通用消费级图形API可支持紧凑的统一训练-部署栈,在实用甚至部分厂商竞争性性能下运行。测量差距指向内核覆盖度、调度与算术策略,而非已识别的API限制。
原文摘要 · Abstract (English)
Training and deployed inference often cross export, conversion, and platform-specific runtime boundaries. Meganeura asks whether one compact native compiler can span both phases on consumer GPUs. Its typed static graph, automatic differentiation, optimizer, checkpoint, memory planner, and runtime lower specialized programs through Vulkan and Metal. We compare five matched workloads with PyTorch on NVIDIA and AMD discrete GPUs, an AMD APU, Apple silicon, and an Intel iGPU. The protocol separates strict f32 from validated fast paths and gates forward and backward independently. Forty-eight of 50 device-workload-mode cells pass both gates; the other two share one unresolved backward-reference disagreement on a newly supported APU. In strict f32, Meganeura wins 12 of 20 GPU-referenced minimal-latency cells and has a median valid training gap of 1.8x. On the discrete AMD GPU, four of five inference workloads are within 1.10x of compiled ROCm PyTorch and three training workloads are faster. Under accelerated contracts, the worst training gap is 4.6x. Compilation takes 0.1-2.4 seconds versus 6-96 seconds for torch.compile on supported GPU paths; the stripped binary is 13 MiB. Dispatch profiles localize the largest gaps to convolution derivatives and attention backward. A physical Android XR case study transfers a Meganeura-trained decoder into an Adreno/OpenXR application sharing the graphics queue. The results show that general consumer graphics APIs can support a compact shared train-to-deploy stack at useful, sometimes vendor-competitive performance. The measured gaps point to kernel coverage, scheduling, and arithmetic policy rather than an identified API limitation.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。