CANN/asc-devkit向量计算API示例
Vector Compute API Samples【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言原生支持C和C标准规范主要由类库和语言扩展层构成提供多层级API满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkitOverviewThis directory contains samples for multiple APIs related to vector computation. Each sample is based on Ascend Csdirect invocation method, supporting both main function and kernel function implementation in the same cpp file.Operator Development SamplesDirectory NameDescriptionabsThis sample implements Abs operation using the Reg programming interface. Relu/Exp/Sqrt/Ln/Log/Log2/Log10/Neg interfaces can also reference this samplearangeThis sample implements Arange operation using the Reg programming interface, generating increasing/decreasing index sequences starting from a scalar valuecastThis 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 scalardata_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 vectorgatherThis sample demonstrates Gather interface (source operand is register) using the Reg programming interface to collect elements by index, using LoadAlign/StoreAlign postUpdate modehistogramThis sample implements Histogram operation using the Reg programming interface, performing histogram statistics on input datamergemodeThis sample comprehensively demonstrates MaskMergeMode::MERGING postUpdate UpdateMask ReduceMax using the Reg programming interfacemulThis sample implements Mul operation using the Reg programming interface. Add/Sub/Div/Max/Min/Prelu interfaces can also reference this samplemulsThis sample implements Muls operation using the Reg programming interface. Adds/Maxs/Mins/LeakyRelu interfaces can also reference this samplereduceThis sample implements Reduce operation (SUM mode) using the Reg programming interface. Reduce interface supports SUM/MAX/MIN reduction modesreduce_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 pairsselectThis sample implements Select operation using the Reg programming interface, selecting elements between two vectors based on masksqueezeThis sample implements Squeeze operation using the Reg programming interface, compressing a vector to a scalarsubnormalThis sample implements Div operation using the Reg programming interface, demonstrating the difference in computation results with and without subnormal supporttraitThis 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 coretruncateThis 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),仅供参考