diff options
author | 2017-09-29 14:02:29 -0700 | |
---|---|---|
committer | 2017-09-29 14:13:20 -0700 | |
commit | 7ec44b7541faabe781bb9b6113534452cda7598c (patch) | |
tree | f35a3a706553bd2b044a3944c4f0368bd34fa736 /tensorflow/compiler/xla/service/logical_buffer_analysis.cc | |
parent | b1f00fc15047967698618a8e9218fac6c2278414 (diff) |
[XLA] Make HloModule::computations() return raw pointers.
Like HloComputation::instructions(), HloModule::computations() used to
return a list of unique_ptrs. But this is an implementation detail that
shouldn't be leaked into the public API.
This patch also adds HloModule::MakeNonFusionComputations(), because
many of the callers of computations() went on to filter out all the
fusion computations.
It would be possible to implement MakeNonFusionComputations() "in place"
using a filtering iterator, but I don't think it's necessary -- we never
have *that* many computations, and since many callers go on to copy the
list of non-fusion computations, making it unconditionally a copy is
simpler and avoids a footgun.
PiperOrigin-RevId: 170529051
Diffstat (limited to 'tensorflow/compiler/xla/service/logical_buffer_analysis.cc')
-rw-r--r-- | tensorflow/compiler/xla/service/logical_buffer_analysis.cc | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/tensorflow/compiler/xla/service/logical_buffer_analysis.cc b/tensorflow/compiler/xla/service/logical_buffer_analysis.cc index 11ee8fc05d..bf3bb2ddf0 100644 --- a/tensorflow/compiler/xla/service/logical_buffer_analysis.cc +++ b/tensorflow/compiler/xla/service/logical_buffer_analysis.cc @@ -41,10 +41,7 @@ Status LogicalBufferAnalysis::Analyze() { // We filter out fusion computations, and get to them through fusion // instructions. This is because it's possible to have orphaned (unreachable) // fusion computations, and we don't want to try to assign buffers to those. - for (auto& computation : module_->computations()) { - if (computation->IsFusionComputation()) { - continue; - } + for (auto* computation : module_->MakeNonfusionComputations()) { TF_RETURN_IF_ERROR(computation->Accept(this)); for (auto* instruction : computation->instructions()) { if (instruction->opcode() != HloOpcode::kFusion) { |