Hawk: Harnessing Hardware-Aware Knowledge for High-Performance NPU Kernel Generation
作者: Junyi Wen, Ruiyan Zhuang, Yongjia Xu, Pengtu Li, Rui Zou, Hongyi Chen, Chingman Wan, Puxu Yang, Wuhui Chen, Yanlin Wang
分类: cs.AI, cs.SE
发布日期: 2026-07-05
💡 一句话要点
提出Hawk框架以解决NPU内核生成中的硬件约束问题
🎯 匹配领域: 支柱二:RL算法与架构 (RL & Architecture) 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 神经处理单元 内核生成 硬件感知 知识蒸馏 性能优化 深度学习 自动化
📋 核心要点
- 现有方法在NPU内核生成中面临硬件约束和内存层次结构的挑战,导致性能下降和运行时崩溃。
- Hawk框架通过运行时知识合成、瓶颈感知知识检索和效果驱动知识蒸馏三大模块,提供了一种无训练的解决方案。
- 实验证明Hawk在真实NPU工作负载下,生成准确率显著提高,并实现了执行速度的显著提升。
📝 摘要(中文)
开发高性能的神经处理单元(NPU)内核是工业界的一大瓶颈,开发者需手动应对隐含的硬件约束和严格的内存层次结构。尽管大型语言模型具有巨大的自动化潜力,但由于缺乏特定硬件的先验知识,它们在NPU上表现不佳。为了解决这一问题,本文提出了Hawk框架,通过三个核心模块有效利用硬件感知知识。实验证明,Hawk将生成准确率从49.4%提升至80.0%,并在执行速度上较最先进的基线实现了最高2.2倍的加速。
🔬 方法详解
问题定义:本文旨在解决NPU内核生成中的硬件约束问题,现有方法常常因缺乏硬件特定知识而导致性能下降和运行时错误。
核心思路:Hawk框架通过结合硬件感知知识,避免了简单代码移植带来的问题,提供了一种系统化的内核生成方法。
技术框架:Hawk框架包含三个主要模块:运行时知识合成模块、瓶颈感知知识检索模块和效果驱动知识蒸馏模块,形成一个闭环反馈机制。
关键创新:Hawk的核心创新在于采用了三重可执行知识表示,能够将错误上下文与可执行语义内在结合,显著提升生成内核的准确性。
关键设计:在知识检索中,Hawk实现了2D检索范式,将查询投影到正交的句法和硬件对齐的语义空间,确保了生成内核的高效性和准确性。
🖼️ 关键图片
📊 实验亮点
Hawk框架在真实NPU工作负载下的实验结果显示,生成准确率从49.4%提升至80.0%,并在执行速度上实现了最高2.2倍的加速,显著超越了现有的最先进基线,展示了其在高性能内核生成中的有效性。
🎯 应用场景
Hawk框架在NPU内核生成中的应用潜力巨大,能够为各种深度学习应用提供高效的内核支持,特别是在需要高性能计算的场景,如图像处理、自然语言处理和实时数据分析等领域。未来,Hawk有望推动NPU技术的普及和应用,提升整体计算效率。
📄 摘要(原文)
Developing high-performance kernels for Neural Processing Units (NPUs) is a critical industry bottleneck, requiring developers to manually navigate implicit hardware constraints and strict memory hierarchies. While large language models offer immense automation potential, they fail catastrophically on NPUs due to a fundamental lack of hardware-specific priors. Naively transplanting code snippets from similar NPU kernels may pass the compiler, but it consistently triggers runtime crashes and performance degradation by blindly violating underlying hardware constraints. To overcome this, we introduce Hawk, a training-free framework that harnesses hardware-aware knowledge through three core modules: (1) Run-Time Knowledge Synthesis Module, which employs a Triple-Part Executable Knowledge Representation to inherently couple the error context with executable semantics; (2) Bottleneck-Aware Knowledge Retrieval Module, which implements a 2D-Retrieval paradigm to project queries into orthogonal syntactic and hardware-aligned semantic spaces; and (3) Effect-Driven Knowledge Distillation Module, which leverages LLM-driven semantic arbitration to continuously distill the knowledge by pruning errors and consolidating redundancies based on the empirical execution feedback. Extensive evaluations on real-world NPU workloads demonstrate that Hawk elevates generation accuracy from 49.4% to 80.0%, while achieving up to a 2.2x execution speedup over state-of-the-art baselines.