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

Method configure_reshaped

src/gpu/cl/operators/ClGemm.cpp:278–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

276}
277
278void ClGemm::configure_reshaped(const CLCompileContext &compile_context,
279 ITensorInfo *a,
280 ITensorInfo *b,
281 ITensorInfo *c,
282 ITensorInfo *output,
283 float alpha,
284 float beta,
285 const GEMMInfo &gemm_info)
286{
287 DataType data_type = a->data_type();
288 bool reinterpret_input_as_3d = gemm_info.reinterpret_input_as_3d();
289 const unsigned int m = reinterpret_input_as_3d ? (a->dimension(1) * a->dimension(2)) : a->dimension(1);
290 const unsigned int n = b->dimension(0);
291 const unsigned int k = a->dimension(0);
292 const unsigned int batch_size = reinterpret_input_as_3d ? a->dimension(3) : a->dimension(2);
293 const int depth_output_gemm3d = gemm_info.depth_output_gemm3d();
294 const GPUTarget gpu_target = CLScheduler::get().target();
295 bool broadcast_bias = gemm_info.broadcast_bias();
296
297 GEMMKernelInfo kernel_info;
298 kernel_info.m = m;
299 kernel_info.n = n;
300 kernel_info.k = k;
301 kernel_info.depth_output_gemm3d = depth_output_gemm3d;
302 kernel_info.reinterpret_input_as_3d = false;
303 kernel_info.broadcast_bias = broadcast_bias;
304 kernel_info.activation_info = gemm_info.activation_info();
305
306 // Set the target for the kernels
307 _reshape_lhs_kernel->set_target(gpu_target);
308 _mm_reshaped_kernel->set_target(gpu_target);
309
310 GEMMLHSMatrixInfo lhs_info{};
311 GEMMRHSMatrixInfo rhs_info{};
312
313 // Pick up the GEMM configuration
314 std::tie(lhs_info, rhs_info) =
315 auto_select_gemm_config_reshaped(auto_heuristics::CommonQuery{gpu_target, data_type, m, n, k, batch_size},
316 kernel_info, a, b, c, output, gemm_info.reinterpret_input_as_3d());
317
318 _reshape_lhs_kernel->configure(compile_context, a, &_tmp_a, lhs_info, gemm_info.reinterpret_input_as_3d());
319 _reshape_rhs_kernel->configure(compile_context, b, &_tmp_b, rhs_info);
320
321 // Configure and tune matrix multiply kernel
322 _mm_reshaped_kernel->configure(compile_context, &_tmp_a, &_tmp_b, c, output, alpha, beta, lhs_info, rhs_info,
323 kernel_info);
324
325 // Request memory for LHS and RHS reshape matrix
326 _aux_mem[LhsReshape] = MemoryInfo(offset_int_vec(LhsReshape), MemoryLifetime::Temporary, _tmp_a.total_size());
327 _aux_mem[RhsReshape] = MemoryInfo(
328 offset_int_vec(RhsReshape),
329 _reshape_b_only_on_first_run ? MemoryLifetime::Persistent : MemoryLifetime::Temporary, _tmp_b.total_size());
330}
331
332void ClGemm::configure_reshaped_only_rhs(const CLCompileContext &compile_context,
333 ITensorInfo *a,

Callers

nothing calls this directly

Calls 13

MemoryInfoClass · 0.85
offset_int_vecFunction · 0.85
data_typeMethod · 0.45
dimensionMethod · 0.45
depth_output_gemm3dMethod · 0.45
targetMethod · 0.45
broadcast_biasMethod · 0.45
activation_infoMethod · 0.45
set_targetMethod · 0.45
configureMethod · 0.45

Tested by

no test coverage detected