asc_gather_datablock
产 品 支 持 情 况
| 产 品 | 是 否 支 持 |
|---|---|
| Ascend 950PR/Ascend 950DT | √ |
功 能 说 明
给 定 源 操 作 数 在UB中 的 基 地 址 和 索 引,根 据 索 引 位 置 将 源 操 作 数 按DataBlock收 集 到 目 的 操 作 数 中。每 个DataBlock长 度 为32B。
函 数 原 型
支 持 掩 码 控 制,允 许 选 择 性 收 集 数 据
C++__simd_callee__ inline void asc_gather_datablock(vector_int8_t& dst, __ubuf__ int8_t* src, vector_uint32_t index, vector_bool mask) __simd_callee__ inline void asc_gather_datablock(vector_uint8_t& dst, __ubuf__ uint8_t* src, vector_uint32_t index, vector_bool mask) __simd_callee__ inline void asc_gather_datablock(vector_int16_t& dst, __ubuf__ int16_t* src, vector_uint32_t index, vector_bool mask) __simd_callee__ inline void asc_gather_datablock(vector_uint16_t& dst, __ubuf__ uint16_t* src, vector_uint32_t index, vector_bool mask) __simd_callee__ inline void asc_gather_datablock(vector_int32_t& dst, __ubuf__ int32_t* src, vector_uint32_t index, vector_bool mask) __simd_callee__ inline void asc_gather_datablock(vector_uint32_t& dst, __ubuf__ uint32_t* src, vector_uint32_t index, vector_bool mask) __simd_callee__ inline void asc_gather_datablock(vector_int64_t& dst, __ubuf__ int64_t* src, vector_uint32_t index, vector_bool mask) __simd_callee__ inline void asc_gather_datablock(vector_uint64_t& dst, __ubuf__ uint64_t* src, vector_uint32_t index, vector_bool mask) __simd_callee__ inline void asc_gather_datablock(vector_half& dst, __ubuf__ half* src, vector_uint32_t index, vector_bool mask) __simd_callee__ inline void asc_gather_datablock(vector_float& dst, __ubuf__ float* src, vector_uint32_t index, vector_bool mask) __simd_callee__ inline void asc_gather_datablock(vector_bfloat16_t& dst, __ubuf__ bfloat16_t* src, vector_uint32_t index, vector_bool mask) __simd_callee__ inline void asc_gather_datablock(vector_fp8_e4m3fn_t& dst, __ubuf__ fp8_e4m3fn_t* src, vector_uint32_t index, vector_bool mask) __simd_callee__ inline void asc_gather_datablock(vector_fp8_e5m2_t& dst, __ubuf__ fp8_e5m2_t* src, vector_uint32_t index, vector_bool mask) __simd_callee__ inline void asc_gather_datablock(vector_fp4x2_e2m1_t& dst, __ubuf__ fp4x2_e2m1_t* src, vector_uint32_t index, vector_bool mask) __simd_callee__ inline void asc_gather_datablock(vector_fp4x2_e1m2_t& dst, __ubuf__ fp4x2_e1m2_t* src, vector_uint32_t index, vector_bool mask) __simd_callee__ inline void asc_gather_datablock(vector_fp8_e8m0_t& dst, __ubuf__ fp8_e8m0_t* src, vector_uint32_t index, vector_bool mask) __simd_callee__ inline void asc_gather_datablock(vector_hifloat8_t& dst, __ubuf__ hifloat8_t* src, vector_uint32_t index, vector_bool mask) __simd_callee__ inline void asc_gather_datablock(vector_int4x2_t& dst, __ubuf__ int4b_t* src, vector_uint32_t index, vector_bool mask)无 掩 码 控 制,默 认 收 集 所 有 索 引 对 应 的 数 据 块
C++__simd_callee__ inline void asc_gather_datablock(vector_int8_t& dst, __ubuf__ int8_t* src, vector_uint32_t index) __simd_callee__ inline void asc_gather_datablock(vector_uint8_t& dst, __ubuf__ uint8_t* src, vector_uint32_t index) __simd_callee__ inline void asc_gather_datablock(vector_int16_t& dst, __ubuf__ int16_t* src, vector_uint32_t index) __simd_callee__ inline void asc_gather_datablock(vector_uint16_t& dst, __ubuf__ uint16_t* src, vector_uint32_t index) __simd_callee__ inline void asc_gather_datablock(vector_int32_t& dst, __ubuf__ int32_t* src, vector_uint32_t index) __simd_callee__ inline void asc_gather_datablock(vector_uint32_t& dst, __ubuf__ uint32_t* src, vector_uint32_t index) __simd_callee__ inline void asc_gather_datablock(vector_int64_t& dst, __ubuf__ int64_t* src, vector_uint32_t index) __simd_callee__ inline void asc_gather_datablock(vector_half& dst, __ubuf__ half* src, vector_uint32_t index) __simd_callee__ inline void asc_gather_datablock(vector_float& dst, __ubuf__ float* src, vector_uint32_t index) __simd_callee__ inline void asc_gather_datablock(vector_bfloat16_t& dst, __ubuf__ bfloat16_t* src, vector_uint32_t index) __simd_callee__ inline void asc_gather_datablock(vector_fp8_e4m3fn_t& dst, __ubuf__ fp8_e4m3fn_t* src, vector_uint32_t index) __simd_callee__ inline void asc_gather_datablock(vector_fp8_e5m2_t& dst, __ubuf__ fp8_e5m2_t* src, vector_uint32_t index) __simd_callee__ inline void asc_gather_datablock(vector_fp4x2_e2m1_t& dst, __ubuf__ fp4x2_e2m1_t* src, vector_uint32_t index) __simd_callee__ inline void asc_gather_datablock(vector_fp4x2_e1m2_t& dst, __ubuf__ fp4x2_e1m2_t* src, vector_uint32_t index) __simd_callee__ inline void asc_gather_datablock(vector_fp8_e8m0_t& dst, __ubuf__ fp8_e8m0_t* src, vector_uint32_t index) __simd_callee__ inline void asc_gather_datablock(vector_hifloat8_t& dst, __ubuf__ hifloat8_t* src, vector_uint32_t index) __simd_callee__ inline void asc_gather_datablock(vector_int4x2_t& dst, __ubuf__ int4b_t* src, vector_uint32_t index)
参 数 说 明
| 参 数 名 | 输 入/输 出 | 描 述 |
|---|---|---|
| dst | 输 出 | 目 的 操 作 数(矢 量 数 据 寄 存 器)。 |
| src | 输 入 | 源 操 作 数(矢 量)的 起 始 地 址。 |
| index | 输 入 | dst中 每 个DataBlock在UB中 相 对 于src的 索 引 位 置。索 引 位 置 要 大 于 等 于0且32B对 齐。 |
| mask | 输 入 | 源 操 作 数 掩 码(掩 码 寄 存 器),用 于 指 示 在 计 算 过 程 中 哪 些 元 素 参 与 计 算。对 应 位 置 为1时 参 与 计 算,为0时 不 参 与 计 算。mask未 筛 选 的 元 素 在 输 出 中 置 零。 |
矢 量 数 据 寄 存 器 和 掩 码 寄 存 器 的 详 细 说 明 请 参 见reg数 据 类 型 定 义。
返 回 值 说 明
无
流 水 类 型
PIPE_V
约 束 说 明
- 源 操 作 数 在UB中 的 起 始 地 址 需 要32B对 齐。
- 索 引 位 置 要 大 于 等 于0且32B对 齐。
- 索 引 可 以 存 在 相 同 的 值,即 可 以 多 次 读 取 源 操 作 数 中 同 一 个DataBlock的 数 据。
调 用 示 例
- 支 持 掩 码 控 制,允 许 选 择 性 收 集 数 据 C++
vector_int8_t dst; __ubuf__ int8_t* src = (__ubuf__ int8_t*)asc_get_phy_buf_addr(0); vector_uint32_t index; vector_bool mask = asc_create_mask_b8(PAT_ALL); asc_loadalign(index, index_addr); // index_addr是 外 部 输 入 的UB内 存 空 间 地 址。 asc_gather_datablock(dst, src, index, mask); - 无 掩 码 控 制,默 认 收 集 所 有 索 引 对 应 的 数 据 块 C++
vector_int8_t dst; __ubuf__ int8_t* src = (__ubuf__ int8_t*)asc_get_phy_buf_addr(0); vector_uint32_t index; asc_loadalign(index, index_addr); // index_addr是 外 部 输 入 的UB内 存 空 间 地 址。 asc_gather_datablock(dst, src, index);