1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing,
12 // software distributed under the License is distributed on an
13 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 // KIND, either express or implied. See the License for the
15 // specific language governing permissions and limitations
16 // under the License.
17
18 #include "parquet/level_comparison.h"
19
20 #define PARQUET_IMPL_NAMESPACE standard
21 #include "parquet/level_comparison_inc.h"
22 #undef PARQUET_IMPL_NAMESPACE
23
24 #include <vector>
25
26 #include "arrow/util/dispatch.h"
27
28 namespace parquet {
29 namespace internal {
30
31 #if defined(ARROW_HAVE_RUNTIME_AVX2)
32 MinMax FindMinMaxAvx2(const int16_t* levels, int64_t num_levels);
33 uint64_t GreaterThanBitmapAvx2(const int16_t* levels, int64_t num_levels, int16_t rhs);
34 #endif
35
36 namespace {
37
38 using ::arrow::internal::DispatchLevel;
39 using ::arrow::internal::DynamicDispatch;
40
41 // defined in level_comparison_avx2.cc
42
43 struct GreaterThanDynamicFunction {
44 using FunctionType = decltype(&GreaterThanBitmap);
45
implementationsparquet::internal::__anond2b0b8840111::GreaterThanDynamicFunction46 static std::vector<std::pair<DispatchLevel, FunctionType>> implementations() {
47 return {
48 { DispatchLevel::NONE, standard::GreaterThanBitmapImpl }
49 #if defined(ARROW_HAVE_RUNTIME_AVX2)
50 , { DispatchLevel::AVX2, GreaterThanBitmapAvx2 }
51 #endif
52 };
53 }
54 };
55
56 struct MinMaxDynamicFunction {
57 using FunctionType = decltype(&FindMinMax);
58
implementationsparquet::internal::__anond2b0b8840111::MinMaxDynamicFunction59 static std::vector<std::pair<DispatchLevel, FunctionType>> implementations() {
60 return {
61 { DispatchLevel::NONE, standard::FindMinMaxImpl }
62 #if defined(ARROW_HAVE_RUNTIME_AVX2)
63 , { DispatchLevel::AVX2, FindMinMaxAvx2 }
64 #endif
65 };
66 }
67 };
68
69 } // namespace
70
GreaterThanBitmap(const int16_t * levels,int64_t num_levels,int16_t rhs)71 uint64_t GreaterThanBitmap(const int16_t* levels, int64_t num_levels, int16_t rhs) {
72 static DynamicDispatch<GreaterThanDynamicFunction> dispatch;
73 return dispatch.func(levels, num_levels, rhs);
74 }
75
FindMinMax(const int16_t * levels,int64_t num_levels)76 MinMax FindMinMax(const int16_t* levels, int64_t num_levels) {
77 static DynamicDispatch<MinMaxDynamicFunction> dispatch;
78 return dispatch.func(levels, num_levels);
79 }
80
81 } // namespace internal
82 } // namespace parquet
83