aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/layout_assignment_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/compiler/xla/service/layout_assignment_test.cc')
-rw-r--r--tensorflow/compiler/xla/service/layout_assignment_test.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/tensorflow/compiler/xla/service/layout_assignment_test.cc b/tensorflow/compiler/xla/service/layout_assignment_test.cc
index 62feb7c1e9..4b1c9bad41 100644
--- a/tensorflow/compiler/xla/service/layout_assignment_test.cc
+++ b/tensorflow/compiler/xla/service/layout_assignment_test.cc
@@ -796,5 +796,26 @@ TEST_F(LayoutAssignmentTest, ConditionalAsymmetricLayout) {
EXPECT_THAT(false_result->opcode(), HloOpcode::kCopy);
}
+TEST_F(LayoutAssignmentTest, InternalErrorOnBitcast) {
+ auto builder = HloComputation::Builder(TestName());
+ auto constant0 = builder.AddInstruction(
+ HloInstruction::CreateConstant(Literal::CreateR2WithLayout<float>(
+ {{1.0, 2.0}, {3.0, 4.0}}, LayoutUtil::MakeLayout({0, 1}))));
+ builder.AddInstruction(HloInstruction::CreateUnary(
+ constant0->shape(), HloOpcode::kBitcast, constant0));
+ auto module = CreateNewModule();
+ module->AddEntryComputation(builder.Build());
+
+ ComputationLayout computation_layout(
+ module->entry_computation()->ComputeProgramShape());
+ LayoutAssignment layout_assignment(&computation_layout);
+ Status error_status = layout_assignment.Run(module.get()).status();
+ EXPECT_FALSE(error_status.ok());
+ EXPECT_THAT(
+ error_status.error_message(),
+ ::testing::HasSubstr(
+ "Unexpected bitcast operation seen during layout assignment"));
+}
+
} // namespace
} // namespace xla