| 84 | }; |
| 85 | |
| 86 | TEST_F(CopyInsertionTest, SingleParameter) { |
| 87 | // Computation is a single parameter passed into a tuple. The parameter should |
| 88 | // be copied before entering the tuple. |
| 89 | auto builder = HloComputation::Builder(TestName()); |
| 90 | HloInstruction* x = builder.AddInstruction( |
| 91 | HloInstruction::CreateParameter(0, ShapeUtil::MakeShape(F32, {}), "x")); |
| 92 | HloInstruction* tuple = |
| 93 | builder.AddInstruction(HloInstruction::CreateTuple({x})); |
| 94 | |
| 95 | EXPECT_THAT(x->users(), UnorderedElementsAre(tuple)); |
| 96 | |
| 97 | auto module = CreateNewVerifiedModule(); |
| 98 | module->AddEntryComputation(builder.Build()); |
| 99 | |
| 100 | InsertCopies(module.get()); |
| 101 | |
| 102 | EXPECT_THAT(module->entry_computation()->root_instruction(), |
| 103 | op::Tuple(op::Copy(x))); |
| 104 | } |
| 105 | |
| 106 | TEST_F(CopyInsertionTest, SingleConstant) { |
| 107 | // Computation is a single constant passed into a tuple. The parameter should |
nothing calls this directly
no test coverage detected