| 330 | } |
| 331 | |
| 332 | void ClGemm::configure_reshaped_only_rhs(const CLCompileContext &compile_context, |
| 333 | ITensorInfo *a, |
| 334 | ITensorInfo *b, |
| 335 | ITensorInfo *c, |
| 336 | ITensorInfo *output, |
| 337 | float alpha, |
| 338 | float beta, |
| 339 | const GEMMInfo &gemm_info) |
| 340 | { |
| 341 | DataType data_type = a->data_type(); |
| 342 | bool reinterpret_input_as_3d = gemm_info.reinterpret_input_as_3d(); |
| 343 | const unsigned int m = reinterpret_input_as_3d ? (a->dimension(1) * a->dimension(2)) : a->dimension(1); |
| 344 | const unsigned int n = b->dimension(0); |
| 345 | const unsigned int k = a->dimension(0); |
| 346 | const unsigned int batch_size = reinterpret_input_as_3d ? a->dimension(3) : a->dimension(2); |
| 347 | const int depth_output_gemm3d = gemm_info.depth_output_gemm3d(); |
| 348 | const GPUTarget gpu_target = CLScheduler::get().target(); |
| 349 | bool broadcast_bias = gemm_info.broadcast_bias(); |
| 350 | |
| 351 | GEMMKernelInfo kernel_info; |
| 352 | kernel_info.m = m; |
| 353 | kernel_info.n = n; |
| 354 | kernel_info.k = k; |
| 355 | kernel_info.depth_output_gemm3d = depth_output_gemm3d; |
| 356 | kernel_info.reinterpret_input_as_3d = reinterpret_input_as_3d; |
| 357 | kernel_info.broadcast_bias = broadcast_bias; |
| 358 | kernel_info.activation_info = gemm_info.activation_info(); |
| 359 | |
| 360 | // Set the target for the kernels |
| 361 | _mm_reshaped_only_rhs_kernel->set_target(gpu_target); |
| 362 | |
| 363 | GEMMLHSMatrixInfo lhs_info{}; |
| 364 | GEMMRHSMatrixInfo rhs_info{}; |
| 365 | |
| 366 | // Pick up the GEMM configuration |
| 367 | std::tie(lhs_info, rhs_info) = auto_select_gemm_config_reshaped_only_rhs( |
| 368 | auto_heuristics::CommonQuery{gpu_target, data_type, m, n, k, batch_size}, kernel_info, a, b, c, output); |
| 369 | |
| 370 | // Transpose matrix |
| 371 | _reshape_rhs_kernel->configure(compile_context, b, &_tmp_b, rhs_info); |
| 372 | |
| 373 | // Configure two variants of CLGEMMMatrixMultiplyReshapedOnlyRHSKernel (has_pad_y = false/true) |
| 374 | // During the prepare stage we check the padding requirement for the lhs and dst tensors. If they do not have |
| 375 | // pad y, we dispatch CLGEMMMatrixMultiplyReshapedOnlyRHSKernel with has_pad_y = false |
| 376 | |
| 377 | // Configure matrix multiply kernel with no y padding support |
| 378 | kernel_info.has_pad_y = false; |
| 379 | _mm_reshaped_only_rhs_kernel->configure(compile_context, a, &_tmp_b, c, output, alpha, beta, lhs_info, rhs_info, |
| 380 | kernel_info); |
| 381 | |
| 382 | // Request memory for RHS reshape matrix |
| 383 | _aux_mem[RhsReshape] = MemoryInfo( |
| 384 | offset_int_vec(RhsReshape), |
| 385 | _reshape_b_only_on_first_run ? MemoryLifetime::Persistent : MemoryLifetime::Temporary, _tmp_b.total_size()); |
| 386 | } |
| 387 | |
| 388 | void ClGemm::configure_reshaped_only_rhs_mmul(const CLCompileContext &compile_context, |
| 389 | ITensorInfo *a, |
nothing calls this directly
no test coverage detected