<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Ai 编译器 on moyutianzun 的博客</title><link>https://moyutianzun.com/tags/ai-%E7%BC%96%E8%AF%91%E5%99%A8/</link><description>Recent content in Ai 编译器 on moyutianzun 的博客</description><generator>Hugo</generator><language>zh-cn</language><copyright>moyutianzun</copyright><lastBuildDate>Thu, 11 Sep 2025 09:00:18 +0800</lastBuildDate><atom:link href="https://moyutianzun.com/tags/ai-%E7%BC%96%E8%AF%91%E5%99%A8/index.xml" rel="self" type="application/rss+xml"/><item><title>AI编译器 —— 笔记</title><link>https://moyutianzun.com/blog/aibian-yi-qi------bi-ji/</link><pubDate>Thu, 11 Sep 2025 09:00:18 +0800</pubDate><guid>https://moyutianzun.com/blog/aibian-yi-qi------bi-ji/</guid><description>&lt;h1 style="" id="challenge"&gt;challenge&lt;/h1&gt;&lt;p style=""&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p style=""&gt;新模型&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p style=""&gt;新module出现，需要对应算子进行计算，还需要结合硬件进行特性优化和测试，尽量充分发挥硬件性能&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p style=""&gt;硬件厂商还会发布新技术的加速计算库&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p style=""&gt;专用加速芯片爆发导致性能可移植性成为一种刚需&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;p style=""&gt;不同厂商的ISA不尽相同&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p style=""&gt;一般缺乏如GCC、LLVM等编译工具链，使得针对CPU和GPU已有的优化算子库和针对语言的优化Pass很难短期移植到NPU上&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p style=""&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=""&gt;&lt;/p&gt;&lt;p style=""&gt;&lt;/p&gt;&lt;p style=""&gt;&lt;/p&gt;&lt;p style=""&gt;&lt;/p&gt;&lt;h1 style="" id="%E6%9E%B6%E6%9E%84"&gt;架构&lt;/h1&gt;&lt;p style=""&gt;&lt;img src="https://moyublog-picture.oss-cn-guangzhou.aliyuncs.com/images/20250911160213415.png" width="100%" height="100%" style="display: inline-block"&gt;&lt;/p&gt;&lt;p style=""&gt;&lt;/p&gt;&lt;p style=""&gt;&lt;/p&gt;&lt;p style=""&gt;&lt;/p&gt;&lt;h2 style="" id="%E5%92%8C%E4%BC%A0%E7%BB%9F%E7%BC%96%E8%AF%91%E5%99%A8%E5%AF%B9%E6%AF%94"&gt;和传统编译器对比&lt;/h2&gt;&lt;p style="text-align: center"&gt;&lt;img src="https://moyublog-picture.oss-cn-guangzhou.aliyuncs.com/images/20250911150445999.png" width="50%" height="100%" style="display: inline-block"&gt;&lt;/p&gt;&lt;p style="text-align: center"&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p style=""&gt;在编译优化层通过统一IR执行不同的Pass进行优化，从而提高执行性能&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p style=""&gt;软件结构栈：分成前端、优化、后端三段式，IR解耦前端和后端使得模块化表示&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p style=""&gt;AI编译器对Graph IR进行优化后，将优化后的IR转换成传统编译器IR，最后依赖传统编译器进行机器码生成&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=""&gt;&lt;img src="https://moyublog-picture.oss-cn-guangzhou.aliyuncs.com/images/20250911152322879.png" width="100%" height="100%" style="display: inline-block"&gt;&lt;/p&gt;&lt;p style="text-align: center"&gt;&lt;strong&gt;左边是旧编译器架构，右边是ai编译器架构&lt;/strong&gt;&lt;/p&gt;</description></item></channel></rss>