| 25 | using GatherExpanderTest = HloTestBase; |
| 26 | |
| 27 | TEST_F(GatherExpanderTest, ErrorStatusOnTooManyIndices) { |
| 28 | const string hlo_text = R"( |
| 29 | HloModule TensorFlowGatherMultipleBatchDims |
| 30 | |
| 31 | ENTRY main { |
| 32 | operand = s32[3,3] parameter(0) |
| 33 | indices = s32[2147483647,5] parameter(1) |
| 34 | ROOT gather = s32[2147483647,3,5] gather(operand, indices), |
| 35 | offset_dims={1}, |
| 36 | collapsed_slice_dims={1}, |
| 37 | start_index_map={1}, |
| 38 | index_vector_dim=2, |
| 39 | slice_sizes={3, 1} |
| 40 | } |
| 41 | )"; |
| 42 | TF_ASSERT_OK_AND_ASSIGN(std::unique_ptr<HloModule> module, |
| 43 | ParseAndReturnVerifiedModule(hlo_text)); |
| 44 | |
| 45 | Status status = GatherExpander{}.Run(module.get()).status(); |
| 46 | EXPECT_EQ(status.code(), tensorflow::error::UNIMPLEMENTED); |
| 47 | |
| 48 | ASSERT_THAT( |
| 49 | status.error_message(), |
| 50 | ::testing::HasSubstr("Gather operations with more than 2147483647 gather " |
| 51 | "indices are not supported.")); |
| 52 | } |
| 53 | |
| 54 | TEST_F(GatherExpanderTest, AvoidDegenerateDims) { |
| 55 | const string hlo_text = R"( |
nothing calls this directly
no test coverage detected