okftype: reference.api description: "将 Global Memory 中的图像数据按水平垂直起始位置与加载尺寸搬运到 L1 Buffer 的 dst 起始地址,并可在目的图像的上、下、左、右四侧填充指定像素数。" tag:
- roles: [data_movement]
- operations: [load]
- traits: [padding] dependencies:
- path: docs/zh/api/SIMD-API/c_api/cube_compute/overview/cube_compute_flow.md kind: related
- path: docs/zh/api/SIMD-API/c_api/cube_datamove/cube_compute_load/asc_copy_l12l0a_arch_2201.md kind: related condition: "仅 Atlas A3 与 Atlas A2 系列产品上存在后续 L1 到 L0 的 3D 搬运衔接"
- path: docs/zh/api/SIMD-API/c_api/cube_datamove/cube_compute_load/asc_copy_l12l0b_arch_2201.md kind: related condition: "仅 Atlas A3 与 Atlas A2 系列产品上存在后续 L1 到 L0 的 3D 搬运衔接"
- path: docs/zh/api/SIMD-API/c_api/general_description_and_constraints.md kind: constrained_by condition: "存储单元空间与对齐要求、通用地址重叠约束" version: ">=9.0.0" version_changes: []
asc_load_image_to_cbuf
产品支持情况
- Ascend 950PR&950DT系列产品:不支持
- Atlas A3系列产品:支持
- Atlas A2系列产品:支持
- Atlas 200I/500 A2推理产品:不支持
- Atlas推理系列产品AI Core:不支持
- Atlas推理系列产品Vector Core:不支持
- Atlas训练系列产品:不支持
功能说明
头文件路径为:"c_api/cube_datamove/cube_datamove.h"。
将图像数据从Global Memory搬运到L1 Buffer。
图像搬入在卷积计算流程中的位置参见矩阵计算流程。
后续L1到L0的3D搬运参见asc_copy_l12l0a(Atlas A3系列产品和Atlas A2系列产品)和asc_copy_l12l0b(Atlas A3系列产品和Atlas A2系列产品)。
函数原型
常规搬运
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)
参数说明
表1 参数说明
| 参数名 | 输入/输出 | 描述 |
|---|---|---|
| dst | 输出 | 目的操作数(矢量)的起始地址。 |
| hor_size | 输入 | 从源图中加载图片的水平宽度,单位为像素。取值范围:[2, 4094]。 |
| ver_size | 输入 | 从源图中加载图片的垂直高度,单位为像素。取值范围:[2, 4094]。 |
| hor_start_pos | 输入 | 加载图片在源图片上的水平起始地址,单位为像素。取值范围:[0, 4095]。 |
| ver_start_pos | 输入 | 加载图片在源图片上的垂直起始地址,单位为像素。取值范围:[0, 4095]。 |
| src_hor_size | 输入 | 源图片水平宽度,单位为像素。取值范围:[2, 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);