| 46 | }; |
| 47 | |
| 48 | TEST_F(StaticScheduleTest, BasicGraph) { |
| 49 | // This trivial graph is so basic there's nothing to prune. |
| 50 | TrivialTestGraphInputYielder fake_input(4, 1, 10, false, {"CPU:0"}); |
| 51 | GrapplerItem item; |
| 52 | CHECK(fake_input.NextItem(&item)); |
| 53 | |
| 54 | std::unique_ptr<VirtualCluster> cluster(CreateVirtualCluster()); |
| 55 | |
| 56 | std::unordered_map<const NodeDef*, Costs::NanoSeconds> completion_times; |
| 57 | Status status = |
| 58 | EstimateEarliestExecutionTimes(item, cluster.get(), &completion_times); |
| 59 | TF_EXPECT_OK(status); |
| 60 | |
| 61 | EXPECT_EQ(item.graph.node_size(), completion_times.size()); |
| 62 | |
| 63 | for (auto time : completion_times) { |
| 64 | if (time.first->name() == "Const/Const") { |
| 65 | EXPECT_EQ(Costs::NanoSeconds(1), time.second); |
| 66 | } else if (time.first->name() == "x") { |
| 67 | EXPECT_EQ(Costs::NanoSeconds(1500001), time.second); |
| 68 | } else if (time.first->name() == "Square") { |
| 69 | EXPECT_EQ(Costs::NanoSeconds(4000004), time.second); |
| 70 | } else if (time.first->name() == "Square_1") { |
| 71 | EXPECT_EQ(Costs::NanoSeconds(6500007), time.second); |
| 72 | } else if (time.first->name() == "Square_2") { |
| 73 | EXPECT_EQ(Costs::NanoSeconds(9000010), time.second); |
| 74 | } else if (time.first->name() == "Square_3") { |
| 75 | EXPECT_EQ(Costs::NanoSeconds(11500013), time.second); |
| 76 | } else if (time.first->name() == "y") { |
| 77 | EXPECT_EQ(Costs::NanoSeconds(14000013), time.second); |
| 78 | } |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | TEST_F(StaticScheduleTest, BasicGraphWithCtrlDependencies) { |
| 83 | // Build a simple graph with a control dependency. |
nothing calls this directly
no test coverage detected