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

Method configure

src/gpu/cl/kernels/ClGemmReshapeLhsMatrixKernel.cpp:127–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127void ClGemmReshapeLhsMatrixKernel::configure(const CLCompileContext &compile_context,
128 ITensorInfo *src,
129 ITensorInfo *dst,
130 const GEMMLHSMatrixInfo &lhs_info,
131 bool reinterpret_input_as_3d)
132{
133 ARM_COMPUTE_ERROR_ON_NULLPTR(src, dst);
134
135 // Perform validate step
136 ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(src, dst, lhs_info, reinterpret_input_as_3d));
137
138 auto padding_info = get_padding_info({src});
139
140 const unsigned int src_w = src->dimension(0);
141 const unsigned int m = reinterpret_input_as_3d ? src->dimension(1) * src->dimension(2) : src->dimension(1);
142 const unsigned int partial_m0 = m % lhs_info.m0;
143 const unsigned int partial_k0 = src_w % lhs_info.k0;
144
145 // Create build options
146 CLBuildOptions build_opts;
147 build_opts.add_option("-DM0=" + support::cpp11::to_string(lhs_info.m0));
148 build_opts.add_option("-DK0=" + support::cpp11::to_string(lhs_info.k0));
149 build_opts.add_option_if(lhs_info.interleave, "-DINTERLEAVE");
150 build_opts.add_option_if_else(lhs_info.transpose, "-DRESHAPE_LHS_T", "-DRESHAPE_LHS_NT");
151 build_opts.add_option("-DDATA_TYPE=" + get_cl_unsigned_type_from_element_size(src->element_size()));
152 build_opts.add_option("-DPARTIAL_M0=" + support::cpp11::to_string(partial_m0));
153 build_opts.add_option("-DPARTIAL_K0=" + support::cpp11::to_string(partial_k0));
154
155 std::string kernel_name("gemm_reshape_lhs_matrix_");
156 kernel_name += lhs_info.transpose ? "t" : "nt";
157
158 // Create kernel
159 _kernel = create_kernel(compile_context, kernel_name, build_opts.options());
160
161 // Configure kernel window
162 auto win_config = configure_window(src, dst, lhs_info, reinterpret_input_as_3d);
163 ICLKernel::configure_internal(win_config);
164
165 unsigned int idx = 2 * num_arguments_per_3d_tensor_nhw();
166 _kernel.setArg<cl_int>(idx++, m);
167 _kernel.setArg<cl_int>(idx++, lhs_info.v0);
168
169 // Set config_id for enabling LWS tuning
170 _config_id = "gemm_reshape_lhs_matrix_";
171 _config_id += (reinterpret_input_as_3d ? "3d_" : "");
172 _config_id += lower_string(string_from_data_type(src->data_type()));
173 _config_id += "_";
174 _config_id += support::cpp11::to_string(dst->dimension(0));
175 _config_id += "_";
176 _config_id += support::cpp11::to_string(dst->dimension(1));
177 _config_id += "_";
178 _config_id += support::cpp11::to_string(dst->dimension(2));
179 _config_id += "_";
180 _config_id += support::cpp11::to_string(lhs_info.m0);
181 _config_id += "_";
182 _config_id += support::cpp11::to_string(lhs_info.k0);
183 _config_id += "_";
184 _config_id += support::cpp11::to_string(lhs_info.v0);

Callers

nothing calls this directly

Calls 14

get_padding_infoFunction · 0.85
create_kernelFunction · 0.85
configure_windowFunction · 0.85
lower_stringFunction · 0.85
has_padding_changedFunction · 0.85
add_option_ifMethod · 0.80
add_option_if_elseMethod · 0.80
validate_argumentsFunction · 0.70
to_stringFunction · 0.50
dimensionMethod · 0.45
add_optionMethod · 0.45

Tested by

no test coverage detected