ANEForge is a Python package that programs the Apple Neural Engine (ANE), the fixed-function neural accelerator on every recent Apple device, directly and without CoreML. In production the engine is reachable only through CoreML, which treats it as a scheduling option: no configuration requires the ANE, and a model can silently run on the CPU or GPU instead. ANEForge compiles a lazy tensor graph, built from 58 fused operators and 19 native bridge operators, into a single ANE program. The program is dispatched through the same ANE daemon and kernel-driver stack as Apple's internal framework. Beyond inference, the package reaches the engine's native fused attention, streams int8, int4, and sparse weights, keeps decoder and optimizer state resident across steps, and runs the forward pass, backward pass, and optimizer update of training on the engine. A small fused program completes a call in about 90us, near the engine's 70us per-program dispatch floor, and a pretrained ResNet-18 forward runs end-to-end in 0.33ms. ResNet-18, a sentence encoder, and a Vision Transformer run end-to-end against framework references, and a Stable Diffusion U-Net validates its forward pass. ANEForge targets Apple Silicon under macOS 14 and later. Each release is verified against a recorded macOS and ANE-compiler version.


翻译:ANEForge是一个Python包,可直接编程苹果神经引擎(Apple Neural Engine, ANE)——每台最新苹果设备上的固定功能神经加速器——而无需通过CoreML。在生产环境中,该引擎仅能通过CoreML访问,而CoreML将其视为调度选项:无配置强制使用ANE,模型可静默地在CPU或GPU上运行。ANEForge将基于58个融合算子和19个原生桥接算子构建的惰性张量图编译为单个ANE程序,并通过与苹果内部框架相同的ANE守护进程和内核驱动程序栈进行调度。除推理外,该包还能调用引擎的原生融合注意力机制,传输int8、int4及稀疏权重,跨步骤保留解码器与优化器状态,并在引擎上运行训练的前向传播、反向传播及优化器更新。一个小型融合程序调用耗时约90微秒,接近引擎每程序调度70微秒的下限;预训练的ResNet-18前向传播端到端运行仅需0.33毫秒。ResNet-18、句子编码器及视觉Transformer(Vision Transformer)均实现了与框架参考的端到端对齐,而Stable Diffusion U-Net验证了其前向传播的正确性。ANEForge面向macOS 14及以上版本的Apple Silicon平台,每个版本均针对记录在案的macOS和ANE编译器版本进行验证。

0
下载
关闭预览

相关内容

专知会员服务
92+阅读 · 2021年4月12日
【干货书】PyTorch 深度学习,255页pdf
专知会员服务
282+阅读 · 2021年4月3日
【实用书】Python机器学习Scikit-Learn应用指南,247页pdf
专知会员服务
272+阅读 · 2020年6月10日
《深度学习》圣经花书的数学推导、原理与Python代码实现
Python 神经网络编程
人工智能头条
10+阅读 · 2019年2月27日
国家自然科学基金
7+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
Arxiv
0+阅读 · 6月16日
VIP会员
最新内容
面向2027年及未来的海军情报改革
专知会员服务
2+阅读 · 8月5日
《无人机蜂群:释放人类-蜂群编队的潜能》
专知会员服务
4+阅读 · 8月5日
《战略战术化:一项综合性述评》
专知会员服务
2+阅读 · 8月5日
相关基金
国家自然科学基金
7+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员