-
Notifications
You must be signed in to change notification settings - Fork 362
/
Copy pathsystem_overview.html
612 lines (611 loc) · 22.3 KB
/
system_overview.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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<meta content="width=device-width,initial-scale=1" name="viewport"/>
<meta content="ie=edge" http-equiv="x-ua-compatible"/>
<meta content="Copy to clipboard" name="lang:clipboard.copy"/>
<meta content="Copied to clipboard" name="lang:clipboard.copied"/>
<meta content="en" name="lang:search.language"/>
<meta content="True" name="lang:search.pipeline.stopwords"/>
<meta content="True" name="lang:search.pipeline.trimmer"/>
<meta content="No matching documents" name="lang:search.result.none"/>
<meta content="1 matching document" name="lang:search.result.one"/>
<meta content="# matching documents" name="lang:search.result.other"/>
<meta content="[\s\-]+" name="lang:search.tokenizer"/>
<link crossorigin="" href="https://fonts.gstatic.com/" rel="preconnect"/>
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500,700|Roboto:300,400,400i,700&display=fallback" rel="stylesheet"/>
<style>
body,
input {
font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif
}
code,
kbd,
pre {
font-family: "Roboto Mono", "Courier New", Courier, monospace
}
</style>
<link href="../_static/stylesheets/application.css" rel="stylesheet"/>
<link href="../_static/stylesheets/application-palette.css" rel="stylesheet"/>
<link href="../_static/stylesheets/application-fixes.css" rel="stylesheet"/>
<link href="../_static/fonts/material-icons.css" rel="stylesheet"/>
<meta content="84bd00" name="theme-color"/>
<script src="../_static/javascripts/modernizr.js">
</script>
<title>
System Overview — TRTorch 0.0.3 documentation
</title>
<link href="../_static/material.css" rel="stylesheet" type="text/css"/>
<link href="../_static/pygments.css" rel="stylesheet" type="text/css"/>
<link href="../_static/collapsible-lists/css/tree_view.css" rel="stylesheet" type="text/css"/>
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js">
</script>
<script src="../_static/jquery.js">
</script>
<script src="../_static/underscore.js">
</script>
<script src="../_static/doctools.js">
</script>
<script src="../_static/language_data.js">
</script>
<script src="../_static/collapsible-lists/js/CollapsibleLists.compressed.js">
</script>
<script src="../_static/collapsible-lists/js/apply-collapsible-lists.js">
</script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js">
</script>
<link href="../genindex.html" rel="index" title="Index"/>
<link href="../search.html" rel="search" title="Search"/>
<link href="lowering.html" rel="next" title="Lowering Phase"/>
<link href="../_cpp_api/define_macros_8h_1abe87b341f562fd1cf40b7672e4d759da.html" rel="prev" title="Define XSTR"/>
</head>
<body data-md-color-accent="light-green" data-md-color-primary="light-green" dir="ltr">
<svg class="md-svg">
<defs data-children-count="0">
<svg height="448" id="__github" viewbox="0 0 416 448" width="416" xmlns="http://www.w3.org/2000/svg">
<path d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z" fill="currentColor">
</path>
</svg>
</defs>
</svg>
<input class="md-toggle" data-md-toggle="drawer" id="__drawer" type="checkbox"/>
<input class="md-toggle" data-md-toggle="search" id="__search" type="checkbox"/>
<label class="md-overlay" data-md-component="overlay" for="__drawer">
</label>
<a class="md-skip" href="#contributors/system_overview" tabindex="1">
Skip to content
</a>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid">
<div class="md-flex navheader">
<div class="md-flex__cell md-flex__cell--shrink">
<a class="md-header-nav__button md-logo" href="../index.html" title="TRTorch 0.0.3 documentation">
<i class="md-icon">
</i>
</a>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer">
</label>
</div>
<div class="md-flex__cell md-flex__cell--stretch">
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
<span class="md-header-nav__topic">
TRTorch
</span>
<span class="md-header-nav__topic">
System Overview
</span>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--search md-header-nav__button" for="__search">
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search">
</label>
<div class="md-search__inner" role="search">
<form action="../search.html" class="md-search__form" method="GET" name="search">
<input autocapitalize="off" autocomplete="off" class="md-search__input" data-md-component="query" data-md-state="active" name="q" placeholder="Search" spellcheck="false" type="text"/>
<label class="md-icon md-search__icon" for="__search">
</label>
<button class="md-icon md-search__icon" data-md-component="reset" tabindex="-1" type="reset">
</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix="">
<div class="md-search-result" data-md-component="result">
<div class="md-search-result__meta">
Type to start searching
</div>
<ol class="md-search-result__list">
</ol>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<div class="md-header-nav__source">
<a class="md-source" data-md-source="github" href="https://github.com/nvidia/TRTorch/" title="Go to repository">
<div class="md-source__icon">
<svg height="28" viewbox="0 0 24 24" width="28" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<use height="24" width="24" xlink:href="#__github">
</use>
</svg>
</div>
<div class="md-source__repository">
TRTorch
</div>
</a>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink dropdown">
<button class="dropdownbutton">
Versions
</button>
<div class="dropdown-content md-hero">
<a href="https://nvidia.github.io/TRTorch/" title="master">
master
</a>
<a href="https://nvidia.github.io/TRTorch/v0.0.3/" title="v0.0.3">
v0.0.3
</a>
<a href="https://nvidia.github.io/TRTorch/v0.0.2/" title="v0.0.2">
v0.0.2
</a>
<a href="https://nvidia.github.io/TRTorch/v0.0.1/" title="v0.0.1">
v0.0.1
</a>
</div>
</div>
</div>
</nav>
</header>
<div class="md-container">
<nav class="md-tabs" data-md-component="tabs">
<div class="md-tabs__inner md-grid">
<ul class="md-tabs__list">
<li class="md-tabs__item">
<a class="md-tabs__link" href="../index.html">
TRTorch 0.0.3 documentation
</a>
</li>
</ul>
</div>
</nav>
<main class="md-main">
<div class="md-main__inner md-grid" data-md-component="container">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="__drawer">
<a class="md-nav__button md-logo" href="../index.html" title="TRTorch 0.0.3 documentation">
<i class="md-icon">
</i>
</a>
<a href="../index.html" title="TRTorch 0.0.3 documentation">
TRTorch
</a>
</label>
<div class="md-nav__source">
<a class="md-source" data-md-source="github" href="https://github.com/nvidia/TRTorch/" title="Go to repository">
<div class="md-source__icon">
<svg height="28" viewbox="0 0 24 24" width="28" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<use height="24" width="24" xlink:href="#__github">
</use>
</svg>
</div>
<div class="md-source__repository">
TRTorch
</div>
</a>
</div>
<ul class="md-nav__list">
<li class="md-nav__item">
<span class="md-nav__link caption">
<span class="caption-text">
Getting Started
</span>
</span>
</li>
<li class="md-nav__item">
<a class="md-nav__link" href="../tutorials/installation.html">
Installation
</a>
</li>
<li class="md-nav__item">
<a class="md-nav__link" href="../tutorials/getting_started.html">
Getting Started
</a>
</li>
<li class="md-nav__item">
<a class="md-nav__link" href="../tutorials/ptq.html">
Post Training Quantization (PTQ)
</a>
</li>
<li class="md-nav__item">
<a class="md-nav__link" href="../tutorials/trtorchc.html">
trtorchc
</a>
</li>
<li class="md-nav__item">
<span class="md-nav__link caption">
<span class="caption-text">
Notebooks
</span>
</span>
</li>
<li class="md-nav__item">
<a class="md-nav__link" href="../_notebooks/lenet-getting-started.html">
TRTorch Getting Started - LeNet
</a>
</li>
<li class="md-nav__item">
<span class="md-nav__link caption">
<span class="caption-text">
Python API Documenation
</span>
</span>
</li>
<li class="md-nav__item">
<a class="md-nav__link" href="../py_api/trtorch.html">
trtorch
</a>
</li>
<li class="md-nav__item">
<a class="md-nav__link" href="../py_api/logging.html">
trtorch.logging
</a>
</li>
<li class="md-nav__item">
<span class="md-nav__link caption">
<span class="caption-text">
C++ API Documenation
</span>
</span>
</li>
<li class="md-nav__item">
<a class="md-nav__link" href="../_cpp_api/trtorch_cpp.html">
TRTorch C++ API
</a>
</li>
<li class="md-nav__item">
<span class="md-nav__link caption">
<span class="caption-text">
Contributor Documentation
</span>
</span>
</li>
<li class="md-nav__item">
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" id="__toc" type="checkbox"/>
<label class="md-nav__link md-nav__link--active" for="__toc">
System Overview
</label>
<a class="md-nav__link md-nav__link--active" href="#">
System Overview
</a>
<nav class="md-nav md-nav--secondary">
<label class="md-nav__title" for="__toc">
Contents
</label>
<ul class="md-nav__list" data-md-scrollfix="">
<li class="md-nav__item">
<a class="md-nav__link" href="#contributors-system-overview--page-root">
System Overview
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a class="md-nav__link" href="#compiler-phases">
Compiler Phases
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a class="md-nav__link" href="#lowering">
Lowering
</a>
</li>
<li class="md-nav__item">
<a class="md-nav__link" href="#conversion">
Conversion
</a>
</li>
<li class="md-nav__item">
<a class="md-nav__link" href="#execution">
Execution
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a class="md-nav__extra_link" href="../_sources/contributors/system_overview.rst.txt">
Show Source
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a class="md-nav__link" href="writing_converters.html">
Writing Converters
</a>
</li>
<li class="md-nav__item">
<a class="md-nav__link" href="useful_links.html">
Useful Links for TRTorch Development
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary">
<label class="md-nav__title" for="__toc">
Contents
</label>
<ul class="md-nav__list" data-md-scrollfix="">
<li class="md-nav__item">
<a class="md-nav__link" href="#contributors-system-overview--page-root">
System Overview
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a class="md-nav__link" href="#compiler-phases">
Compiler Phases
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a class="md-nav__link" href="#lowering">
Lowering
</a>
</li>
<li class="md-nav__item">
<a class="md-nav__link" href="#conversion">
Conversion
</a>
</li>
<li class="md-nav__item">
<a class="md-nav__link" href="#execution">
Execution
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a class="md-nav__extra_link" href="../_sources/contributors/system_overview.rst.txt">
Show Source
</a>
</li>
<li class="md-nav__item" id="searchbox">
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset" role="main">
<span id="id1">
</span>
<h1 id="contributors-system-overview--page-root">
System Overview
<a class="headerlink" href="#contributors-system-overview--page-root" title="Permalink to this headline">
¶
</a>
</h1>
<p>
TRTorch is primarily a C++ Library with a Python API planned. We use Bazel as our build system and target Linux x86_64 and
Linux aarch64 (only natively) right now. The compiler we use is GCC 7.5.0 and the library is untested with compilers before that
version so there may be compilation errors if you try to use an older compiler.
</p>
<p>
The repository is structured into:
</p>
<ul class="simple">
<li>
<p>
core: Main compiler source code
</p>
</li>
<li>
<p>
cpp: C++ API
</p>
</li>
<li>
<p>
tests: tests of the C++ API, the core and converters
</p>
</li>
<li>
<p>
py: Python API
</p>
</li>
<li>
<p>
notebooks: Example applications built with TRTorch
</p>
</li>
<li>
<p>
docs: Documentation
</p>
</li>
<li>
<p>
docsrc: Documentation Source
</p>
</li>
<li>
<p>
third_party: BUILD files for dependency libraries
</p>
</li>
<li>
<p>
toolchains: Toolchains for different platforms
</p>
</li>
</ul>
<p>
The C++ API is unstable and subject to change until the library matures, though most work is done under the hood in the core.
</p>
<p>
The core has a couple major parts: The top level compiler interface which coordinates ingesting a module, lowering,
converting and generating a new module and returning it back to the user. The there are the three main phases of the
compiler, the lowering phase, the conversion phase, and the execution phase.
</p>
<h2 id="compiler-phases">
Compiler Phases
<a class="headerlink" href="#compiler-phases" title="Permalink to this headline">
¶
</a>
</h2>
<div class="toctree-wrapper compound">
</div>
<h3 id="lowering">
Lowering
<a class="headerlink" href="#lowering" title="Permalink to this headline">
¶
</a>
</h3>
<p>
<a class="reference internal" href="lowering.html#lowering">
<span class="std std-ref">
Lowering Phase
</span>
</a>
</p>
<p>
The lowering is made up of a set of passes (some from PyTorch and some specific to TRTorch)
run over the graph IR to map the large PyTorch opset to a reduced opset that is easier to convert to
TensorRT.
</p>
<h3 id="conversion">
Conversion
<a class="headerlink" href="#conversion" title="Permalink to this headline">
¶
</a>
</h3>
<p>
<a class="reference internal" href="conversion.html#conversion">
<span class="std std-ref">
Conversion Phase
</span>
</a>
</p>
<p>
In the conversion phase we traverse the lowered graph and construct an equivalent TensorRT graph.
The conversion phase is made up of three main components, a context to manage compile time data,
a evaluator library which will execute operations that can be resolved at compile time and a converter
library which maps an op from JIT to TensorRT.
</p>
<h3 id="execution">
Execution
<a class="headerlink" href="#execution" title="Permalink to this headline">
¶
</a>
</h3>
<p>
<a class="reference internal" href="execution.html#execution">
<span class="std std-ref">
Execution Phase
</span>
</a>
</p>
<p>
The execution phase constructs a TorchScript program to run the converted TensorRT engine. It
takes a serialized engine and instantiates it within a engine manager, then the compiler will
build out a JIT graph that references this engine and wraps it in a module to return to the user.
When the user executes the module, the JIT program will look up the engine and pass the inputs
to it, then return the results.
</p>
</article>
</div>
</div>
</main>
</div>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
<a class="md-flex md-footer-nav__link md-footer-nav__link--prev" href="../_cpp_api/define_macros_8h_1abe87b341f562fd1cf40b7672e4d759da.html" rel="prev" title="Define XSTR">
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-back md-footer-nav__button">
</i>
</div>
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span class="md-footer-nav__direction">
Previous
</span>
Define XSTR
</span>
</div>
</a>
<a class="md-flex md-footer-nav__link md-footer-nav__link--next" href="lowering.html" rel="next" title="Lowering Phase">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span class="md-footer-nav__direction">
Next
</span>
Lowering Phase
</span>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-forward md-footer-nav__button">
</i>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
<div class="md-footer-copyright__highlight">
© Copyright 2020, NVIDIA Corporation.
</div>
Created using
<a href="http://www.sphinx-doc.org/">
Sphinx
</a>
3.1.2.
and
<a href="https://github.com/bashtage/sphinx-material/">
Material for
Sphinx
</a>
</div>
</div>
</div>
</footer>
<script src="../_static/javascripts/application.js">
</script>
<script>
app.initialize({version: "1.0.4", url: {base: ".."}})
</script>
</body>
</html>