Skip to content

asc_set_gm2l1_loop2_stride

产品支持情况

  • Ascend 950PR/Ascend 950DT:支持
  • Atlas A3 训练系列产品/Atlas A3 推理系列产品:不支持
  • Atlas A2 训练系列产品/Atlas A2 推理系列产品:不支持
  • Atlas 200I/500 A2 推理产品:不支持
  • Atlas 推理系列产品AI Core:不支持
  • Atlas 推理系列产品Vector Core:不支持
  • Atlas 训练系列产品:不支持

功能说明

将数据从Global Memory (GM)搬运到L1 Buffer时,通过调用该接口设置外层循环中相邻迭代数据块间的间隔。

以源操作数搬运场景为例,如下图所示。

源操作数搬运场景示例

函数原型

C++
__aicore__ inline void asc_set_gm2l1_loop2_stride(uint64_t loop2_src_stride, uint64_t loop2_dst_stride)

参数说明

表1 参数说明

参数名输入/输出描述
loop2_src_stride输入外层循环中相邻迭代源操作数的数据块间的间隔,单位为Byte,取值范围为[0,2^40]。
loop2_dst_stride输入外层循环中相邻迭代目标操作数的数据块间的间隔,单位为Byte,取值范围为[0,2^21],且必须32B对齐。

返回值说明

流水类型

PIPE_S

约束说明

调用示例

C++
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;
// src表示源操作数的起始地址
__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 仓 master 分支自动编译生成,属于持续开发版本,可能存在缺陷,仅供预览与参考。如需稳定及商用资料,请查阅官方 昇腾社区