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 Name | Description |
|---|---|
| abs | This sample implements Abs operation using the Reg programming interface. Relu/Exp/Sqrt/Ln/Log/Log2/Log10/Neg interfaces can also reference this sample |
| arange | This sample implements Arange operation using the Reg programming interface, generating increasing/decreasing index sequences starting from a scalar value |
| cast | This sample implements Cast operation using the Reg programming interface for RegTensor data type conversion (narrowing/widening) |
| compare | This sample implements Compare operation using the Reg programming interface for comparing two vectors or a vector with a scalar |
| data_relayout | This sample demonstrates Interleave and Pack interfaces using the Reg programming interface for data relayout (Interleave + Pack low-bit extraction) |
| duplicate | This sample implements Duplicate operation (scalar fill) using the Reg programming interface, filling a scalar value to each position of a vector |
| gather | This sample demonstrates Gather interface (source operand is register) using the Reg programming interface to collect elements by index, using LoadAlign/StoreAlign postUpdate mode |
| histogram | This sample implements Histogram operation using the Reg programming interface, performing histogram statistics on input data |
| mergemode | This sample comprehensively demonstrates MaskMergeMode::MERGING + postUpdate + UpdateMask + ReduceMax using the Reg programming interface |
| mul | This sample implements Mul operation using the Reg programming interface. Add/Sub/Div/Max/Min/Prelu interfaces can also reference this sample |
| muls | This sample implements Muls operation using the Reg programming interface. Adds/Maxs/Mins/LeakyRelu interfaces can also reference this sample |
| reduce | This sample implements Reduce operation (SUM mode) using the Reg programming interface. Reduce interface supports SUM/MAX/MIN reduction modes |
| reduce_block | This sample implements ReduceDataBlock operation (SUM mode) using the Reg programming interface, performing reduction within each DataBlock (32B) |
| reduce_pair | This sample implements PairReduceElem operation (SUM mode) using the Reg programming interface, performing reduction sum on adjacent odd-even element pairs |
| select | This sample implements Select operation using the Reg programming interface, selecting elements between two vectors based on mask |
| squeeze | This sample implements Squeeze operation using the Reg programming interface, compressing a vector to a scalar |
| subnormal | This sample implements Div operation using the Reg programming interface, demonstrating the difference in computation results with and without subnormal support |
| trait | This 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 |
| truncate | This 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),仅供参考