asc_gather_datablock
产 品 支 持 情 况
| 产 品 | 是 否 支 持 |
|---|---|
| √ | |
| √ |
功 能 说 明
给 定 一 个 输 入 的 矢 量 和 一 个 地 址 偏 移 矢 量,根 据 偏 移 地 址 按 照DataBlock的 粒 度 将 输 入 矢 量 收 集 到 目 的 矢 量 中。
函 数 原 型
高 维 切 分 计 算
C++__aicore__ inline void asc_gather_datablock(__ubuf__ uint16_t* dst, __ubuf__ uint16_t* src, __ubuf__ uint32_t* src_offset, uint16_t dst_repeat_stride, uint8_t dst_block_stride, uint8_t repeat) __aicore__ inline void asc_gather_datablock(__ubuf__ uint32_t* dst, __ubuf__ uint32_t* src, __ubuf__ uint32_t* src_offset, uint16_t dst_repeat_stride, uint8_t dst_block_stride, uint8_t repeat)同 步 计 算
C++__aicore__ inline void asc_gather_datablock_sync(__ubuf__ uint16_t* dst, __ubuf__ uint16_t* src, __ubuf__ uint32_t* src_offset, uint16_t dst_repeat_stride, uint8_t dst_block_stride, uint8_t repeat) __aicore__ inline void asc_gather_datablock_sync(__ubuf__ uint32_t* dst, __ubuf__ uint32_t* src, __ubuf__ uint32_t* src_offset, uint16_t dst_repeat_stride, uint8_t dst_block_stride, uint8_t repeat)
参 数 说 明
| 参 数 名 | 输 入/输 出 | 描 述 |
|---|---|---|
| dst | 输 出 | 目 的 操 作 数(矢 量)的 起 始 地 址。 |
| src | 输 入 | 源 操 作 数(矢 量)的 起 始 地 址。 |
| src_offset | 输 入 | 每 个Datablock在 源 操 作 数 中 的 地 址 偏 移。 |
| dst_repeat_stride | 输 入 | 目 的 操 作 数 相 邻 迭 代 间 相 同DataBlock的 地 址 步 长。 |
| dst_block_stride | 输 入 | 目 的 操 作 数 单 次 迭 代 内 不 同DataBlock间 地 址 步 长。 |
| repeat | 输 入 | 迭 代 次 数。 |
返 回 值 说 明
无
流 水 类 型
PIPE_V
约 束 说 明
- src_offset取 值 应 保 证src元 素 类 型 位 宽 对 齐。
- src加 上src_offset偏 移 后 的 地 址 不 能 超 出Unified Buffer (UB)大 小 数 据 的 范 围。
- dst、src的 起 始 地 址 需 要32字 节 对 齐。
- 操 作 数 地 址 重 叠 约 束 请 参 考通 用 地 址 重 叠 约 束。
调 用 示 例
C++
constexpr uint64_t total_length = 128; // total_length指 参 与 计 算 的 数 据 长 度
__ubuf__ uint32_t src_offset[total_length * sizeof(uint32_t) / 32];
__ubuf__ uint32_t dst[total_length];
__ubuf__ uint32_t src[total_length];
asc_gather_datablock(dst, src, src_offset, 8, 1, 2);
// src [1, 2, 3, ..., 126, 127, 128] 128个uint32_t类 型 数 据
// src_offset [0, 32, 64, ..., 416, 448, 480]
// dst [1, 2, 3, ..., 126, 127, 128]