| 718 | } |
| 719 | |
| 720 | Status ClGemm::validate(const ITensorInfo *a, |
| 721 | const ITensorInfo *b, |
| 722 | const ITensorInfo *c, |
| 723 | const ITensorInfo *output, |
| 724 | float alpha, |
| 725 | float beta, |
| 726 | const GEMMInfo &gemm_info) |
| 727 | { |
| 728 | // Get the GPU target |
| 729 | bool reinterpret_input_as_3d = gemm_info.reinterpret_input_as_3d(); |
| 730 | const unsigned int m = reinterpret_input_as_3d ? (a->dimension(1) * a->dimension(2)) : a->dimension(1); |
| 731 | const unsigned int n = b->dimension(0); |
| 732 | const unsigned int k = a->dimension(0); |
| 733 | const unsigned int batch_size = reinterpret_input_as_3d ? a->dimension(3) : a->dimension(2); |
| 734 | |
| 735 | // Check data type early because the auto_select_gemm_kernel has assertions on supported data types |
| 736 | ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(a, 1, DataType::F32, DataType::F16); |
| 737 | |
| 738 | // Select GEMMType |
| 739 | CLGEMMKernelType gemm_kernel_type = auto_select_gemm_kernel( |
| 740 | auto_heuristics::CommonQuery{ |
| 741 | CLScheduler::get().target(), |
| 742 | a->data_type(), |
| 743 | m, |
| 744 | n, |
| 745 | k, |
| 746 | batch_size, |
| 747 | }, |
| 748 | gemm_info.reshape_b_only_on_first_run(), b->are_values_constant()); |
| 749 | |
| 750 | const bool fuse_add_c = (!(helpers::float_ops::is_zero(beta)) && c != nullptr); |
| 751 | |
| 752 | const ITensorInfo *c_to_use = fuse_add_c ? c : nullptr; |
| 753 | |
| 754 | switch (gemm_kernel_type) |
| 755 | { |
| 756 | case CLGEMMKernelType::NATIVE: |
| 757 | { |
| 758 | ARM_COMPUTE_RETURN_ON_ERROR(validate_native(a, b, c_to_use, output, alpha, beta, gemm_info)); |
| 759 | break; |
| 760 | } |
| 761 | case CLGEMMKernelType::RESHAPED: |
| 762 | { |
| 763 | ARM_COMPUTE_RETURN_ON_ERROR(validate_reshaped(a, b, c_to_use, output, alpha, beta, gemm_info)); |
| 764 | break; |
| 765 | } |
| 766 | case CLGEMMKernelType::RESHAPED_ONLY_RHS: |
| 767 | { |
| 768 | ARM_COMPUTE_RETURN_ON_ERROR(validate_reshaped_only_rhs(a, b, c_to_use, output, alpha, beta, gemm_info)); |
| 769 | break; |
| 770 | } |
| 771 | case CLGEMMKernelType::RESHAPED_ONLY_RHS_MMUL: |
| 772 | { |
| 773 | ARM_COMPUTE_RETURN_ON_ERROR( |
| 774 | validate_reshaped_only_rhs_mmul(a, b, c_to_use, output, alpha, beta, gemm_info)); |
| 775 | break; |
| 776 | } |
| 777 | default: |
nothing calls this directly
no test coverage detected