CANN/asc-devkit图像数据搬运API

📅 2026/7/16 16:39:56
CANN/asc-devkit图像数据搬运API
asc_load_image_to_cbuf【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言原生支持C和C标准规范主要由类库和语言扩展层构成提供多层级API满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkit产品支持情况Ascend 950PR/Ascend 950DT不支持Atlas A3 训练系列产品/Atlas A3 推理系列产品支持Atlas A2 训练系列产品/Atlas A2 推理系列产品支持Atlas 200I/500 A2 推理产品不支持Atlas 推理系列产品AI Core不支持Atlas 推理系列产品Vector Core不支持Atlas 训练系列产品不支持功能说明头文件路径c_api/cube_datamove/cube_datamove.h。将图像数据从Global Memory搬运到L1 Buffer。函数原型常规搬运__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)同步搬运__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约束说明dst的起始地址需要32字节对齐。操作数地址重叠约束请参考通用地址重叠约束。调用示例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本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言原生支持C和C标准规范主要由类库和语言扩展层构成提供多层级API满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkit创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考