"git@developer.sourcefind.cn:zhaoyu6/sglang.git" did not exist on "9e8d2c7f7490d553c98abbfc84ecb60a8789f89c"
Commit a7de63a4 authored by Chris Austen's avatar Chris Austen
Browse files

Add documentation from 5.1

parent 608c8f96
<!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>Contributor Guide &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="next" title="MIGraphX Fundamentals" href="dev_intro.html" />
<link rel="prev" title="MIGraphX Driver" href="driver.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="current reference internal" href="#">Contributor Guide</a><ul>
<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="dev/data.html">Data types</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/operators.html">Operators</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/program.html">Program</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/targets.html">Targets</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/quantization.html">Quantization</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/pass.html">Passes</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/matchers.html">Matchers</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/tools.html">Tools</a></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>Contributor Guide</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/contributor_guide.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="contributor-guide">
<h1>Contributor Guide<a class="headerlink" href="#contributor-guide" title="Permalink to this headline"></a></h1>
<div class="toctree-wrapper compound">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="dev_intro.html">MIGraphX Fundamentals</a><ul>
<li class="toctree-l2"><a class="reference internal" href="dev_intro.html#location-of-the-examples">Location of the Examples</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev_intro.html#adding-two-literals">Adding Two Literals</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev_intro.html#using-parameters">Using Parameters</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev_intro.html#handling-tensor-data">Handling Tensor Data</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev_intro.html#importing-from-onnx">Importing From ONNX</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="dev/data.html">Data types</a><ul>
<li class="toctree-l2"><a class="reference internal" href="dev/data.html#shape">shape</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/data.html#literal">literal</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/data.html#argument">argument</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/data.html#raw-data">raw_data</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/data.html#tensor-view">tensor_view</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="dev/operators.html">Operators</a><ul>
<li class="toctree-l2"><a class="reference internal" href="dev/operators.html#operation">operation</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/operators.html#id1">operators</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="dev/program.html">Program</a><ul>
<li class="toctree-l2"><a class="reference internal" href="dev/program.html#instruction">instruction</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/program.html#instruction-ref">instruction_ref</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/program.html#id1">program</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/program.html#parse-onnx">parse_onnx</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/program.html#parse-tf">parse_tf</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/program.html#onnx-options">onnx_options</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/program.html#tf-options">tf_options</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="dev/targets.html">Targets</a><ul>
<li class="toctree-l2"><a class="reference internal" href="dev/targets.html#target">target</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/targets.html#gpu-target">gpu::target</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/targets.html#cpu-target">cpu::target</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="dev/quantization.html">Quantization</a><ul>
<li class="toctree-l2"><a class="reference internal" href="dev/quantization.html#quantize-fp16">quantize_fp16</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/quantization.html#quantize-int8">quantize_int8</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="dev/pass.html">Passes</a><ul>
<li class="toctree-l2"><a class="reference internal" href="dev/pass.html#pass">pass</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/pass.html#dead-code-elimination">dead_code_elimination</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/pass.html#eliminate-common-subexpression">eliminate_common_subexpression</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/pass.html#eliminate-concat">eliminate_concat</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/pass.html#eliminate-contiguous">eliminate_contiguous</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/pass.html#eliminate-identity">eliminate_identity</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/pass.html#eliminate-pad">eliminate_pad</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/pass.html#propagate-constant">propagate_constant</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/pass.html#rewrite-batchnorm">rewrite_batchnorm</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/pass.html#rewrite-rnn">rewrite_rnn</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/pass.html#schedule">schedule</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/pass.html#simplify-algebra">simplify_algebra</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/pass.html#simplify-reshapes">simplify_reshapes</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="dev/matchers.html">Matchers</a><ul>
<li class="toctree-l2"><a class="reference internal" href="dev/matchers.html#introduction">Introduction</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/matchers.html#arguments">Arguments</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/matchers.html#binding">Binding</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/matchers.html#finding-matches">Finding matches</a></li>
<li class="toctree-l2"><a class="reference internal" href="dev/matchers.html#creating-matchers">Creating matchers</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="dev/tools.html">Tools</a><ul>
<li class="toctree-l2"><a class="reference internal" href="dev/tools.html#roctx-py">roctx.py</a></li>
</ul>
</li>
</ul>
</div>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="driver.html" class="btn btn-neutral float-left" title="MIGraphX Driver" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="dev_intro.html" class="btn btn-neutral float-right" title="MIGraphX Fundamentals" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></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>
\ No newline at end of file
<!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>C++ User Guide &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="next" title="C++ Reference" href="reference/cpp.html" />
<link rel="prev" title="Python Reference" href="reference/py.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 current"><a class="current reference internal" href="#">C++ User Guide</a><ul>
<li class="toctree-l2"><a class="reference internal" href="reference/cpp.html">C++ Reference</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="driver.html">MIGraphX Driver</a></li>
<li class="toctree-l1"><a class="reference internal" href="contributor_guide.html">Contributor Guide</a></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>C++ User Guide</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/cpp_user_guide.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="c-user-guide">
<h1>C++ User Guide<a class="headerlink" href="#c-user-guide" title="Permalink to this headline"></a></h1>
<div class="toctree-wrapper compound">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="reference/cpp.html">C++ Reference</a><ul>
<li class="toctree-l2"><a class="reference internal" href="reference/cpp.html#shape">shape</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/cpp.html#argument">argument</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/cpp.html#target">target</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/cpp.html#program">program</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/cpp.html#quantize">quantize</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/cpp.html#parse-onnx">parse_onnx</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/cpp.html#load">load</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/cpp.html#save">save</a></li>
</ul>
</li>
</ul>
</div>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="reference/py.html" class="btn btn-neutral float-left" title="Python Reference" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="reference/cpp.html" class="btn btn-neutral float-right" title="C++ Reference" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></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>
\ No newline at end of file
This diff is collapsed.
<!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>Matchers &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="next" title="Tools" href="tools.html" />
<link rel="prev" title="Passes" href="pass.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 current"><a class="current reference internal" href="#">Matchers</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#introduction">Introduction</a></li>
<li class="toctree-l3"><a class="reference internal" href="#arguments">Arguments</a></li>
<li class="toctree-l3"><a class="reference internal" href="#binding">Binding</a></li>
<li class="toctree-l3"><a class="reference internal" href="#finding-matches">Finding matches</a></li>
<li class="toctree-l3"><a class="reference internal" href="#creating-matchers">Creating matchers</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="tools.html">Tools</a></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>Matchers</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/dev/matchers.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="matchers">
<h1>Matchers<a class="headerlink" href="#matchers" title="Permalink to this headline"></a></h1>
<section id="introduction">
<h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline"></a></h2>
<p>The matchers provide a way compose several predicates together. Many of the matchers can be composed so that <code class="docutils literal notranslate"><span class="pre">m(m1,</span> <span class="pre">m2)</span></code> will first check that <code class="docutils literal notranslate"><span class="pre">m</span></code> matches and then it will check that <code class="docutils literal notranslate"><span class="pre">m1</span></code> and <code class="docutils literal notranslate"><span class="pre">m2</span></code> will match.</p>
<p>The most commonly-used matcher is the <code class="docutils literal notranslate"><span class="pre">name</span></code> matcher. It will match the instruction that have the operator that is equal to the name specified:</p>
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="k">auto</span><span class="w"> </span><span class="n">match_sum</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">name</span><span class="p">(</span><span class="s">&quot;sum&quot;</span><span class="p">);</span><span class="w"></span>
</pre></div>
</div>
<p>This will find <code class="docutils literal notranslate"><span class="pre">sum</span></code> operators. We can also find <code class="docutils literal notranslate"><span class="pre">sum</span></code> operators which the output is <code class="docutils literal notranslate"><span class="pre">standard_shape</span></code>:</p>
<blockquote>
<div><p>auto match_sum = name(“sum”)(standard_shape());</p>
</div></blockquote>
</section>
<section id="arguments">
<h2>Arguments<a class="headerlink" href="#arguments" title="Permalink to this headline"></a></h2>
<p>We also want to match arguments to the instructions as well. One way, is to match each argument using the <code class="docutils literal notranslate"><span class="pre">arg</span></code> matcher:</p>
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="k">auto</span><span class="w"> </span><span class="n">match_sum</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">name</span><span class="p">(</span><span class="s">&quot;sum&quot;</span><span class="p">)(</span><span class="n">arg</span><span class="p">(</span><span class="mi">0</span><span class="p">)(</span><span class="n">name</span><span class="p">(</span><span class="s">&quot;@literal&quot;</span><span class="p">),</span><span class="w"> </span><span class="n">arg</span><span class="p">(</span><span class="mi">1</span><span class="p">)(</span><span class="n">name</span><span class="p">(</span><span class="s">&quot;@literal&quot;</span><span class="p">))));</span><span class="w"></span>
</pre></div>
</div>
<p>This will match a <code class="docutils literal notranslate"><span class="pre">sum</span></code> operator with the two arguments that are literals. Of course, instead of writing <code class="docutils literal notranslate"><span class="pre">arg(0)</span></code> and <code class="docutils literal notranslate"><span class="pre">arg(1)</span></code> everytime, the <code class="docutils literal notranslate"><span class="pre">args</span></code> matcher can be used:</p>
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="k">auto</span><span class="w"> </span><span class="n">match_sum</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">name</span><span class="p">(</span><span class="s">&quot;sum&quot;</span><span class="p">)(</span><span class="n">args</span><span class="p">(</span><span class="n">name</span><span class="p">(</span><span class="s">&quot;@literal&quot;</span><span class="p">),</span><span class="w"> </span><span class="n">name</span><span class="p">(</span><span class="s">&quot;@literal&quot;</span><span class="p">)));</span><span class="w"></span>
</pre></div>
</div>
</section>
<section id="binding">
<h2>Binding<a class="headerlink" href="#binding" title="Permalink to this headline"></a></h2>
<p>As we traverse through the instructions we may want reference some of the instructions we find along the way. We can do this by calling <code class="docutils literal notranslate"><span class="pre">.bind</span></code>:</p>
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="k">auto</span><span class="w"> </span><span class="n">match_sum</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">name</span><span class="p">(</span><span class="s">&quot;sum&quot;</span><span class="p">)(</span><span class="n">args</span><span class="p">(</span><span class="w"></span>
<span class="w"> </span><span class="n">name</span><span class="p">(</span><span class="s">&quot;@literal&quot;</span><span class="p">).</span><span class="n">bind</span><span class="p">(</span><span class="s">&quot;one&quot;</span><span class="p">),</span><span class="w"></span>
<span class="w"> </span><span class="n">name</span><span class="p">(</span><span class="s">&quot;@literal&quot;</span><span class="p">).</span><span class="n">bind</span><span class="p">(</span><span class="s">&quot;two&quot;</span><span class="p">)</span><span class="w"></span>
<span class="w"> </span><span class="p">)).</span><span class="n">bind</span><span class="p">(</span><span class="s">&quot;sum&quot;</span><span class="p">);</span><span class="w"></span>
</pre></div>
</div>
<p>This will associate the instruction to a name that can be read from the <code class="docutils literal notranslate"><span class="pre">matcher_result</span></code> when it matches.</p>
</section>
<section id="finding-matches">
<h2>Finding matches<a class="headerlink" href="#finding-matches" title="Permalink to this headline"></a></h2>
<p>Finally, when you want to use the matchers to find instructions a callback object can be written which has the matcher and an <code class="docutils literal notranslate"><span class="pre">apply</span></code> function which will take the <code class="docutils literal notranslate"><span class="pre">matcher_result</span></code> when the match is found:</p>
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="k">struct</span><span class="w"> </span><span class="nc">match_find_sum</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="k">auto</span><span class="w"> </span><span class="n">matcher</span><span class="p">()</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">name</span><span class="p">(</span><span class="s">&quot;sum&quot;</span><span class="p">);</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w"> </span><span class="kt">void</span><span class="w"> </span><span class="n">apply</span><span class="p">(</span><span class="n">program</span><span class="o">&amp;</span><span class="w"> </span><span class="n">p</span><span class="p">,</span><span class="w"> </span><span class="n">matcher_result</span><span class="w"> </span><span class="n">r</span><span class="p">)</span><span class="w"> </span><span class="k">const</span><span class="w"></span>
<span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="c1">// Do something with the result</span>
<span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">};</span><span class="w"></span>
<span class="n">find_matches</span><span class="p">(</span><span class="n">prog</span><span class="p">,</span><span class="w"> </span><span class="n">match_find_sum</span><span class="p">{});</span><span class="w"></span>
</pre></div>
</div>
</section>
<section id="creating-matchers">
<h2>Creating matchers<a class="headerlink" href="#creating-matchers" title="Permalink to this headline"></a></h2>
<p>There are several ways to create matchers. The macros <code class="docutils literal notranslate"><span class="pre">MIGRAPH_BASIC_MATCHER</span></code> and <code class="docutils literal notranslate"><span class="pre">MIGRAPH_PRED_MATCHER</span></code> help with creating matchers. For example, we can create a matcher for shapes that are broadcasted:</p>
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">MIGRAPH_PRED_MATCHER</span><span class="p">(</span><span class="n">broadcasted_shape</span><span class="p">,</span><span class="w"> </span><span class="n">instruction_ref</span><span class="w"> </span><span class="n">ins</span><span class="p">)</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">ins</span><span class="o">-&gt;</span><span class="n">get_shape</span><span class="p">().</span><span class="n">broadcasted</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>
</div>
<p>If we want parameters to the predicate, then we will need to use the <code class="docutils literal notranslate"><span class="pre">make_basic_pred_matcher</span></code> to create the matcher. For example, here is how we would create a matcher to check the number of dimensions of the shape:</p>
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="kr">inline</span><span class="w"> </span><span class="k">auto</span><span class="w"> </span><span class="n">number_of_dims</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="kt">size_t</span><span class="w"> </span><span class="n">n</span><span class="p">)</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">make_basic_pred_matcher</span><span class="p">([</span><span class="o">=</span><span class="p">](</span><span class="n">instruction_ref</span><span class="w"> </span><span class="n">ins</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">ins</span><span class="o">-&gt;</span><span class="n">get_shape</span><span class="p">().</span><span class="n">lens</span><span class="p">().</span><span class="n">size</span><span class="p">()</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">n</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="p">});</span><span class="w"></span>
<span class="p">}</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="pass.html" class="btn btn-neutral float-left" title="Passes" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="tools.html" class="btn btn-neutral float-right" title="Tools" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></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>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<!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>Quantization &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="next" title="Passes" href="pass.html" />
<link rel="prev" title="Targets" href="targets.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 current"><a class="current reference internal" href="#">Quantization</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#quantize-fp16">quantize_fp16</a></li>
<li class="toctree-l3"><a class="reference internal" href="#quantize-int8">quantize_int8</a></li>
</ul>
</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"><a class="reference internal" href="tools.html">Tools</a></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>Quantization</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/dev/quantization.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="quantization">
<h1>Quantization<a class="headerlink" href="#quantization" title="Permalink to this headline"></a></h1>
<section id="quantize-fp16">
<h2>quantize_fp16<a class="headerlink" href="#quantize-fp16" title="Permalink to this headline"></a></h2>
<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv4N8migraphx8internal13quantize_fp16ER7programRKNSt6vectorINSt6stringEEE">
<span id="_CPPv3N8migraphx8internal13quantize_fp16ER7programRKNSt6vectorINSt6stringEEE"></span><span id="_CPPv2N8migraphx8internal13quantize_fp16ER7programRKNSt6vectorINSt6stringEEE"></span><span id="migraphx::internal::quantize_fp16__programR.std::vector:ss:CR"></span><span class="target" id="namespacemigraphx_1_1internal_1a3da28d9084091d7603e0c5ca571bc026"></span><span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="sig-prename descclassname"><span class="n"><span class="pre">migraphx</span></span><span class="p"><span class="pre">::</span></span><span class="n"><span class="pre">internal</span></span><span class="p"><span class="pre">::</span></span></span><span class="sig-name descname"><span class="n"><span class="pre">quantize_fp16</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="program.html#_CPPv4N8migraphx8internal7programE" title="migraphx::internal::program"><span class="n"><span class="pre">program</span></span></a><span class="w"> </span><span class="p"><span class="pre">&amp;</span></span><span class="n sig-param"><span class="pre">prog</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="n"><span class="pre">std</span></span><span class="p"><span class="pre">::</span></span><span class="n"><span class="pre">vector</span></span><span class="p"><span class="pre">&lt;</span></span><span class="n"><span class="pre">std</span></span><span class="p"><span class="pre">::</span></span><span class="n"><span class="pre">string</span></span><span class="p"><span class="pre">&gt;</span></span><span class="w"> </span><span class="p"><span class="pre">&amp;</span></span><span class="n sig-param"><span class="pre">ins_names</span></span><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="p"><span class="pre">{</span></span><s><span class="pre">&quot;all&quot;</span></s><span class="p"><span class="pre">}</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv4N8migraphx8internal13quantize_fp16ER7programRKNSt6vectorINSt6stringEEE" title="Permalink to this definition"></a><br /></dt>
<dd></dd></dl>
</section>
<section id="quantize-int8">
<h2>quantize_int8<a class="headerlink" href="#quantize-int8" title="Permalink to this headline"></a></h2>
<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv4N8migraphx8internal13quantize_int8ER7programRK6targetRKNSt6vectorI13parameter_mapEERKNSt6vectorINSt6stringEEE">
<span id="_CPPv3N8migraphx8internal13quantize_int8ER7programRK6targetRKNSt6vectorI13parameter_mapEERKNSt6vectorINSt6stringEEE"></span><span id="_CPPv2N8migraphx8internal13quantize_int8ER7programRK6targetRKNSt6vectorI13parameter_mapEERKNSt6vectorINSt6stringEEE"></span><span id="migraphx::internal::quantize_int8__programR.targetCR.std::vector:parameter_map:CR.std::vector:ss:CR"></span><span class="target" id="namespacemigraphx_1_1internal_1a1bce2cbf7df6939443d7f2921fd4dba3"></span><span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="sig-prename descclassname"><span class="n"><span class="pre">migraphx</span></span><span class="p"><span class="pre">::</span></span><span class="n"><span class="pre">internal</span></span><span class="p"><span class="pre">::</span></span></span><span class="sig-name descname"><span class="n"><span class="pre">quantize_int8</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="program.html#_CPPv4N8migraphx8internal7programE" title="migraphx::internal::program"><span class="n"><span class="pre">program</span></span></a><span class="w"> </span><span class="p"><span class="pre">&amp;</span></span><span class="n sig-param"><span class="pre">prog</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><a class="reference internal" href="targets.html#_CPPv4N8migraphx8internal6targetE" title="migraphx::internal::target"><span class="n"><span class="pre">target</span></span></a><span class="w"> </span><span class="p"><span class="pre">&amp;</span></span><span class="n sig-param"><span class="pre">t</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="n"><span class="pre">std</span></span><span class="p"><span class="pre">::</span></span><span class="n"><span class="pre">vector</span></span><span class="p"><span class="pre">&lt;</span></span><span class="n"><span class="pre">parameter_map</span></span><span class="p"><span class="pre">&gt;</span></span><span class="w"> </span><span class="p"><span class="pre">&amp;</span></span><span class="n sig-param"><span class="pre">calibration</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="n"><span class="pre">std</span></span><span class="p"><span class="pre">::</span></span><span class="n"><span class="pre">vector</span></span><span class="p"><span class="pre">&lt;</span></span><span class="n"><span class="pre">std</span></span><span class="p"><span class="pre">::</span></span><span class="n"><span class="pre">string</span></span><span class="p"><span class="pre">&gt;</span></span><span class="w"> </span><span class="p"><span class="pre">&amp;</span></span><span class="n sig-param"><span class="pre">ins_names</span></span><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="p"><span class="pre">{</span></span><s><span class="pre">&quot;dot&quot;</span></s><span class="p"><span class="pre">,</span></span><span class="w"> </span><s><span class="pre">&quot;convolution&quot;</span></s><span class="p"><span class="pre">}</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv4N8migraphx8internal13quantize_int8ER7programRK6targetRKNSt6vectorI13parameter_mapEERKNSt6vectorINSt6stringEEE" title="Permalink to this definition"></a><br /></dt>
<dd></dd></dl>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="targets.html" class="btn btn-neutral float-left" title="Targets" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="pass.html" class="btn btn-neutral float-right" title="Passes" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></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>
\ No newline at end of file
This diff is collapsed.
<!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>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment