| 11 | |
| 12 | #if MEGDNN_WITH_BENCHMARK |
| 13 | TEST_F(ARMV7, BENCHMARK_CONVOLUTION_STRIDE2) { |
| 14 | using Param = param::Convolution; |
| 15 | auto run = [&](const TensorShapeArray& shapes, Param param) { |
| 16 | Benchmarker<Convolution> benchmarker_float(handle()); |
| 17 | size_t RUN = 100; |
| 18 | auto tfloat = benchmarker_float.set_display(false) |
| 19 | .set_times(RUN) |
| 20 | .set_param(param) |
| 21 | .exec(shapes); |
| 22 | size_t IC = shapes[1][1]; |
| 23 | size_t FH = shapes[1][2]; |
| 24 | size_t FW = shapes[1][3]; |
| 25 | TensorLayout dst_layout; |
| 26 | auto opr = handle()->create_operator<Convolution>(); |
| 27 | opr->param() = param; |
| 28 | opr->deduce_layout( |
| 29 | {shapes[0], dtype::Float32()}, {shapes[1], dtype::Float32()}, |
| 30 | dst_layout); |
| 31 | printf("flops: %.3f mflops\n", (IC * dst_layout.total_nr_elems() * FH * FW * |
| 32 | 2) / (tfloat / RUN * 1000)); |
| 33 | }; |
| 34 | |
| 35 | auto profile = [&](size_t oc, size_t ic, size_t w, size_t h, size_t kernel, |
| 36 | size_t stride) { |
| 37 | Param param; |
| 38 | param.stride_h = stride; |
| 39 | param.stride_w = stride; |
| 40 | param.pad_h = kernel / 2; |
| 41 | param.pad_w = kernel / 2; |
| 42 | printf("oc: %zd ic: %zd w: %zd h: %zd stride: %zd kernel_size: %zd\n", oc, ic, |
| 43 | w, h, stride, kernel); |
| 44 | |
| 45 | run({{1, ic, h, w}, {oc, ic, kernel, kernel}, {}}, param); |
| 46 | }; |
| 47 | |
| 48 | for (size_t kernel : {2, 3, 5, 7}) { |
| 49 | for (size_t ic : {3, 6, 12, 24}) { |
| 50 | for (size_t oc : {3, 6, 12, 24}) { |
| 51 | for (size_t size : {4, 7, 8, 14, 16, 17, 28, 32, 34, 64, 112}) { |
| 52 | profile(oc, ic, size, size, kernel, 2); |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | #endif |
| 59 | |
| 60 | TEST_F(ARMV7, BENCHMARK_CONVOLUTION_1X1) { |
nothing calls this directly
no test coverage detected