当前位置:网站首页>[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 .
边栏推荐
- Todesk remote control, detailed introduction and tutorial
- Using dynamic time warping (DTW) to solve the similarity measurement of time series and the similarity identification analysis of pollution concentration in upstream and downstream rivers
- Clustered index (clustered index), nonclustered index (nonclustered index)
- What do I mean when I link Mysql to report this error?
- 试驾 Citus 11.0 beta(官方博客)
- Methods for comparing float types in the kernel
- Does version 2.2.0 support dynamic addition of MySQL synchronization tables
- Bytebase 加入阿裏雲 PolarDB 開源數據庫社區
- Steering gear control (stm32f103c8t6)
- Obstacle avoidance sensor module (stm32f103c8t6)
猜你喜欢
物联网?快来看 Arduino 上云啦
R for Data Science (notes) -- data transformation (used by filter)
php OSS文件讀取和寫入文件,workerman生成臨時文件並輸出瀏覽器下載
Bytebase rejoint la communauté de base de données open source d'alicloud polardb
The agile way? Is agile development really out of date?
Zadig + 洞态 IAST:让安全溶于持续交付
R for Data Science (note) -- data transformation (select basic use)
【Go语言刷题篇】Go从0到入门4:切片的高级用法、初级复习与Map入门学习
Working for 6 years with a monthly salary of 3W and a history of striving for one PM
Fundamentals of performance testing -- definitions of common terms
随机推荐
Nodered has no return value after successfully inserting into the database (the request cannot be ended)
Comparative analysis of arrayblockingqueue and linkedblockingqueue
假如,程序员面试的时候说真话
[R tidyverse] use of select verb
Bytebase joins Alibaba cloud polardb open source database community
Jsup supports XPath
等等党们的胜利!挖矿退潮后,显卡价格全面暴跌
Openstack actual installation and deployment tutorial, openstack installation tutorial
应用实践 | 海量数据,秒级分析!Flink+Doris 构建实时数仓方案
What are the functions of IBPs open source form designer?
Apache+PHP+MySQL环境搭建超详细!!!
Does finkcdc support sqlserver2008?
JVM tuning
Generate the last login user account report of the computer through SCCM SQL
The cdc+mysql connector joins the date and time field from the dimension table by +8:00. Could you tell me which one is hosted by Alibaba cloud
Database index can improve query efficiency. Ask what will improve, what is the difference between inapplicable index and index use, and what will happen.
60 个神级 VS Code 插件!!
To open the registry
Get to know the data structure of redis - hash
STM32 uses time delay to realize breathing lamp register version