https://github.com/hollance/neural-engine Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code + Explore + All features + Documentation + GitHub Skills + Blog * Solutions + For + Enterprise + Teams + Startups + Education + By Solution + CI/CD & Automation + DevOps + DevSecOps + Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles + Repositories + Topics + Trending + Collections * Pricing [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} hollance / neural-engine Public * Notifications * Fork 48 * Star 1.3k Everything we actually know about the Apple Neural Engine (ANE) License MIT license 1.3k stars 48 forks Star Notifications * Code * Issues 2 * Pull requests 2 * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Security * Insights hollance/neural-engine This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 1 branch 0 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/h] Use Git or checkout with SVN using the web URL. [gh repo clone hollan] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @hollance hollance Merge pull request #21 from sladewatkins/master ... 723043d Jan 22, 2023 Merge pull request #21 from sladewatkins/master Add M1/M2 Pro, Max, and Ultra, and add iMac 24-inch (2021) 723043d Git stats * 45 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time docs tidy up for pull request January 21, 2023 18:29 .gitignore add the docs April 17, 2020 21:59 LICENSE Initial commit April 15, 2020 18:47 README.md remove some links from readme September 1, 2021 18:20 View code The Neural Engine -- what do we know about it? Why this document? Table of contents README.md The Neural Engine -- what do we know about it? Most new iPhones and iPads have a Neural Engine, a special processor that makes machine learning models really fast, but not much is publicly known about how this processor actually works. The Apple Neural Engine (or ANE) is a type of NPU, which stands for Neural Processing Unit. It's like a GPU, but instead of accelerating graphics an NPU accelerates neural network operations such as convolutions and matrix multiplies. The ANE isn't the only NPU out there -- many companies besides Apple are developing their own AI accelerator chips. Besides the Neural Engine, the most famous NPU is Google's TPU (or Tensor Processing Unit). Why this document? When I was still providing ML consulting services for iOS, I would often get email from people who are confused why their model doesn't appear to be running on the Neural Engine, or why it is so slow when the ANE is supposed to be way faster than the GPU... It turns out that not every Core ML model can make full use of the ANE. The reason why can be complicated, hence this document tries to answer the most common questions. The ANE is great for making ML models run really fast on iPhones and iPads. A model that is optimized for the ANE will seriously outperform the CPU and GPU. But the ANE also has limitations. Unfortunately Apple isn't giving third-party developers any guidance on how to optimize their models to take advantage of the ANE. It's mostly a process of trial-and-error to figure out what works and what doesn't. Note: Everything here was obtained by experimentation. I do not work at Apple and never have, so I am not privy to any implementation details of this chip. Some of this information is probably wrong. It's definitely incomplete. If you know something that isn't explained here, or if you find information that is wrong or missing, please file an issue or make a pull request. Thanks! I was originally planning to make this a blog post but decided to put it on GitHub to make it a community resource and so that other people could contribute to it too. Please do! Table of contents * Which devices have an ANE? * Why should I care about the ANE? * How do I make my model run on the ANE? * How do I prevent my model from running on the ANE? * Is my model using the ANE? * Can I program the ANE directly? * Isn't the ANE the same as the GPU? * Is the ANE 16-bit? * Which Core ML layers are not supported by the ANE? * Use os_log to look at warning / error messages * How to replace unsupported layers * How does the ANE work internally? * Other weird issues * Reverse engineering the ANE About Everything we actually know about the Apple Neural Engine (ANE) Topics ios neural-network iphone ane coreml tpu neural-engine Resources Readme License MIT license Stars 1.3k stars Watchers 69 watching Forks 48 forks Releases No releases published Packages 0 No packages published Contributors 6 * @hollance * @alexsmbaratti * @sladewatkins * @paramaggarwal * @dshakhbazyan * @nealmcb Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.