MCPcopy Create free account
hub / github.com/apache/arrow / DispatchExactImpl

Function DispatchExactImpl

cpp/src/arrow/compute/function.cc:123–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121
122template <typename KernelType>
123const 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
159const Kernel* DispatchExactImpl(const Function* func,
160 const std::vector<TypeHolder>& values) {

Callers 15

DispatchExactMethod · 0.85
DispatchBestMethod · 0.85
DispatchBestMethod · 0.85
DispatchBestMethod · 0.85
DispatchBestMethod · 0.85
DispatchBestMethod · 0.85
DispatchBestMethod · 0.85
DispatchBestMethod · 0.85
DispatchBestMethod · 0.85
DispatchBestMethod · 0.85
DispatchBestMethod · 0.85
DispatchBestMethod · 0.85

Calls 4

MatchesInputsMethod · 0.80
kernelsMethod · 0.80
IsSupportedMethod · 0.45
kindMethod · 0.45

Tested by

no test coverage detected