asc_set_gm2l1_loop1_stride

产品支持情况

产品 是否支持
Ascend 950PR/Ascend 950DT

功能说明

将数据从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);