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

Method Fuse

tensorflow/compiler/xla/service/multi_output_fusion.cc:132–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131
132HloInstruction* MultiOutputFusion::Fuse(HloInstruction* instr1,
133 HloInstruction* instr2) {
134 HloInstruction* remaining = instr1;
135 HloInstruction* fused = instr2;
136 // Make sure that if only one of the instructions is a fusion, or if only one
137 // of the instructions is a multi-output fusion, it's what will be fused into.
138 if (fused->opcode() == HloOpcode::kFusion) {
139 std::swap(remaining, fused);
140 }
141 if (fused->IsMultiOutputFusion()) {
142 std::swap(remaining, fused);
143 }
144 if (fused->opcode() == HloOpcode::kFusion) {
145 remaining->MergeFusionInstructionIntoMultiOutput(fused);
146 } else {
147 remaining->FuseInstructionIntoMultiOutput(fused);
148 CHECK_EQ(0, fused->user_count());
149 TF_CHECK_OK(computation()->RemoveInstruction(fused));
150 }
151 return remaining;
152}
153
154HloInstruction* MultiOutputFusion::CreateFusion(HloInstruction* base,
155 HloInstruction* to_fuse) {

Callers

nothing calls this directly

Calls 7

computationFunction · 0.85
opcodeMethod · 0.80
user_countMethod · 0.80
IsMultiOutputFusionMethod · 0.45
RemoveInstructionMethod · 0.45

Tested by

no test coverage detected