Skip to content

Commit d171785

Browse files
committed
Revert "Attempt at making decoding faster with SIMD"
This reverts commit e85658b42b5373ef7e54295b100d1f083d55dd8d.
1 parent 2c1734a commit d171785

File tree

2 files changed

+9
-417
lines changed

2 files changed

+9
-417
lines changed

cpp/src/arrow/util/alp/Alp.cc

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include <map>
2525

2626
#include "arrow/util/alp/AlpConstants.h"
27-
#include "arrow/util/alp/alp_simd_internal.h"
2827
#include "arrow/util/bit_stream_utils_internal.h"
2928
#include "arrow/util/bpacking_internal.h"
3029
#include "arrow/util/logging.h"
@@ -681,38 +680,17 @@ void AlpCompression<T>::DecodeVector(TargetType* output_vector,
681680
const ExactType* data = input_vector.data();
682681
const ExactType frame_of_ref = vector_info.frame_of_reference;
683682

684-
// Use SIMD-optimized path when T == TargetType (no type conversion needed)
685-
if constexpr (std::is_same_v<T, TargetType>) {
686-
// Get the two factors separately to preserve exact floating-point precision
687-
// Original decode: value * GetFactor(factor) * Constants::GetFactor(exponent)
688-
const int64_t int_factor =
689-
AlpConstants::GetFactor(vector_info.exponent_and_factor.factor);
690-
const T float_factor =
691-
Constants::GetFactor(vector_info.exponent_and_factor.exponent);
692-
693-
if constexpr (std::is_same_v<T, double>) {
694-
internal::DecodeVectorSimdDouble(data, output_vector, num_elements, frame_of_ref,
695-
int_factor, float_factor);
696-
} else {
697-
static_assert(std::is_same_v<T, float>);
698-
internal::DecodeVectorSimdFloat(data, output_vector, num_elements, frame_of_ref,
699-
int_factor, float_factor);
700-
}
701-
} else {
702-
// Fall back to scalar loop for type conversions (e.g., float -> double)
703-
// to preserve exact floating-point behavior
704683
#pragma GCC unroll AlpConstants::kLoopUnrolls
705684
#pragma GCC ivdep
706-
for (size_t i = 0; i < num_elements; ++i) {
707-
// 1. Apply frame of reference (unFOR) - unsigned arithmetic
708-
const ExactType unfored_value = data[i] + frame_of_ref;
709-
// 2. Reinterpret as signed integer for decode
710-
SignedExactType signed_value;
711-
std::memcpy(&signed_value, &unfored_value, sizeof(SignedExactType));
712-
// 3. Decode using original function to preserve exact floating-point behavior
713-
output_vector[i] =
714-
AlpInlines<T>::DecodeValue(signed_value, vector_info.exponent_and_factor);
715-
}
685+
for (size_t i = 0; i < num_elements; ++i) {
686+
// 1. Apply frame of reference (unFOR) - unsigned arithmetic
687+
const ExactType unfored_value = data[i] + frame_of_ref;
688+
// 2. Reinterpret as signed integer for decode
689+
SignedExactType signed_value;
690+
std::memcpy(&signed_value, &unfored_value, sizeof(SignedExactType));
691+
// 3. Decode using original function to preserve exact floating-point behavior
692+
output_vector[i] =
693+
AlpInlines<T>::DecodeValue(signed_value, vector_info.exponent_and_factor);
716694
}
717695
}
718696

0 commit comments

Comments
 (0)