| 121 | |
| 122 | template <typename KernelType> |
| 123 | const KernelType* DispatchExactImpl(const std::vector<KernelType*>& kernels, |
| 124 | const std::vector<TypeHolder>& values) { |
| 125 | const KernelType* kernel_matches[SimdLevel::MAX] = {nullptr}; |
| 126 | |
| 127 | // Validate arity |
| 128 | for (const auto& kernel : kernels) { |
| 129 | if (kernel->signature->MatchesInputs(values)) { |
| 130 | kernel_matches[kernel->simd_level] = kernel; |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | // Dispatch as the CPU feature |
| 135 | #if defined(ARROW_HAVE_RUNTIME_AVX512) || defined(ARROW_HAVE_RUNTIME_AVX2) |
| 136 | auto cpu_info = arrow::internal::CpuInfo::GetInstance(); |
| 137 | #endif |
| 138 | #if defined(ARROW_HAVE_RUNTIME_AVX512) |
| 139 | if (cpu_info->IsSupported(arrow::internal::CpuInfo::AVX512)) { |
| 140 | if (kernel_matches[SimdLevel::AVX512]) { |
| 141 | return kernel_matches[SimdLevel::AVX512]; |
| 142 | } |
| 143 | } |
| 144 | #endif |
| 145 | #if defined(ARROW_HAVE_RUNTIME_AVX2) |
| 146 | if (cpu_info->IsSupported(arrow::internal::CpuInfo::AVX2)) { |
| 147 | if (kernel_matches[SimdLevel::AVX2]) { |
| 148 | return kernel_matches[SimdLevel::AVX2]; |
| 149 | } |
| 150 | } |
| 151 | #endif |
| 152 | if (kernel_matches[SimdLevel::NONE]) { |
| 153 | return kernel_matches[SimdLevel::NONE]; |
| 154 | } |
| 155 | |
| 156 | return nullptr; |
| 157 | } |
| 158 | |
| 159 | const Kernel* DispatchExactImpl(const Function* func, |
| 160 | const std::vector<TypeHolder>& values) { |
no test coverage detected