| 73 | |
| 74 | #if __ARM_FEATURE_FP16_VECTOR_ARITHMETIC |
| 75 | TEST_F(ARM_COMMON_BENCHMARK_MULTI_THREADS, BENCHMARK_CONVBIAS_DIRECTF16) { |
| 76 | constexpr size_t RUNS = 50; |
| 77 | |
| 78 | param::ConvBias param; |
| 79 | param.nonlineMode = param::ConvBias::NonlineMode::RELU; |
| 80 | param.pad_h = 1; |
| 81 | param.pad_w = 1; |
| 82 | param.stride_h = 1; |
| 83 | param.stride_w = 1; |
| 84 | param.sparse = param::ConvBias::Sparse::GROUP; |
| 85 | |
| 86 | std::vector<std::pair<SmallVector<TensorShape>, float>> shapes_and_computation; |
| 87 | auto bench_case = [&](size_t N, size_t IC, size_t OC, size_t H, size_t W, size_t FS, |
| 88 | size_t group) { |
| 89 | SmallVector<TensorShape> shapes{ |
| 90 | {N, IC, H, W}, |
| 91 | {group, OC / group, IC / group, FS, FS}, |
| 92 | {1, OC, 1, 1}, |
| 93 | {}, |
| 94 | {N, OC, H, W}}; |
| 95 | TensorShape dst{N, OC, H, W}; |
| 96 | float computations = ((IC / group) * FS * FS * dst.total_nr_elems() * 2 + |
| 97 | dst.total_nr_elems()) * |
| 98 | 1e-6; |
| 99 | shapes_and_computation.push_back(std::make_pair(shapes, computations)); |
| 100 | }; |
| 101 | |
| 102 | bench_case(1, 32, 32, 200, 200, 3, 4); |
| 103 | bench_case(1, 32, 32, 200, 200, 3, 32); |
| 104 | bench_case(1, 32, 32, 128, 128, 3, 4); |
| 105 | bench_case(1, 32, 32, 128, 128, 3, 32); |
| 106 | bench_case(1, 32, 32, 100, 100, 3, 4); |
| 107 | bench_case(1, 32, 32, 100, 100, 3, 32); |
| 108 | bench_case(1, 32, 32, 80, 80, 3, 4); |
| 109 | bench_case(1, 32, 32, 80, 80, 3, 32); |
| 110 | |
| 111 | std::string algo_name = "F16DIRECT"; |
| 112 | printf("Benchmark F16DIRECT_LARGE_GROUP algo\n"); |
| 113 | std::vector<DType> data_type = { |
| 114 | dtype::Float16(), dtype::Float16(), dtype::Float16(), dtype::Float16()}; |
| 115 | benchmark_impl( |
| 116 | param, shapes_and_computation, algo_name, RUNS, {4, {4, 5, 6, 7}}, {1, {4}}, |
| 117 | data_type); |
| 118 | benchmark_impl( |
| 119 | param, shapes_and_computation, algo_name, RUNS, {4, {4, 5, 6, 7}}, {1, {7}}, |
| 120 | data_type); |
| 121 | benchmark_impl( |
| 122 | param, shapes_and_computation, algo_name, RUNS, {2, {4, 5}}, {1, {4}}, |
| 123 | data_type); |
| 124 | shapes_and_computation.clear(); |
| 125 | |
| 126 | algo_name = "F16DIRECT"; |
| 127 | printf("Benchmark F16DIRECT_SMALL_GROUP algo\n"); |
| 128 | bench_case(1, 32, 32, 200, 200, 3, 1); |
| 129 | bench_case(1, 32, 32, 128, 128, 3, 1); |
| 130 | bench_case(1, 32, 32, 100, 100, 3, 1); |
| 131 | bench_case(1, 32, 32, 80, 80, 3, 1); |
| 132 | benchmark_impl( |
nothing calls this directly
no test coverage detected