Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/cpp_extra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@ jobs:
-e CMAKE_CXX_STANDARD=23
runs-on: ubuntu-latest
title: AMD64 Debian C++23
- envs:
- DEBIAN=13
image: debian-cpp
run-options: >-
-e ARROW_SIMD_LEVEL=NONE

@AntoinePrv AntoinePrv Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try adding somethin explicit like

CMAKE_CXX_FLAGS=-march=x86-64

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, I added CXXFLAGS

-e CXXFLAGS=-march=x86-64
runs-on: ubuntu-latest
title: AMD64 Debian SIMD Level NONE
env:
ARCHERY_DEBUG: 1
ARROW_ENABLE_TIMING_TESTS: OFF
Expand Down
15 changes: 15 additions & 0 deletions cpp/src/arrow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,13 @@ function(ADD_ARROW_BENCHMARK REL_TEST_NAME)
${ARG_UNPARSED_ARGUMENTS})
endfunction()

macro(append_runtime_sse4_2_src SRCS SRC)
if(ARROW_HAVE_RUNTIME_SSE4_2 AND ARROW_SIMD_LEVEL STREQUAL "NONE")
list(APPEND ${SRCS} ${SRC})
set_source_files_properties(${SRC} PROPERTIES COMPILE_OPTIONS "${ARROW_SSE4_2_FLAG}")
endif()
endmacro()

macro(append_runtime_avx2_src SRCS SRC)
if(ARROW_HAVE_RUNTIME_AVX2)
list(APPEND ${SRCS} ${SRC})
Expand Down Expand Up @@ -585,9 +592,17 @@ set(ARROW_UTIL_SRCS

append_runtime_avx2_src(ARROW_UTIL_SRCS util/byte_stream_split_internal_avx2.cc)

append_runtime_sse4_2_src(ARROW_UTIL_SRCS util/byte_stream_split_internal_sse4_2.cc)

append_runtime_avx2_src(ARROW_UTIL_SRCS util/bpacking_simd_256.cc)
append_runtime_avx512_src(ARROW_UTIL_SRCS util/bpacking_simd_avx512.cc)

# also provides the NEON kernels on aarch64, so it stays in ARROW_UTIL_SRCS
if(ARROW_CPU_FLAG STREQUAL "x86" AND ARROW_HAVE_RUNTIME_SSE4_2)
set_source_files_properties(util/bpacking_simd_128.cc PROPERTIES COMPILE_OPTIONS
"${ARROW_SSE4_2_FLAG}")
endif()

append_runtime_sve128_src(ARROW_UTIL_SRCS util/bpacking_simd_128_alt.cc)
append_runtime_sve256_src(ARROW_UTIL_SRCS util/bpacking_simd_256.cc)

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/util/bpacking_simd_128.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#if defined(ARROW_HAVE_NEON)
# define UNPACK_PLATFORM unpack_neon
# define KERNEL_PLATFORM KernelNeon
#elif defined(ARROW_HAVE_SSE4_2)
#elif defined(ARROW_HAVE_SSE4_2) || defined(ARROW_HAVE_RUNTIME_SSE4_2)
# define UNPACK_PLATFORM unpack_sse4_2
# define KERNEL_PLATFORM KernelSse42
#endif
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/util/bpacking_simd_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace arrow::internal::bpacking {

#if defined(ARROW_HAVE_NEON)
# define UNPACK_ARCH128 unpack_neon
#elif defined(ARROW_HAVE_SSE4_2)
#elif defined(ARROW_HAVE_SSE4_2) || defined(ARROW_HAVE_RUNTIME_SSE4_2)
# define UNPACK_ARCH128 unpack_sse4_2
#endif

Expand Down
8 changes: 6 additions & 2 deletions cpp/src/arrow/util/bpacking_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
#include "arrow/util/bpacking_scalar_internal.h"
#include "arrow/util/bpacking_simd_internal.h"

#if defined(ARROW_HAVE_RUNTIME_AVX2) || defined(ARROW_HAVE_RUNTIME_AVX512) || \
#if defined(ARROW_HAVE_SSE4_2) || defined(ARROW_HAVE_RUNTIME_SSE4_2) || \
defined(ARROW_HAVE_RUNTIME_AVX2) || defined(ARROW_HAVE_RUNTIME_AVX512) || \
defined(ARROW_HAVE_RUNTIME_SVE128) || defined(ARROW_HAVE_RUNTIME_SVE256)
# include "arrow/util/cpu_info.h"
#endif
Expand Down Expand Up @@ -273,8 +274,11 @@ TYPED_TEST(TestUnpack, UnpackScalar) {
this->TestAll(&bpacking::unpack_scalar<TypeParam>);
}

#if defined(ARROW_HAVE_SSE4_2)
#if defined(ARROW_HAVE_SSE4_2) || defined(ARROW_HAVE_RUNTIME_SSE4_2)
TYPED_TEST(TestUnpack, UnpackSse4_2) {
if (!CpuInfo::GetInstance()->IsSupported(CpuInfo::SSE4_2)) {
GTEST_SKIP() << "Test requires SSE4.2";
}
this->TestAll(&bpacking::unpack_sse4_2<TypeParam>);
}
#endif
Expand Down
24 changes: 22 additions & 2 deletions cpp/src/arrow/util/byte_stream_split_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,31 @@ void ByteStreamSplitEncodeSimd(const uint8_t* raw_values, int width,
}
}

# if defined(ARROW_HAVE_RUNTIME_AVX2)

// The extern template declaration are used internally and need export
// to be used in tests and benchmarks.

# if defined(ARROW_HAVE_RUNTIME_SSE4_2) && !defined(ARROW_HAVE_SSE4_2)

// instantiated in byte_stream_split_internal_sse4_2.cc

extern template ARROW_TEMPLATE_EXPORT void ByteStreamSplitDecodeSimd<xsimd::sse4_2, 2>(
const uint8_t*, int, int64_t, int64_t, uint8_t*);
extern template ARROW_TEMPLATE_EXPORT void ByteStreamSplitDecodeSimd<xsimd::sse4_2, 4>(
const uint8_t*, int, int64_t, int64_t, uint8_t*);
extern template ARROW_TEMPLATE_EXPORT void ByteStreamSplitDecodeSimd<xsimd::sse4_2, 8>(
const uint8_t*, int, int64_t, int64_t, uint8_t*);

extern template ARROW_TEMPLATE_EXPORT void ByteStreamSplitEncodeSimd<xsimd::sse4_2, 2>(
const uint8_t*, int, const int64_t, uint8_t*);
extern template ARROW_TEMPLATE_EXPORT void ByteStreamSplitEncodeSimd<xsimd::sse4_2, 4>(
const uint8_t*, int, const int64_t, uint8_t*);
extern template ARROW_TEMPLATE_EXPORT void ByteStreamSplitEncodeSimd<xsimd::sse4_2, 8>(
const uint8_t*, int, const int64_t, uint8_t*);

# endif

# if defined(ARROW_HAVE_RUNTIME_AVX2)

extern template ARROW_TEMPLATE_EXPORT void ByteStreamSplitDecodeSimd<xsimd::avx2, 2>(
const uint8_t*, int, int64_t, int64_t, uint8_t*);
extern template ARROW_TEMPLATE_EXPORT void ByteStreamSplitDecodeSimd<xsimd::avx2, 4>(
Expand Down
43 changes: 43 additions & 0 deletions cpp/src/arrow/util/byte_stream_split_internal_sse4_2.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

#include "arrow/util/byte_stream_split_internal.h"
#include "arrow/util/math_internal.h"
#include "arrow/util/simd.h"

#include <xsimd/types/xsimd_sse4_2_register.hpp>
#include <xsimd/xsimd.hpp>

#include <cstdint>

namespace arrow::util::internal {

template void ByteStreamSplitDecodeSimd<xsimd::sse4_2, 2>(const uint8_t*, int, int64_t,
int64_t, uint8_t*);
template void ByteStreamSplitDecodeSimd<xsimd::sse4_2, 4>(const uint8_t*, int, int64_t,
int64_t, uint8_t*);
template void ByteStreamSplitDecodeSimd<xsimd::sse4_2, 8>(const uint8_t*, int, int64_t,
int64_t, uint8_t*);

template void ByteStreamSplitEncodeSimd<xsimd::sse4_2, 2>(const uint8_t*, int,
const int64_t, uint8_t*);
template void ByteStreamSplitEncodeSimd<xsimd::sse4_2, 4>(const uint8_t*, int,
const int64_t, uint8_t*);
template void ByteStreamSplitEncodeSimd<xsimd::sse4_2, 8>(const uint8_t*, int,
const int64_t, uint8_t*);

} // namespace arrow::util::internal
Loading