| 107 | } |
| 108 | |
| 109 | void ConvolutionImpl::exec_preprocess( |
| 110 | const TensorLayout& src_layout, _megdnn_tensor_in filter, |
| 111 | const TensorLayout& dst_layout, PreprocessedFilter* preprocessed_filter, |
| 112 | _megdnn_workspace workspace) { |
| 113 | //! exec_preprocess currently only support preprocess weights before exec, |
| 114 | //! src/dst will be ignored, just set to nullptr |
| 115 | TensorND src{nullptr, src_layout}, dst{nullptr, dst_layout}; |
| 116 | auto fparam = make_ncb_kern_param(src, filter, dst, preprocessed_filter, workspace); |
| 117 | |
| 118 | //! should not pass workspace_size limit otherwise can not find match algo |
| 119 | auto&& algo = get_algorithm(fparam); |
| 120 | if (!is_naive_algo(algo) && |
| 121 | NCB_ALGO_FUNC(get_preprocess_workspace, algo, fparam) <= workspace.size) { |
| 122 | exec_preprocess_with_ncb_kern(fparam, algo); |
| 123 | } else { |
| 124 | naive::ConvolutionForwardImpl::exec_preprocess( |
| 125 | src_layout, filter, dst_layout, preprocessed_filter, workspace); |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | size_t ConvolutionImpl::get_workspace_in_bytes( |
| 130 | const TensorLayout& src, const TensorLayout& filter, const TensorLayout& dst, |
nothing calls this directly
no test coverage detected