@@ -713,23 +713,28 @@ static LogicalResult updateOp(mlir::OpBuilder &builder, mlir::Operation *op,
713713 return success ();
714714}
715715
716- // / Update the types of successor regions at control-flow transfer points. If
717- // / the control flow transfers to a new block the block arguments are updated.
718- // / If the control flow transfers out of the region op, the result types of the
719- // / region op are updated.
720- // / Example:
716+ // / Region ops like scf.for need special handling because they have blocks
717+ // / inside. If the blocks have tensor descriptor type as block arguments, thier
718+ // / types must be updated. Also region op can have results that may not have any
719+ // / users (e.g. A and B tiles). They are not assigned a layout by layout
720+ // / analysis because they have no users. However inside the region op
721+ // / corresponding block arguments for these results do have layouts. Therefore,
722+ // / in this case we still need to update the result types with the layout
723+ // / attribute. This function function updates the internal block arguments and
724+ // / the result types of the region op with the assigned layouts.
721725// / clang-format off
722- // / scf.for ... iter_args(...) -> (out types) {
726+ // / Example: scf.for ... iter_args(...) -> (out types) {
723727// / ^bb0(block types):
724728// / ...
725729// / scf.yield ... : (yield types)
726730// / }
727731// / clang-format on
728- // / In this example, at scf.yield, control-flow can transfer to successor
732+ // / In this example, at scf.yield, control-flow can transfer to two successor
729733// / regions. One is the ^bb0 (for loop body) and the other is the scf.for op
730734// / itself (yield the results). So we update both the block arguments of the
731735// / successor region (i.e. block types) and the result types of the scf.for op
732- // / (i.e. out types). Note that yield types are updated by respective producers.
736+ // / (i.e. out types). Note that yield types are updated by respective producers
737+ // / inside bb0.
733738static LogicalResult
734739updateControlFlowOps (mlir::OpBuilder &builder,
735740 mlir::RegionBranchTerminatorOpInterface terminator,
0 commit comments