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

Method IsCompilableNode

tensorflow/compiler/jit/compilability_check_util.cc:284–431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

282}
283
284bool RecursiveCompilabilityChecker::IsCompilableNode(
285 const Node& node, FunctionLibraryRuntime* lib_runtime,
286 std::vector<StackFrameView>* stack_trace,
287 std::vector<UncompilableNodeInfo>* uncompilable_nodes) const {
288 auto stack_depth = stack_trace->size();
289 if (node.IsSource() || node.IsSink()) {
290 absl::string_view uncompilable_reason = "source or sink node";
291 MaybeMarkUncompilableNode(uncompilable_reason, *stack_trace,
292 uncompilable_nodes);
293 LogNotCompilable(node, uncompilable_reason);
294 return false;
295 }
296
297 // _Arg nodes in a top-level function represent feeds and _Retval nodes in a
298 // top-level function represent fetches.
299 if (stack_depth == 1 &&
300 (node.type_string() == "_Arg" || node.type_string() == "_Retval")) {
301 absl::string_view uncompilable_reason = "top level _Arg or _Retval";
302 MaybeMarkUncompilableNode(uncompilable_reason, *stack_trace,
303 uncompilable_nodes);
304 LogNotCompilable(node, uncompilable_reason);
305 return false;
306 }
307
308 if (node.attrs().Find("_scoped_allocator") ||
309 node.attrs().Find("_forward_from")) {
310 // TODO(b/128858118): XLA does not support _scoped_allocator and
311 // _forward_from.
312 absl::string_view uncompilable_reason =
313 "_scoped_allocator or _forward_from attribute";
314 MaybeMarkUncompilableNode(uncompilable_reason, *stack_trace,
315 uncompilable_nodes);
316 LogNotCompilable(node, uncompilable_reason);
317 return false;
318 }
319
320 if (IsFunctionCall(*lib_runtime->GetFunctionLibraryDefinition(), node)) {
321 if (!IsCompilableCall(node.def(), lib_runtime, stack_trace,
322 uncompilable_nodes)) {
323 LogNotCompilable(node, "unsupported function");
324 return false;
325 }
326 } else if (!HasXLAKernel(node)) {
327 absl::string_view uncompilable_reason = "unsupported op";
328 MaybeMarkUncompilableNode(uncompilable_reason, *stack_trace,
329 uncompilable_nodes);
330 LogNotCompilable(node, uncompilable_reason);
331 return false;
332 }
333
334 if (node.IsWhileNode() &&
335 !IsCompilableWhile(node, lib_runtime, stack_trace, uncompilable_nodes)) {
336 LogNotCompilable(node, "unsupported while");
337 return false;
338 }
339
340 if (node.IsIfNode() &&
341 !IsCompilableIf(node, lib_runtime, stack_trace, uncompilable_nodes)) {

Callers 2

TEST_FFunction · 0.45

Calls 15

LogNotCompilableFunction · 0.85
IsStackOpFunction · 0.85
HasResourceInputFunction · 0.85
IsSourceMethod · 0.80
IsSinkMethod · 0.80
IsWhileNodeMethod · 0.80
IsIfNodeMethod · 0.80
IsControlTriggerMethod · 0.80
IsFunctionCallFunction · 0.50
sizeMethod · 0.45
FindMethod · 0.45

Tested by 1

TEST_FFunction · 0.36