Skip to content

Commit 9d5c43c

Browse files
Update docs
1 parent 51263d0 commit 9d5c43c

File tree

5 files changed

+64
-1
lines changed

5 files changed

+64
-1
lines changed

_sources/autoapi/tilelang/language/allocate/index.rst.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Functions
3232
tilelang.language.allocate.alloc_fragment
3333
tilelang.language.allocate.alloc_var
3434
tilelang.language.allocate.alloc_barrier
35+
tilelang.language.allocate.alloc_reducer
3536

3637

3738
Module Contents
@@ -106,3 +107,30 @@ Module Contents
106107
:rtype: T.Buffer
107108

108109

110+
.. py:function:: alloc_reducer(shape, dtype, op='sum', replication=None)
111+
112+
Allocate a reducer buffer.
113+
114+
Modifications needs to conform with `op`,
115+
such as `op="sum"` requires `reducer[...] += ...` and
116+
`op="max"` requires `reducer[...] = T.max(reducer[...], ...)`.
117+
118+
Only after T.fill with proper initializer the reduction may begin;
119+
only after T.finalize_reducer the partial results will be available.
120+
121+
For `op="sum"`, filled value must be 0; for min and max, the filled initializer will become max or min clamper correspondingly.
122+
You may want to use `T.max_value` for min and `T.min_value` for max.
123+
124+
:param shape: The shape of the buffer to allocate
125+
:type shape: tuple
126+
:param dtype: The data type of the buffer (e.g., 'float32', 'int32')
127+
:type dtype: str
128+
:param op: The reduce operation corresponded with the reducer
129+
:type op: str
130+
:param replication: Replication strategy, can be "all" or "none". Defaults to not specified, and the compiler will do whatever it want.
131+
:type replication: str | None
132+
133+
:returns: A TVM buffer object allocated in thread-private storage, available to reduce values in T.Parallel loops.
134+
:rtype: T.Buffer
135+
136+

autoapi/tilelang/language/allocate/index.html

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,9 @@ <h2>Functions<a class="headerlink" href="#functions" title="Link to this heading
504504
<tr class="row-odd"><td><p><a class="reference internal" href="#tilelang.language.allocate.alloc_barrier" title="tilelang.language.allocate.alloc_barrier"><code class="xref py py-obj docutils literal notranslate"><span class="pre">alloc_barrier</span></code></a>(arrive_count)</p></td>
505505
<td><p>Allocate a barrier buffer.</p></td>
506506
</tr>
507+
<tr class="row-even"><td><p><a class="reference internal" href="#tilelang.language.allocate.alloc_reducer" title="tilelang.language.allocate.alloc_reducer"><code class="xref py py-obj docutils literal notranslate"><span class="pre">alloc_reducer</span></code></a>(shape, dtype[, op, replication])</p></td>
508+
<td><p>Allocate a reducer buffer.</p></td>
509+
</tr>
507510
</tbody>
508511
</table>
509512
</div>
@@ -610,6 +613,35 @@ <h2>Module Contents<a class="headerlink" href="#module-contents" title="Link to
610613
</dl>
611614
</dd></dl>
612615

616+
<dl class="py function">
617+
<dt class="sig sig-object py" id="tilelang.language.allocate.alloc_reducer">
618+
<span class="sig-prename descclassname"><span class="pre">tilelang.language.allocate.</span></span><span class="sig-name descname"><span class="pre">alloc_reducer</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">shape</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dtype</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">op</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'sum'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">replication</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tilelang.language.allocate.alloc_reducer" title="Link to this definition"></a></dt>
619+
<dd><p>Allocate a reducer buffer.</p>
620+
<p>Modifications needs to conform with <cite>op</cite>,
621+
such as <cite>op=”sum”</cite> requires <cite>reducer[…] += …</cite> and
622+
<cite>op=”max”</cite> requires <cite>reducer[…] = T.max(reducer[…], …)</cite>.</p>
623+
<p>Only after T.fill with proper initializer the reduction may begin;
624+
only after T.finalize_reducer the partial results will be available.</p>
625+
<p>For <cite>op=”sum”</cite>, filled value must be 0; for min and max, the filled initializer will become max or min clamper correspondingly.
626+
You may want to use <cite>T.max_value</cite> for min and <cite>T.min_value</cite> for max.</p>
627+
<dl class="field-list simple">
628+
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
629+
<dd class="field-odd"><ul class="simple">
630+
<li><p><strong>shape</strong> (<em>tuple</em>) – The shape of the buffer to allocate</p></li>
631+
<li><p><strong>dtype</strong> (<em>str</em>) – The data type of the buffer (e.g., ‘float32’, ‘int32’)</p></li>
632+
<li><p><strong>op</strong> (<em>str</em>) – The reduce operation corresponded with the reducer</p></li>
633+
<li><p><strong>replication</strong> (<em>str</em><em> | </em><em>None</em>) – Replication strategy, can be “all” or “none”. Defaults to not specified, and the compiler will do whatever it want.</p></li>
634+
</ul>
635+
</dd>
636+
<dt class="field-even">Returns<span class="colon">:</span></dt>
637+
<dd class="field-even"><p>A TVM buffer object allocated in thread-private storage, available to reduce values in T.Parallel loops.</p>
638+
</dd>
639+
<dt class="field-odd">Return type<span class="colon">:</span></dt>
640+
<dd class="field-odd"><p>T.Buffer</p>
641+
</dd>
642+
</dl>
643+
</dd></dl>
644+
613645
</section>
614646
</section>
615647

@@ -676,6 +708,7 @@ <h2>Module Contents<a class="headerlink" href="#module-contents" title="Link to
676708
<li><a class="reference internal" href="#tilelang.language.allocate.alloc_fragment"><code class="docutils literal notranslate"><span class="pre">alloc_fragment()</span></code></a></li>
677709
<li><a class="reference internal" href="#tilelang.language.allocate.alloc_var"><code class="docutils literal notranslate"><span class="pre">alloc_var()</span></code></a></li>
678710
<li><a class="reference internal" href="#tilelang.language.allocate.alloc_barrier"><code class="docutils literal notranslate"><span class="pre">alloc_barrier()</span></code></a></li>
711+
<li><a class="reference internal" href="#tilelang.language.allocate.alloc_reducer"><code class="docutils literal notranslate"><span class="pre">alloc_reducer()</span></code></a></li>
679712
</ul>
680713
</li>
681714
</ul>

genindex.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,8 @@ <h2>A</h2>
701701
<li><a href="autoapi/tilelang/language/allocate/index.html#tilelang.language.allocate.alloc_fragment">alloc_fragment() (in module tilelang.language.allocate)</a>
702702
</li>
703703
<li><a href="autoapi/tilelang/language/allocate/index.html#tilelang.language.allocate.alloc_local">alloc_local() (in module tilelang.language.allocate)</a>
704+
</li>
705+
<li><a href="autoapi/tilelang/language/allocate/index.html#tilelang.language.allocate.alloc_reducer">alloc_reducer() (in module tilelang.language.allocate)</a>
704706
</li>
705707
<li><a href="autoapi/tilelang/language/allocate/index.html#tilelang.language.allocate.alloc_shared">alloc_shared() (in module tilelang.language.allocate)</a>
706708
</li>

objects.inv

3 Bytes
Binary file not shown.

searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)