| 86 | } |
| 87 | |
| 88 | void ClMatMul::configure(const CLCompileContext &compile_context, |
| 89 | ITensorInfo *lhs, |
| 90 | ITensorInfo *rhs, |
| 91 | ITensorInfo *dst, |
| 92 | const MatMulInfo &matmul_info, |
| 93 | const ActivationLayerInfo &act_info) |
| 94 | { |
| 95 | ARM_COMPUTE_ERROR_ON_NULLPTR(lhs, rhs, dst); |
| 96 | ARM_COMPUTE_LOG_PARAMS(lhs, rhs, dst, matmul_info); |
| 97 | |
| 98 | // Perform validation step |
| 99 | ARM_COMPUTE_ERROR_THROW_ON(validate(lhs, rhs, dst, matmul_info)); |
| 100 | |
| 101 | const GPUTarget gpu_target = CLScheduler::get().target(); |
| 102 | const auto kernel_config = ClMatMulNativeKernelConfigurationFactory::create(gpu_target); |
| 103 | const MatMulKernelInfo kernel_info = kernel_config->configure(lhs, rhs, matmul_info); |
| 104 | |
| 105 | const auto kernel_selector = ClMatMulNativeKernelVariantFactory::create(gpu_target); |
| 106 | const MatMulKernelType kernel_type = kernel_selector->select_kernel(lhs, rhs, matmul_info, act_info); |
| 107 | |
| 108 | switch (kernel_type) |
| 109 | { |
| 110 | case MatMulKernelType::NATIVE_FP: |
| 111 | { |
| 112 | auto kernel = std::make_unique<ClMatMulNativeKernel>(); |
| 113 | kernel->set_target(gpu_target); |
| 114 | |
| 115 | kernel->configure(compile_context, lhs, rhs, nullptr /* bias */, dst, kernel_info, act_info); |
| 116 | _matmul_kernel = std::move(kernel); |
| 117 | } |
| 118 | break; |
| 119 | case MatMulKernelType::NATIVE_MMUL_FP: |
| 120 | { |
| 121 | auto kernel = std::make_unique<ClMatMulNativeMMULKernel>(); |
| 122 | kernel->set_target(gpu_target); |
| 123 | |
| 124 | kernel->configure(compile_context, lhs, rhs, nullptr /* bias */, dst, kernel_info); |
| 125 | _matmul_kernel = std::move(kernel); |
| 126 | } |
| 127 | break; |
| 128 | case MatMulKernelType::NATIVE_QUANTIZED: |
| 129 | { |
| 130 | auto kernel = std::make_unique<ClMatMulLowpNativeKernel>(); |
| 131 | kernel->set_target(gpu_target); |
| 132 | |
| 133 | kernel->configure(compile_context, lhs, rhs, nullptr /* bias */, dst, kernel_info, act_info); |
| 134 | _matmul_kernel = std::move(kernel); |
| 135 | } |
| 136 | break; |
| 137 | case MatMulKernelType::NATIVE_MMUL_QUANTIZED: |
| 138 | { |
| 139 | auto kernel = std::make_unique<ClMatMulLowpNativeMMULKernel>(); |
| 140 | kernel->set_target(gpu_target); |
| 141 | |
| 142 | kernel->configure(compile_context, lhs, rhs, nullptr /* bias */, dst, kernel_info, act_info); |
| 143 | _matmul_kernel = std::move(kernel); |
| 144 | } |
| 145 | break; |
no test coverage detected