asc_set_gm2l1_loop_size
产 品 支 持 情 况
| 产 品 | 是 否 支 持 |
|---|---|
| Ascend 950PR/Ascend 950DT | √ |
功 能 说 明
将 数 据 从Global Memory (GM)搬 运 到L1 Buffer时,通 过 调 用 该 接 口 设 置 数 据 搬 运 流 程 中 的 循 环 次 数。
以 源 操 作 数 搬 运 场 景 为 例,如 下 图 所 示。

函 数 原 型
C++
__aicore__ inline void asc_set_gm2l1_loop_size(uint64_t loop1_size, uint64_t loop2_size)
参 数 说 明
| 参 数 名 | 输 入/输 出 | 描 述 |
|---|---|---|
| loop1_size | 输 入 | 内 层 循 环 的 循 环 次 数,取 值 范 围 为[0,2^21]。 |
| loop2_size | 输 入 | 外 层 循 环 的 循 环 次 数,取 值 范 围 为[0,2^21]。 |
返 回 值 说 明
无
流 水 类 型
PIPE_S
约 束 说 明
每 次 设 置 循 环 相 关 参 数 后,需 要 进 行 寄 存 器 的 复 位(循 环 次 数 设 置 为1),否 则 会 影 响 下 一 次 搬 运 的 使 用。
调 用 示 例
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;
__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);