SelB-k-NN: A Mini-Batch K-Nearest Neighbors Algorithm on AI Processors

被引:0
|
作者
Tang, Yifeng [1 ]
Wang, Cho-li [1 ]
机构
[1] Univ Hong Kong, Dept Comp Sci, Hong Kong, Peoples R China
关键词
AI processors; k-NN algorithm; AI processor optimization;
D O I
10.1109/IPDPS54959.2023.00088
中图分类号
TP3 [计算技术、计算机技术];
学科分类号
0812 ;
摘要
The popularity of Artificial Intelligence (AI) motivates novel domain-specific hardware named AI processors. With a design trade-off, the AI processors feature incredible computation power for matrix multiplications and activations, while some leave other operations less powerful, e.g., scalar operations and vectorized comparisons & selections. For k-nearest neighbors (k-NN) algorithm, consisting of distance computation phase and k-selection phase, while the former is naturally accelerated, the previous efficient k-selection becomes problematic. Moreover, limited memory forces k-NN to adopt a mini-batch manner with tiling technique. As the distance computation's results are the kselection's inputs, the former's tiling shape determines that of the latter. Since the two phases execute on separate hardware units requiring different performance analyses, whether the former's tiling strategies benefit the latter and entire k-NN is doubtful. To address the new challenges brought by the AI processors, this paper proposes SelB-k-NN (Selection-Bitonic-k-NN), a minibatch algorithm inspired by selection sort and bitonic k-selection. SelB-k-NN avoids the expansion of the weakly-supported operations on the huge scale of datasets. To apply SelB-k-NN to various AI processors, we propose two algorithms to reduce the hardware support requirements. Since the matrix multiplication operates data with the specifically-designed memory hierarchy which kselection does not share, the tiling shape of the former cannot guarantee the best execution of the latter and vice versa. By quantifying the runtime workload variations of k-selection, we formulate an optimization problem to search for the optimal tiling shapes of both phases with an offline pruning method, which reduces the search space in the preprocessing stage. Evaluations show that on Huawei Ascend 310 AI processor, SelB-k-NN achieves 2.01x speedup of the bitonic k-selection, 23.93x of the heap approach, 78.52x of the CPU approach. For mini-batch SelB-k-NN, the optimal tiling shapes for two phases respectively achieve 1.48x acceleration compared with the matrix multiplication tiling shapes and 1.14x with the k-selection tiling shapes, with 72.80% of the search space pruned.
引用
收藏
页码:831 / 841
页数:11
相关论文
共 50 条
  • [1] K-nearest neighbors clustering algorithm
    Gauza, Dariusz
    Zukowska, Anna
    Nowak, Robert
    PHOTONICS APPLICATIONS IN ASTRONOMY, COMMUNICATIONS, INDUSTRY, AND HIGH-ENERGY PHYSICS EXPERIMENTS 2014, 2014, 9290
  • [2] A NEW FUZZY K-NEAREST NEIGHBORS ALGORITHM
    Li, Chengjie
    Pei, Zheng
    Li, Bo
    Zhang, Zhen
    INTELLIGENT DECISION MAKING SYSTEMS, VOL. 2, 2010, : 246 - +
  • [3] K-Nearest Neighbors Hashing
    He, Xiangyu
    Wang, Peisong
    Cheng, Jian
    2019 IEEE/CVF CONFERENCE ON COMPUTER VISION AND PATTERN RECOGNITION (CVPR 2019), 2019, : 2834 - 2843
  • [4] Modernizing k-nearest neighbors
    Elizabeth Yancey, Robin
    Xin, Bochao
    Matloff, Norm
    STAT, 2021, 10 (01):
  • [5] EDITING FOR THE K-NEAREST NEIGHBORS RULE BY A GENETIC ALGORITHM
    KUNCHEVA, LI
    PATTERN RECOGNITION LETTERS, 1995, 16 (08) : 809 - 814
  • [6] BRANCH AND BOUND ALGORITHM FOR COMPUTING K-NEAREST NEIGHBORS
    FUKUNAGA, K
    NARENDRA, PM
    IEEE TRANSACTIONS ON COMPUTERS, 1975, C 24 (07) : 750 - 753
  • [7] PERFORMANCE OF K-NEAREST NEIGHBORS ALGORITHM IN OPINION CLASSIFICATION
    Jedrzejewski, Krzysztof
    Zamorski, Maurycy
    FOUNDATIONS OF COMPUTING AND DECISION SCIENCES, 2013, 38 (02) : 97 - 110
  • [8] Chameleon algorithm based on mutual k-nearest neighbors
    Yuru Zhang
    Shifei Ding
    Lijuan Wang
    Yanru Wang
    Ling Ding
    Applied Intelligence, 2021, 51 : 2031 - 2044
  • [9] Chameleon algorithm based on mutual k-nearest neighbors
    Zhang, Yuru
    Ding, Shifei
    Wang, Lijuan
    Wang, Yanru
    Ding, Ling
    APPLIED INTELLIGENCE, 2021, 51 (04) : 2031 - 2044
  • [10] NS-k-NN: Neutrosophic Set-Based k-Nearest Neighbors Classifier
    Akbulut, Yaman
    Sengur, Abdulkadir
    Guo, Yanhui
    Smarandache, Florentin
    SYMMETRY-BASEL, 2017, 9 (09):