Tests whether 'call_def' is a call to a completely compilable function. Every operator in the function must be compilable for a function to be compilable.
| 222 | // Every operator in the function must be compilable for a function to be |
| 223 | // compilable. |
| 224 | bool RecursiveCompilabilityChecker::IsCompilableCall( |
| 225 | const NodeDef& call_def, FunctionLibraryRuntime* lib_runtime, |
| 226 | std::vector<StackFrameView>* stack_trace, |
| 227 | std::vector<UncompilableNodeInfo>* uncompilable_nodes) const { |
| 228 | if (stack_trace->size() > kMaxRecursionDepth) { |
| 229 | std::string uncompilable_reason = "function depth limit exceeded"; |
| 230 | MaybeMarkUncompilableNode(uncompilable_reason, *stack_trace, |
| 231 | uncompilable_nodes); |
| 232 | VLOG(2) << "Rejecting " << call_def.op() << ": " << uncompilable_reason |
| 233 | << "."; |
| 234 | return false; |
| 235 | } |
| 236 | |
| 237 | FunctionLibraryRuntime::Handle handle; |
| 238 | Status status = InstantiateFunctionCall(call_def, lib_runtime, &handle); |
| 239 | if (!status.ok()) { |
| 240 | std::string uncompilable_reason = "could not instantiate call"; |
| 241 | MaybeMarkUncompilableNode(uncompilable_reason, *stack_trace, |
| 242 | uncompilable_nodes); |
| 243 | VLOG(2) << "Rejecting " << call_def.DebugString() << ": " |
| 244 | << uncompilable_reason << " : " << status; |
| 245 | return false; |
| 246 | } |
| 247 | |
| 248 | auto release_handle_on_return = gtl::MakeCleanup( |
| 249 | [&] { TF_CHECK_OK(lib_runtime->ReleaseHandle(handle)); }); |
| 250 | const FunctionBody* fbody = lib_runtime->GetFunctionBody(handle); |
| 251 | bool is_compilable = true; |
| 252 | for (const Node* node : fbody->graph->op_nodes()) { |
| 253 | stack_trace->emplace_back(StackFrameView{node->name(), call_def.op()}); |
| 254 | is_compilable &= |
| 255 | IsCompilableNode(*node, lib_runtime, stack_trace, uncompilable_nodes); |
| 256 | stack_trace->pop_back(); |
| 257 | if (!uncompilable_nodes && !is_compilable) return is_compilable; |
| 258 | } |
| 259 | |
| 260 | return is_compilable; |
| 261 | } |
| 262 | |
| 263 | bool RecursiveCompilabilityChecker::OpIsInaccurate(const Node& node) const { |
| 264 | // b/127344411: SelfAdjointEigV2 and Svd precision issues. |
no test coverage detected