[XLA] Don't add constraints for computations we're not currently looking at.

TuplePointsToAnalysis is computed globally per module, so we add all
unconstrained buffers in that module, even if it's outside of the computation
we're currently running on. Then we proceed to propagate default layouts to all
those buffers and then throw the constraints away because they don't affect any
instruction in the current computation.

PiperOrigin-RevId: 157635564
This commit is contained in:
Benjamin Kramer 2017-05-31 14:29:50 -07:00 committed by TensorFlower Gardener
parent a980aead87
commit bef563dc88

View File

@ -102,7 +102,9 @@ LayoutConstraints::LayoutConstraints(
: points_to_analysis_(points_to_analysis), computation_(computation) {
// Gather all array-shaped logical buffers into unconstrained_buffer_ids.
for (auto& buffer : points_to_analysis_.logical_buffers()) {
if (buffer->IsArray()) {
// The points to analysis is computed per module, restrict constraints to
// array buffers in this computation.
if (buffer->IsArray() && buffer->instruction()->parent() == computation) {
unconstrained_buffer_ids_.insert(buffer->id());
}
}