Skip to content

Commit 88cbe5e

Browse files
committed
add doc
1 parent e8155a5 commit 88cbe5e

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

python/tvm/meta_schedule/schedule_rule/auto_tensorize.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,28 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717
"""Auto tensorization related components."""
18+
from typing import Optional
1819

1920
from .. import _ffi_api
21+
from tvm.tir.schedule import Schedule, BlockRV, LoopRV
2022

2123

22-
def tiling_with_tensor_intrin(sch, block, intrin_name):
23-
return _ffi_api.TilingwithTensorIntrin(sch, block, intrin_name)
24+
def tiling_with_tensor_intrin(sch: Schedule, block: BlockRV, intrin_name: str) -> Optional[LoopRV]:
25+
"""Tile a subset of loops in the block according to the given tensor intrinsic.
26+
27+
Parameters
28+
----------
29+
sch : Schedule
30+
The schedule to which tiling is applied
31+
block : BlockRV
32+
The block whose subset of loops will be tiled
33+
intrin_name : str
34+
The name of a tensor intrinsic, must be registerd via TensorIntrin.register(...) beforehand
35+
36+
Returns
37+
-------
38+
tiled_loop_rv : Optional[LoopRV]
39+
LoopRV corresponding to the outermost loop of a block tiled according to the given intrin
40+
NullOpt if no valid loop mapping is found
41+
"""
42+
return _ffi_api.TilingwithTensorIntrin(sch, block, intrin_name) # type: ignore

src/meta_schedule/schedule_rule/auto_tensorize.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@
2424
namespace tvm {
2525
namespace meta_schedule {
2626

27+
/*!
28+
* \brief Tile a subset of loops in the block according to the given tensor intrinsic.
29+
* \param self The schedule to which tiling is applied
30+
* \param block_rv The block whose subset of loops will be tiled
31+
* \param intrin_name The name of a tensor intrinsic, must be registerd via
32+
* TensorIntrin.register(...) beforehand
33+
* \return LoopRV corresponding to the outermost loop of a
34+
* block tiled according to the given intrin, NullOpt if a valid loop mapping is not found
35+
*/
36+
2737
Optional<tir::LoopRV> TilingwithTensorIntrin(const tir::Schedule& sch, const tir::BlockRV& block_rv,
2838
const String& intrin_name);
2939

0 commit comments

Comments
 (0)