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

Simd sort #6326

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
added compile definitions for simd sort
Signed-off-by: Hari Hara Naveen S <harihara.sn@gmail.com>
Johan511 committed Oct 19, 2023
commit 2ef787200aa94fa6474d1806548ed0a751109dfe
30 changes: 11 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -545,38 +545,30 @@ hpx_option(
)

hpx_option(
HPX_WITH_FETCH_SIMD_SORT
HPX_WITH_SIMD_SORT
BOOL
"Use FetchContent to fetch x86-simd-sort. By default an installed x86-simd-sort will be used. (default: On). It has support only for AVX-512 registers. If the architecture has no AVX-512 registers, simd-sort won't be used"
ON
CATEGORY "Build Targets"
ADVANCED
)
hpx_option(
HPX_WITH_SIMD_SORT_TAG STRING "x86-simd-sort repository tag or branch" "v2.0"
HPX_WITH_SIMD_SORT_TAG STRING "x86-simd-sort repository tag or branch"
"1b396372e2bc10fd883d49e28dfc2a5ea5d2e194"
CATEGORY "Build Targets"
ADVANCED
)

add_compile_options(-march=native)
hpx_check_for_32bit_simd_sort(DEFINITIONS HPX_HAVE_AVX512F)

# simd sort supports only avx-512 registers
# if(__AVX512F__)
set(HPX_WITH_SIMD_SORT ON)
if(HPX_WITH_FETCH_SIMD_SORT)
include(HPX_SetupSimdSort)
else()
find_package(SimdSort)
endif()

# else()
# set(HPX_WITH_SIMD_SORT OFF)
# set(HPX_WITH_FETCH_SIMD_SORT OFF)
# endif()
if(NOT (HPX_WITH_AVX512F))
set(HPX_WITH_SIMD_SORT Off)
endif()

# debug message to be removed before merge
message(WARNING "HPX_WITH_SIMD_SORT : ${HPX_WITH_SIMD_SORT}")
message(WARNING "HPX_WITH_FETCH_SIMD_SORT : ${HPX_WITH_FETCH_SIMD_SORT}")
if(HPX_WITH_SIMD_SORT)
hpx_add_config_define(HPX_HAVE_SIMD_SORT)
include(HPX_SetupSimdSort)
endif()

# ##############################################################################
# HPX CUDA configuration
4 changes: 2 additions & 2 deletions cmake/FindSimdSort.cmake
Original file line number Diff line number Diff line change
@@ -31,9 +31,9 @@ if(NOT TARGET SimdSort::simdsort)
VERSION_VAR SIMD_SORT_VERSION_STRING
)

add_library(SimdSort::simdsort INTERFACE IMPORTED)
add_library(SimdSort::simdsort PRIVATE IMPORTED)
target_include_directories(
SimdSort::simdsort SYSTEM INTERFACE ${SIMD_SORT_INCLUDE_DIR}
SimdSort::simdsort SYSTEM PRIVATE ${SIMD_SORT_INCLUDE_DIR}
)

mark_as_advanced(
9 changes: 9 additions & 0 deletions cmake/HPX_AddConfigTest.cmake
Original file line number Diff line number Diff line change
@@ -713,3 +713,12 @@ function(hpx_check_for_stable_inplace_merge)
FILE ${ARGN}
)
endfunction()

# ##############################################################################
function(hpx_check_avx512f)
add_hpx_config_test(
HPX_WITH_AVX512F
SOURCE cmake/tests/avx512f.cpp
FILE ${ARGN} CXXFLAGS -mavx512f
)
endfunction()
Original file line number Diff line number Diff line change
@@ -6,13 +6,12 @@

#pragma once

// #include <avx512-16bit-qsort.hpp>
// #include <avx512-32bit-qsort.hpp>
#ifdef HPX_HAVE_SIMD_SORT
#include <avx512-32bit-qsort.hpp>
#include <avx512-64bit-qsort.hpp>

#include <type_traits>


namespace hpx::parallel::util {
// TODO : add support for _Float16
// need compile time test as _Float16 is not always supported
@@ -42,7 +41,7 @@ namespace hpx::parallel::util {
constexpr bool is_simd_sortable_v = is_simd_sortable<T>::value;
} // namespace hpx::parallel::util

#if (HPX_WITH_SIMD_SORT)
// #if (HPX_WITH_SIMD_SORT)

namespace hpx::parallel::util {
template <typename T>