| 2037 | class DoesNotUseOperandBufferTest : public HloDataflowAnalysisTestBase {}; |
| 2038 | |
| 2039 | TEST_F(DoesNotUseOperandBufferTest, GetTupleElement) { |
| 2040 | auto builder = HloComputation::Builder(TestName()); |
| 2041 | |
| 2042 | Shape elem_shape = ShapeUtil::MakeShape(F32, {8}); |
| 2043 | auto tuple = builder.AddInstruction(HloInstruction::CreateParameter( |
| 2044 | 0, ShapeUtil::MakeTupleShape({elem_shape, elem_shape}), "tuple")); |
| 2045 | auto gte0 = builder.AddInstruction( |
| 2046 | HloInstruction::CreateGetTupleElement(elem_shape, tuple, 0)); |
| 2047 | auto gte1 = builder.AddInstruction( |
| 2048 | HloInstruction::CreateGetTupleElement(elem_shape, tuple, 1)); |
| 2049 | builder.AddInstruction( |
| 2050 | HloInstruction::CreateBinary(elem_shape, HloOpcode::kAdd, gte0, gte1)); |
| 2051 | |
| 2052 | BuildModuleAndRunAnalysis(builder.Build()); |
| 2053 | |
| 2054 | // GetTupleElement instructions only access the top-level buffer of their |
| 2055 | // operand. |
| 2056 | EXPECT_TRUE(dataflow_analysis_->DoesNotUseOperandBuffer(tuple, {0}, gte0)); |
| 2057 | EXPECT_TRUE(dataflow_analysis_->DoesNotUseOperandBuffer(tuple, {1}, gte1)); |
| 2058 | EXPECT_FALSE(dataflow_analysis_->DoesNotUseOperandBuffer(tuple, {}, gte0)); |
| 2059 | EXPECT_FALSE(dataflow_analysis_->DoesNotUseOperandBuffer(tuple, {}, gte1)); |
| 2060 | } |
| 2061 | |
| 2062 | TEST_F(DoesNotUseOperandBufferTest, FusedDynamicUpdateSlice) { |
| 2063 | auto builder = HloComputation::Builder(TestName()); |
nothing calls this directly
no test coverage detected