当前位置:网站首页>[cann document express issue 04] unveiling the development of shengteng cann operator
[cann document express issue 04] unveiling the development of shengteng cann operator
2022-06-24 19:59:00 【Hua Weiyun】

The developer of shengteng is in the process of neural network model training or reasoning , You will often encounter the following scenarios :
- Transform the third-party open source framework network model into an adaptive shengteng AI The model of the processor , Yes CANN Operator not yet supported .
- The performance of existing operators cannot meet the requirements of developers .
- Developers want to modify the calculation logic of existing operators .
At this point, we need to consider the development of user-defined operators , In this issue, we mainly show you CANN Type of custom operator , compile 、 Run logical architecture , And the development process of operators , Let you be right CANN Operators have a macroscopic understanding .
CANN Custom operator type
CANN There are two types of custom operators :TBE Operators and AI CPU operator , The difference between the two operators is as follows .

among AI CPU The implementation of the operator is relatively simple ,TBE The implementation of the operator is complex , But the performance is better . If the user wants to quickly get through the model execution process , You can choose to customize AI CPU operator , So as to improve the commissioning efficiency . After function adjustment , In the subsequent performance testing process, we will AI CPU Operator switches to TBE Operator implementation .
Operator compilation
Let's take a look at CANN The compilation process of the operator , As shown in the figure below :

- The third-party framework network model goes through Parser After the parsing , Transitioning to an intermediate state IR (Intermediate Representation) Graph.
- GE receive IR Graph Then prepare the diagram 、 Split 、 Subgraph optimization and other operations .
- In the process of subgraph optimization , Can match and select operators , Priority by FE be based on TBE The operator information base judges the operator support , if TBE I won't support it , By AI CPU Engine be based on AI CPU The operator information base determines whether it supports .
- GE Merge the split subgraphs 、 Optimize , And compile , Operators will be generated during compilation Task Information , Finally, executable om Model .
Operator operation

First GE Issue an operator execution request to Runtime, then Runtime Can judge operators Task type , if TBE operator , Then send the operator execution request to AI Core On the implementation ; if AI CPU operator , Then send the operator execution request to AI CPU On the implementation .
Operator development process

Light purple shading for operator development deliverables , The deliverables are described below :
- Operator prototype : The operator is external API, Define operator input 、 Output 、 Properties and operators shape Derivation logic .
- Operator implementation code : Describe the operational logic of an operator . in the light of TBE operator , by python file ; in the light of AI CPU operator , by C++ file .
- Operator information base : The description operator is rising AI Implementation limitations on processors , Contains the input and output of the operator data type、format as well as shape Information .
- Operator adapter plug-in : The operators of the third-party framework are mapped to adaptive lifting AI Processor operators .
Operator project creation method

The developer can choose the operator development method by himself , And develop the deliverables under the corresponding directory based on the above rules .
More about
Learn more about , You can log in to shengteng community https://www.hiascend.com/, Read the relevant documents :

Rise CANN The document center is dedicated to providing developers with better content and more convenient development experience , help CANN Developers co build AI ecology . Any comments and suggestions can be fed back in shengteng community , Your every attention is our driving force .
边栏推荐
- Understanding openstack network
- Network security review office starts network security review on HowNet
- Predicate
- LCD1602 string display (STM32F103)
- [go language questions] go from 0 to entry 4: advanced usage of slice, elementary review and introduction to map
- Volcano成Spark默认batch调度器
- The efficiency of okcc call center data operation
- UART communication (STM32F103 library function)
- Apache+php+mysql environment construction is super detailed!!!
- What are the functions of IBPs open source form designer?
猜你喜欢

Q1: error in JMeter filename must not be null or empty

Todesk remote control, detailed introduction and tutorial

LCD1602 string display (STM32F103)

网络安全审查办公室对知网启动网络安全审查,称其“掌握大量重要数据及敏感信息”

Apache+php+mysql environment construction is super detailed!!!

Download steps of STM32 firmware library

程序员大部分时间不是写代码,而是。。。

微信小程序轮播图怎么自定义光标位置

Methods for comparing float types in the kernel

Understanding openstack network
随机推荐
Five day summary of software testing
工作6年,月薪3W,1名PM的奋斗史
Get to know the data structure of redis - hash
Download steps of STM32 firmware library
Win7 10 tips for installing Office2010 five solutions for installing MSXML components
Huawei cloud modelarts has ranked first in China's machine learning public cloud service market for the fourth time!
R语言corrplot相关热图美化实例分析
Bytebase joins Alibaba cloud polardb open source database community
gateway
Bat learning notes
three. Basic framework created by JS
Microsoft Office Excel 2013 2016 graphic tutorial on how to enable macro function
【Go语言刷题篇】Go从0到入门4:切片的高级用法、初级复习与Map入门学习
微信小程序轮播图怎么自定义光标位置
Unityshader world coordinates do not change with the model
Php OSS file read and write file, workerman Generate Temporary file and Output Browser Download
Bytebase rejoint la communauté de base de données open source d'alicloud polardb
RF_DC系统时钟设置GEN1/GEN2
怎么使用R包ggtreeExtra绘制进化树
Programmers spend most of their time not writing code, but...