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

Method validate_reshaped

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

Source from the content-addressed store, hash-verified

483}
484
485Status ClGemm::validate_reshaped(const ITensorInfo *a,
486 const ITensorInfo *b,
487 const ITensorInfo *c,
488 const ITensorInfo *output,
489 float alpha,
490 float beta,
491 const GEMMInfo &gemm_info)
492{
493 ARM_COMPUTE_UNUSED(alpha);
494 ARM_COMPUTE_UNUSED(output);
495
496 TensorInfo tmp_a_info{};
497 TensorInfo tmp_b_info{};
498
499 // Get the GPU target
500 const GPUTarget gpu_target = CLScheduler::get().target();
501 DataType data_type = a->data_type();
502 bool reinterpret_input_as_3d = gemm_info.reinterpret_input_as_3d();
503 const unsigned int m = reinterpret_input_as_3d ? (a->dimension(1) * a->dimension(2)) : a->dimension(1);
504 const unsigned int n = b->dimension(0);
505 const unsigned int k = a->dimension(0);
506 const unsigned int batch_size = reinterpret_input_as_3d ? a->dimension(3) : a->dimension(2);
507 const int depth_output_gemm3d = gemm_info.depth_output_gemm3d();
508 const bool broadcast_bias = gemm_info.broadcast_bias();
509
510 GEMMKernelInfo kernel_info;
511 kernel_info.m = m;
512 kernel_info.n = n;
513 kernel_info.k = k;
514 kernel_info.depth_output_gemm3d = depth_output_gemm3d;
515 kernel_info.reinterpret_input_as_3d = false;
516 kernel_info.broadcast_bias = broadcast_bias;
517 kernel_info.activation_info = gemm_info.activation_info();
518
519 GEMMLHSMatrixInfo lhs_info;
520 GEMMRHSMatrixInfo rhs_info;
521
522 // Pick up the GEMM configuration
523 // NOTE: No need to validate mlgo configurations as they automatically fall back to default heuristics if validation fails
524 const auto gemm_config =
525 select_default_gemm_config_reshaped(auto_heuristics::CommonQuery{gpu_target, data_type, m, n, k, batch_size});
526 lhs_info = gemm_config.lhs_info;
527 rhs_info = gemm_config.rhs_info;
528
529 auto_init_if_empty(tmp_a_info, a->clone()->set_tensor_shape(
530 compute_lhs_reshaped_shape(*a, lhs_info, gemm_info.reinterpret_input_as_3d())));
531 ARM_COMPUTE_RETURN_ON_ERROR(
532 ClGemmReshapeLhsMatrixKernel::validate(a, &tmp_a_info, lhs_info, gemm_info.reinterpret_input_as_3d()));
533
534 auto_init_if_empty(tmp_b_info, b->clone()->set_tensor_shape(compute_rhs_reshaped_shape(*b, rhs_info)));
535 ARM_COMPUTE_RETURN_ON_ERROR(ClGemmReshapeRhsMatrixKernel::validate(b, &tmp_b_info, rhs_info));
536
537 // Validate matrix multiply
538 ARM_COMPUTE_RETURN_ON_ERROR(ClGemmMatrixMultiplyReshapedKernel::validate(&tmp_a_info, &tmp_b_info, c, output, alpha,
539 beta, lhs_info, rhs_info, kernel_info));
540
541 return Status{};
542}

Callers

nothing calls this directly

Calls 13

auto_init_if_emptyFunction · 0.85
validateFunction · 0.50
targetMethod · 0.45
data_typeMethod · 0.45
dimensionMethod · 0.45
depth_output_gemm3dMethod · 0.45
broadcast_biasMethod · 0.45
activation_infoMethod · 0.45

Tested by

no test coverage detected