211 Star 1.1K Fork 967

Ascend/samples

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
best_practices
common
cplusplus
docs
growthpath
inference
operator
ascendc
0_introduction
0_helloworld
10_matmul_frameworklaunch
11_matmul_kernellaunch
12_matmulleakyrelu_frameworklaunch
13_matmulleakyrelu_kernellaunch
14_reduce_frameworklaunch
15_sub_frameworklaunch
16_unaligned_abs_kernellaunch
17_unaligned_reducemin_kernellaunch
18_unaligned_wholereduces_frameworklaunch
19_unaligned_wholereduces_kernellaunch
1_add_frameworklaunch
20_mmad_kernellaunch
2_add_frameworklaunchlite
3_add_kernellaunch
AddKernelInvocationNeo
AddKernelInvocationTilingNeo
CppExtensions
README.md
4_addn_frameworklaunch
5_addn_kernellaunch
6_addtemplate_frameworklaunch
7_broadcast_frameworklaunch
9_leakyrelu_frameworklaunch
README.md
1_utilities
2_features
3_libraries
4_best_practices
README.md
.clang-format
README.md
operator_contrib
python
robot/ascend_car
st
training
.gitignore
CONTRIBUTING_CN.md
CONTRIBUTING_EN.md
LICENSE
NOTICE
OWNERS
README.md
build_run.sh
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

概述

本样例介绍Add算子的核函数直调方法。

目录结构介绍

├── 3_add_kernellaunch                // 使用核函数直调的方式调用Add自定义算子
│   ├── AddKernelInvocationNeo        // Kernel Launch方式调用核函数样例
│   ├── AddKernelInvocationTilingNeo  // Kernel Launch方式调用核函数样例,带有Tiling
│   └── CppExtensions                 // pybind方式调用核函数样例,带有Tiling

算子描述

Add算子实现了两个数据相加,返回相加结果的功能。对应的数学表达式为:

z = x + y

算子规格描述

算子类型(OpType)Add
算子输入nameshapedata typeformat
x8 * 2048floatND
y8 * 2048floatND
算子输出z8 * 2048floatND
核函数名add_custom

支持的产品型号

本样例支持如下产品型号:

  • Atlas 训练系列产品
  • Atlas 推理系列产品(Ascend 310P处理器)
  • Atlas A2训练系列产品/Atlas 800I A2推理产品
  • Atlas 200/500 A2推理产品

编译运行样例算子

针对自定义算子工程,编译运行包含如下步骤:

  • 编译自定义算子工程;
  • 调用执行自定义算子;

详细操作如下所示。

1. 获取源码包

编译运行此样例前,请参考准备:获取样例代码完成源码包获取。

2. 编译运行样例工程

更新说明

时间 更新事项 注意事项
2023/10/09 新增AddCustomSample/KernelLaunch样例
2024/01/04 新增AddKernelInvocationNeo样例 需要基于社区CANN包7.0.0.alpha003及之后版本运行
2024/01/04 新增AddKernelInvocationTilingNeo样例 需要基于社区CANN包7.0.0.alpha003及之后版本运行
2024/02/02 新增AddCustomSample/KernelLaunch/CppExtensions样例 需要基于社区CANN包7.0.0.alpha003及之后版本运行
2024/05/22 更新readme结构 需要基于社区CANN包7.0.0.alpha003及之后版本运行
2024/06/06 AddKernelInvocation样例转维护,不再更新,不推荐使用
2024/08/11 删除AddKernelInvocation样例
2024/11/11 样例目录调整
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ascend/samples.git
git@gitee.com:ascend/samples.git
ascend
samples
samples
v0.3-8.0.0.alpha003

搜索帮助