tools.html 13 KB
Newer Older
Chris Austen's avatar
Chris Austen committed
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
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Tools &mdash; MIGraphX 2.1 documentation</title>
      <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
      <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
  <!--[if lt IE 9]>
    <script src="../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
        <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/js/theme.js"></script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="prev" title="Matchers" href="matchers.html" /> 
</head>

<body class="wy-body-for-nav"> 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
            <a href="../index.html" class="icon icon-home"> MIGraphX
          </a>
              <div class="version">
                2.1
              </div>
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
        </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
              <p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../py_user_guide.html">Python User Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../cpp_user_guide.html">C++ User Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../driver.html">MIGraphX Driver</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../contributor_guide.html">Contributor Guide</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../dev_intro.html">MIGraphX Fundamentals</a></li>
<li class="toctree-l2"><a class="reference internal" href="data.html">Data types</a></li>
<li class="toctree-l2"><a class="reference internal" href="operators.html">Operators</a></li>
<li class="toctree-l2"><a class="reference internal" href="program.html">Program</a></li>
<li class="toctree-l2"><a class="reference internal" href="targets.html">Targets</a></li>
<li class="toctree-l2"><a class="reference internal" href="quantization.html">Quantization</a></li>
<li class="toctree-l2"><a class="reference internal" href="pass.html">Passes</a></li>
<li class="toctree-l2"><a class="reference internal" href="matchers.html">Matchers</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Tools</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#roctx-py">roctx.py</a></li>
</ul>
</li>
</ul>
</li>
</ul>

        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../index.html">MIGraphX</a>
      </nav>

      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../index.html" class="icon icon-home"></a> &raquo;</li>
          <li><a href="../contributor_guide.html">Contributor Guide</a> &raquo;</li>
      <li>Tools</li>
      <li class="wy-breadcrumbs-aside">
            <a href="../_sources/dev/tools.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
             
  <section id="tools">
<h1>Tools<a class="headerlink" href="#tools" title="Permalink to this headline"></a></h1>
<section id="roctx-py">
<h2>roctx.py<a class="headerlink" href="#roctx-py" title="Permalink to this headline"></a></h2>
<p>MIGraphX driver provides <code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">roctx</span></code> command which can be used with <code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">rocprof</span></code> binary to get marker timing information for each MIGraphX operator.
In order to help user to process timing information, rocTX helper script is provided at <code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">tools/roctx.py</span></code>.
The <code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">roctx.py</span></code> helper script provides two main functionality: <code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">run</span></code> and <code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">parse</span></code>. Available knobs and usage are given below:</p>
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="nl">Usage</span><span class="p">:</span><span class="w"> </span><span class="n">roctx</span><span class="p">.</span><span class="n">py</span><span class="w"> </span><span class="p">[</span><span class="o">-</span><span class="n">h</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="o">--</span><span class="n">json</span><span class="o">-</span><span class="n">path</span><span class="w"> </span><span class="n">json_path</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="o">--</span><span class="n">out</span><span class="w"> </span><span class="n">out</span><span class="p">]</span><span class="w"></span>
<span class="p">[</span><span class="o">--</span><span class="n">study</span><span class="o">-</span><span class="n">name</span><span class="w"> </span><span class="n">study</span><span class="o">-</span><span class="n">name</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="o">--</span><span class="n">repeat</span><span class="w"> </span><span class="n">repeat</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="o">--</span><span class="n">parse</span><span class="p">]</span><span class="w"></span>
<span class="p">[</span><span class="o">--</span><span class="n">run</span><span class="w"> </span><span class="n">run</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="o">--</span><span class="n">debug</span><span class="p">]</span><span class="w"></span>
</pre></div>
</div>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-run">
<span class="sig-name descname"><span class="pre">--run</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-run" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<p>Runs <code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">migraphx-driver</span> <span class="pre">roctx</span></code> command and given <code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">migraphx-driver</span></code> knobs, and then parses the results, providing GPU kernel timing information.
MIGraphX knobs can be given via a string to <code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">--run</span></code> knob. Please see the examples below.</p>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-parse">
<span class="sig-name descname"><span class="pre">--parse</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-parse" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<p>Given <code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">--json-path</span></code>, parses JSON file and provides GPU kernel timing information.</p>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-out">
<span class="sig-name descname"><span class="pre">--out</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-out" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<p>Output folder</p>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-study-name">
<span class="sig-name descname"><span class="pre">--study-name</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-study-name" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<p>Optional. Allows user to name a study for easier interpretation. Defaults to timestamp.</p>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-repeat">
<span class="sig-name descname"><span class="pre">--repeat</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-repeat" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<p>Number of iterations. Set to <strong>2</strong> by default.</p>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-debug">
<span class="sig-name descname"><span class="pre">--debug</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-debug" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<p>Provides additional debug information related to data. Only use for debugging purposes.</p>
<p><strong>Examples:</strong></p>
<p><strong>Running inference with rocTX for a given ONNX file:</strong></p>
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span>python roctx.py --run &#39;--onnx --gpu fcn-resnet50-11.onnx&#39; --out output_folder --repeat 5
</pre></div>
</div>
<p>After a run, similar to output given below is expected at terminal. The output will provide <code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">SUM</span></code>, <code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">MIN</span></code>, <code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">MAX</span></code> and <code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">COUNT</span></code> information for each kernel executed for a given model.
Average total time is also provided. There are three files provided for reference:</p>
<ol class="arabic simple">
<li><p><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">OUTPUT</span> <span class="pre">CSV</span> <span class="pre">FILE</span></code> provides a summary of the run, providing utilized MIGraphX knobs and related kernel timing information</p></li>
<li><p><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">KERNEL</span> <span class="pre">TIMING</span> <span class="pre">DETAILS</span></code> provides the hotspot kernel timing information</p></li>
<li><p>This will provide all output data related to all iterations executed during a run.</p></li>
</ol>
<p>An example output:</p>
<img alt="../_images/roctx1.jpg" src="../_images/roctx1.jpg" />
<p>Hotspot kerel timing information:</p>
<img alt="../_images/roctx2.jpg" src="../_images/roctx2.jpg" />
<p><strong>Parsing an already existing JSON file:</strong></p>
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">python</span><span class="w"> </span><span class="n">roctx</span><span class="p">.</span><span class="n">py</span><span class="w"> </span><span class="o">--</span><span class="n">parse</span><span class="w"> </span><span class="o">--</span><span class="n">json</span><span class="o">-</span><span class="n">path</span><span class="w"> </span><span class="p">..</span><span class="o">/</span><span class="n">trace</span><span class="p">.</span><span class="n">json</span><span class="w"></span>
</pre></div>
</div>
</section>
</section>


           </div>
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="matchers.html" class="btn btn-neutral float-left" title="Matchers" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2018-2022, AMD.</p>
  </div>

  Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    provided by <a href="https://readthedocs.org">Read the Docs</a>.
   

</footer>
        </div>
      </div>
    </section>
  </div>
  <script>
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>