[XLA:GPU] Add more VLOGing to ease debugging.

PiperOrigin-RevId: 328931055
Change-Id: I93547e0f1110c37cf3a60c55e58e6e52f7a46518
This commit is contained in:
Thomas Joerg 2020-08-28 06:59:24 -07:00 committed by TensorFlower Gardener
parent 24aa11dd48
commit 6ba62e9fea
2 changed files with 14 additions and 3 deletions

View File

@ -60,6 +60,7 @@ bool GpuInstructionFusion::ShouldFuseInexpensiveChecks(HloInstruction* consumer,
// Output fusions are not currently supported on GPUs.
if (producer->opcode() == HloOpcode::kFusion) {
VLOG(4) << "Producer " << producer->name() << " is a fusion op";
return false;
}
// Cost condition: not fuse (simple, expensive producers) and (consumers who
@ -67,11 +68,15 @@ bool GpuInstructionFusion::ShouldFuseInexpensiveChecks(HloInstruction* consumer,
if (producer->opcode() != HloOpcode::kFusion &&
consumer->ReusesOperandElements(operand_index) &&
is_expensive(*producer)) {
VLOG(4) << "Do not fuse simple, expensive producer " << producer->name()
<< " and consumer which reuses operand elements.";
return false;
}
if (!IsProducerConsumerFusible(*producer, *consumer) ||
!InstructionFusion::ShouldFuse(consumer, operand_index)) {
VLOG(4) << "Producer " << producer->name()
<< " is not fusible or should not be fused.";
return false;
}
return true;
@ -107,8 +112,13 @@ bool GpuInstructionFusion::ShouldFuse(HloInstruction* consumer,
fusion_node_evaluations_.emplace(consumer,
FusionNodeIndexingEvaluation(consumer));
}
return !fusion_node_evaluations_.at(consumer).AverageCodeDuplicationTooHigh(
producer);
if (fusion_node_evaluations_.at(consumer).AverageCodeDuplicationTooHigh(
producer)) {
VLOG(5) << "Fusion of " << producer->name() << " into " << consumer->name()
<< " would result in overly large code duplication.";
return false;
}
return true;
}
bool GpuInstructionFusion::ShouldFuseIntoMultiOutput(HloInstruction* consumer,

View File

@ -516,11 +516,12 @@ StatusOr<bool> InstructionFusion::Run(HloModule* module) {
continue;
}
VLOG(5) << "Considering fusion of: " << instruction->ToString();
std::vector<int64>& sorted_operand_numbers = next_entry.second;
for (int64 i : sorted_operand_numbers) {
HloInstruction* operand = instruction->mutable_operand(i);
VLOG(5) << "Considering fusion of: " << instruction->ToString()
<< " with operand " << operand->name();
if (!operand->IsFusible()) {
VLOG(3) << "Operand (" << operand->ToString() << ") is not fusible";