tensorflow/compiler/mlir/xla/transforms/legalize_tf_communication.cc
// Updates control flow op terminator with an extra element `token`.
Updates control flow op terminator with an extra element `token`.
Updates control flow op terminator with an extra element ` token ` .
void RewriteControlFlowTerminator(OpBuilder& builder, Operation* terminator,
                                  Value token, bool flatten_tuple) {
  assert(flatten_tuple || terminator->getNumOperands() == 1);
  assert(flatten_tuple || terminator->getBlock()->getNumArguments() == 1);
  if (auto while_parent = dyn_cast_or_null<WhileOp>(terminator->getParentOp()))
    if (terminator->getParentRegion() == &while_parent.cond()) return;
  builder.setInsertionPoint(terminator);
  llvm::SmallDenseMap<Value, Value> rewritten_operands;
  auto new_results =
      GetValueWithToken(builder, llvm::to_vector(terminator->getOperands()),
                        token, rewritten_operands, flatten_tuple);
  terminator->setOperands(new_results);
}
void RewriteControlFlowTerminator ( OpBuilder & builder , Operation * terminator , Value token , bool flatten_tuple ) { assert ( flatten_tuple || terminator -> getNumOperands ( ) == 1 ) ; assert ( flatten_tuple || terminator -> getBlock ( ) -> getNumArguments ( ) == 1 ) ; if ( auto while_parent = dyn_cast_or_null < WhileOp > ( terminator -> getParentOp ( ) ) ) if ( terminator -> getParentRegion ( ) == & while_parent . cond ( ) ) return ; builder . setInsertionPoint ( terminator ) ; llvm :: SmallDenseMap < Value , Value > rewritten_operands ; auto new_results = GetValueWithToken ( builder , llvm :: to_vector ( terminator -> getOperands ( ) ) , token , rewritten_operands , flatten_tuple ) ; terminator -> setOperands ( new_results ) ; }
Updates control flow op terminator with an extra element `token`.
Updates control flow op terminator with an extra element ` token ` .
// `mhlo.while` cond terminator does not need to be rewritten as it always // returns a tensor<i1> predicate value.