Print out the deadness predicate on a mismatch
PiperOrigin-RevId: 248610290
This commit is contained in:
parent
220e8e059a
commit
eb2d84f659
@ -1188,4 +1188,8 @@ Status ComputePredicates(const Graph& graph,
|
|||||||
}
|
}
|
||||||
} // namespace deadness_analysis_internal
|
} // namespace deadness_analysis_internal
|
||||||
|
|
||||||
|
string DeadnessAnalysis::DebugString(DeadnessPredicate predicate) const {
|
||||||
|
return static_cast<Predicate*>(predicate.pred_)->ToString();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace tensorflow
|
} // namespace tensorflow
|
||||||
|
@ -82,6 +82,8 @@ class DeadnessAnalysis {
|
|||||||
virtual void Print() const = 0;
|
virtual void Print() const = 0;
|
||||||
virtual ~DeadnessAnalysis();
|
virtual ~DeadnessAnalysis();
|
||||||
|
|
||||||
|
string DebugString(DeadnessPredicate predicate) const;
|
||||||
|
|
||||||
// Run the deadness analysis over `graph` and returns an error or a populated
|
// Run the deadness analysis over `graph` and returns an error or a populated
|
||||||
// instance of DeadnessAnalysis in `result`.
|
// instance of DeadnessAnalysis in `result`.
|
||||||
static Status Run(const Graph& graph,
|
static Status Run(const Graph& graph,
|
||||||
|
@ -401,6 +401,13 @@ class MarkForCompilationPassImpl {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string EdgeContractionFailureMsg(Cluster* from, Cluster* to,
|
||||||
|
absl::string_view reason) {
|
||||||
|
return absl::StrCat("Could not contract ", from->DebugString(*graph_),
|
||||||
|
" -> ", to->DebugString(*graph_), " because ", reason,
|
||||||
|
".");
|
||||||
|
}
|
||||||
|
|
||||||
DebugOptions debug_options_;
|
DebugOptions debug_options_;
|
||||||
Graph* graph_;
|
Graph* graph_;
|
||||||
FunctionLibraryDefinition* flib_def_;
|
FunctionLibraryDefinition* flib_def_;
|
||||||
@ -1067,8 +1074,7 @@ bool MarkForCompilationPassImpl::CompilationDisallowedByXlaCompileAttr(
|
|||||||
|
|
||||||
bool MarkForCompilationPassImpl::LogNotContractableAndReturnFalse(
|
bool MarkForCompilationPassImpl::LogNotContractableAndReturnFalse(
|
||||||
Cluster* from, Cluster* to, absl::string_view reason) {
|
Cluster* from, Cluster* to, absl::string_view reason) {
|
||||||
VLOG(3) << "Could not contract " << from->DebugString(*graph_) << " -> "
|
VLOG(3) << EdgeContractionFailureMsg(from, to, reason);
|
||||||
<< to->DebugString(*graph_) << " because " << reason << ".";
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1077,8 +1083,14 @@ StatusOr<bool> MarkForCompilationPassImpl::TryToContractEdge(Cluster* from,
|
|||||||
DCHECK(from->deadness_predicate().has_value() ==
|
DCHECK(from->deadness_predicate().has_value() ==
|
||||||
to->deadness_predicate().has_value());
|
to->deadness_predicate().has_value());
|
||||||
if (from->deadness_predicate() != to->deadness_predicate()) {
|
if (from->deadness_predicate() != to->deadness_predicate()) {
|
||||||
return LogNotContractableAndReturnFalse(
|
VLOG(3) << EdgeContractionFailureMsg(
|
||||||
from, to, "the two nodes have mismatching deadness");
|
from, to,
|
||||||
|
absl::StrCat(
|
||||||
|
"the two nodes have mismatching deadness: ",
|
||||||
|
deadness_analysis_->DebugString(*from->deadness_predicate()),
|
||||||
|
" and ",
|
||||||
|
deadness_analysis_->DebugString(*to->deadness_predicate())));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TF_ASSIGN_OR_RETURN(bool devices_compatible,
|
TF_ASSIGN_OR_RETURN(bool devices_compatible,
|
||||||
|
Loading…
Reference in New Issue
Block a user