Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-44098: [C++] Add home made _mm256_set_m128i for compilers who are missing it #44116

Merged
merged 1 commit into from
Sep 17, 2024
Merged
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
3 changes: 1 addition & 2 deletions cpp/src/arrow/acero/swiss_join_avx2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
// specific language governing permissions and limitations
// under the License.

#include <immintrin.h>

#include "arrow/acero/swiss_join_internal.h"
#include "arrow/util/bit_util.h"
#include "arrow/util/simd.h"

namespace arrow {
namespace acero {
Expand Down
3 changes: 1 addition & 2 deletions cpp/src/arrow/compute/row/compare_internal_avx2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
// specific language governing permissions and limitations
// under the License.

#include <immintrin.h>

#include "arrow/compute/row/compare_internal.h"
#include "arrow/compute/util.h"
#include "arrow/util/bit_util.h"
#include "arrow/util/simd.h"

namespace arrow {
namespace compute {
Expand Down
13 changes: 10 additions & 3 deletions cpp/src/arrow/util/simd.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,25 @@
#else
// gcc/clang (possibly others)

# if defined(ARROW_HAVE_BMI2)
# if defined(ARROW_HAVE_BMI2) || defined(ARROW_HAVE_RUNTIME_BMI2)
Copy link
Collaborator Author

@zanmato1984 zanmato1984 Sep 14, 2024

Choose a reason for hiding this comment

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

I try to find some common place to put simd specific code and found this one. However it seems this file is only adapting the static simd optimizations, thus the additions of the ARROW_HAVE_RUNTIME_* which are for dynamic simd optimizations.

W/o these || defined(ARROW_HAVE_RUNTIME_*, one won't see <immintrin.h> inclusion because there are no ARROW_HAVE_* macros defined. (This might be yet another issue of our current simd macro organization).

# include <x86intrin.h>
# endif

# if defined(ARROW_HAVE_AVX2) || defined(ARROW_HAVE_AVX512)
# if defined(ARROW_HAVE_AVX2) || defined(ARROW_HAVE_AVX512) || \
defined(ARROW_HAVE_RUNTIME_AVX2) || defined(ARROW_HAVE_RUNTIME_AVX512)
# include <immintrin.h>
# elif defined(ARROW_HAVE_SSE4_2)
# elif defined(ARROW_HAVE_SSE4_2) || defined(ARROW_HAVE_RUNTIME_SSE4_2)
# include <nmmintrin.h>
# endif

# ifdef ARROW_HAVE_NEON
# include <arm_neon.h>
# endif

// GH-44098: Workaround for missing _mm256_set_m128i in older versions of GCC.
# if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 8
# define _mm256_set_m128i(hi, lo) \
_mm256_inserti128_si256(_mm256_castsi128_si256(lo), (hi), 1)
# endif

#endif
Loading