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
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vector Predication Roadmap — LLVM 13 documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/llvm-theme.css" type="text/css" />
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="prev" title="Variable Names Plan" href="VariableNames.html" />
<style type="text/css">
table.right { float: right; margin-left: 20px; }
table.right td { border: 1px solid #ccc; }
</style>
</head><body>
<div class="logo">
<a href="../index.html">
<img src="../_static/logo.png"
alt="LLVM Logo" width="250" height="88"/></a>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="VariableNames.html" title="Variable Names Plan"
accesskey="P">previous</a> |</li>
<li><a href="https://llvm.org/">LLVM Home</a> | </li>
<li><a href="../index.html">Documentation</a>»</li>
<li class="nav-item nav-item-1"><a href="../GettingInvolved.html" accesskey="U">Getting Involved</a> »</li>
<li class="nav-item nav-item-this"><a href="">Vector Predication Roadmap</a></li>
</ul>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3>Documentation</h3>
<ul class="want-points">
<li><a href="https://llvm.org/docs/GettingStartedTutorials.html">Getting Started/Tutorials</a></li>
<li><a href="https://llvm.org/docs/UserGuides.html">User Guides</a></li>
<li><a href="https://llvm.org/docs/Reference.html">Reference</a></li>
</ul>
<h3>Getting Involved</h3>
<ul class="want-points">
<li><a href="https://llvm.org/docs/Contributing.html">Contributing to LLVM</a></li>
<li><a href="https://llvm.org/docs/HowToSubmitABug.html">Submitting Bug Reports</a></li>
<li><a href="https://llvm.org/docs/GettingInvolved.html#mailing-lists">Mailing Lists</a></li>
<li><a href="https://llvm.org/docs/GettingInvolved.html#irc">IRC</a></li>
<li><a href="https://llvm.org/docs/GettingInvolved.html#meetups-and-social-events">Meetups and Social Events</a></li>
</ul>
<h3>Additional Links</h3>
<ul class="want-points">
<li><a href="https://llvm.org/docs/FAQ.html">FAQ</a></li>
<li><a href="https://llvm.org/docs/Lexicon.html">Glossary</a></li>
<li><a href="https://llvm.org/pubs">Publications</a></li>
<li><a href="https://github.com/llvm/llvm-project//">Github Repository</a></li>
</ul>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/Proposals/VectorPredication.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="vector-predication-roadmap">
<h1>Vector Predication Roadmap<a class="headerlink" href="#vector-predication-roadmap" title="Permalink to this headline">¶</a></h1>
<div class="contents local topic" id="table-of-contents">
<p class="topic-title">Table of Contents</p>
<ul class="simple">
<li><p><a class="reference internal" href="#motivation" id="id3">Motivation</a></p></li>
<li><p><a class="reference internal" href="#roadmap" id="id4">Roadmap</a></p>
<ul>
<li><p><a class="reference internal" href="#ir-level-vp-intrinsics" id="id5">1. IR-level VP intrinsics</a></p></li>
<li><p><a class="reference internal" href="#codegen-support" id="id6">2. CodeGen support</a></p></li>
<li><p><a class="reference internal" href="#lift-instsimplify-instcombine-dagcombiner-to-vp" id="id7">3. Lift InstSimplify/InstCombine/DAGCombiner to VP</a></p></li>
<li><p><a class="reference internal" href="#deprecate-llvm-masked-llvm-experimental-reduce" id="id8">4. Deprecate llvm.masked.* / llvm.experimental.reduce.*</a></p></li>
<li><p><a class="reference internal" href="#predicated-ir-instructions" id="id9">5. Predicated IR Instructions</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#references" id="id10">References</a></p></li>
</ul>
</div>
<div class="section" id="motivation">
<h2><a class="toc-backref" href="#id3">Motivation</a><a class="headerlink" href="#motivation" title="Permalink to this headline">¶</a></h2>
<p>This proposal defines a roadmap towards native vector predication in LLVM,
specifically for vector instructions with a mask and/or an explicit vector
length. LLVM currently has no target-independent means to model predicated
vector instructions for modern SIMD ISAs such as AVX512, ARM SVE, the RISC-V V
extension and NEC SX-Aurora. Only some predicated vector operations, such as
masked loads and stores, are available through intrinsics <a class="reference internal" href="#maskedir" id="id1"><span>[MaskedIR]</span></a>.</p>
<p>The Vector Predication (VP) extensions is a concrete RFC and prototype
implementation to achieve native vector predication in LLVM. The VP prototype
and all related discussions can be found in the VP patch on Phabricator
<a class="reference internal" href="#vprfc" id="id2"><span>[VPRFC]</span></a>.</p>
</div>
<div class="section" id="roadmap">
<h2><a class="toc-backref" href="#id4">Roadmap</a><a class="headerlink" href="#roadmap" title="Permalink to this headline">¶</a></h2>
<div class="section" id="ir-level-vp-intrinsics">
<h3><a class="toc-backref" href="#id5">1. IR-level VP intrinsics</a><a class="headerlink" href="#ir-level-vp-intrinsics" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li><p>There is a consensus on the semantics/instruction set of VP.</p></li>
<li><p>VP intrinsics and attributes are available on IR level.</p></li>
<li><p>TTI has capability flags for VP (<code class="docutils literal notranslate"><span class="pre">supportsVP()</span></code>?,
<code class="docutils literal notranslate"><span class="pre">haveActiveVectorLength()</span></code>?).</p></li>
</ul>
<p>Result: VP usable for IR-level vectorizers (LV, VPlan, RegionVectorizer),
potential integration in Clang with builtins.</p>
</div>
<div class="section" id="codegen-support">
<h3><a class="toc-backref" href="#id6">2. CodeGen support</a><a class="headerlink" href="#codegen-support" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li><p>VP intrinsics translate to first-class SDNodes
(eg <code class="docutils literal notranslate"><span class="pre">llvm.vp.fdiv.*</span> <span class="pre">-></span> <span class="pre">vp_fdiv</span></code>).</p></li>
<li><p>VP legalization (legalize explicit vector length to mask (AVX512), legalize VP
SDNodes to pre-existing ones (SSE, NEON)).</p></li>
</ul>
<p>Result: Backend development based on VP SDNodes.</p>
</div>
<div class="section" id="lift-instsimplify-instcombine-dagcombiner-to-vp">
<h3><a class="toc-backref" href="#id7">3. Lift InstSimplify/InstCombine/DAGCombiner to VP</a><a class="headerlink" href="#lift-instsimplify-instcombine-dagcombiner-to-vp" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li><p>Introduce PredicatedInstruction, PredicatedBinaryOperator, .. helper classes
that match standard vector IR and VP intrinsics.</p></li>
<li><p>Add a matcher context to PatternMatch and context-aware IR Builder APIs.</p></li>
<li><p>Incrementally lift DAGCombiner to work on VP SDNodes as well as on regular
vector instructions.</p></li>
<li><p>Incrementally lift InstCombine/InstSimplify to operate on VP as well as
regular IR instructions.</p></li>
</ul>
<p>Result: Optimization of VP intrinsics on par with standard vector instructions.</p>
</div>
<div class="section" id="deprecate-llvm-masked-llvm-experimental-reduce">
<h3><a class="toc-backref" href="#id8">4. Deprecate llvm.masked.* / llvm.experimental.reduce.*</a><a class="headerlink" href="#deprecate-llvm-masked-llvm-experimental-reduce" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li><p>Modernize llvm.masked.* / llvm.experimental.reduce* by translating to VP.</p></li>
<li><p>DCE transitional APIs.</p></li>
</ul>
<p>Result: VP has superseded earlier vector intrinsics.</p>
</div>
<div class="section" id="predicated-ir-instructions">
<h3><a class="toc-backref" href="#id9">5. Predicated IR Instructions</a><a class="headerlink" href="#predicated-ir-instructions" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li><p>Vector instructions have an optional mask and vector length parameter. These
lower to VP SDNodes (from Stage 2).</p></li>
<li><p>Phase out VP intrinsics, only keeping those that are not equivalent to
vectorized scalar instructions (reduce, shuffles, ..)</p></li>
<li><p>InstCombine/InstSimplify expect predication in regular Instructions (Stage (3)
has laid the groundwork).</p></li>
</ul>
<p>Result: Native vector predication in IR.</p>
</div>
</div>
<div class="section" id="references">
<h2><a class="toc-backref" href="#id10">References</a><a class="headerlink" href="#references" title="Permalink to this headline">¶</a></h2>
<dl class="citation">
<dt class="label" id="maskedir"><span class="brackets"><a class="fn-backref" href="#id1">MaskedIR</a></span></dt>
<dd><p><cite>llvm.masked.*</cite> intrinsics,
<a class="reference external" href="https://llvm.org/docs/LangRef.html#masked-vector-load-and-store-intrinsics">https://llvm.org/docs/LangRef.html#masked-vector-load-and-store-intrinsics</a></p>
</dd>
<dt class="label" id="vprfc"><span class="brackets"><a class="fn-backref" href="#id2">VPRFC</a></span></dt>
<dd><p>RFC: Prototype & Roadmap for vector predication in LLVM,
<a class="reference external" href="https://reviews.llvm.org/D57504">https://reviews.llvm.org/D57504</a></p>
</dd>
</dl>
</div>
</div>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="VariableNames.html" title="Variable Names Plan"
>previous</a> |</li>
<li><a href="https://llvm.org/">LLVM Home</a> | </li>
<li><a href="../index.html">Documentation</a>»</li>
<li class="nav-item nav-item-1"><a href="../GettingInvolved.html" >Getting Involved</a> »</li>
<li class="nav-item nav-item-this"><a href="">Vector Predication Roadmap</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2003-2021, LLVM Project.
Last updated on 2021-09-18.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.5.4.
</div>
</body>
</html>
|