MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TEST_F

Function TEST_F

tensorflow/compiler/xla/service/hlo_alias_analysis_test.cc:117–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115};
116
117TEST_F(HloAliasAnalysisTest, BinaryOperation) {
118 // Test the analysis on a single binary operation (Add).
119 auto builder = HloComputation::Builder(TestName());
120 auto constant1 = builder.AddInstruction(
121 HloInstruction::CreateConstant(LiteralUtil::CreateR0<float>(1.0)));
122 auto constant2 = builder.AddInstruction(
123 HloInstruction::CreateConstant(LiteralUtil::CreateR0<float>(2.0)));
124 auto add = builder.AddInstruction(HloInstruction::CreateBinary(
125 scalar_shape_, HloOpcode::kAdd, constant1, constant2));
126 module_->AddEntryComputation(builder.Build());
127 SCOPED_TRACE(module_->ToString());
128
129 const HloAliasAnalysis& analysis = RunAnalysis();
130
131 EXPECT_EQ(analysis.buffers().size(), 3);
132
133 // All of the buffer sets should trivially contain a single buffer containing
134 // a single value.
135 for (const HloInstruction* instruction : {constant1, constant2, add}) {
136 EXPECT_EQ(analysis.GetUniqueBufferAt(instruction).GetUniqueValue(),
137 GetValueDefinedAt(instruction));
138 }
139
140 EXPECT_FALSE(analysis.InstructionBuffersAreAmbiguous(add));
141 EXPECT_TRUE(analysis.InstructionBuffersAreDistinct(add));
142
143 EXPECT_FALSE(AnyValuesInSameBufferInterfere());
144}
145
146TEST_F(HloAliasAnalysisTest, TupleAndGtes) {
147 // Verify the analysis for a Tuple and GetTupleElement instructions.

Callers

nothing calls this directly

Calls 15

TestNameFunction · 0.85
MakeShapeFunction · 0.85
AddEntryComputationMethod · 0.80
ComputePositionsMethod · 0.80
SetUpAliasMethod · 0.80
BufferLivesOutMethod · 0.80
set_sequenceMethod · 0.80
BuilderClass · 0.70

Tested by

no test coverage detected