Parallel Scan on Ascend AI Accelerators
Preprint
Abstract
We design and implement parallel prefix sum (scan) algorithms using Ascend AI accelerators. Ascend accelerators feature specialized computing units - the cube units for efficient matrix multiplication and the vector units for optimized vector operations. A key feature of the proposed scan algorithms is their extensive use of matrix multiplications and accumulations enabled by the cube unit. To showcase the effectiveness of these algorithms, we also implement and evaluate several scan-based operators commonly used in AI workloads, including sorting, tensor masking, and top-$k$ / top-$p$ sampling. Our single-core results demonstrate substantial performance improvements, with speedups ranging from $5\times$ to $9.6\times$ compared to vector-only implementations for sufficiently large input lengths. Additionally, we present a multi-core scan algorithm that fully utilizes both the cube and vector units of Ascend, reaching up to 37.5% of the theoretical memory bandwidth. Furthermore, our radix sort implementation, which utilizes matrix multiplications for its parallel splits, showcases the potential of matrix engines to enhance complex operations, offering up to $3.3\times$ speedup over the baseline.
Keywords
All Related Versions
This publication has 28 references indexed in Scilit:
- Introduction2022
- Matrix Engines for High Performance Computing: A Paragon of Performance or Grasping at Straws?2021
- Ascend: a Scalable and Unified Architecture for Ubiquitous Deep Neural Network Computing : Industry Track Paper2021
- DaVinci: A Scalable Architecture for Neural Network Computing2019
- A Novel Computational Model for GPUs with Application to I/O Optimal Sorting Algorithms2014
- Thrust2012
- Parallel Computing Using the Prefix Problem1994
- Scans as primitive parallel operationsIEEE Transactions on Computers, 1989
- Depth-size trade-offs for parallel prefix computationJournal of Algorithms, 1986
- Algorithmically Specialized Parallel Computers1985