计算机科学 ›› 2026, Vol. 53 ›› Issue (11A): 260300067-1046.doi: 10.11896/jsjkx.260300067
李恩泽1, 史涛1, 王富平1,2, 申澍楠1, 王兆彤1, 李璇1
LI Enze1, SHI Tao1, WANG Fuping1,2, SHEN Shunan1, WANG Zhaotong1, LI Xuan1
摘要: RWKV(Receptance Weighted Key Value)网络的推理过程满足并行性,并且时间复杂度为O(n)。RWKV-7为该系列的最新版本,在昇腾人工智能平台上的支持较少,制约了该架构在昇腾生态上的发展。在具体实现方面,RWKV-7包含多个相同计算式,向量与矩阵的计算混合执行。针对上述问题,基于昇腾人工智能平台,移植了RWKV-7网络,提出了一种网络调优策略,针对矢量计算设计了一种自定义融合算子。最后在昇腾910B1 NPU芯片上从多个维度进行了性能评估实验,验证了方案的有效性。结果表明,自定义算子的局部加速比达到4.81,RWKV-7-World-0.4B模型的吞吐量从15.87 token/s提升至20.12 token/s,单token latency由63.01 ms降低至49.70 ms,相比仅计算图复现,推理性能总体提升27%。与A100 GPU相比,910B1在较大批量推理时扩展性更优,极大批大小场景下吞吐量最大较A100提升121%。
中图分类号:
| [1] KHURANA D,KOLI A,KHATTER K,et al.Natural languageprocessing:state of the art,current trends and challenges[J].Multimedia tools and applications,2023,82(3):3713-3744. [2] XU M,DU H,NIYATOD,et al.Unleashing the power of edge-cloud generative AI in mobile networks:A survey of AIGC services[J].IEEE Communications Surveys & Tutorials,2024,26(2):1127-1170. [3] CHENG J,KANG H,SHAO Y,et al.Survey on Efficient Large Language Models:Principles,Algorithms,Applications,and Open Issues[J].IEEE Transactions on Neural Networks and Learning Systems,2026,37(5):2025-2045. [4] VASWANI A,SHAZEER N,PARMAR N,et al.Attention isAll you Need[C]//Advances in Neural Information Processing Systems.Curran Associates,Inc.,2017. [5] PENG B,ALCAIDE E,ANTHONYQ G,et al.RWKV:Reinven-ting RNNs for the Transformer Era[C]//The 2023 Conference on Empirical Methods in Natural Language Processing.2023:14048-14077. [6] LIU Z,DESAI A,LIAO F,et al.Scissorhands:Exploiting thePersistence of Importance Hypothesis for LLM KV Cache Compression at Test Time[C]//OH A,NAUMANN T,GLOBERSON A,et al.Advances in Neural Information Processing Systems:Vol.36.Curran Associates,Inc.,2023:52342-52364. [7] CHEN T,MOREAU T,JIANG Z,et al.TVM:An Automated End-to-End Optimizing Compiler for Deep Learning[C]//13th USENIX Symposium on Operating Systems Design and Implementation(OSDI 18).Carlsbad,CA:USENIX Association,2018:578-594. [8] ZHENG L,JIA C,SUN M,et al.Ansor:Generating High-Per-formance Tensor Programs for Deep Learning[C]//14th USENIX Symposium on Operating Systems Design and Implementation(OSDI 20).USENIX Association,2020:863-879. [9] JIANG X,WANG H,CHEN Y,et al.MNN:A Universal and Efficient Inference Engine[C]//Proceedings of Machine Learning and Systems.2020:1-13. [10] LI M,LIU Y,LIU X,et al.The Deep Learning Compiler:A Comprehensive Survey[J].IEEE Transactions on Parallel and Distributed Systems,2021,32(3):708-727. [11] ZHENG Q,XIA X,ZOU X,et al.CodeGeeX:A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-X[C]//Proceedings of the 29th ACM SIGKDD Conference on Knowledge Discovery and Data Mining.New York,NY,USA:Association for Computing Machinery,2023:5673-5684. [12] ZENG W,REN X,SU T,et al.PanGu-α:Large-scale Auto-regressive Pretrained Chinese Language Models with Auto-parallel Computation[EB/OL].(2021-04-26) [2026-02-04].https://arxiv.org/abs/2104.12369. [13] PENG B,ZHANG R,GOLDSTEIN D,et al.RWKV-7“Goose” with Expressive Dynamic State Evolution[C]//Second Conference on Language Modeling.2025.https://openreview.net/forum?id=ayB1PACN5j. [14] GHEISARI M,EBRAHIMZADEH F,RAHIMI M,et al.Deeplearning:Applications,architectures,models,tools,and frameworks:A comprehensive survey[J].CAAI Transactions on Intelligence Technology,2023,8(3):581-606. [15] SHUVO M H,ISLAM S K,CHENG J,et al.Efficient Acceleration of Deep Learning Inference on Resource-Constrained Edge Devices:A Review[J].Proceedings of the IEEE,2023,111(1):42-91. [16] NGUYEN G,DLUGOLINSKY S,BOBAK M,et al.Machine Learning and Deep Learning frameworks and libraries for large-scale data mining:a survey[J].Artificial Intelligence Review,2019,52(1):77-124. [17] TAYE M M.Understanding of Machine Learning with DeepLearning:Architectures,Workflow,Applications and Future Directions[J].Computers,2023,12(5):91. [18] FLORIDI L,CHIRIATTI M.GPT-3:Its Nature,Scope,Limits,and Consequences[J].Minds and Machines,2020,30(4):681-694. [19] DEVLIN J,CHANG M W,LEEK,et al.BERT:Pretraining of Deep Bidirectional Transformers for Language Understanding[C]//BURSTEIN J,DORAN C,SOLORIO T.Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics:Human Language Technologies,Volume 1(Long and Short Papers).Minneapolis,Minnesota:Association for Computational Linguistics,2019:4171-4186. [20] ROMBACH R,BLATTMANN A,LORENZD,et al.High-Resolution Image Synthesis With Latent Diffusion Models[C]//Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition(CVPR).2022:10684-10695. [21] DEEPSEEK-AI,GUO D,YANG D,et al.DeepSeek-R1:In-centivizing Reasoning Capability in LLMs via Reinforcement Learning[EB/OL].(2026-01-04) [2026-02-04].https://arxiv.org/abs/2501.12948. [22] YANG A,LI A,YANG B,et al.Qwen3 Technical Report[EB/OL].(2025-05-14) [2026-02-04].https://arxiv.org/abs/2505.09388. [23] ZENG A,XU B,WANG B,et al.ChatGLM:A Family of Large Language Models from GLM-130B to GLM-4 All Tools[EB/OL].(2024-01-30) [2026-02-04].https://arxiv.org/abs/2406.12793. [24] DUAN Y,WANG W,CHEN Z,et al.Vision-rwkv:Efficient and scalable visual perception with rwkv-like architectures[C]//International Conference on Learning Representations.2025,2025:83166-83182. [25] YANG Z,LI J,ZHANG H,et al.Restore-RWKV:Efficient and Effective Medical Image Restoration With RWKV[J].IEEE Journal of Biomedical and Health Informatics,2026,30(1):513-526. [26] FEI Z,FAN M,YU C,et al.Diffusion-RWKV:Scaling RWKV-Like Architectures for Diffusion Models[EB/OL].(2024-04-06) [2026-02-04].https://arxiv.org/abs/2404.04478. [27] LU W Z,ZHANG F,HE Y X,et al.Evaluation and Optimization for Huawei Ascend Neural Network Accelerator[J].Chinese Journal of Computers,2022,45(8):1618-1637. [28] GE H B,WANG D X,ZHENG T,et al.Study on Model Migration of Natural Language Processing for Domestic Deep Learning Platform[J].Computer Science,2024,51(1):50-59. [29] LUO J,WANG H,ZHU Y J,et al.Optimization and Deployment of a Lightweight Traffic Sign Recognition System Based on YOLOv8n[EB/OL].Computer Applications and Software,1-11(2025-12-11) [2026-02-04].https://link.cnki.net/urlid/31.1260.TP.20251210.1431.006. [30] ZHAO D D,LAI L,CHEN P,et al.Design and implementation of edge-based human action recognition algorithm based on ascend processor[J].Opto-Electronic Engineering,2024,51(6):240072. [31] LIAO H,TU J,XIA J,et al.Ascend:a Scalable and Unified Architecture for Ubiquitous Deep Neural Network Computing:Industry Track Paper[C]//2021 IEEE International Symposium on High-Performance Computer Architecture(HPCA).2021:789-801. [32] OH C S,CHUN K C,BYUN Y Y,et al.22.1 A 1.1V 16GB 640GB/s HBM2E DRAM with a Data-Bus Window-Extension Technique and a Synergetic On-Die ECC Scheme[C]//IEEE International Solid-State Circuits Conference(ISSCC 2020).2020:330-332. [33] HE J X,LI Y W,LI R,et al.Design and Implementation of FFTOperator for Neural Network Processor-Taking Ascend910 as an Example[J].Telecommunication Engineering,2025,65(12):2160-2172. |
|
||