Proceedings

QiMeng-TensorOp: One-Line Prompt is Enough for High-Performance Tensor Operator Generation with Hardware Primitives

Download BibTeX Cite

Proceedings of the Thirty-Fourth International Joint Conference on Artificial Intelligence. Main Track. Pages 7038-7046.

https://doi.org/10.24963/ijcai.2025/783

Abstract

Computation-intensive tensor operators constitute over 90% of the computations in Large Language Models (LLMs) and Deep Neural Networks. Automatically and efficiently generating high-performance tensor operators with hardware primitives is crucial for diverse and ever-evolving hardware architectures like RISC-V, ARM, and GPUs, as manually optimized implementation takes at least months and lacks portability. LLMs excel at generating high-level language codes, but they struggle to fully comprehend hardware characteristics and produce high-performance tensor operators.

We introduce a tensor-operator auto-generation framework with a one-line user prompt (QiMeng-TensorOp), which enables LLMs to automatically exploit hardware characteristics to generate tensor operators with hardware primitives, and tune parameters for optimal performance across diverse hardware. Experimental results on various hardware platforms, SOTA LLMs, and typical tensor operators demonstrate that QiMeng-TensorOp effectively unleashes the computing capability of various hardware platforms, and automatically generates tensor operators of superior performance. Compared with vanilla LLMs, QiMeng-TensorOp achieves up to 1291× performance improvement. Even compared with human experts, QiMeng-TensorOp could reach 251% of OpenBLAS on RISC-V CPUs, and 124% of cuBLAS on NVIDIA GPUs. Additionally, QiMeng-TensorOp also significantly reduces development costs by 200× compared with human experts.

  1. [Anam et al., 2013] Ashraful Anam, Paul Whatmough, and Yiannis Andreopoulos. Precision-energy-throughput scal- ing of generic matrix multiplication and discrete convolu- tion kernels via linear projections. In The 11th IEEE Sym- posium on Embedded Systems for Real-time Multimedia, pages 21-30. IEEE, 2013.
  2. [Athiwaratkun et al., 2022] Ben Athiwaratkun, Sanjay Gouda, and Zijian Wang et al. Multi-lingual Evaluation of Code Generation Models. ArXiv abs/2210.14868, 2022.
  3. [Austin et al., 2021] Jacob Austin, Augustus Odena, and Maxwell Nyen et al. Program Synthesis with Large Lan- guage Models. ArXiv, abs/2108.07732, 2021.
  4. [Bi et al., 2023] Jun Bi, Qi Guo, and Xiaqing Li et al. Heron: Automatically Constrained High-Performance Li- brary Generation for Deep Learning Accelerators. In Pro- ceedings of the 28th ACM International Conference on Ar- chitectural Support for Programming Languages and Op- erating Systems, Volume 3, pages 314-328, 2023.
  5. [Castelló et al., 2024] Adrián Castelló, Julian Bellavita, and Grace Dinh et al. Tackling the Matrix Multiplication Micro-Kernel Generation with Exo. In 2024 IEEE/ACM International Symposium on Code Generation and Opti- mization (CGO), pages 182-193. IEEE, 2024.
  6. [Chen et al., 2018a] Tianqi Chen, Thierry Moreau, and Zi- heng Jiang et al. TVM: An automated End-to-End opti- mizing compiler for deep learning. In 13th USENIX Sym- posium on Operating Systems Design and Implementation (OSDI 18), pages 578-594, 2018.
  7. [Chen et al., 2018b] Tianqi Chen, Lianmin Zheng, and Ed- die Yan et al. Learning to Optimize Tensor Programs. In Neural Information Processing Systems, 2018.
  8. [Chen et al., 2020a] Chen Chen, Xiaoyan Xiang, and Chang Liu et al. Xuantie-910: A Commercial Multi- Core 12-Stage Pipeline Out-of-Order 64-bit High Per- formance RISC-V Processor with Vector Extension. In 2020 ACM/IEEE 47th Annual International Symposium on Computer Architecture (ISCA), pages 52-64. IEEE, 2020.
  9. [Chen et al., 2020b] Yi-Ru Chen, Hui-Hsin Liao, and Chia- Hsuan Chang et al. Experiments and optimizations for TVM on RISC-V Architectures with P Extension. In 2020 International Symposium on VLSI Design, Automation and Test (VLSI-DAT), pages 1-4, 2020.
  10. [Choquette et al., 2021] Jack Choquette, Wishwesh Gandhi, and Olivier et al. Giroux. Nvidia A100 Tensor Core GPU: Performance and innovation. IEEE Micro, 41(2):29-35, 2021. [Claude3.5, 2024] Claude3.5. Claude 3.5 Sonnet. https: //www.anthropic.com/news/claude-3-5-sonnet, 2024. Ac- cessed: 2024-12-27. Link
  11. [Dally et al., 2021] William J Dally, Stephen W Keckler, and David B Kirk. Evolution of the graphics processing unit (GPU). IEEE Micro, 41(6):42-51, 2021.
  12. [DeepSeek-AI et al., 2024] DeepSeek-AI, Aixin Liu, and Bing Xue et al. DeepSeek-V3 Technical Report. 2024.
  13. [Faingnaert et al., 2021] Thomas Faingnaert, Tim Besard, and Bjorn De Sutter. Flexible Performant GEMM Kernels on GPUs. IEEE Transactions on Parallel and Distributed Systems, 33(9):2230-2248, 2021.
  14. [Feng et al., 2023] Siyuan Feng, Bohan Hou, and Hongyi Jin et al. Tensorir: An abstraction for automatic tensorized program optimization. In Proceedings of the 28th ACM In- ternational Conference on Architectural Support for Pro- gramming Languages and Operating Systems, Volume 2, pages 804-817, 2023.
  15. [Grattafiori et al., 2024] Aaron Grattafiori, Abhima Dubey, and Abhinav Jauhri et al. The Llama 3 Herd of Models. ArXiv abs/2407.21783, 2024.
  16. [Guillermo et al., 2024] Alae Guillermo, Martínez Héctor, and Castelló Adrián et al. Automatic generation of ARM NEON micro-kernels for matrix multiplication. The Jour- nal of Supercomputing, pages 1-27, 2024.
  17. [Gunasekar et al., 2023] Suriya Gunasekar, Yi Zhang, and Jyoti Aneja et al. Textbooks Are All You Need. ArXiv abs/2306.11644, 2023.
  18. [He et al., 2015] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep Residual Learning for Image Recognition. ArXiv abs/1512.03385, 2015.
  19. [Hennessy and Patterson, 2019] John Hennessy and David Patterson. A new golden age for computer architecture. Communications of the ACM, 62(2):48-60, 2019.
  20. [Igual et al., 2023] Francisco Igual, Luis Piñuel, and San- dra Catalán et al. Automatic Generation of Micro-kernels for Performance Portability of Matrix Multiplication on RISC-V Vector Processors. In Proceedings of the SC'23 Workshops of The International Conference on High Per- formance Computing, Network, Storage, and Analysis, pages 1523-1532, 2023.
  21. [Jouppi et al., 2017] Norman P Jouppi, Cliff Young, and Nis- hant Patil et al. In-datacenter performance analysis of a tensor processing unit. In Proceedings of the 44th annual international symposium on computer architecture, pages 1-12, 2017.
  22. [Katel et al., 2021] Navdeep Katel, Vivek Khandelwal, and Uday Bondhugula. High performance GPU code gener- ation for matrix-matrix multiplication using mlir: some early results. arXiv preprint arXiv:2108.13191, 2021.
  23. [Kim et al., 2024] Hyungyo Kim, Gaohan Ye, and Nachuan et al. Wang. Exploiting Intel® Advanced Matrix Exten- sions (AMX) for Large Language Model Inference. IEEE Computer Architecture Letters, 2024.
  24. [Krainiuk et al., 2021] Mariia Krainiuk, Mehdi Goli, and Vincent R Pascuzzi. oneAPI Open-Source Math Library Interface. In 2021 International Workshop on Perfor- mance, Portability and Productivity in HPC (P3HPC), pages 22-32. IEEE, 2021.
  25. [Kurzak et al., 2012] Jakub Kurzak, Stanimire Tomov, and Jack Dongarra. Autotuning GEMM kernels for the Fermi GPU. IEEE Transactions on Parallel and Distributed Sys- tems, 23(11):2045-2057, 2012.
  26. [Li et al., 2023] Raymond Li, Loubna Ben, and Yangtian Zi et al. StarCoder: may the source be with you! ArXiv, abs/2305.06161, 2023.
  27. [Liu et al., 2016] Shaoli Liu, Zidong Du, and Jinhua Tao et al. Cambricon: An instruction set architecture for neural networks. ACM SIGARCH Computer Architecture News, 44(3):393-405, 2016.
  28. [Liu et al., 2022] Xiao-Yang Liu, Zeliang Zhang, and Zhiyuan Wang et al. High-Performance Tensor Learning Primitives Using GPU Tensor Cores. IEEE Transactions on Computers, 72(6):1733-1746, 2022. [Llama3.1, 2024] Llama3.
  29. Introducing Llama 3.1: Our most capable models to date. https://ai.meta.com/blog/ meta-llama-3-1/, 2024. Accessed: 2024-12-27. Link
  30. [Lu et al., 2022] Shuai Lu, Nan Duan, Hojae Han, Daya Guo, Seung won Hwang, and Alexey Svyatkovskiy. ReACC: A Retrieval-Augmented Code Completion Framework. ArXiv abs/2203.07722, 2022.
  31. [Markidis et al., 2018] Stefano Markidis, Der Chien, and Steven Wei et al. NVIDIA Tensor Core Programmabil- ity, Performance & Precision. In 2018 IEEE international parallel and distributed processing symposium workshops (IPDPSW), pages 522-531. IEEE, 2018.
  32. [NVIDIA, 2023] NVIDIA. CUBLAS LIBRARY user guide v12.1. https://docs.nvidia.com/cuda/archive/12.1.0, 2023. Accessed: 2024-07-22. Link
  33. [OpenAI, 2025] OpenAI. GPT-4o. https://openai.com/index/ hello-gpt-4o/, 2025. Accessed: 2024-12-27. Link
  34. [Ragan et al., 2013] Jonathan Ragan, Connelly Barnes, and Andrew Adams et al. Halide: a language and com- piler for optimizing parallelism, locality, and recomputa- tion in image processing pipelines. Acm Sigplan Notices, 48(6):519-530, 2013.
  35. [Ronneberger et al., 2015] Olaf Ronneberger, Philipp Fis- cher, and Thomas Brox. U-Net: Convolutional Networks for Biomedical Image Segmentation, 2015.
  36. [Rozière et al., 2023] Baptiste Rozière, Jonas Gehring, and Fabian Gloeckle et al. Code Llama: Open Foundation Models for Code. ArXiv, abs/2308.12950, 2023.
  37. [Shao et al., 2022] Junru Shao, Xi Zhou, and Siyuan Feng et al. Tensor program optimization with probabilistic pro- grams. Advances in Neural Information Processing Sys- tems, 35:35783-35796, 2022.
  38. [Simonyan and Zisserman, 2015] Karen Simonyan and An- drew Zisserman. Very Deep Convolutional Networks for Large-Scale Image Recognition. ArXiv abs/1409.1556, 2015.
  39. [Sze et al., 2017] Vivienne Sze, Yu-Hsin Chen, and Tien- Ju Yang et al. Efficient processing of deep neural net- works: A tutorial and survey. Proceedings of the IEEE, 105(12):2295-2329, 2017.
  40. [Tan et al., 2011] Guangming Tan, Linchuan Li, and Sean Triechle et al. Fast implementation of DGEMM on Fermi GPU. In Proceedings of 2011 International Con- ference for High Performance Computing, Networking, Storage and Analysis, pages 1-11, 2011.
  41. [Touvron et al., 2023] Hugo Touvron, Thibaut Lavril, and Gautier Izacard et al. LLaMA: Open and Efficient Foun- dation Language Models. ArXiv abs/2302.13971, 2023.
  42. [Wei et al., 2022] Jason Wei, Xuezhi Wang, and Dale Schu- urmans et al. Chain-of-Thought Prompting Elicits Rea- soning in Large Language Models. Advances in neural information processing systems, 35:24824-24837, 2022.
  43. [Wu et al., 2021] Kan Wu, Zhihan Guo, and Guanzhou Hu et al. The storage hierarchy is not a hierarchy: Optimiz- ing caching on modern storage devices with orthus. In 19th USENIX Conference on File and Storage Technolo- gies (FAST 21), pages 307-323, 2021.
  44. [Wu et al., 2024] Du Wu, Jintao Meng, and Wenxi Zhu et al. autoGEMM: Pushing the Limits of Irregular Matrix Mul- tiplication on Arm Architectures. In SC24: International Conference for High Performance Computing, Network- ing, Storage and Analysis, pages 1-15. IEEE, 2024.
  45. [Xianyi et al., 2012] Zhang Xianyi, Wang Qian, and Zhang Yunquan. Model-driven level 3 BLAS performance opti- mization on Loongson 3A processor. In 2012 IEEE 18th international conference on parallel and distributed sys- tems, pages 684-691. IEEE, 2012.
  46. [Xiao et al., 2021] Qingcheng Xiao, Size Zheng, and Bingzhe Wu et al. Hasco: Towards agile hardware and software co-design for tensor computation. In 2021 ACM/IEEE 48th Annual International Symposium on Computer Architecture, pages 1055-1068. IEEE, 2021.
  47. [Zan et al., 2022] Daoguang Zan, Bin Chen, and Fengji Zhang et al. Large Language Models Meet NL2Code: A Survey. In Annual Meeting of the Associa- tion for Computational Linguistics, 2022.
  48. [Zhai et al., 2023] Yi Zhai, Yu Zhang, and Shuo Liu et al. TLP: A Deep Learning-Based Cost Model for Tensor Pro- gram Tuning. In Proceedings of the 28th ACM Interna- tional Conference on Architectural Support for Program- ming Languages and Operating Systems, Volume 2, pages 833-845, 2023.
  49. [Zhai et al., 2024] Yi Zhai, Sijia Yang, and Keyu Pan et al. Enabling Tensor Language Model to Assist in Generating High-Performance Tensor Programs for Deep Learning. In 18th USENIX Symposium on Operating Systems Design and Implementation (OSDI 24), pages 289-305, 2024.
  50. [Zheng et al., 2020] Lianmin Zheng, Chengfan Jia, and Min- min Sun et al. Ansor: Generating High-Performance Ten- sor Programs for Deep Learning. In 14th USENIX sym- posium on operating systems design and implementation (OSDI 20), pages 863-879, 2020.

References were extracted automatically from the PDF and may contain errors.

Welcome Future Conferences AI Journal Division IJCAI Proceedings About IJCAI IJCAI Awards