| 1729 | } |
| 1730 | |
| 1731 | ExecutorInternal::ExecuteCostModel* ExecutorImpl::TryToBuildCostModel() { |
| 1732 | if (cost_model_) return cost_model_; |
| 1733 | |
| 1734 | if (!enable_cost_model_ || |
| 1735 | !kernel_stats_.CollectStatsDone()) { |
| 1736 | return nullptr; |
| 1737 | } |
| 1738 | |
| 1739 | // Build cost model |
| 1740 | int counter = build_cost_model_counter_.fetch_add(1); |
| 1741 | if (counter == 0) { |
| 1742 | ExecutorInternal::ExecuteCostModel* cm = |
| 1743 | new ExecutorInternal::ExecuteCostModel(); |
| 1744 | cm->BuildCostModel(&kernel_stats_); |
| 1745 | cost_model_ = cm; |
| 1746 | LOG(INFO) << "Build execute cost model successful."; |
| 1747 | } |
| 1748 | if (cost_model_) return cost_model_; |
| 1749 | return nullptr; |
| 1750 | } |
| 1751 | |
| 1752 | void ExecutorImpl::RunAsync(const Args& args, DoneCallback done) { |
| 1753 | if (immutable_state_.requires_control_flow_support()) { |
no test coverage detected