usage of weight pre-processing for winograd benchmark
| 1024 | |
| 1025 | // usage of weight pre-processing for winograd benchmark |
| 1026 | void benchmark_winograd_weight_preprocess( |
| 1027 | const char* algo_name, megdnn::Handle* handle, size_t kernel, size_t pack_size, |
| 1028 | size_t io_pack_size) { |
| 1029 | auto&& args = get_winograd_benchmark_args(kernel, pack_size, io_pack_size); |
| 1030 | using namespace conv_bias; |
| 1031 | constexpr size_t RUN = 10; |
| 1032 | |
| 1033 | //! here!!! |
| 1034 | Benchmarker<ConvBias, Timer, OprWeightPreprocessBenchmarkProxy<ConvBias>> |
| 1035 | benchmark_winograd(handle); |
| 1036 | benchmark_winograd.set_display(false); |
| 1037 | benchmark_winograd.set_times(RUN); |
| 1038 | |
| 1039 | for (auto&& arg : args) { |
| 1040 | TensorLayout dst_layout; |
| 1041 | auto opr = handle->create_operator<ConvBias>(); |
| 1042 | opr->param() = arg.param; |
| 1043 | opr->deduce_layout( |
| 1044 | {arg.src, dtype::Float32()}, {arg.filter, dtype::Float32()}, |
| 1045 | {arg.bias, dtype::Float32()}, {}, dst_layout); |
| 1046 | float computations = 0.0; |
| 1047 | if (io_pack_size == 1) { |
| 1048 | //! dst.nr_elems * IC * FH * FW * 2 |
| 1049 | computations = dst_layout.total_nr_elems() * arg.filter[1] * arg.filter[2] * |
| 1050 | arg.filter[3] * 2.0 / (1024 * 1024 * 1024) * 1e3; |
| 1051 | } else { |
| 1052 | //! dst.nr_elems * IC/4 * FH * FW * 4 * 2 |
| 1053 | computations = dst_layout.total_nr_elems() * arg.filter[1] * arg.filter[2] * |
| 1054 | arg.filter[3] * arg.filter[4] * 2.0 / (1024 * 1024 * 1024) * |
| 1055 | 1e3; |
| 1056 | } |
| 1057 | |
| 1058 | benchmark_winograd.set_param(arg.param); |
| 1059 | auto used_winograd = |
| 1060 | algo_benchmark< |
| 1061 | ConvBias, OprWeightPreprocessBenchmarkProxy<ConvBias>, Timer>( |
| 1062 | benchmark_winograd, {arg.src, arg.filter, {}, {}, {}}, |
| 1063 | algo_name) / |
| 1064 | RUN; |
| 1065 | |
| 1066 | printf("%s %s: %s: %f ms %f Gflops\n", arg.src.to_string().c_str(), |
| 1067 | arg.filter.to_string().c_str(), algo_name, used_winograd, |
| 1068 | computations / used_winograd); |
| 1069 | } |
| 1070 | } |
| 1071 | |
| 1072 | void benchmark_winograd_compare( |
| 1073 | const char* algoA_name, const char* algoB_name, megdnn::Handle* handle, |
no test coverage detected