CANN/asc-devkit向量计算API示例
2026/6/13 16:18:52 网站建设 项目流程

Vector Compute API Samples

【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言,原生支持C和C++标准规范,主要由类库和语言扩展层构成,提供多层级API,满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkit

Overview

This directory contains samples for multiple APIs related to vector computation. Each sample is based on Ascend C's<<<>>>direct invocation method, supporting both main function and kernel function implementation in the same cpp file.

Operator Development Samples

Directory NameDescription
absThis sample implements Abs operation using the Reg programming interface. Relu/Exp/Sqrt/Ln/Log/Log2/Log10/Neg interfaces can also reference this sample
arangeThis sample implements Arange operation using the Reg programming interface, generating increasing/decreasing index sequences starting from a scalar value
castThis sample implements Cast operation using the Reg programming interface for RegTensor data type conversion (narrowing/widening)
compareThis sample implements Compare operation using the Reg programming interface for comparing two vectors or a vector with a scalar
data_relayoutThis sample demonstrates Interleave and Pack interfaces using the Reg programming interface for data relayout (Interleave + Pack low-bit extraction)
duplicateThis sample implements Duplicate operation (scalar fill) using the Reg programming interface, filling a scalar value to each position of a vector
gatherThis sample demonstrates Gather interface (source operand is register) using the Reg programming interface to collect elements by index, using LoadAlign/StoreAlign postUpdate mode
histogramThis sample implements Histogram operation using the Reg programming interface, performing histogram statistics on input data
mergemodeThis sample comprehensively demonstrates MaskMergeMode::MERGING + postUpdate + UpdateMask + ReduceMax using the Reg programming interface
mulThis sample implements Mul operation using the Reg programming interface. Add/Sub/Div/Max/Min/Prelu interfaces can also reference this sample
mulsThis sample implements Muls operation using the Reg programming interface. Adds/Maxs/Mins/LeakyRelu interfaces can also reference this sample
reduceThis sample implements Reduce operation (SUM mode) using the Reg programming interface. Reduce interface supports SUM/MAX/MIN reduction modes
reduce_blockThis sample implements ReduceDataBlock operation (SUM mode) using the Reg programming interface, performing reduction within each DataBlock (32B)
reduce_pairThis sample implements PairReduceElem operation (SUM mode) using the Reg programming interface, performing reduction sum on adjacent odd-even element pairs
selectThis sample implements Select operation using the Reg programming interface, selecting elements between two vectors based on mask
squeezeThis sample implements Squeeze operation using the Reg programming interface, compressing a vector to a scalar
subnormalThis sample implements Div operation using the Reg programming interface, demonstrating the difference in computation results with and without subnormal support
traitThis sample implements Div operation using the Reg programming interface, using int64_t data type to demonstrate the performance advantage of RegTensor processing 2x width data in single core
truncateThis sample implements Truncate operation using the Reg programming interface, truncating floating-point numbers to integer bits

【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言,原生支持C和C++标准规范,主要由类库和语言扩展层构成,提供多层级API,满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkit

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询