-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
209 lines (180 loc) · 31.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>优秀的守夜人</title><meta name="author" content="优秀的守夜人"><meta name="copyright" content="优秀的守夜人"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="ffffff"><meta property="og:type" content="website">
<meta property="og:title" content="优秀的守夜人">
<meta property="og:url" content="http://youxiudeshouyeren.github.io/index.html">
<meta property="og:site_name" content="优秀的守夜人">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://youxiudeshouyeren.github.io/img/figure.jpg">
<meta property="article:author" content="优秀的守夜人">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://youxiudeshouyeren.github.io/img/figure.jpg"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="http://youxiudeshouyeren.github.io/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="stylesheet" href="css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = {
root: '/',
algolia: undefined,
localSearch: undefined,
translate: undefined,
noticeOutdate: undefined,
highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
copy: {
success: '复制成功',
error: '复制错误',
noSupport: '浏览器不支持'
},
relativeDate: {
homepage: false,
post: false
},
runtime: '',
date_suffix: {
just: '刚刚',
min: '分钟前',
hour: '小时前',
day: '天前',
month: '个月前'
},
copyright: undefined,
lightbox: 'fancybox',
Snackbar: undefined,
source: {
justifiedGallery: {
js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
}
},
isPhotoFigcaption: false,
islazyload: false,
isAnchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
title: '优秀的守夜人',
isPost: false,
isHome: true,
isHighlightShrink: false,
isToc: false,
postUpdate: '2023-01-07 18:50:08'
}</script><noscript><style type="text/css">
#nav {
opacity: 1
}
.justified-gallery img {
opacity: 1
}
#recent-posts time,
#post-meta time {
display: inline !important
}
</style></noscript><script>(win=>{
win.saveToLocal = {
set: function setWithExpiry(key, value, ttl) {
if (ttl === 0) return
const now = new Date()
const expiryDay = ttl * 86400000
const item = {
value: value,
expiry: now.getTime() + expiryDay,
}
localStorage.setItem(key, JSON.stringify(item))
},
get: function getWithExpiry(key) {
const itemStr = localStorage.getItem(key)
if (!itemStr) {
return undefined
}
const item = JSON.parse(itemStr)
const now = new Date()
if (now.getTime() > item.expiry) {
localStorage.removeItem(key)
return undefined
}
return item.value
}
}
win.getScript = url => new Promise((resolve, reject) => {
const script = document.createElement('script')
script.src = url
script.async = true
script.onerror = reject
script.onload = script.onreadystatechange = function() {
const loadState = this.readyState
if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
script.onload = script.onreadystatechange = null
resolve()
}
document.head.appendChild(script)
})
win.activateDarkMode = function () {
document.documentElement.setAttribute('data-theme', 'dark')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
}
}
win.activateLightMode = function () {
document.documentElement.setAttribute('data-theme', 'light')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', 'ffffff')
}
}
const t = saveToLocal.get('theme')
if (t === 'dark') activateDarkMode()
else if (t === 'light') activateLightMode()
const asideStatus = saveToLocal.get('aside-status')
if (asideStatus !== undefined) {
if (asideStatus === 'hide') {
document.documentElement.classList.add('hide-aside')
} else {
document.documentElement.classList.remove('hide-aside')
}
}
const detectApple = () => {
if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
document.documentElement.classList.add('apple')
}
}
detectApple()
})(window)</script><meta name="generator" content="Hexo 6.3.0"></head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="/img/figure.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="archives/"><div class="headline">文章</div><div class="length-num">7</div></a><a href="tags/"><div class="headline">标签</div><div class="length-num">5</div></a><a href="categories/"><div class="headline">分类</div><div class="length-num">2</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="index.html"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="page" id="body-wrap"><header class="not-top-img" id="page-header"><nav id="nav"><span id="blog_name"><a id="site-name" href="index.html">优秀的守夜人</a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="index.html"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav></header><main class="layout" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="2023/01/07/%E7%9F%A5%E8%AF%86%E8%92%B8%E9%A6%8F%E6%A6%82%E8%BF%B0/" title="知识蒸馏(一)概述">知识蒸馏(一)概述</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-01-07T10:05:44.000Z" title="发表于 2023-01-07 18:05:44">2023-01-07</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-01-07T10:09:34.542Z" title="更新于 2023-01-07 18:09:34">2023-01-07</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="categories/%E7%A5%9E%E7%BB%8F%E7%BD%91%E7%BB%9C%E5%8E%8B%E7%BC%A9/">神经网络压缩</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="tags/%E7%9F%A5%E8%AF%86%E8%92%B8%E9%A6%8F/">知识蒸馏</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="tags/%E7%BB%BC%E8%BF%B0/">综述</a></span></div><div class="content">1.介绍 知识蒸馏,近年来越来越受到研究界的关注。大型深度神经网络取得了显著的成功,特别是在大规模数据的真实场景中,因为当考虑新数据时,过度参数化提高了泛化性能。然而,由于移动设备的算力和存储受限,在这些设备中部署DNN模型是一个巨大的挑战。为了解决这个问题,Bucilua等人(2006)首次提出了模型压缩,将信息从大模型或集成模型转移到训练的小模型中,并且不会显著导致精度下降。从大模型中学习小模型的方法后来作为知识蒸馏正式推广。
在知识蒸馏中,小型学生模型通常由大型教师模型监督。其主要思想是:学生模型模仿教师模型,并获得近似甚至更优越的性能表现。关键问题是如何将大教师模型转移到小的学生模型上。知识蒸馏系统基本由三个关键部分组成:知识、蒸馏算法、教师-学生结构。其一般框架如下:
2.知识 将知识分为三种形式:基于响应的(response-based)、基于特征的(feature-based)、基于关系的(relation-based)。
2.1 基于响应的知识(response-based) 基于响应的知识通常指教师模型最后一个输出层的神经响应。其 ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="2023/01/07/tvm-2/" title="TVM第三方论文调研(二):KunlunTVM,昆仑芯片的TVM编译器扩展">TVM第三方论文调研(二):KunlunTVM,昆仑芯片的TVM编译器扩展</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-01-07T09:58:54.000Z" title="发表于 2023-01-07 17:58:54">2023-01-07</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-01-07T10:05:15.756Z" title="更新于 2023-01-07 18:05:15">2023-01-07</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="categories/%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0%E7%BC%96%E8%AF%91%E5%99%A8/">深度学习编译器</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="tags/TVM/">TVM</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="tags/%E8%AE%BA%E6%96%87%E8%B0%83%E7%A0%94/">论文调研</a></span></div><div class="content">论文信息出处:J. Zeng, M. Kou, and H. Yao, “KunlunTVM: A Compilation Framework for Kunlun Chip Supporting Both Training and Inference,” in Proceedings of the Great Lakes Symposium on VLSI 2022, Irvine CA USA, Jun. 2022, pp. 299–304. doi: 10.1145/3526241.3530316.
简介:为昆仑芯片开发的端到端编译器,基于TVM扩展,名为KunlunTVM,支持在昆仑芯片上的训练和推理任务。该方法针对不同后端的TVM框架是通用且可扩展的,可以借鉴其设计思路,学习如何为新后端添加编译器工具链。
主要贡献:
在昆仑芯片上的基于TVM的端到端编译器,可支持各种现代神经网络模型
训练计算图优化策略,旨在提高训练性能
专用的内存管理算法,针对昆仑芯片的分层存储提升了内存分配和访问性能
KunlunTVM概述
前端:
1.直接采用relay生成的反向传播计算图存在冗余算 ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="2023/01/07/tvm-3/" title="TVM第三方论文调研(三) BYOC,将自己的硬件加速器对接深度学习编译器">TVM第三方论文调研(三) BYOC,将自己的硬件加速器对接深度学习编译器</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-01-07T09:55:29.000Z" title="发表于 2023-01-07 17:55:29">2023-01-07</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-01-07T10:01:26.794Z" title="更新于 2023-01-07 18:01:26">2023-01-07</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="categories/%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0%E7%BC%96%E8%AF%91%E5%99%A8/">深度学习编译器</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="tags/TVM/">TVM</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="tags/%E8%AE%BA%E6%96%87%E8%B0%83%E7%A0%94/">论文调研</a></span></div><div class="content">论文信息论文出处:Z. Chen et al., “Bring Your Own Codegen to Deep Learning Compiler.” arXiv, May 03, 2021. Accessed: Jun. 27, 2022. [Online]. Available: http://arxiv.org/abs/2105.03215
Motivation:深度学习加速器需要编译栈来将模型映射到指令集,如果每个加速器供应商都开发一个专用深度学习编译堆栈,无疑会带来巨大的成本,也无法利用现存的基础设施。该文提出了一个框架,允许用户重用现有的编译器中尽可能多的组件,只专注于专有的代码生成工具的开发。
主要贡献:
提出了一个统一的框架,允许不同的硬件加速器供应商通过以即插即用的方式集成他们的代码工具,复用尽可能多的硬件无关的优化
为开发人员提供了灵活的接口,以便1)对计算图进行标注和分区;2)对分区图应用特定于硬件的优化
平均2000行代码的集成方法的案例研究
另外,TVM文档中有该框架的教程,关键字即论文题目
框架设计与实现编译流程如下:
白色的部分是深度学习编译器已有 ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="2023/01/07/relay-pass/" title="TVM设计与架构:Relay Pass,深度学习编译器的高层次优化在做什么">TVM设计与架构:Relay Pass,深度学习编译器的高层次优化在做什么</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-01-07T09:53:20.000Z" title="发表于 2023-01-07 17:53:20">2023-01-07</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-01-07T10:12:02.468Z" title="更新于 2023-01-07 18:12:02">2023-01-07</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="categories/%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0%E7%BC%96%E8%AF%91%E5%99%A8/">深度学习编译器</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="tags/TVM/">TVM</a></span></div><div class="content">pass的作用pass是编译器中用来对程序进行优化或分析的步骤,一个程序通常要经过多个pass,每个pass也可能执行多遍。关于TVM中的pass机制,请参考TVM的官方文档:
https://tvm.apache.org/docs/arch/pass_infra.htmltvm.apache.org/docs/arch/pass_infra.html
本文粗略统计了Relay高层次pass,主要想搞明白在高层次计算图优化中,编译器都做了哪些事。
关于pass执行前后程序的变化,可以参考relay的测试文件夹,文中示例均来自tvm/tests/python/relay/ ,由于精力有限,我只选取个别进行了输入输出的对比。
pass统计DeadCodeElimination
名称
中文名
作用
备注
DeadCodeElimination
死节点消除
删除未被使用到的表达式
实现在tvm/src/relay/transforms/dead_code.cc
实现流程应该是用UsageVisitor遍历每个节点,计数每个节点被用到的次数,当其为0时,在Eliminato ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="2023/01/07/batchNorm%E4%B8%8ELayerNorm/" title="BatchNorm与LayerNorm的部署优化加速">BatchNorm与LayerNorm的部署优化加速</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-01-07T09:50:07.000Z" title="发表于 2023-01-07 17:50:07">2023-01-07</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-01-07T09:52:46.932Z" title="更新于 2023-01-07 17:52:46">2023-01-07</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="categories/%E7%A5%9E%E7%BB%8F%E7%BD%91%E7%BB%9C%E5%8E%8B%E7%BC%A9/">神经网络压缩</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="tags/%E7%AE%97%E5%AD%90%E8%BF%90%E8%A1%8C%E5%8E%9F%E7%90%86/">算子运行原理</a></span></div><div class="content">
两者的计算方式相同,区别在计算的维度和统计数据是否可以离线获得。
BatchNorm使用Batch维度参与了均值和方差的计算。训练时,BatchNorm会根据训练数据更新统计值;在推理时,方差、均值、 γ 和 β 都是固定的参数。这导致训练和推理时行为的不匹配,但是给推理时优化带来了机会。BatchNorm一般用在一个Conv2d操作之后,对于这种矩阵计算,固定的参数可以在编译器优化时将其提前融合进权重(守夜人:TVM设计与架构:Relay Pass,深度学习编译器的高层次优化在做什么)。nn.BatchNorm2d(num_features)中的num_features一般是输入数据的第二维(假设输入数据的维度为(N,num_features, H, W)),一层BatchNorm2d的γ 和 β数量等于num_features。在计算方差和均值时,将除了轴num_features以外的所有轴的元素放一起,取均值和方差后,乘以对应的γ 和 β(共享)。
LayerNorm一般用特征的最后一维计算方差和均值。在训练时只对 γ 和 β 进行统计;推理时只有 γ 和 β是提前已知的,方 ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="2023/01/07/%E6%96%B0%E5%A2%9E%E7%AE%97%E5%AD%90/" title="代码实践:向TVM新增算子">代码实践:向TVM新增算子</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-01-07T09:45:46.000Z" title="发表于 2023-01-07 17:45:46">2023-01-07</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-01-07T09:50:28.905Z" title="更新于 2023-01-07 17:50:28">2023-01-07</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="categories/%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0%E7%BC%96%E8%AF%91%E5%99%A8/">深度学习编译器</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="tags/TVM/">TVM</a></span></div><div class="content">纸上得来终觉浅,绝知此事要躬行。参考TVM文档向Relay添加新算子( TVM对应文档:https://tvm.apache.org/docs/dev/how_to/relay_add_op.html),文档中省去了许多细节,在本文中将实践向Relay添加新算子,并将细节一一列出,给出涉及的文件地址、新增代码、测试脚本。
算子定义LayerNorm由于其推理时在线计算均值和方差的特性,使得其运行时开销较大(LayerNorm计算特性和部署优化: https://zhuanlan.zhihu.com/p/587092648)。为了减小开销,其中一种方法是采用新的归一化方法替代LayerNorm。RMSNorm就是一个可行的研究工作。
RMSNorm论文:Zhang B, Sennrich R. Root mean square layer normalization[J]. Advances in Neural Information Processing Systems, 2019, 32
对LayerNorm成功的一个著名的解释是它的重新定心和重新缩放的不变性。前者使模型对输入和权值 ...</div></div></div><div class="recent-post-item"><div class="recent-post-info no-cover"><a class="article-title" href="2023/01/07/%E8%B0%83%E8%AF%95TVM/" title="调试TVM:在Python与C++混合编程中启动调试">调试TVM:在Python与C++混合编程中启动调试</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-01-07T07:29:47.000Z" title="发表于 2023-01-07 15:29:47">2023-01-07</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-01-07T09:44:45.921Z" title="更新于 2023-01-07 17:44:45">2023-01-07</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="categories/%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0%E7%BC%96%E8%AF%91%E5%99%A8/">深度学习编译器</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="tags/TVM/">TVM</a></span></div><div class="content">TVM是Python与C++混合编程,通常在Python层提供相关接口,在C++层进行具体实现,兼具灵活与性能。C++代码被编译为动态链接库,在运行时调用。这样给调试带来了不方便,想要调试C++代码就不能通过直接打断点的方式,需要有特殊的处理。本文分享在TVM与VTA的FSIM之间进行python和C++混合调试的方法(其他组件也一样的步骤),使用Vscode实现,亲测有效,整个配置时间大概1小时左右。
编译debug版本的TVM注意:这里编译之类操作不要在Vscode的终端下操作,直接在Linux的终端下操作,否则安装了一些奇怪的插件后,Vscode在编译时自做主张加东西,可能导致之后的配置失败。
首先删除build目录下除config.cmake以外的所有文件及文件夹。
config.cmake设置以下两个选项,其他默认不变。(本文的目的是调试VTA的FSIM,如果有其他需要,打开对应开关即可,后续步骤通用)
set(USE_LLVM ON) #启用LLVM,如果没安装LLVM需要安装,参照下文set(USE_VTA_FSIM ON) #启用VTA的快速仿真器
在tvm/buil ...</div></div></div><nav id="pagination"><div class="pagination"><span class="page-number current">1</span></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="../img/figure.jpg" onerror="this.onerror=null;this.src='../img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">优秀的守夜人</div><div class="author-info__description"></div></div><div class="card-info-data site-data is-center"><a href="../archives/"><div class="headline">文章</div><div class="length-num">7</div></a><a href="../tags/"><div class="headline">标签</div><div class="length-num">5</div></a><a href="../categories/"><div class="headline">分类</div><div class="length-num">2</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://www.zhihu.com/people/shou-ye-ren-47-6"><i class="fab fa-zhihu"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/youxiudeshouyeren" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="../mailto:1929724847@qq.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a><a class="social-icon" href="https://www.zhihu.com/people/shou-ye-ren-47-6" target="_blank" title="Zhihu"><i class="fab fa-zhihu"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">深度学习编译器、加速器及神经网络压缩</div></div><div class="sticky_layout"><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item no-cover"><div class="content"><a class="title" href="../2023/01/07/%E7%9F%A5%E8%AF%86%E8%92%B8%E9%A6%8F%E6%A6%82%E8%BF%B0/" title="知识蒸馏(一)概述">知识蒸馏(一)概述</a><time datetime="2023-01-07T10:05:44.000Z" title="发表于 2023-01-07 18:05:44">2023-01-07</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="../2023/01/07/tvm-2/" title="TVM第三方论文调研(二):KunlunTVM,昆仑芯片的TVM编译器扩展">TVM第三方论文调研(二):KunlunTVM,昆仑芯片的TVM编译器扩展</a><time datetime="2023-01-07T09:58:54.000Z" title="发表于 2023-01-07 17:58:54">2023-01-07</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="../2023/01/07/tvm-3/" title="TVM第三方论文调研(三) BYOC,将自己的硬件加速器对接深度学习编译器">TVM第三方论文调研(三) BYOC,将自己的硬件加速器对接深度学习编译器</a><time datetime="2023-01-07T09:55:29.000Z" title="发表于 2023-01-07 17:55:29">2023-01-07</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="../2023/01/07/relay-pass/" title="TVM设计与架构:Relay Pass,深度学习编译器的高层次优化在做什么">TVM设计与架构:Relay Pass,深度学习编译器的高层次优化在做什么</a><time datetime="2023-01-07T09:53:20.000Z" title="发表于 2023-01-07 17:53:20">2023-01-07</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="../2023/01/07/batchNorm%E4%B8%8ELayerNorm/" title="BatchNorm与LayerNorm的部署优化加速">BatchNorm与LayerNorm的部署优化加速</a><time datetime="2023-01-07T09:50:07.000Z" title="发表于 2023-01-07 17:50:07">2023-01-07</time></div></div></div></div><div class="card-widget card-categories"><div class="item-headline">
<i class="fas fa-folder-open"></i>
<span>分类</span>
</div>
<ul class="card-category-list" id="aside-cat-list">
<li class="card-category-list-item "><a class="card-category-list-link" href="../categories/%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0%E7%BC%96%E8%AF%91%E5%99%A8/"><span class="card-category-list-name">深度学习编译器</span><span class="card-category-list-count">5</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="../categories/%E7%A5%9E%E7%BB%8F%E7%BD%91%E7%BB%9C%E5%8E%8B%E7%BC%A9/"><span class="card-category-list-name">神经网络压缩</span><span class="card-category-list-count">2</span></a></li>
</ul></div><div class="card-widget card-tags"><div class="item-headline"><i class="fas fa-tags"></i><span>标签</span></div><div class="card-tag-cloud"><a href="../tags/TVM/" style="font-size: 1.5em; color: #99a9bf">TVM</a> <a href="../tags/%E7%9F%A5%E8%AF%86%E8%92%B8%E9%A6%8F/" style="font-size: 1.1em; color: #999">知识蒸馏</a> <a href="../tags/%E7%AE%97%E5%AD%90%E8%BF%90%E8%A1%8C%E5%8E%9F%E7%90%86/" style="font-size: 1.1em; color: #999">算子运行原理</a> <a href="../tags/%E7%BB%BC%E8%BF%B0/" style="font-size: 1.1em; color: #999">综述</a> <a href="../tags/%E8%AE%BA%E6%96%87%E8%B0%83%E7%A0%94/" style="font-size: 1.3em; color: #99a1ac">论文调研</a></div></div><div class="card-widget card-archives"><div class="item-headline"><i class="fas fa-archive"></i><span>归档</span></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="../archives/2023/01/"><span class="card-archive-list-date">一月 2023</span><span class="card-archive-list-count">7</span></a></li></ul></div><div class="card-widget card-webinfo"><div class="item-headline"><i class="fas fa-chart-line"></i><span>网站资讯</span></div><div class="webinfo"><div class="webinfo-item"><div class="item-name">文章数目 :</div><div class="item-count">7</div></div><div class="webinfo-item"><div class="item-name">最后更新时间 :</div><div class="item-count" id="last-push-date" data-lastPushDate="2023-01-07T10:50:07.848Z"><i class="fa-solid fa-spinner fa-spin"></i></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">©2023 By 优秀的守夜人</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text">与我交流:qq:1929724847 wechat:include_jxr</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="js/utils.js"></script><script src="js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.min.js"></script><div class="js-pjax"></div></div></body></html>