CANN/asc-devkit矢量与运算API文档

📅 2026/7/16 20:42:58
CANN/asc-devkit矢量与运算API文档
asc_and【免费下载链接】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/vector_compute/vector_compute.h。执行矢量与运算。计算公式如下$$ dst_i src0_i \quad \quad src1_i $$函数原型前n个数据计算__aicore__ inline void asc_and(__ubuf__ int16_t* dst, __ubuf__ int16_t* src0, __ubuf__ int16_t* src1, uint32_t count) __aicore__ inline void asc_and(__ubuf__ uint16_t* dst, __ubuf__ uint16_t* src0, __ubuf__ uint16_t* src1, uint32_t count)高维切分计算__aicore__ inline void asc_and(__ubuf__ int16_t* dst, __ubuf__ int16_t* src0, __ubuf__ int16_t* src1, uint8_t repeat, uint8_t dst_block_stride, uint8_t src0_block_stride, uint8_t src1_block_stride, uint8_t dst_repeat_stride, uint8_t src0_repeat_stride, uint8_t src1_repeat_stride) __aicore__ inline void asc_and(__ubuf__ uint16_t* dst, __ubuf__ uint16_t* src0, __ubuf__ uint16_t* src1, uint8_t repeat, uint8_t dst_block_stride, uint8_t src0_block_stride, uint8_t src1_block_stride, uint8_t dst_repeat_stride, uint8_t src0_repeat_stride, uint8_t src1_repeat_stride)同步计算__aicore__ inline void asc_and_sync(__ubuf__ int16_t* dst, __ubuf__ int16_t* src0, __ubuf__ int16_t* src1, uint32_t count) __aicore__ inline void asc_and_sync(__ubuf__ uint16_t* dst, __ubuf__ uint16_t* src0, __ubuf__ uint16_t* src1, uint32_t count)参数说明表1参数说明参数名输入/输出描述dst输出目的操作数。src0、src1输入源操作数矢量的起始地址。count输入参与计算的元素个数。dst_block_stride输入目的操作数单次迭代内不同DataBlock间地址步长。src0_block_stride输入源操作数0单次迭代内不同DataBlock间地址步长。src1_block_stride输入源操作数1单次迭代内不同DataBlock间地址步长。dst_repeat_stride输入目的操作数相邻迭代间相同DataBlock的地址步长。src0_repeat_stride输入源操作数0相邻迭代间相同DataBlock的地址步长。src1_repeat_stride输入源操作数1相邻迭代间相同DataBlock的地址步长。repeat输入迭代次数。返回值说明无流水类型PIPE_V约束说明操作数地址重叠约束请参考通用地址重叠约束。dst、src0、src1的起始地址需要32字节对齐。调用示例constexpr uint64_t total_length 64; //total_length指参与计算的数据长度 __ubuf__ int16_t src0[total_length]; __ubuf__ int16_t src1[total_length]; __ubuf__ int16_t dst[total_length]; asc_and(dst, src0, src1, total_length);【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言原生支持C和C标准规范主要由类库和语言扩展层构成提供多层级API满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkit创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考