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 条
  • [21] Wind power forecasting using the k-nearest neighbors algorithm
    Mangalova, E.
    Agafonov, E.
    INTERNATIONAL JOURNAL OF FORECASTING, 2014, 30 (02) : 402 - 406
  • [22] Improving k-Nearest Neighbors Algorithm for Imbalanced Data Classification
    Shi, Zhan
    3RD ANNUAL INTERNATIONAL CONFERENCE ON CLOUD TECHNOLOGY AND COMMUNICATION ENGINEERING, 2020, 719
  • [23] k-Nearest Neighbors in Uncertain Graphs
    Potamias, Michalis
    Bonchi, Francesco
    Gionis, Aristides
    Kollios, George
    PROCEEDINGS OF THE VLDB ENDOWMENT, 2010, 3 (01): : 997 - 1008
  • [24] K-NN FOREST: a software for the non-parametric prediction and mapping of environmental variables by the k-Nearest Neighbors algorithm
    Chirici, Gherardo
    Corona, Piermaria
    Marchetti, Marco
    Mastronardi, Alessandro
    Maselli, Fabio
    Bottai, Lorenzo
    Travaglini, Davide
    EUROPEAN JOURNAL OF REMOTE SENSING, 2012, 45 : 433 - 442
  • [25] Predicting the number of nearest neighbors for the k-NN classification algorithm
    Zhang, Xueying
    Song, Qinbao
    INTELLIGENT DATA ANALYSIS, 2014, 18 (03) : 449 - 464
  • [26] Fault detection of batch process based on diffusion K-nearest neighbors distance
    Research Center for Technical Process Fault Diagnosis and Safety, Shenyang University of Chemical Technology, Shenyang
    Liaoning
    110142, China
    不详
    Liaoning
    110819, China
    Kong Zhi Li Lun Yu Ying Yong, 12 (1653-1659):
  • [27] Particles Contaminations Detection during Plasma Etching Process by using k-Nearest Neighbors and Fuzzy k-Nearest Neighbors
    Somari, Noratika Mohammad
    Abdullah, Mohd Firdaus
    Osman, Muhammad Khusairi
    Nazelan, Abdul Mu'iz
    Ahmad, Khairul Azman
    Appanan, Sooria Pragash Rao S.
    Hooi, Loh Kwang
    2016 6TH IEEE INTERNATIONAL CONFERENCE ON CONTROL SYSTEM, COMPUTING AND ENGINEERING (ICCSCE), 2016, : 512 - 516
  • [28] Estimating Translational and Orientational Entropies Using the k-Nearest Neighbors Algorithm
    Huggins, David J.
    JOURNAL OF CHEMICAL THEORY AND COMPUTATION, 2014, 10 (09) : 3617 - 3625
  • [29] An efficient clustering algorithm based on the k-nearest neighbors with an indexing ratio
    Raneem Qaddoura
    Hossam Faris
    Ibrahim Aljarah
    International Journal of Machine Learning and Cybernetics, 2020, 11 : 675 - 714
  • [30] Things You Might Not Know about the k-Nearest Neighbors Algorithm
    Karpus, Aleksandra
    Raczynska, Marta
    Przybylek, Adam
    KDIR: PROCEEDINGS OF THE 11TH INTERNATIONAL JOINT CONFERENCE ON KNOWLEDGE DISCOVERY, KNOWLEDGE ENGINEERING AND KNOWLEDGE MANAGEMENT - VOL 1: KDIR, 2019, : 539 - 547