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

Function IsCompilable

tensorflow/compiler/jit/mark_for_compilation_pass.cc:1721–1754  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1719} // anonymous namespace
1720
1721bool IsCompilable(
1722 FunctionLibraryRuntime* flr, const NodeDef& ndef,
1723 std::vector<RecursiveCompilabilityChecker::UncompilableNodeInfo>*
1724 uncompilable_node_info) {
1725 Device* device = flr->device();
1726 const XlaOpRegistry::DeviceRegistration* registration;
1727 CHECK(XlaOpRegistry::GetCompilationDevice(device->device_type(),
1728 &registration));
1729 DeviceType jit_device_type(registration->compilation_device_name);
1730
1731 // We can always *compile* resource operations, stateful RNGs and dummy ops,
1732 // even if we are sometimes unable to auto-cluster them.
1733 RecursiveCompilabilityChecker::OperationFilter op_filter;
1734 op_filter.allow_resource_ops_in_called_functions = true;
1735 op_filter.allow_stack_ops = true;
1736 op_filter.allow_tensor_array_ops = true;
1737 op_filter.allow_stateful_rng_ops = true;
1738 op_filter.allow_control_trigger = true;
1739 op_filter.allow_eliding_assert_and_checknumerics_ops = true;
1740 op_filter.allow_ops_producing_or_consuming_variant = true;
1741 op_filter.allow_slow_ops = true;
1742 op_filter.allow_inaccurate_ops = true;
1743
1744 RecursiveCompilabilityChecker checker{&op_filter, &jit_device_type};
1745 if (!uncompilable_node_info) {
1746 // We do not need uncompilable node info. Just return the result.
1747 return checker.IsCompilableCall(ndef, flr);
1748 }
1749
1750 std::vector<RecursiveCompilabilityChecker::UncompilableNodeInfo>
1751 uncompilable_node_result = checker.FindUncompilableNodes(ndef, flr);
1752 uncompilable_node_info->swap(uncompilable_node_result);
1753 return uncompilable_node_info->empty();
1754}
1755
1756Status MarkForCompilationPass::Run(
1757 const GraphOptimizationPassOptions& options) {

Callers 1

CreateKernelMethod · 0.85

Calls 6

FindUncompilableNodesMethod · 0.80
deviceMethod · 0.45
device_typeMethod · 0.45
IsCompilableCallMethod · 0.45
swapMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected