The efficient deployment of large language models (LLMs) is hindered by memory architecture heterogeneity, where traditional compilers suffer from fragmented workflows and high adaptation costs. We present nncase, an open-source, end-to-end compilation framework designed to unify optimization across diverse targets. Central to nncase is an e-graph-based term rewriting engine that mitigates the phase ordering problem, enabling global exploration of computation and data movement strategies. The framework integrates three key modules: Auto Vectorize for adapting to heterogeneous computing units, Auto Distribution for searching parallel strategies with cost-aware communication optimization, and Auto Schedule for maximizing on-chip cache locality. Furthermore, a buffer-aware Codegen phase ensures efficient kernel instantiation. Evaluations show that nncase outperforms mainstream frameworks like MLC LLM and Intel IPEX on Qwen3 series models and achieves performance comparable to the hand-optimized llama.cpp on CPUs, demonstrating the viability of automated compilation for high-performance LLM deployment. The source code is available at https://github.com/kendryte/nncase.


翻译:大语言模型(LLM)的高效部署受到内存架构异构性的阻碍,传统编译器在此场景下面临工作流碎片化与高适配成本的问题。本文提出 nncase,一个开源的端到端编译框架,旨在统一针对多样化目标的优化过程。nncase 的核心是一个基于 e-graph 的项重写引擎,该引擎缓解了阶段排序问题,实现了对计算与数据移动策略的全局探索。该框架集成了三个关键模块:Auto Vectorize 用于适配异构计算单元,Auto Distribution 用于搜索并行策略并进行成本感知的通信优化,以及 Auto Schedule 用于最大化片上缓存局部性。此外,一个具备缓冲区感知能力的代码生成阶段确保了高效的内核实例化。评估结果表明,在 Qwen3 系列模型上,nncase 的性能优于 MLC LLM 和 Intel IPEX 等主流框架,并在 CPU 上达到了与手工优化的 llama.cpp 相当的性能,这证明了自动化编译对于高性能 LLM 部署的可行性。源代码发布于 https://github.com/kendryte/nncase。

0
下载
关闭预览

相关内容

KnowledGPT:基于知识库的检索和存储访问增强大型语言模型
【CVPR2023】基于文本驱动软掩码的多模态表示学习
专知会员服务
21+阅读 · 2023年4月10日
《用于代码弱点识别的 LLVM 中间表示》CMU
专知会员服务
14+阅读 · 2022年12月12日
基于PyTorch/TorchText的自然语言处理库
专知
28+阅读 · 2019年4月22日
LibRec 每周算法:LDA主题模型
LibRec智能推荐
29+阅读 · 2017年12月4日
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
VIP会员
相关VIP内容
KnowledGPT:基于知识库的检索和存储访问增强大型语言模型
【CVPR2023】基于文本驱动软掩码的多模态表示学习
专知会员服务
21+阅读 · 2023年4月10日
《用于代码弱点识别的 LLVM 中间表示》CMU
专知会员服务
14+阅读 · 2022年12月12日
相关资讯
基于PyTorch/TorchText的自然语言处理库
专知
28+阅读 · 2019年4月22日
LibRec 每周算法:LDA主题模型
LibRec智能推荐
29+阅读 · 2017年12月4日
相关基金
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员