MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / configure

Method configure

src/gpu/cl/kernels/ClGemmLowpReductionKernel.cpp:107–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107void 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
154Status ClGemmLowpMatrixAReductionKernel::validate(const ITensorInfo *mtx_a,
155 const ITensorInfo *vector_sum_row,

Callers

nothing calls this directly

Calls 15

auto_init_if_emptyFunction · 0.85
get_padding_infoFunction · 0.85
dot8_supportedFunction · 0.85
upper_stringFunction · 0.85
create_kernelFunction · 0.85
StepsClass · 0.85
has_padding_changedFunction · 0.85
adjust_vec_sizeFunction · 0.85
add_option_ifMethod · 0.80

Tested by

no test coverage detected