| 87 | } |
| 88 | |
| 89 | TEST(XlaCompilationTest, Chains) { |
| 90 | std::unique_ptr<Graph> graph(new Graph(OpRegistry::Global())); |
| 91 | { |
| 92 | GraphDefBuilder builder(GraphDefBuilder::kFailImmediately); |
| 93 | Node* a = |
| 94 | ops::SourceOp("UncompilableNullary", builder.opts().WithName("A")); |
| 95 | Node* b = ops::UnaryOp("Relu", a, builder.opts().WithName("B")); |
| 96 | Node* c = ops::UnaryOp("Relu", b, builder.opts().WithName("C")); |
| 97 | Node* d = |
| 98 | ops::UnaryOp("UncompilableUnary", c, builder.opts().WithName("D")); |
| 99 | Node* e = ops::UnaryOp("Relu", d, builder.opts().WithName("E")); |
| 100 | ops::UnaryOp("Relu", e, builder.opts().WithName("F")); |
| 101 | TF_EXPECT_OK(GraphDefBuilderToGraph(builder, graph.get())); |
| 102 | } |
| 103 | |
| 104 | TF_ASSERT_OK(MarkForCompilationPassTestHelper::MarkForCompilation(&graph)); |
| 105 | auto clusters = GetClusters(*graph); |
| 106 | EXPECT_EQ(4, clusters.size()); |
| 107 | EXPECT_EQ(clusters["B"], clusters["C"]); |
| 108 | EXPECT_EQ(clusters["E"], clusters["F"]); |
| 109 | EXPECT_NE(clusters["B"], clusters["E"]); |
| 110 | EXPECT_TRUE(clusters.find("A") == clusters.cend()); |
| 111 | EXPECT_TRUE(clusters.find("D") == clusters.cend()); |
| 112 | } |
| 113 | |
| 114 | TEST(XlaCompilationTest, UncompilableCycles) { |
| 115 | std::unique_ptr<Graph> graph(new Graph(OpRegistry::Global())); |
nothing calls this directly
no test coverage detected