@@ -52,7 +52,7 @@ def Gradient(
5252 """Reverse-mode automatic differentiation.
5353
5454 This pass will differentiate one function in the IRModule. Now the input function must have only
55- one dataflow block.
55+ one dataflow block (ConvertToDataflow may need to be called first) .
5656
5757 For a given function specified by `func_name`, it generates a new function with the name
5858 `func_name + "_adjoint"`. The new function computes the gradient of the **differentiation
@@ -260,6 +260,8 @@ def DataflowUseInplaceCalls() -> tvm.ir.transform.Pass:
260260 in-place PrimFunc implementations of those operators (which are based on the legalizations of
261261 those operators).
262262
263+ Note: ConvertToDataflow may need to be called first to provide dataflow blocks.
264+
263265 Returns
264266 -------
265267 ret: tvm.ir.transform.Pass
@@ -282,6 +284,8 @@ def ConvertToDataflow(min_size: int = 2) -> tvm.ir.transform.Pass:
282284 """A pass that converts consecutive dataflow operations
283285 inside binding blocks into dataflow blocks.
284286
287+ Note: ConvertToDataflow may need to be called first.
288+
285289 Params
286290 ------
287291 min_size: int
@@ -395,6 +399,8 @@ def RewriteDataflowReshape() -> tvm.ir.transform.Pass:
395399 operation at runtime, instead of doing real data copy.
396400 Here "reshape-like" includes reshape, expand_dims, flatten, etc.
397401
402+ Note: Operates only in dataflow blocks. ConvertToDataflow may need to be called first.
403+
398404 Returns
399405 -------
400406 ret : tvm.ir.transform.Pass
@@ -584,7 +590,9 @@ def RunCodegen(
584590
585591
586592def FoldConstant () -> tvm .ir .transform .Pass :
587- """Fold constant expressions.
593+ """Fold constant expressions within dataflow blocks.
594+
595+ Note: ConvertToDataflow may need to be called first to provide dataflow blocks.
588596
589597 Returns
590598 -------
@@ -651,6 +659,8 @@ def FuseOps(fuse_opt_level=-1) -> tvm.ir.transform.Pass:
651659
652660 A follow-up pass named "FuseTIR" will generate a TIR PrimFunc for each grouped function.
653661
662+ Note: ConvertToDataflow may need to be called first to provide dataflow blocks.
663+
654664 Parameters
655665 ----------
656666 fuse_opt_level : int
@@ -764,6 +774,8 @@ def FuseOpsByPattern(
764774
765775 The end result is similar to FuseOps, but fusion is driven completely by the provided patterns.
766776
777+ Note: Only operates within dataflow blocks. ConvertToDataflow may need to be called first.
778+
767779 Parameters
768780 ----------
769781 patterns : List[Union[FusionPattern, Tuple]]
@@ -1172,11 +1184,12 @@ def DeadCodeElimination(entry_functions: Optional[List[str]] = None) -> tvm.ir.t
11721184 """Remove dead code in the IRModule.
11731185 Currently it removes:
11741186
1175- 1. Unused local VarBindings in a DataflowBlock.
1176- 2. Unused DataflowBlocks in a function .
1177- 3 . Unused Relax functions in the module.
1187+ 1. Unused local VarBindings
1188+ (those where the bound var is unused and no impure operation is used) .
1189+ 2 . Unused Relax functions in the module.
11781190 We detect the call chain from the entry function, and remove all unused functions.
11791191
1192+ Any binding blocks that are left empty will be removed by the normalizer.
11801193
11811194 Notes
11821195 -----
@@ -1203,6 +1216,8 @@ def ToMixedPrecision(
12031216 """Automatic mixed precision pass. Currently the pass assumes the input module to be fp32
12041217 only, and will automatically cast fp32 to fp16 for certain ops.
12051218
1219+ Note: Mainly operates within dataflow blocks. ConvertToDataflow may need to be called first.
1220+
12061221 Parameters
12071222 ----------
12081223 out_dtype : str
0 commit comments