CANN/asc-devkit SIMD API数据搬运函数
asc_set_gm2l1_loop1_stride
【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言,原生支持C和C++标准规范,主要由类库和语言扩展层构成,提供多层级API,满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkit
产品支持情况
- Ascend 950PR/Ascend 950DT:支持
- Atlas A3 训练系列产品/Atlas A3 推理系列产品:不支持
- Atlas A2 训练系列产品/Atlas A2 推理系列产品:不支持
- Atlas 200I/500 A2 推理产品:不支持
- Atlas 推理系列产品AI Core:不支持
- Atlas 推理系列产品Vector Core:不支持
- Atlas 训练系列产品:不支持
功能说明
头文件路径:"c_api/cube_datamove/cube_datamove.h"。
将数据从Global Memory (GM)搬运到L1 Buffer时,通过调用该接口设置内层循环中相邻迭代数据块间的间隔。
以源操作数搬运场景为例,如下图所示。
函数原型
__aicore__ inline void asc_set_gm2l1_loop1_stride(uint64_t loop1_src_stride, uint64_t loop1_dst_stride)参数说明
| 参数名 | 输入/输出 | 描述 |
|---|---|---|
| loop1_src_stride | 输入 | 内层循环中相邻迭代源操作数的数据块间的间隔,单位为Byte,取值范围为[0,2^40]。 |
| loop1_dst_stride | 输入 | 内层循环中相邻迭代目标操作数的数据块间的间隔,单位为Byte,取值范围为[0,2^21],且必须32B对齐。 |
返回值说明
无
流水类型
PIPE_S
约束说明
无
调用示例
asc_set_gm2l1_loop_size(2, 2); asc_set_gm2l1_loop1_stride(96, 128); asc_set_gm2l1_loop2_stride(192, 288); constexpr uint32_t n_burst = 2; constexpr uint32_t len_burst = 2; constexpr uint8_t left_padding_count = 0; constexpr uint8_t right_padding_count = 0; constexpr bool data_select_bit = false; constexpr uint8_t l2_cache_ctl = 0; constexpr uint64_t burst_src_stride = 0; constexpr uint32_t burst_dst_stride = 0; __gm__ half src[256]; __cbuf__ half dst[256]; asc_copy_gm2l1_align(dst, src, n_burst, len_burst, left_padding_count, right_padding_count, data_select_bit, l2_cache_ctl, burst_src_stride, burst_dst_stride); asc_set_gm2l1_loop_size(1, 1);【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言,原生支持C和C++标准规范,主要由类库和语言扩展层构成,提供多层级API,满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkit
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
