| 1191 | } |
| 1192 | |
| 1193 | TEST_P(SoftPlacementPlacerTest, TestInvalidMultipleColocationGroups) { |
| 1194 | Graph g(OpRegistry::Global()); |
| 1195 | { // Scope for temporary variables used to construct g. |
| 1196 | GraphDefBuilder b(GraphDefBuilder::kFailImmediately); |
| 1197 | Node* input = ops::SourceOp("TestInput", b.opts().WithName("in")); |
| 1198 | Node* colocated_with_input = ops::UnaryOp( |
| 1199 | "ReluCPU", input, |
| 1200 | b.opts().WithName("colocated_1").WithAttr("_class", {"loc:@in"})); |
| 1201 | Node* colocated_with_input_and_other = |
| 1202 | ops::UnaryOp("ReluGPU", input, |
| 1203 | b.opts().WithName("foo").WithAttr( |
| 1204 | "_class", {"loc:@in", "loc:@colocated_1"})); |
| 1205 | CHECK(colocated_with_input); |
| 1206 | CHECK(colocated_with_input_and_other); |
| 1207 | TF_EXPECT_OK(BuildGraph(b, &g)); |
| 1208 | } |
| 1209 | |
| 1210 | bool allow_soft_placement = GetParam(); |
| 1211 | Status s = Place(&g, allow_soft_placement, true); |
| 1212 | if (allow_soft_placement) { |
| 1213 | EXPECT_EQ(error::OK, s.code()) << s.ToString(); |
| 1214 | EXPECT_DEVICE_TYPE(g, "in", "FakeCPU"); |
| 1215 | EXPECT_DEVICE_TYPE(g, "colocated_1", "FakeCPU"); |
| 1216 | EXPECT_DEVICE_TYPE(g, "foo", "FakeGPU"); |
| 1217 | } else { |
| 1218 | EXPECT_TRUE(absl::StrContains( |
| 1219 | s.error_message(), |
| 1220 | "Cannot colocate nodes {{colocation_node foo}} and " |
| 1221 | "{{colocation_node in}} because no device type supports both of those " |
| 1222 | "nodes and the other nodes colocated with them")) |
| 1223 | << s.ToString(); |
| 1224 | } |
| 1225 | } |
| 1226 | |
| 1227 | TEST_F(PlacerTest, TestColocationGroupWithReferenceConnections) { |
| 1228 | Graph g(OpRegistry::Global()); |
nothing calls this directly
no test coverage detected