Skip to content

Commit 829a009

Browse files
whoozlegeorgepaw
authored andcommitted
Rebalance tensors for inplace ops
Summary: This commit removes poputil::duplicate from FindInplaceOutputs, properly remapping tensors with aliasing Depends on D62682. Ref T56588. Test Plan: CI Reviewers: #tensorflow, #framework_ip_review_-_any_oss_or_third-party_code_use_has_been_approved, georgep, samuelh, babakk Reviewed By: #tensorflow, #framework_ip_review_-_any_oss_or_third-party_code_use_has_been_approved, babakk Maniphest Tasks: T56588 Differential Revision: https://phabricator.sourcevertex.net/D62646
1 parent aca1bbf commit 829a009

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

tensorflow/compiler/plugin/poplar/driver/tensor.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,9 +1665,10 @@ StatusOr<TensorOrRemoteBufferVectors> FindInplaceOutputs(
16651665
if (require_parallel_writeable && !tensor.isParallelWriteable()) {
16661666
poplar::Graph& graph =
16671667
GetGraphWithOutputIndex(res, inst->operand(inplace_index), j);
1668-
tensors[i][j] = poputil::duplicate(
1669-
graph, tensor, seq, {debug_name_and_id, "clone"},
1670-
poplar::TensorCloneMethod::PRESERVE_ORDER_UNLESS_ALIASES);
1668+
poplar::Tensor out = TensorCloneAndRebalanceAliasing(
1669+
graph, res, tensor, {debug_name_and_id, "clone"});
1670+
seq.add(poplar::program::Copy(tensor, out, false, debug_name_and_id));
1671+
tensors[i][j] = out;
16711672
}
16721673
}
16731674
}

tensorflow/compiler/plugin/poplar/tests/wide_const_expansion_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def my_graph(a, b):
156156
self.assertAllClose(np.zeros(pb.shape), out[0])
157157

158158
report = pva.openReport(report_helper.find_report())
159-
self.assert_max_tile_memory(report, 534373)
159+
self.assert_max_tile_memory(report, 417947)
160160

161161
def testCheckMaxTileSizePadding2(self):
162162
cfg = IPUConfig()

0 commit comments

Comments
 (0)