Skip to content
版 本

asc_load_image_to_cbuf

产 品 支 持 情 况

产 品是 否 支 持
Atlas A3 训 练 系 列 产 品/Atlas A3 推 理 系 列 产 品
Atlas A2 训 练 系 列 产 品/Atlas A2 推 理 系 列 产 品

功 能 说 明

将 图 像 数 据 从Global Memory搬 运 到L1 Buffer。

函 数 原 型

  • 常 规 搬 运

    C++
    __aicore__ inline void asc_load_image_to_cbuf(__cbuf__ int8_t* dst, uint16_t hor_size, uint16_t ver_size, uint16_t hor_start_pos, uint16_t ver_start_pos, uint16_t src_hor_size, uint8_t top_pad_size, uint8_t bot_pad_size, uint16_t left_pad_size, uint16_t right_pad_size)
    __aicore__ inline void asc_load_image_to_cbuf(__cbuf__ half* dst, uint16_t hor_size, uint16_t ver_size, uint16_t hor_start_pos, uint16_t ver_start_pos, uint16_t src_hor_size, uint8_t top_pad_size, uint8_t bot_pad_size, uint16_t left_pad_size, uint16_t right_pad_size)
    
  • 同 步 搬 运

    C++
    __aicore__ inline void asc_load_image_to_cbuf_sync(__cbuf__ int8_t* dst, uint16_t hor_size, uint16_t ver_size, uint16_t hor_start_pos, uint16_t ver_start_pos, uint16_t src_hor_size, uint8_t top_pad_size, uint8_t bot_pad_size, uint16_t left_pad_size, uint16_t right_pad_size)
    __aicore__ inline void asc_load_image_to_cbuf_sync(__cbuf__ half* dst, uint16_t hor_size, uint16_t ver_size, uint16_t hor_start_pos, uint16_t ver_start_pos, uint16_t src_hor_size, uint8_t top_pad_size, uint8_t bot_pad_size, uint16_t left_pad_size, uint16_t right_pad_size)
    

参 数 说 明

参 数 名输 入/输 出描 述
dst输 出目 的 操 作 数(矢 量)的 起 始 地 址。
hor_size输 入从 源 图 中 加 载 图 片 的 水 平 宽 度,单 位 为 像 素。取 值 范 围:[1, 4094]。
ver_size输 入从 源 图 中 加 载 图 片 的 垂 直 高 度,单 位 为 像 素。取 值 范 围:[1, 4094]。
hor_start_pos输 入加 载 图 片 在 源 图 片 上 的 水 平 起 始 地 址,单 位 为 像 素。取 值 范 围:[0, 4095]。
ver_start_pos输 入加 载 图 片 在 源 图 片 上 的 垂 直 起 始 地 址,单 位 为 像 素。取 值 范 围:[0, 4095]。
src_hor_size输 入源 图 片 水 平 宽 度,单 位 为 像 素。取 值 范 围:[1, 4094]。
top_pad_size输 入目 的 图 片 顶 部 填 充 的 像 素 数。取 值 范 围:[0, 32]。
bot_pad_size输 入目 的 图 片 底 部 填 充 的 像 素 数。取 值 范 围:[0, 32]。
left_pad_size输 入目 的 图 片 左 边 填 充 的 像 素 数。取 值 范 围:[0, 32]。
right_pad_size输 入目 的 图 片 右 边 填 充 的 像 素 数。取 值 范 围:[0, 32]。

返 回 值 说 明

流 水 类 型

PIPE_MTE2

约 束 说 明

调 用 示 例

C++
constexpr uint64_t total_length = 128;    // total_length指 参 与 搬 运 的 数 据 总 长 度
__cbuf__ half dst[total_length];
// 加 载 图 片 时 的 高 度 与 宽 度 均 为1,起 始 地 址 为(0,0),源 图 片 水 平 宽 度 为1,不 做padding
asc_load_image_to_cbuf(dst, 1, 1, 0, 0, 1, 0, 0, 0, 0);

免 责 声 明:本 站 内 容 由 asc-devkit 仓 master 分 支 自 动 编 译 生 成,属 于 持 续 开 发 版 本,可 能 存 在 缺 陷,仅 供 预 览 与 参 考。如 需 稳 定 及 商 用 资 料,请 查 阅 官 方 昇 腾 社 区