asc_copy_l12l0c
产 品 支 持 情 况
| 产 品 | 是 否 支 持 |
|---|---|
| √ | |
| √ |
功 能 说 明
将 矩 阵 由L1 Buffer搬 运 到L0C Buffer中。该 搬 运 支 持 的 数 据 类 型 如 下:
- bfloat16_t->bfloat16_t
- half->half
- float->half
- float->bfloat16_t
- float->float
- int32_t->int32_t
- uint32_t->uint32_t
函 数 原 型
常 规 搬 运
C++__aicore__ inline void asc_copy_l12l0c(__cc__ bfloat16_t* dst, __cbuf__ bfloat16_t* src, uint16_t n_burst, uint16_t len_burst, uint16_t src_gap, uint16_t dst_gap) __aicore__ inline void asc_copy_l12l0c(__cc__ half* dst, __cbuf__ half* src, uint16_t n_burst, uint16_t len_burst, uint16_t src_gap, uint16_t dst_gap) __aicore__ inline void asc_copy_l12l0c(__cc__ half* dst, __cbuf__ float* src, uint16_t n_burst, uint16_t len_burst, uint16_t src_gap, uint16_t dst_gap) __aicore__ inline void asc_copy_l12l0c(__cc__ bfloat16_t* dst, __cbuf__ float* src, uint16_t n_burst, uint16_t len_burst, uint16_t src_gap, uint16_t dst_gap) __aicore__ inline void asc_copy_l12l0c(__cc__ float* dst, __cbuf__ float* src, uint16_t n_burst, uint16_t len_burst, uint16_t src_gap, uint16_t dst_gap) __aicore__ inline void asc_copy_l12l0c(__cc__ int32_t* dst, __cbuf__ int32_t* src, uint16_t n_burst, uint16_t len_burst, uint16_t src_gap, uint16_t dst_gap) __aicore__ inline void asc_copy_l12l0c(__cc__ uint32_t* dst, __cbuf__ uint32_t* src, uint16_t n_burst, uint16_t len_burst, uint16_t src_gap, uint16_t dst_gap)同 步 搬 运
C++__aicore__ inline void asc_copy_l12l0c_sync(__cc__ bfloat16_t* dst, __cbuf__ bfloat16_t* src, uint16_t n_burst, uint16_t len_burst, uint16_t src_gap, uint16_t dst_gap) __aicore__ inline void asc_copy_l12l0c_sync(__cc__ half* dst, __cbuf__ half* src, uint16_t n_burst, uint16_t len_burst, uint16_t src_gap, uint16_t dst_gap) __aicore__ inline void asc_copy_l12l0c_sync(__cc__ half* dst, __cbuf__ float* src, uint16_t n_burst, uint16_t len_burst, uint16_t src_gap, uint16_t dst_gap) __aicore__ inline void asc_copy_l12l0c_sync(__cc__ bfloat16_t* dst, __cbuf__ float* src, uint16_t n_burst, uint16_t len_burst, uint16_t src_gap, uint16_t dst_gap) __aicore__ inline void asc_copy_l12l0c_sync(__cc__ float* dst, __cbuf__ float* src, uint16_t n_burst, uint16_t len_burst, uint16_t src_gap, uint16_t dst_gap) __aicore__ inline void asc_copy_l12l0c_sync(__cc__ int32_t* dst, __cbuf__ int32_t* src, uint16_t n_burst, uint16_t len_burst, uint16_t src_gap, uint16_t dst_gap) __aicore__ inline void asc_copy_l12l0c_sync(__cc__ uint32_t* dst, __cbuf__ uint32_t* src, uint16_t n_burst, uint16_t len_burst, uint16_t src_gap, uint16_t dst_gap)
参 数 说 明
| 参 数 名 | 输 入/输 出 | 描 述 |
|---|---|---|
| dst | 输 出 | 目 的 操 作 数 的 起 始 地 址。 |
| src | 输 入 | 源 操 作 数 的 起 始 地 址。 |
| n_burst | 输 入 | 待 搬 运 的 连 续 传 输 数 据 块 个 数。取 值 范 围:[1, 4095]。 |
| len_burst | 输 入 | 待 搬 运 的 每 个 连 续 传 输 数 据 块 的 长 度,单 位 为32个 字 节。取 值 范 围:[1, 65535]。 |
| src_gap | 输 入 | 表 示 相 邻 迭 代 间,源 操 作 数 前 一 个 迭 代 第 一 个 分 形 的 结 束 地 址 到 下 一 个 迭 代 第 一 个 分 形 起 始 地 址 的 间 隔。 |
| dst_gap | 输 入 | 表 示 相 邻 迭 代 间,目 的 操 作 数 前 一 个 迭 代 第 一 个 分 形 的 结 束 地 址 到 下 一 个 迭 代 第 一 个 分 形 起 始 地 址 的 间 隔。 |
返 回 值 说 明
无
流 水 类 型
PIPE_MTE1
约 束 说 明
- src的 起 始 地 址 要 求 按 照 对 应 数 据 类 型 所 占 字 节 数 对 齐。
- dst的 起 始 地 址 要 求32字 节 对 齐。
- 如 果 需 要 执 行 多 条asc_copy_l12l0c指 令,且asc_copy_l12l0c指 令 的 目 的 地 址 存 在 重 叠,需 要 插 入 同 步 指 令,保 证 多 个asc_copy_l12l0c指 令 的 串 行 化,防 止 出 现 异 常 数 据。
调 用 示 例
C++
//待 搬 运 的 连 续 传 输 数 据 块 为1个
constexpr uint16_t n_burst = 1;
//待 搬 运 的 每 个 连 续 传 输 数 据 块 的 长 度 为32个 字 节
constexpr uint16_t len_burst = 1;
//相 邻 迭 代 间,源 操 作 数 前 一 个 分 形 与 后 一 个 分 形 起 始 地 址 的 间 隔 为64个 字 节
constexpr uint16_t src_gap = 1;
//相 邻 迭 代 间,源 操 作 数 前 一 个 分 形 与 后 一 个 分 形 起 始 地 址 的 间 隔 为32个 字 节
constexpr uint16_t dst_gap = 0;
__cbuf__ half src[256];
__cc__ half dst[256];
asc_copy_l12l0c(dst, src, n_burst, len_burst, src_gap, dst_gap);