aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/hlo_ordering_test.cc
diff options
context:
space:
mode:
authorGravatar Peter Hawkins <phawkins@google.com>2018-03-17 09:57:03 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-03-17 10:01:11 -0700
commit6a0b4e177620626596c610f129a66233ffb6f5af (patch)
tree6400d1b3c1fbe9a60fb005f476686f74aaab8a26 /tensorflow/compiler/xla/service/hlo_ordering_test.cc
parentd8315b74750683cec1758149afffa1ec9213120f (diff)
[XLA] Fix points-to set calculation in HLO ListScheduler.
Previously the list scheduler considered that an instruction used only the buffers defined by its operands. This is inaccurate in the presence of aliasing?an instruction may potentially use anything in the points-to set of the operand, including buffers defined by an ancestor of an operand. Change to use the full points-to set instead. PiperOrigin-RevId: 189460681
Diffstat (limited to 'tensorflow/compiler/xla/service/hlo_ordering_test.cc')
-rw-r--r--tensorflow/compiler/xla/service/hlo_ordering_test.cc47
1 files changed, 0 insertions, 47 deletions
diff --git a/tensorflow/compiler/xla/service/hlo_ordering_test.cc b/tensorflow/compiler/xla/service/hlo_ordering_test.cc
index 441d790f0e..37a7fbad97 100644
--- a/tensorflow/compiler/xla/service/hlo_ordering_test.cc
+++ b/tensorflow/compiler/xla/service/hlo_ordering_test.cc
@@ -34,53 +34,6 @@ namespace {
class HloOrderingTest : public HloTestBase {};
-TEST_F(HloOrderingTest, LastUseScheduledFirst) {
- // Tests scheduling of the following HLO code:
- //
- // %ab = abs(%param)
- // %exp = exp(%param)
- // %add = add(%ab, %exp)
- // %negate = negate(%exp)
- // %sub = subtract(%add, %negate)
- //
- // %add should be scheduled before %negate because %add is the last (and only)
- // use of %ab. Scheduling %add first then frees up %ab's buffer.
- const Shape vec = ShapeUtil::MakeShape(xla::F32, {42});
- auto builder = HloComputation::Builder(TestName());
- auto param =
- builder.AddInstruction(HloInstruction::CreateParameter(0, vec, "param"));
- auto ab = builder.AddInstruction(
- HloInstruction::CreateUnary(vec, HloOpcode::kAbs, param));
- auto exp = builder.AddInstruction(
- HloInstruction::CreateUnary(vec, HloOpcode::kExp, param));
-
- auto add = builder.AddInstruction(
- HloInstruction::CreateBinary(vec, HloOpcode::kAdd, ab, exp));
- auto negate = builder.AddInstruction(
- HloInstruction::CreateUnary(vec, HloOpcode::kNegate, exp));
- auto sub = builder.AddInstruction(
- HloInstruction::CreateBinary(vec, HloOpcode::kSubtract, add, negate));
-
- auto module = CreateNewModule();
- module->AddEntryComputation(builder.Build());
-
- TF_ASSERT_OK_AND_ASSIGN(
- SequentialHloOrdering::HloModuleSequence sequence,
- CreateMemoryMinimizingSequence(*module, [](const LogicalBuffer& buffer) {
- return ShapeUtil::ByteSizeOf(buffer.shape());
- }));
- // Verify that all instructions are in the sequence.
- EXPECT_EQ(module->entry_computation()->instruction_count(),
- sequence.at(module->entry_computation()).size());
-
- // The first instruction should be the parameter and the last the root "sub".
- EXPECT_EQ(param, sequence.at(module->entry_computation()).front());
- EXPECT_EQ(sub, sequence.at(module->entry_computation()).back());
-
- SequentialHloOrdering ordering(module.get(), sequence);
- EXPECT_TRUE(ordering.ExecutesBefore(add, negate));
-}
-
TEST_F(HloOrderingTest, InstructionsInDifferentComputations) {
// Tests the ordering of instructions in different computations using the
// following HLO code: