news 2026/5/11 18:41:32

CANN/asc-devkit asc_copy_gm2l1 API

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
CANN/asc-devkit asc_copy_gm2l1 API

asc_copy_gm2l1

【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言,原生支持C和C++标准规范,主要由类库和语言扩展层构成,提供多层级API,满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkit

产品支持情况

产品是否支持
Atlas A2 训练系列产品/Atlas A2 推理系列产品
Atlas A3 训练系列产品/Atlas A3 推理系列产品

功能说明

将矩阵数据从Global Memory搬运到L1 Buffer中。

函数原型

  • 常规计算

    __aicore__ inline void asc_copy_gm2l1(__cbuf__ bfloat16_t* dst, __gm__ bfloat16_t* src, uint16_t base_idx, uint8_t repeat, uint16_t src_stride, uint16_t dst_stride) __aicore__ inline void asc_copy_gm2l1(__cbuf__ half* dst, __gm__ half* src, uint16_t base_idx, uint8_t repeat, uint16_t src_stride, uint16_t dst_stride) __aicore__ inline void asc_copy_gm2l1(__cbuf__ float* dst, __gm__ float* src, uint16_t base_idx, uint8_t repeat, uint16_t src_stride, uint16_t dst_stride) __aicore__ inline void asc_copy_gm2l1(__cbuf__ int32_t* dst, __gm__ int32_t* src, uint16_t base_idx, uint8_t repeat, uint16_t src_stride, uint16_t dst_stride) __aicore__ inline void asc_copy_gm2l1(__cbuf__ int8_t* dst, __gm__ int8_t* src, uint16_t base_idx, uint8_t repeat, uint16_t src_stride, uint16_t dst_stride) __aicore__ inline void asc_copy_gm2l1(__cbuf__ uint32_t* dst, __gm__ uint32_t* src, uint16_t base_idx, uint8_t repeat, uint16_t src_stride, uint16_t dst_stride) __aicore__ inline void asc_copy_gm2l1(__cbuf__ uint8_t* dst, __gm__ uint8_t* src, uint16_t base_idx, uint8_t repeat, uint16_t src_stride, uint16_t dst_stride)
  • 同步计算

    __aicore__ inline void asc_copy_gm2l1_sync(__cbuf__ bfloat16_t* dst, __gm__ bfloat16_t* src, uint16_t base_idx, uint8_t repeat, uint16_t src_stride, uint16_t dst_stride) __aicore__ inline void asc_copy_gm2l1_sync(__cbuf__ half* dst, __gm__ half* src, uint16_t base_idx, uint8_t repeat, uint16_t src_stride, uint16_t dst_stride) __aicore__ inline void asc_copy_gm2l1_sync(__cbuf__ float* dst, __gm__ float* src, uint16_t base_idx, uint8_t repeat, uint16_t src_stride, uint16_t dst_stride) __aicore__ inline void asc_copy_gm2l1_sync(__cbuf__ int32_t* dst, __gm__ int32_t* src, uint16_t base_idx, uint8_t repeat, uint16_t src_stride, uint16_t dst_stride) __aicore__ inline void asc_copy_gm2l1_sync(__cbuf__ int8_t* dst, __gm__ int8_t* src, uint16_t base_idx, uint8_t repeat, uint16_t src_stride, uint16_t dst_stride) __aicore__ inline void asc_copy_gm2l1_sync(__cbuf__ uint32_t* dst, __gm__ uint32_t* src, uint16_t base_idx, uint8_t repeat, uint16_t src_stride, uint16_t dst_stride) __aicore__ inline void asc_copy_gm2l1_sync(__cbuf__ uint8_t* dst, __gm__ uint8_t* src, uint16_t base_idx, uint8_t repeat, uint16_t src_stride, uint16_t dst_stride)

参数说明

参数名输入/输出描述
dst输出目的操作数(矢量)的起始地址。
src输入源操作数(矢量)的起始地址。
base_idx输入以16*16个数对矩阵进行分块,搬运的起始分块ID。
repeat输入迭代次数。
src_stride输入输入数据中两个相邻连续数据块之间的距离。
dst_stride输入输出数据中两个相邻连续数据块之间的距离。

返回值说明

流水类型

PIPE_MTE2

约束说明

调用示例

//搬运的起始分块为1 constexpr uint16_t base_idx = 1; //搬运的迭代次数为2 constexpr uint8_t repeat = 2; //输入的搬运步长为0字节,输出的搬运步长为512字节 constexpr uint16_t src_stride = 0; constexpr uint16_t dst_stride = 1; __gm__ half src[256]; __cbuf__ half dst[256]; asc_copy_gm2l1(dst, src, base_idx, repeat, src_stride, dst_stride);

【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言,原生支持C和C++标准规范,主要由类库和语言扩展层构成,提供多层级API,满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkit

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/5/11 18:38:55

CANN/asc-devkit PostFakeMsg API文档

PostFakeMsg 【免费下载链接】asc-devkit 本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言,原生支持C和C标准规范,主要由类库和语言扩展层构成,提供多层级API,满足多维场景算子开发诉求。 项目地址: https://gitcode.co…

作者头像 李华
网站建设 2026/5/11 18:37:58

Godot 3 Demos多人游戏开发:使用高级API构建在线游戏体验

Godot 3 Demos多人游戏开发:使用高级API构建在线游戏体验 【免费下载链接】godot-3-demos Dozens of free and open source demos for the Godot game engine, version 3. Head to the link below for newer demos for Godot 4 项目地址: https://gitcode.com/gh_…

作者头像 李华
网站建设 2026/5/11 18:36:13

在唯与阿之间守住边界,老子之问给 SAP RAP 开发的一盏灯

老子说「唯之与阿,相去几何?美之与恶,相去若何?人之所畏,不可不畏。荒兮,其未央哉!」这句话放进 SAP ABAP RESTful Application Programming Model 里读,味道很特别。它不是在教人含糊,也不是在取消判断,而是在提醒我们,很多看起来差别巨大的东西,真正落到系统运行…

作者头像 李华