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

Method validate_reshaped_only_rhs

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

Source from the content-addressed store, hash-verified

542}
543
544Status ClGemm::validate_reshaped_only_rhs(const ITensorInfo *a,
545 const ITensorInfo *b,
546 const ITensorInfo *c,
547 const ITensorInfo *output,
548 float alpha,
549 float beta,
550 const GEMMInfo &gemm_info)
551{
552 ARM_COMPUTE_UNUSED(alpha);
553 ARM_COMPUTE_UNUSED(output);
554
555 TensorInfo tmp_b_info{};
556
557 // Get the GPU target
558 const GPUTarget gpu_target = CLScheduler::get().target();
559 const DataType data_type = a->data_type();
560 bool reinterpret_input_as_3d = gemm_info.reinterpret_input_as_3d();
561 const unsigned int m = reinterpret_input_as_3d ? (a->dimension(1) * a->dimension(2)) : a->dimension(1);
562 const unsigned int n = b->dimension(0);
563 const unsigned int k = a->dimension(0);
564 const unsigned int batch_size = reinterpret_input_as_3d ? a->dimension(3) : a->dimension(2);
565 const int depth_output_gemm3d = gemm_info.depth_output_gemm3d();
566 const bool broadcast_bias = gemm_info.broadcast_bias();
567
568 GEMMKernelInfo kernel_info;
569 kernel_info.m = m;
570 kernel_info.n = n;
571 kernel_info.k = k;
572 kernel_info.depth_output_gemm3d = depth_output_gemm3d;
573 kernel_info.reinterpret_input_as_3d = reinterpret_input_as_3d;
574 kernel_info.broadcast_bias = broadcast_bias;
575 kernel_info.activation_info = gemm_info.activation_info();
576
577 GEMMLHSMatrixInfo lhs_info;
578 GEMMRHSMatrixInfo rhs_info;
579
580 // Pick up the GEMM configuration
581 // NOTE: No need to validate mlgo configurations as they automatically fall back to default heuristics if validation fails
582 const auto gemm_config = select_default_gemm_config_reshaped_only_rhs(
583 auto_heuristics::CommonQuery{gpu_target, data_type, m, n, k, batch_size});
584 lhs_info = gemm_config.lhs_info;
585 rhs_info = gemm_config.rhs_info;
586
587 auto_init_if_empty(tmp_b_info, b->clone()->set_tensor_shape(compute_rhs_reshaped_shape(*b, rhs_info)));
588 ARM_COMPUTE_RETURN_ON_ERROR(ClGemmReshapeRhsMatrixKernel::validate(b, &tmp_b_info, rhs_info));
589
590 // Validate matrix multiply
591 kernel_info.has_pad_y = false;
592 ARM_COMPUTE_RETURN_ON_ERROR(ClGemmMatrixMultiplyReshapedOnlyRhsKernel::validate(
593 a, &tmp_b_info, c, output, alpha, beta, lhs_info, rhs_info, kernel_info));
594
595 kernel_info.has_pad_y = true;
596 ARM_COMPUTE_RETURN_ON_ERROR(ClGemmMatrixMultiplyReshapedOnlyRhsKernel::validate(
597 a, &tmp_b_info, c, output, alpha, beta, lhs_info, rhs_info, kernel_info));
598
599 return Status{};
600}
601

Callers

nothing calls this directly

Calls 12

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
cloneMethod · 0.45

Tested by

no test coverage detected