M2K: Making the Model-Kernel Interface Explicit for Reliable CUDA Kernel Verification
The Pennsylvania State University(宾夕法尼亚州立大学);State Key Lab of Processors, Institute of Computing Technology, CAS(中国科学院计算技术研究所处理器实验室);Peking University(北京大学)
Mengting He, Shihao Xia, Haomin Jia, Wenfei Wu, Linhai Song
Large language model (LLM) inference systems rely on CUDA kernels for core GPU computations, yet the interface between models and kernels is implicit and poorly specified. Models and kernels evolve independently and often make incompatible assumptions about tensor shapes and input sizes, leading to subtle memory bugs in CUDA kernels. These bugs can crash inference services, corrupt model weights, or be exploited by remote adversaries. Existing techniques either incur prohibitive runtime overhead, require specialized hardware, or fail to handle dynamic tensor shapes and variable kernel launch configurations, leaving the CUDA memory bugs largely unaddressed.
This paper presents M2K, a fully automated framework that makes the model-kernel interface explicit and leverages it to detect memory bugs in CUDA kernels used in LLM inference systems. M2K consists of two components. HFProbe traces model execution without GPU hardware, classifies kernel arguments into model-fixed and user-variable, and emits symbolic constraints that capture the interface. cuKLEE then performs symbolic execution on CUDA kernels to pinpoint memory bugs under the interface constraints, modeling tensors as disjoint memory regions and treating thread identifiers symbolically to scale to thousands of threads. In the evaluation, M2K discovers 181 previously unknown bugs in real LLM inference systems, while producing only nine false positives, demonstrating its effectiveness.
Towards Feedback-to-Plan Decisions for Self-Evolving LLM Agents in CUDA Kernel Generation
Department of Computer Science and Technology, Tsinghua University, Beijing, China(清华大学计算机科学与技术系);Beijing National Research Center for Information Science and Technology, Beijing, China(北京信息科学国家研究中心)
OptiML: An End-to-End Framework for Program Synthesis and CUDA Kernel Optimization
Iowa State University, Ames, Iowa, USA(爱荷华州立大学);Cisco AI Research, San Jose, California, USA(思科人工智能研究);University of Southern California, Los Angeles, California, USA(南加州大学)
Automatic Kernel Generation for Volta Tensor Cores
神经网络中一个常见的计算习惯用法是对矩阵乘法的结果进行逐点运算。这样的操作序列通常在深度学习编译器中表示为计算图。当编译到GPU目标时,这些计算可以单独映射到由cuBLAS和cuDNN等库提供的手动调优实现。这些库还为NVIDIA GPU中的目标张量核提供现成支持,通过专门支持混合精度矩阵运算,可以大幅提升性能。此外,还可以使用CUDA API或内联汇编指令直接对张量核进行编程,从而为此类计算自动生成高效CUDA内核提供可能性。当通过将多个操作融合到单个设备函数中而不是为每个操作调用单独的内核来为整个计算图生成有效代码时,自动内核生成尤其重要。多面体编译技术为仿射循环嵌套序列的分析和变换提供了一种系统的方法。在本文中,我们描述了一种多面体的方法来生成高效的CUDA内核矩阵乘法使用内联汇编指令编程张量核心的NVIDIA Volta GPU。此外,我们基于这种方法为涉及矩阵乘法和逐点操作(如偏置加法,ReLU激活等)的计算序列生成融合内核。对这些技术的实验评估表明,自动生成的内核可以提供比手动调整的库实现更好的性能,加速倍数高达2.55倍。