Coder Social home page Coder Social logo

stephanosio / cmsis-nn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from arm-software/cmsis-nn

0.0 1.0 0.0 4.76 MB

CMSIS-NN Library

Home Page: https://arm-software.github.io/CMSIS-NN/index.html

License: Apache License 2.0

Shell 0.21% JavaScript 0.31% Python 4.14% C 93.82% CSS 0.63% HTML 0.06% CMake 0.82%

cmsis-nn's Introduction

CMSIS NN

CMSIS NN software library is a collection of efficient neural network kernels developed to maximize the performance and minimize the memory footprint of neural networks on Arm Cortex-M processors.

Supported Framework

The library follows the int8 and int16 quantization specification of TensorFlow Lite for Microcontrollers.

Branches and Tags

There is a single branch called 'main'. Tags are created during a release. Two releases are planned to be done in a year. The releases can be found here .

Current Operator Support

In general optimizations are written for an architecture feature. This falls into one of the following categories. Based on feature flags for a processor or architecture provided to the compiler, the right implementation is picked.

Pure C

There is always a pure C implementation for an operator. This is used for processors like Arm Cortex-M0 or Cortex-M3.

DSP Extension

Processors with DSP extension uses Single Instruction Multiple Data(SIMD) instructions for optimization. Examples of processors here are Cortex-M4 or a Cortex-M33 configured with optional DSP extension.

MVE Extension

Processors with Arm Helium Technology use the Arm M-profile Vector Extension(MVE) instructions for optimization. Examples are Cortex-M55 or Cortex-M85 configured with MVE.

Operator C
int8
C
int16
DSP
int8
DSP
int16
MVE
int8
MVE
int16
Conv2D Yes Yes Yes Yes Yes Yes
DepthwiseConv2D Yes Yes Yes Yes Yes Yes
Fully Connected Yes Yes Yes Yes Yes Yes
Add Yes Yes Yes Yes Yes Yes
Mul Yes Yes Yes Yes Yes Yes
MaxPooling Yes Yes Yes Yes Yes Yes
AvgPooling Yes Yes Yes Yes Yes Yes
Softmax Yes Yes Yes Yes Yes No
LSTM Yes NA Yes NA Yes NA
SVDF Yes No Yes No Yes No

Contribution Guideline

First, a thank you for the contribution. Here are some guidelines and good to know information to get started.

Coding Guideline

By default, follow the style used in the file. You'll soon start noticing a pattern like

  • Variable and function names are lower case with an underscore separator.
  • Hungarian notation is not used. Well, almost.
  • If the variable names don't convey the action, then add comments.

New Files

One function per file is followed in most places. In those cases, the file name must match the function name. Connect the function to an appropriate Doxygen group as well.

Doxygen

Function prototypes must have a detailed comment header in Doxygen format. You can execute the doxygen document generation script in the Doxygen folder to check that no errors are introduced.

Unit Tests

For any new features and bug fixes, new unit tests are needed. Improvements have to be verifed by unit tests. If you do not have the means to execute the tests, you can still make the PR and comment that you need help in completing/executing the unit tests.

Version & Date

Each File has a version number and a date field that must be updated when making any change to that file. The versioning follows Semantic Versioning 2.0.0 format.

Building CMSIS-NN as a library

It is recommended to use toolchain files from Arm Ethos-U Core Platform project. These are supporting TARGET_CPU, which is a required argument. Note that if not specifying TARGET_CPU, these toolchains will set some default. The format must be TARGET_CPU=cortex-mXX, see examples below.

Here is an example:

cd </path/to/CMSIS_NN>
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=</path/to/ethos-u-core-platform>/cmake/toolchain/arm-none-eabi-gcc.cmake -DTARGET_CPU=cortex-m55
make

Some more examples:

cmake .. -DCMAKE_TOOLCHAIN_FILE=</path/to/ethos-u-core-platform>/cmake/toolchain/armclang.cmake -DTARGET_CPU=cortex-m55
cmake .. -DCMAKE_TOOLCHAIN_FILE=</path/to/ethos-u-core-platform>/cmake/toolchain/arm-none-eabi-gcc.cmake -DTARGET_CPU=cortex-m7
cmake .. -DCMAKE_TOOLCHAIN_FILE=</path/to/ethos-u-core-platform>/cmake/toolchain/armclang.cmake -DTARGET_CPU=cortex-m3

Compiler Options

Default optimization level is set at Ofast. Please change according to project needs. Just bear in mind this can impact performance. With only optimization level -O0, ARM_MATH_AUTOVECTORIZE needs to be defined for processors with Helium Technology.

The compiler option '-fomit-frame-pointer' is enabled by default at -O and higher. When no optimization level is specified, you may need to specify '-fomit-frame-pointer'.

The compiler option '-fno-builtin' does not utilize optimized implementations of e.g. memcpy and memset, which are heavily used by CMSIS-NN. It can significantly downgrade performance. So this should be avoided. The compiler option '-ffreestanding' should also be avoided as it enables '-fno-builtin' implicitly.

Supported Compilers

  • CMSIS-NN is tested on Arm Compiler 6 and on Arm GNU Toolchain.
  • IAR compiler is not tested and there can be compilation and/or performance issues.
  • Compilation for Host is not supported out of the box. It should be possible to use the C implementation and compile for host with minor stubbing effort.

Inclusive Language

This product confirms to Arm’s inclusive language policy and, to the best of our knowledge, does not contain any non-inclusive language. If you find something that concerns you, email [email protected].

Support / Contact

For any questions or to reach the CMSIS-NN team, please create a new issue in https://github.com/ARM-software/CMSIS-NN/issues

cmsis-nn's People

Contributors

felix-johnny avatar mansnils avatar christophe0606 avatar gmiodice avatar jonatanantoni avatar giorgio-arenarm avatar dependabot[bot] avatar annietllnd avatar freddan80 avatar jenselofsson avatar hmogensen-arm avatar lamarrr avatar ttornblom avatar jkrech avatar oscarandersson8218 avatar patriklaurell avatar arvoelke avatar alessandrocapotondi avatar bewagner avatar fabklein avatar fpedd avatar csukuangfj avatar majianjia avatar mortior avatar jvistrand avatar sandeepmistry avatar sebastian-larsson avatar tombana avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.