| 5203 | } |
| 5204 | |
| 5205 | static void BM_MklLayoutRewritePass(int iters, int op_nodes) { |
| 5206 | testing::StopTiming(); |
| 5207 | string s; |
| 5208 | for (int in = 0; in < 10; in++) { |
| 5209 | s += strings::Printf("node { name: 'in%04d' op: 'Input'}", in); |
| 5210 | } |
| 5211 | random::PhiloxRandom philox(301, 17); |
| 5212 | random::SimplePhilox rnd(&philox); |
| 5213 | for (int op = 0; op < op_nodes; op++) { |
| 5214 | s += strings::Printf( |
| 5215 | "node { name: 'op%04d' op: 'Zeta' attr { key: 'T' value { " |
| 5216 | "type: DT_FLOAT } } input: ['in%04d', 'in%04d' ] }", |
| 5217 | op, rnd.Uniform(10), rnd.Uniform(10)); |
| 5218 | } |
| 5219 | |
| 5220 | bool first = true; |
| 5221 | while (iters > 0) { |
| 5222 | Graph* graph = new Graph(OpRegistry::Global()); |
| 5223 | InitGraph(s, graph); |
| 5224 | int N = graph->num_node_ids(); |
| 5225 | if (first) { |
| 5226 | testing::SetLabel(strings::StrCat("Per graph node. Nodes: ", N)); |
| 5227 | first = false; |
| 5228 | } |
| 5229 | { |
| 5230 | testing::StartTiming(); |
| 5231 | std::unique_ptr<Graph> ug(graph); |
| 5232 | RunMklLayoutRewritePass(&ug); |
| 5233 | testing::StopTiming(); |
| 5234 | } |
| 5235 | iters -= N; // Our benchmark units are individual graph nodes, |
| 5236 | // not whole graphs |
| 5237 | // delete graph; |
| 5238 | } |
| 5239 | } |
| 5240 | BENCHMARK(BM_MklLayoutRewritePass)->Arg(1000)->Arg(10000); |
| 5241 | |
| 5242 | } // namespace |
nothing calls this directly
no test coverage detected