| 2562 | }; |
| 2563 | |
| 2564 | TEST_F(TestWeightPreprocess, NoPreprocessNeeded) { |
| 2565 | using ::testing::_; |
| 2566 | using ::testing::Return; |
| 2567 | auto& mock = mock_conv(); |
| 2568 | |
| 2569 | MockAlgorithm algo; |
| 2570 | EXPECT_CALL(mock, get_algorithm_heuristic(_, _, _, _, _, _)) |
| 2571 | .WillRepeatedly(Return(&algo)); |
| 2572 | EXPECT_CALL(mock, get_algorithm_from_desc(_)).WillRepeatedly(Return(&algo)); |
| 2573 | EXPECT_CALL(mock, get_workspace_in_bytes(_, _, _, _)).WillRepeatedly(Return(0)); |
| 2574 | EXPECT_CALL(mock, get_preprocess_workspace_in_bytes(_, _, _)) |
| 2575 | .WillRepeatedly(Return(0)); |
| 2576 | |
| 2577 | { |
| 2578 | ::testing::InSequence seq; |
| 2579 | // Return empty preprocess filters, indicating no need to preprocess |
| 2580 | EXPECT_CALL(mock, deduce_preprocessed_filter_layout(_, _, _)) |
| 2581 | .WillRepeatedly(Return(SmallVector<TensorLayout>{})); |
| 2582 | EXPECT_CALL(mock, exec_preprocess(_, _, _, _, _)).Times(0); |
| 2583 | EXPECT_CALL(mock, exec(_, _, _, nullptr, _)); |
| 2584 | run(); |
| 2585 | } |
| 2586 | } |
| 2587 | |
| 2588 | TEST_F(TestWeightPreprocess, PreprocessCalledOnlyOnce) { |
| 2589 | megdnn::AlgorithmCache::instance().clear(); |