message: Use replicatedAllReduceWithOutput in gradient accumulation.
  Summary:
  Use the replicatedAllReduceWithOutput function in gradient accumulation to prevent an extra buffer from being created.
  Fixes T9500
  Test Plan: All tests pass. All hardware tests pass.
  Reviewers: #tensorflow, davidn
  Subscribers: georgep, davidn
  Maniphest Tasks: T9500
diff: @@ -91,16 +91,15 @@ class StatefulGradientAccumulateOp : public PoplibsOpDef {
  poplar::Tensor output = input;
  poplar::program::Sequence if_true;
  {
  - poplar::Tensor result = accumulator;
  if (do_all_reduce) {
  - // All reduce the accumulator tensor.
  - result = popops::replicatedAllReduce(
  - GetMasterGraph(res), accumulator, popops::Operation::ADD, if_true,
  - GetDebugName(inst), GetReplicateAllReduceOptions());
  - }
  -
  + // All reduce the accumulator tensor into the output.
  + popops::replicatedAllReduceWithOutput(
  + GetMasterGraph(res), accumulator, output, popops::Operation::ADD,
  + if_true, GetDebugName(inst), GetReplicateAllReduceOptions());
  + } else {
  // Copy accumulator into output.
  - if_true.add(poplar::program::Copy(result, output));
  + if_true.add(poplar::program::Copy(accumulator, output));
  + }
  // Zero the accumulator.
  popops::zero(graph, accumulator, if_true,
  