| 1719 | } // anonymous namespace |
| 1720 | |
| 1721 | bool 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 | ®istration)); |
| 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 | |
| 1756 | Status MarkForCompilationPass::Run( |
| 1757 | const GraphOptimizationPassOptions& options) { |
no test coverage detected