| 516 | } |
| 517 | |
| 518 | void MarkForCompilationPassImpl::Cluster::Merge(Cluster* other) { |
| 519 | // We keep our own cycles_graph_node_id_ to mirror what GraphCycles does. |
| 520 | |
| 521 | // Clearing out data structures in `other` is just a memory saving |
| 522 | // optimization and not needed for correctness. |
| 523 | |
| 524 | cluster_size_ += other->cluster_size_; |
| 525 | effective_cluster_size_ += other->effective_cluster_size_; |
| 526 | has_functional_control_flow_ |= other->has_functional_control_flow_; |
| 527 | |
| 528 | devices_.UnionWith(other->devices_); |
| 529 | |
| 530 | DCHECK(!(resource_op_device_.has_value() && |
| 531 | other->resource_op_device_.has_value()) || |
| 532 | *resource_op_device_ == *other->resource_op_device_) |
| 533 | << "AreDevicesCompatible should have returned false otherwise!"; |
| 534 | |
| 535 | if (!resource_op_device_.has_value()) { |
| 536 | resource_op_device_ = other->resource_op_device_; |
| 537 | } |
| 538 | |
| 539 | is_xla_compile_attr_true_ |= other->is_xla_compile_attr_true_; |
| 540 | |
| 541 | if (!xla_scope_.has_value()) { |
| 542 | xla_scope_ = std::move(other->xla_scope_); |
| 543 | } |
| 544 | |
| 545 | resource_var_operation_node_ids_.reserve( |
| 546 | resource_var_operation_node_ids_.size() + |
| 547 | other->resource_var_operation_node_ids_.size()); |
| 548 | absl::c_copy(other->resource_var_operation_node_ids_, |
| 549 | std::back_inserter(resource_var_operation_node_ids_)); |
| 550 | other->resource_var_operation_node_ids_.clear(); |
| 551 | } |
| 552 | |
| 553 | Status IgnoreResourceOpForSafetyAnalysis( |
| 554 | jit::DeviceInfoCache* device_info_cache, const Node& n, bool* ignore) { |
no test coverage detected