Skip to content

Commit d9960a6

Browse files
Update docs
1 parent 22dca90 commit d9960a6

File tree

152 files changed

+1759
-52
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+1759
-52
lines changed

_sources/autoapi/tilelang/intrinsics/utils/index.rst.txt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Functions
1616
tilelang.intrinsics.utils.mma_store_index_map
1717
tilelang.intrinsics.utils.mfma_store_index_map
1818
tilelang.intrinsics.utils.get_mma_micro_size
19-
tilelang.intrinsics.utils.index_to_coordinates
2019

2120

2221
Module Contents
@@ -36,16 +35,3 @@ Module Contents
3635
3736
.. py:function:: get_mma_micro_size(dtype)
3837
39-
.. py:function:: index_to_coordinates(index, shape)
40-
41-
General Implementation of:
42-
vjj = index % (micro_size_k // num_elems_per_byte)
43-
coordinates[-1] = index % shape[-1];
44-
vii = index // (micro_size_k // num_elems_per_byte) % micro_size_y
45-
index = index // shape[-1]; coordinates[-2] = index % shape[-2];
46-
vj = index // (micro_size_k // num_elems_per_byte * micro_size_y) % block_K // (micro_size_k // num_elems_per_byte)
47-
index = index // shape[-2]; coordinates[-3] = index % shape[-3];
48-
vi = index // (micro_size_k // num_elems_per_byte * micro_size_y * (block_K // (micro_size_k // num_elems_per_byte))) % block_N // micro_size_y
49-
index = index // shape[-3]; coordinates[-4] = index % shape[-4];
50-
51-

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Submodules
3333
/autoapi/tilelang/language/proxy/index
3434
/autoapi/tilelang/language/reduce/index
3535
/autoapi/tilelang/language/tir/index
36+
/autoapi/tilelang/language/utils/index
3637
/autoapi/tilelang/language/warpgroup/index
3738

3839

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
tilelang.language.utils
2+
=======================
3+
4+
.. py:module:: tilelang.language.utils
5+
6+
7+
Functions
8+
---------
9+
10+
.. autoapisummary::
11+
12+
tilelang.language.utils.index_to_coordinates
13+
tilelang.language.utils.linear_index
14+
15+
16+
Module Contents
17+
---------------
18+
19+
.. py:function:: index_to_coordinates(index, shape)
20+
21+
Convert a flat (linear) index to multi-dimensional coordinates for a given shape.
22+
23+
.. rubric:: Example
24+
25+
shape = (4, 5, 6)
26+
index = 53
27+
index_to_coordinates(53, (4, 5, 6)) -> [1, 3, 5]
28+
# Explanation:
29+
# 53 // (5*6) = 1 (1st coordinate)
30+
# 53 % (5*6) = 23
31+
# 23 // 6 = 3 (2nd coordinate)
32+
# 23 % 6 = 5 (3rd coordinate)
33+
34+
:param index: The flat index to convert.
35+
:type index: int
36+
:param shape: The shape of the multi-dimensional array.
37+
:type shape: tuple or list of int
38+
39+
:returns: A list of coordinates corresponding to each dimension.
40+
:rtype: list
41+
42+
43+
.. py:function:: linear_index(*args)
44+
45+
Convert a list of coordinates to a flat (linear) index using strides.
46+
47+
Usage examples:
48+
linear_index(i) -> i
49+
linear_index(i, j) -> i * stride + j
50+
linear_index(i, j, stride_j) -> i * stride_j + j
51+
linear_index(i, j, k, stride_j, stride_k)
52+
-> i * stride_j * stride_k + j * stride_k + k
53+
54+
Example for index = i * threads * local_size + tx * local_size + v:
55+
Suppose you have i, tx, v as coordinates, and threads, local_size as strides:
56+
linear_index(i, tx, v, threads, local_size) == i * threads * local_size + tx * local_size + v
57+
58+

_sources/autoapi/tilelang/quantize/index.rst.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Submodules
1111
:maxdepth: 1
1212

1313
/autoapi/tilelang/quantize/lop3/index
14+
/autoapi/tilelang/quantize/mxfp/index
1415
/autoapi/tilelang/quantize/quantization/index
1516
/autoapi/tilelang/quantize/utils/index
1617

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
tilelang.quantize.mxfp
2+
======================
3+
4+
.. py:module:: tilelang.quantize.mxfp
5+
6+
7+
Attributes
8+
----------
9+
10+
.. autoapisummary::
11+
12+
tilelang.quantize.mxfp.decode_f4_to_bf16_twiddling
13+
14+
15+
Functions
16+
---------
17+
18+
.. autoapisummary::
19+
20+
tilelang.quantize.mxfp.get_mxfp_intrin_group
21+
22+
23+
Module Contents
24+
---------------
25+
26+
.. py:data:: decode_f4_to_bf16_twiddling
27+
:value: Multiline-String
28+
29+
.. raw:: html
30+
31+
<details><summary>Show Value</summary>
32+
33+
.. code-block:: python
34+
35+
"""
36+
// N should be the number of elements processed by one thread
37+
template<typename T1, typename T2>
38+
__device__ void decode_fp4_to_bf16_twiddling(T1 *B_local, T2 *B_local_decode, const int N = 8) {
39+
#pragma unroll
40+
for (int i = 0; i < N; ++i) {
41+
uint B_dequantize_local_vec[4];
42+
uint tmp, bias, d0, d1, d2, d3, d4, d5, d6;
43+
asm volatile(
44+
// To handle the endianness issue
45+
"prmt.b32 %13, %4, 0, 0x0123;"
46+
"mov.b32 %12, 0x7e807e80;"
47+
"and.b32 %0, %13, 0b10000001110000001000000111000000;"
48+
"mul.bf16x2 %0, %0, %12;"
49+
"shl.b32 %1, %13, 3;"
50+
"and.b32 %1, %1, 0b10000001110000001000000111000000;"
51+
"mul.bf16x2 %1, %1, %12;"
52+
"shl.b32 %2, %13, 6;"
53+
"and.b32 %2, %2, 0b10000001110000001000000111000000;"
54+
"mul.bf16x2 %2, %2, %12;"
55+
"shl.b32 %5, %13, 1;"
56+
"and.b32 %6, %5, 0b10000000000000001000000000000000;"
57+
"shr.b32 %7, %13, 3;"
58+
"and.b32 %8, %7, 0b00000001100000000000000110000000;"
59+
"or.b32 %9, %6, %8;"
60+
"shr.b32 %10, %13, 7;"
61+
"and.b32 %11, %10, 0b00000000010000000000000001000000;"
62+
"or.b32 %3, %9, %11;"
63+
"mul.bf16x2 %3, %3, %12;"
64+
:"=r"(B_dequantize_local_vec[0])
65+
,"=r"(B_dequantize_local_vec[1])
66+
,"=r"(B_dequantize_local_vec[2])
67+
,"=r"(B_dequantize_local_vec[3])
68+
:"r"(*(uint*)&B_local[i << 2]), "r"(d0), "r"(d1), "r"(d2), "r"(d3), "r"(d4), "r"(d5), "r"(d6), "r"(bias), "r"(tmp)
69+
);
70+
for (int j = 0; j < 4; ++j) {
71+
// Pay attention to the big-endianness issue
72+
B_local_decode[(i << 3) + j] = reinterpret_cast<T2*>(&B_dequantize_local_vec[j])[1];
73+
B_local_decode[(i << 3) + j + 4] = reinterpret_cast<T2*>(&B_dequantize_local_vec[j])[0];
74+
}
75+
}
76+
// Check if the synchronization is needed
77+
}
78+
"""
79+
80+
.. raw:: html
81+
82+
</details>
83+
84+
85+
86+
.. py:function:: get_mxfp_intrin_group(out_dtype = 'bfloat16', source_format = 'uint', source_bit = 4, storage_dtype = 'uint8', use_twiddling = False)
87+
88+
This function is used to get the intrinsic group of the MXFP operation to avoid the overhead of fast decoding.
89+
MXFP is a type of logic operation that takes three inputs. The intrinsic group refers to the set of
90+
intrinsic operations that can be performed on these inputs. This function retrieves and returns this group.
91+
92+

autoapi/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@
363363
<li class="toctree-l4"><a class="reference internal" href="tilelang/language/tir/op/index.html">tilelang.language.tir.op</a></li>
364364
</ul>
365365
</li>
366+
<li class="toctree-l3"><a class="reference internal" href="tilelang/language/utils/index.html">tilelang.language.utils</a></li>
366367
<li class="toctree-l3"><a class="reference internal" href="tilelang/language/warpgroup/index.html">tilelang.language.warpgroup</a></li>
367368
</ul>
368369
</li>
@@ -388,6 +389,7 @@
388389
</li>
389390
<li class="toctree-l2 has-children"><a class="reference internal" href="tilelang/quantize/index.html">tilelang.quantize</a><input class="toctree-checkbox" id="toctree-checkbox-27" name="toctree-checkbox-27" role="switch" type="checkbox"/><label for="toctree-checkbox-27"><div class="visually-hidden">Toggle navigation of tilelang.quantize</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
390391
<li class="toctree-l3"><a class="reference internal" href="tilelang/quantize/lop3/index.html">tilelang.quantize.lop3</a></li>
392+
<li class="toctree-l3"><a class="reference internal" href="tilelang/quantize/mxfp/index.html">tilelang.quantize.mxfp</a></li>
391393
<li class="toctree-l3"><a class="reference internal" href="tilelang/quantize/quantization/index.html">tilelang.quantize.quantization</a></li>
392394
<li class="toctree-l3"><a class="reference internal" href="tilelang/quantize/utils/index.html">tilelang.quantize.utils</a></li>
393395
</ul>
@@ -601,6 +603,7 @@ <h1>API Reference<a class="headerlink" href="#api-reference" title="Link to this
601603
<li class="toctree-l4"><a class="reference internal" href="tilelang/language/tir/op/index.html">tilelang.language.tir.op</a></li>
602604
</ul>
603605
</li>
606+
<li class="toctree-l3"><a class="reference internal" href="tilelang/language/utils/index.html">tilelang.language.utils</a></li>
604607
<li class="toctree-l3"><a class="reference internal" href="tilelang/language/warpgroup/index.html">tilelang.language.warpgroup</a></li>
605608
</ul>
606609
</li>
@@ -626,6 +629,7 @@ <h1>API Reference<a class="headerlink" href="#api-reference" title="Link to this
626629
</li>
627630
<li class="toctree-l2"><a class="reference internal" href="tilelang/quantize/index.html">tilelang.quantize</a><ul>
628631
<li class="toctree-l3"><a class="reference internal" href="tilelang/quantize/lop3/index.html">tilelang.quantize.lop3</a></li>
632+
<li class="toctree-l3"><a class="reference internal" href="tilelang/quantize/mxfp/index.html">tilelang.quantize.mxfp</a></li>
629633
<li class="toctree-l3"><a class="reference internal" href="tilelang/quantize/quantization/index.html">tilelang.quantize.quantization</a></li>
630634
<li class="toctree-l3"><a class="reference internal" href="tilelang/quantize/utils/index.html">tilelang.quantize.utils</a></li>
631635
</ul>

autoapi/tilelang/autotuner/capture/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@
363363
<li class="toctree-l4"><a class="reference internal" href="../../language/tir/op/index.html">tilelang.language.tir.op</a></li>
364364
</ul>
365365
</li>
366+
<li class="toctree-l3"><a class="reference internal" href="../../language/utils/index.html">tilelang.language.utils</a></li>
366367
<li class="toctree-l3"><a class="reference internal" href="../../language/warpgroup/index.html">tilelang.language.warpgroup</a></li>
367368
</ul>
368369
</li>
@@ -388,6 +389,7 @@
388389
</li>
389390
<li class="toctree-l2 has-children"><a class="reference internal" href="../../quantize/index.html">tilelang.quantize</a><input class="toctree-checkbox" id="toctree-checkbox-27" name="toctree-checkbox-27" role="switch" type="checkbox"/><label for="toctree-checkbox-27"><div class="visually-hidden">Toggle navigation of tilelang.quantize</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
390391
<li class="toctree-l3"><a class="reference internal" href="../../quantize/lop3/index.html">tilelang.quantize.lop3</a></li>
392+
<li class="toctree-l3"><a class="reference internal" href="../../quantize/mxfp/index.html">tilelang.quantize.mxfp</a></li>
391393
<li class="toctree-l3"><a class="reference internal" href="../../quantize/quantization/index.html">tilelang.quantize.quantization</a></li>
392394
<li class="toctree-l3"><a class="reference internal" href="../../quantize/utils/index.html">tilelang.quantize.utils</a></li>
393395
</ul>

autoapi/tilelang/autotuner/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@
363363
<li class="toctree-l4"><a class="reference internal" href="../language/tir/op/index.html">tilelang.language.tir.op</a></li>
364364
</ul>
365365
</li>
366+
<li class="toctree-l3"><a class="reference internal" href="../language/utils/index.html">tilelang.language.utils</a></li>
366367
<li class="toctree-l3"><a class="reference internal" href="../language/warpgroup/index.html">tilelang.language.warpgroup</a></li>
367368
</ul>
368369
</li>
@@ -388,6 +389,7 @@
388389
</li>
389390
<li class="toctree-l2 has-children"><a class="reference internal" href="../quantize/index.html">tilelang.quantize</a><input class="toctree-checkbox" id="toctree-checkbox-27" name="toctree-checkbox-27" role="switch" type="checkbox"/><label for="toctree-checkbox-27"><div class="visually-hidden">Toggle navigation of tilelang.quantize</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
390391
<li class="toctree-l3"><a class="reference internal" href="../quantize/lop3/index.html">tilelang.quantize.lop3</a></li>
392+
<li class="toctree-l3"><a class="reference internal" href="../quantize/mxfp/index.html">tilelang.quantize.mxfp</a></li>
391393
<li class="toctree-l3"><a class="reference internal" href="../quantize/quantization/index.html">tilelang.quantize.quantization</a></li>
392394
<li class="toctree-l3"><a class="reference internal" href="../quantize/utils/index.html">tilelang.quantize.utils</a></li>
393395
</ul>

autoapi/tilelang/autotuner/param/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@
363363
<li class="toctree-l4"><a class="reference internal" href="../../language/tir/op/index.html">tilelang.language.tir.op</a></li>
364364
</ul>
365365
</li>
366+
<li class="toctree-l3"><a class="reference internal" href="../../language/utils/index.html">tilelang.language.utils</a></li>
366367
<li class="toctree-l3"><a class="reference internal" href="../../language/warpgroup/index.html">tilelang.language.warpgroup</a></li>
367368
</ul>
368369
</li>
@@ -388,6 +389,7 @@
388389
</li>
389390
<li class="toctree-l2 has-children"><a class="reference internal" href="../../quantize/index.html">tilelang.quantize</a><input class="toctree-checkbox" id="toctree-checkbox-27" name="toctree-checkbox-27" role="switch" type="checkbox"/><label for="toctree-checkbox-27"><div class="visually-hidden">Toggle navigation of tilelang.quantize</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
390391
<li class="toctree-l3"><a class="reference internal" href="../../quantize/lop3/index.html">tilelang.quantize.lop3</a></li>
392+
<li class="toctree-l3"><a class="reference internal" href="../../quantize/mxfp/index.html">tilelang.quantize.mxfp</a></li>
391393
<li class="toctree-l3"><a class="reference internal" href="../../quantize/quantization/index.html">tilelang.quantize.quantization</a></li>
392394
<li class="toctree-l3"><a class="reference internal" href="../../quantize/utils/index.html">tilelang.quantize.utils</a></li>
393395
</ul>

autoapi/tilelang/autotuner/tuner/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@
363363
<li class="toctree-l4"><a class="reference internal" href="../../language/tir/op/index.html">tilelang.language.tir.op</a></li>
364364
</ul>
365365
</li>
366+
<li class="toctree-l3"><a class="reference internal" href="../../language/utils/index.html">tilelang.language.utils</a></li>
366367
<li class="toctree-l3"><a class="reference internal" href="../../language/warpgroup/index.html">tilelang.language.warpgroup</a></li>
367368
</ul>
368369
</li>
@@ -388,6 +389,7 @@
388389
</li>
389390
<li class="toctree-l2 has-children"><a class="reference internal" href="../../quantize/index.html">tilelang.quantize</a><input class="toctree-checkbox" id="toctree-checkbox-27" name="toctree-checkbox-27" role="switch" type="checkbox"/><label for="toctree-checkbox-27"><div class="visually-hidden">Toggle navigation of tilelang.quantize</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
390391
<li class="toctree-l3"><a class="reference internal" href="../../quantize/lop3/index.html">tilelang.quantize.lop3</a></li>
392+
<li class="toctree-l3"><a class="reference internal" href="../../quantize/mxfp/index.html">tilelang.quantize.mxfp</a></li>
391393
<li class="toctree-l3"><a class="reference internal" href="../../quantize/quantization/index.html">tilelang.quantize.quantization</a></li>
392394
<li class="toctree-l3"><a class="reference internal" href="../../quantize/utils/index.html">tilelang.quantize.utils</a></li>
393395
</ul>

0 commit comments

Comments
 (0)