| 31 | } |
| 32 | |
| 33 | Status OptimizationPassRegistry::RunGrouping( |
| 34 | Grouping grouping, const GraphOptimizationPassOptions& options) { |
| 35 | auto group = groups_.find(grouping); |
| 36 | if (group != groups_.end()) { |
| 37 | for (auto& phase : group->second) { |
| 38 | VLOG(1) << "Running optimization phase " << phase.first; |
| 39 | for (auto& pass : phase.second) { |
| 40 | VLOG(1) << "Running optimization pass: " << pass->name(); |
| 41 | Status s = pass->Run(options); |
| 42 | if (!s.ok()) return s; |
| 43 | if (VLOG_IS_ON(1)) { |
| 44 | if (options.graph) { |
| 45 | DumpGraphToFile(strings::StrCat("after_group_", grouping, "_phase_", |
| 46 | phase.first, "_", pass->name(), "_", |
| 47 | reinterpret_cast<uintptr_t>( |
| 48 | (*options.graph).get())), |
| 49 | **options.graph, options.flib_def); |
| 50 | } |
| 51 | if (options.partition_graphs) { |
| 52 | for (auto& part : *options.partition_graphs) { |
| 53 | DumpGraphToFile( |
| 54 | strings::StrCat( |
| 55 | "after_group_", grouping, "_phase_", phase.first, "_", |
| 56 | pass->name(), "_partition_", part.first, "_", |
| 57 | reinterpret_cast<uintptr_t>(part.second.get())), |
| 58 | *part.second, options.flib_def); |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | return Status::OK(); |
| 66 | } |
| 67 | |
| 68 | void OptimizationPassRegistry::LogGrouping(Grouping grouping, int vlog_level) { |
| 69 | auto group = groups_.find(grouping); |