| 105 | } |
| 106 | |
| 107 | void ClGemmLowpMatrixAReductionKernel::configure(const CLCompileContext &compile_context, |
| 108 | const ITensorInfo *mtx_a, |
| 109 | ITensorInfo *vector_sum_row, |
| 110 | const GEMMLowpReductionKernelInfo &info) |
| 111 | { |
| 112 | // Perform validate step |
| 113 | ARM_COMPUTE_ERROR_ON_NULLPTR(mtx_a, vector_sum_row); |
| 114 | ARM_COMPUTE_ERROR_THROW_ON(validate_arguments_matrix_a_reduction(mtx_a, vector_sum_row)); |
| 115 | |
| 116 | // Output auto initialization if not yet initialized |
| 117 | auto_init_if_empty(*vector_sum_row, TensorShape(mtx_a->dimension(1)), 1, DataType::S32); |
| 118 | |
| 119 | auto padding_info = get_padding_info({mtx_a, vector_sum_row}); |
| 120 | |
| 121 | // Set the arguments to pass at compile time |
| 122 | CLBuildOptions build_opts; |
| 123 | build_opts.add_option("-DCOLS_A=" + support::cpp11::to_string(mtx_a->dimension(0))); |
| 124 | build_opts.add_option("-DDATA_TYPE=" + get_cl_type_from_data_type(mtx_a->data_type())); |
| 125 | build_opts.add_option("-DACC_DATA_TYPE=" + get_cl_dot8_acc_type_from_data_type(mtx_a->data_type())); |
| 126 | build_opts.add_option_if(info.mul_by_scalar, "-DSCALAR=" + support::cpp11::to_string(info.scalar)); |
| 127 | |
| 128 | const bool is_dot8_supported = dot8_supported(CLKernelLibrary::get().get_device()); |
| 129 | |
| 130 | std::string kernel_name = "gemmlowp_matrix_a_reduction" + std::string(is_dot8_supported ? "_dot8" : ""); |
| 131 | |
| 132 | // A macro guard to compile ONLY the kernel of interest |
| 133 | build_opts.add_option("-D" + upper_string(kernel_name)); |
| 134 | |
| 135 | // Create kernel |
| 136 | _kernel = create_kernel(compile_context, kernel_name, build_opts.options()); |
| 137 | |
| 138 | // Configure kernel window |
| 139 | // This kernel does not need padding |
| 140 | Window win = calculate_max_window(*vector_sum_row, Steps()); |
| 141 | ICLKernel::configure_internal(win); |
| 142 | |
| 143 | _config_id = kernel_name; |
| 144 | _config_id += "_"; |
| 145 | _config_id += support::cpp11::to_string(mtx_a->dimension(0)); |
| 146 | _config_id += "_"; |
| 147 | _config_id += support::cpp11::to_string(mtx_a->dimension(1)); |
| 148 | _config_id += "_"; |
| 149 | _config_id += support::cpp11::to_string(mtx_a->dimension(2)); |
| 150 | |
| 151 | ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); |
| 152 | } |
| 153 | |
| 154 | Status ClGemmLowpMatrixAReductionKernel::validate(const ITensorInfo *mtx_a, |
| 155 | const ITensorInfo *vector_sum_row, |
nothing calls this directly
no test coverage detected