Skip to content

Commit

Permalink
add doc
Browse files Browse the repository at this point in the history
  • Loading branch information
masahi committed Apr 20, 2022
1 parent e8155a5 commit 88cbe5e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
23 changes: 21 additions & 2 deletions python/tvm/meta_schedule/schedule_rule/auto_tensorize.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,28 @@
# specific language governing permissions and limitations
# under the License.
"""Auto tensorization related components."""
from typing import Optional

from .. import _ffi_api
from tvm.tir.schedule import Schedule, BlockRV, LoopRV


def tiling_with_tensor_intrin(sch, block, intrin_name):
return _ffi_api.TilingwithTensorIntrin(sch, block, intrin_name)
def tiling_with_tensor_intrin(sch: Schedule, block: BlockRV, intrin_name: str) -> Optional[LoopRV]:
"""Tile a subset of loops in the block according to the given tensor intrinsic.
Parameters
----------
sch : Schedule
The schedule to which tiling is applied
block : BlockRV
The block whose subset of loops will be tiled
intrin_name : str
The name of a tensor intrinsic, must be registerd via TensorIntrin.register(...) beforehand
Returns
-------
tiled_loop_rv : Optional[LoopRV]
LoopRV corresponding to the outermost loop of a block tiled according to the given intrin
NullOpt if no valid loop mapping is found
"""
return _ffi_api.TilingwithTensorIntrin(sch, block, intrin_name) # type: ignore
10 changes: 10 additions & 0 deletions src/meta_schedule/schedule_rule/auto_tensorize.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@
namespace tvm {
namespace meta_schedule {

/*!
* \brief Tile a subset of loops in the block according to the given tensor intrinsic.
* \param self The schedule to which tiling is applied
* \param block_rv The block whose subset of loops will be tiled
* \param intrin_name The name of a tensor intrinsic, must be registerd via
* TensorIntrin.register(...) beforehand
* \return LoopRV corresponding to the outermost loop of a
* block tiled according to the given intrin, NullOpt if a valid loop mapping is not found
*/

Optional<tir::LoopRV> TilingwithTensorIntrin(const tir::Schedule& sch, const tir::BlockRV& block_rv,
const String& intrin_name);

Expand Down

0 comments on commit 88cbe5e

Please sign in to comment.