Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f91eb8d
[parallel] Add projection support to hpx::is_sorted, hpx::is_sorted_u…
dasaneek007-cpu Apr 22, 2026
01e66d6
Remove inline comments from is_sorted_projection test
dasaneek007-cpu Apr 22, 2026
118ce13
Fix is_sorted_until cross-chunk cancellation indexing bug
dasaneek007-cpu Apr 22, 2026
b1223a9
Fix clang-format issues in test file
dasaneek007-cpu Apr 23, 2026
4e02198
Fix ambiguity in is_sorted and is_partitioned overloads and update tr…
dasaneek007-cpu Apr 23, 2026
aba2785
Apply clang-format
dasaneek007-cpu Apr 23, 2026
ccca6a4
Fix formatting, missing templates, and parallel logic for is_sorted a…
dasaneek007-cpu Apr 23, 2026
4809671
Fix data races in parallel algorithms by ensuring per-chunk loops are…
dasaneek007-cpu Apr 23, 2026
0bf482f
Fix iterator vs value type mismatch in util::loop_n callbacks
dasaneek007-cpu Apr 23, 2026
cdeb015
Fix segmented algorithm dispatch and standardize projection support f…
dasaneek007-cpu Apr 24, 2026
a0ba9ef
Address maintainer feedback for is_sorted and is_partitioned
dasaneek007-cpu Apr 24, 2026
eccc0e0
Merge branch 'master' into fix/is-sorted-is-partitioned-projection
aneek22112007-tech Apr 24, 2026
fff9af3
Stabilize is_sorted and is_partitioned for segmented iterators
dasaneek007-cpu Apr 24, 2026
5f6a1f9
Fix CI failures: fix formatting, add missing includes, and resolve ma…
dasaneek007-cpu Apr 24, 2026
bab99a9
Address maintainer feedback: rename partition_status enums and remove…
dasaneek007-cpu Apr 27, 2026
c99a4d4
Resolve merge conflicts with upstream/master
dasaneek007-cpu Apr 27, 2026
65cebbd
Fix clang-format: restore unmodified files to upstream state
dasaneek007-cpu Apr 27, 2026
485facf
Merge branch 'master' into fix/is-sorted-is-partitioned-projection
aneek22112007-tech Apr 28, 2026
93c17cb
Fix is_sorted and is_partitioned projection support and cleanup expor…
dasaneek007-cpu Apr 28, 2026
e588d25
Merge branch 'master' into fix/is-sorted-is-partitioned-projection
aneek22112007-tech Apr 28, 2026
58b8b8f
Apply clang-format to projection support files
dasaneek007-cpu Apr 28, 2026
b2322b6
Fix export macros in projection traits and apply formatting
dasaneek007-cpu Apr 28, 2026
2c30820
Comprehensive clang-format pass for all modified algorithm files
dasaneek007-cpu Apr 28, 2026
01ea3cc
Final cleanup of CMakeLists.txt and test registration for projection …
dasaneek007-cpu Apr 28, 2026
be5aff9
Finalizing is_sorted and is_partitioned parallel algorithms: fix canc…
dasaneek007-cpu Apr 29, 2026
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
7 changes: 5 additions & 2 deletions libs/core/algorithms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ set(algorithms_headers
hpx/parallel/algorithms/fill.hpp
hpx/parallel/algorithms/find.hpp
hpx/parallel/algorithms/for_each.hpp
hpx/parallel/algorithms/for_each_index.hpp
hpx/parallel/algorithms/for_loop.hpp
hpx/parallel/algorithms/for_loop_induction.hpp
hpx/parallel/algorithms/for_loop_reduction.hpp
Expand Down Expand Up @@ -261,6 +260,10 @@ set(algorithms_compat_headers

set(algorithms_sources handle_exception_termination_handler.cpp task_group.cpp)

if(HPX_TRACY_WITH_TRACY)
set(additional_dependencies hpx_tracy)
endif()

include(HPX_AddModule)
add_hpx_module(
core algorithms
Expand Down Expand Up @@ -298,8 +301,8 @@ add_hpx_module(
hpx_synchronization
hpx_tag_invoke
hpx_threading_base
hpx_tracing
hpx_type_support
hpx_util
${additional_dependencies}
CMAKE_SUBDIRS examples tests
)
67 changes: 28 additions & 39 deletions libs/core/algorithms/include/hpx/algorithms/traits/projected.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
namespace hpx::traits {

///////////////////////////////////////////////////////////////////////////
HPX_CXX_CORE_EXPORT template <typename T, typename Enable = void>
template <typename T, typename Enable = void>
struct projected_iterator
{
using type = std::decay_t<T>;
};

// For segmented iterators, we consider the local_raw_iterator instead of
// the given one.
HPX_CXX_CORE_EXPORT template <typename Iterator>
template <typename Iterator>
struct projected_iterator<Iterator,
std::enable_if_t<is_segmented_iterator_v<Iterator>>>
{
Expand All @@ -39,14 +39,14 @@ namespace hpx::traits {
local_iterator>::local_raw_iterator;
};

HPX_CXX_CORE_EXPORT template <typename Iterator>
template <typename Iterator>
struct projected_iterator<Iterator,
std::void_t<typename std::decay_t<Iterator>::proxy_type>>
{
using type = typename std::decay_t<Iterator>::proxy_type;
};

HPX_CXX_CORE_EXPORT template <typename Iterator>
template <typename Iterator>
using projected_iterator_t = typename projected_iterator<Iterator>::type;
} // namespace hpx::traits

Expand All @@ -55,18 +55,17 @@ namespace hpx::parallel::traits {
///////////////////////////////////////////////////////////////////////////
namespace detail {

HPX_CXX_CORE_EXPORT template <typename F, typename Iter,
typename Enable = void>
template <typename F, typename Iter, typename Enable = void>
struct projected_result_of;

HPX_CXX_CORE_EXPORT template <typename Proj, typename Iter>
template <typename Proj, typename Iter>
struct projected_result_of<Proj, Iter,
std::enable_if_t<hpx::traits::is_iterator_v<Iter>>>
: hpx::util::invoke_result<Proj, hpx::traits::iter_reference_t<Iter>>
{
};

HPX_CXX_CORE_EXPORT template <typename Projected>
template <typename Projected>
struct projected_result_of_indirect
: projected_result_of<typename Projected::projector_type,
typename Projected::iterator_type>
Expand All @@ -77,8 +76,7 @@ namespace hpx::parallel::traits {
// This is being instantiated if a vector pack execution policy is used
// with a zip_iterator. In this case the function object is invoked
// with a tuple<datapar<T>...> instead of just a tuple<T...>
HPX_CXX_CORE_EXPORT template <typename Proj, typename ValueType,
typename Enable = void>
template <typename Proj, typename ValueType, typename Enable = void>
struct projected_result_of_vector_pack_
: hpx::util::invoke_result<Proj,
typename hpx::parallel::traits::vector_pack_load<
Expand All @@ -88,11 +86,10 @@ namespace hpx::parallel::traits {
{
};

HPX_CXX_CORE_EXPORT template <typename Projected,
typename Enable = void>
template <typename Projected, typename Enable = void>
struct projected_result_of_vector_pack;

HPX_CXX_CORE_EXPORT template <typename Projected>
template <typename Projected>
struct projected_result_of_vector_pack<Projected,
std::void_t<typename Projected::iterator_type>>
: projected_result_of_vector_pack_<typename Projected::projector_type,
Expand All @@ -102,8 +99,7 @@ namespace hpx::parallel::traits {
#endif
} // namespace detail

HPX_CXX_CORE_EXPORT template <typename F, typename Iter,
typename Enable = void>
template <typename F, typename Iter, typename Enable = void>
struct projected_result_of
: detail::projected_result_of<std::decay_t<F>, std::decay_t<Iter>>
{
Expand All @@ -112,8 +108,7 @@ namespace hpx::parallel::traits {
///////////////////////////////////////////////////////////////////////////
namespace detail {

HPX_CXX_CORE_EXPORT template <typename F, typename Iter,
typename Enable = void>
template <typename F, typename Iter, typename Enable = void>
struct is_projected : std::false_type
{
};
Expand All @@ -123,7 +118,7 @@ namespace hpx::parallel::traits {
// void

// clang-format off
HPX_CXX_CORE_EXPORT template <typename Proj, typename Iter>
template <typename Proj, typename Iter>
struct is_projected<Proj, Iter,
std::enable_if_t<
hpx::traits::is_iterator_v<Iter> &&
Expand All @@ -136,13 +131,12 @@ namespace hpx::parallel::traits {
};
// clang-format on

HPX_CXX_CORE_EXPORT template <typename Projected,
typename Enable = void>
template <typename Projected, typename Enable = void>
struct is_projected_indirect : std::false_type
{
};

HPX_CXX_CORE_EXPORT template <typename Projected>
template <typename Projected>
struct is_projected_indirect<Projected,
std::void_t<typename Projected::projector_type>>
: detail::is_projected<typename Projected::projector_type,
Expand All @@ -151,36 +145,35 @@ namespace hpx::parallel::traits {
};
} // namespace detail

HPX_CXX_CORE_EXPORT template <typename F, typename Iter,
typename Enable = void>
template <typename F, typename Iter, typename Enable = void>
struct is_projected
: detail::is_projected<std::decay_t<F>,
hpx::traits::projected_iterator_t<Iter>>
{
};

HPX_CXX_CORE_EXPORT template <typename F, typename Iter>
template <typename F, typename Iter>
inline constexpr bool is_projected_v = is_projected<F, Iter>::value;

///////////////////////////////////////////////////////////////////////////
HPX_CXX_CORE_EXPORT template <typename Proj, typename Iter>
template <typename Proj, typename Iter>
struct projected
{
using projector_type = std::decay_t<Proj>;
using iterator_type = hpx::traits::projected_iterator_t<Iter>;
};

HPX_CXX_CORE_EXPORT template <typename Projected, typename Enable = void>
template <typename Projected, typename Enable = void>
struct is_projected_indirect : detail::is_projected_indirect<Projected>
{
};

HPX_CXX_CORE_EXPORT template <typename Projected, typename Enable = void>
template <typename Projected, typename Enable = void>
struct is_projected_zip_iterator : std::false_type
{
};

HPX_CXX_CORE_EXPORT template <typename Projected>
template <typename Projected>
struct is_projected_zip_iterator<Projected,
std::void_t<typename Projected::iterator_type>>
: hpx::traits::is_zip_iterator<typename Projected::iterator_type>
Expand All @@ -190,19 +183,18 @@ namespace hpx::parallel::traits {
///////////////////////////////////////////////////////////////////////////
namespace detail {

HPX_CXX_CORE_EXPORT template <typename F, typename... Args>
template <typename F, typename... Args>
struct is_indirect_callable_impl : hpx::is_invocable<F, Args...>
{
};

HPX_CXX_CORE_EXPORT template <typename ExPolicy, typename F,
typename ProjectedPack, typename Enable = void>
template <typename ExPolicy, typename F, typename ProjectedPack,
typename Enable = void>
struct is_indirect_callable : std::false_type
{
};

HPX_CXX_CORE_EXPORT template <typename ExPolicy, typename F,
typename... Projected>
template <typename ExPolicy, typename F, typename... Projected>
struct is_indirect_callable<ExPolicy, F, hpx::util::pack<Projected...>,
std::enable_if_t<
hpx::util::all_of_v<is_projected_indirect<Projected>...> &&
Expand All @@ -218,8 +210,7 @@ namespace hpx::parallel::traits {
// Vector pack execution policies used with zip-iterators require
// special handling because zip_iterator<>::reference is not a real
// reference type.
HPX_CXX_CORE_EXPORT template <typename ExPolicy, typename F,
typename... Projected>
template <typename ExPolicy, typename F, typename... Projected>
struct is_indirect_callable<ExPolicy, F, hpx::util::pack<Projected...>,
std::enable_if_t<
hpx::util::all_of_v<is_projected_indirect<Projected>...> &&
Expand All @@ -232,16 +223,14 @@ namespace hpx::parallel::traits {
#endif
} // namespace detail

HPX_CXX_CORE_EXPORT template <typename ExPolicy, typename F,
typename... Projected>
template <typename ExPolicy, typename F, typename... Projected>
struct is_indirect_callable
: detail::is_indirect_callable<std::decay_t<ExPolicy>, std::decay_t<F>,
hpx::util::pack<std::decay_t<Projected>...>>
{
};

HPX_CXX_CORE_EXPORT template <typename ExPolicy, typename F,
typename... Projected>
template <typename ExPolicy, typename F, typename... Projected>
inline constexpr bool is_indirect_callable_v =
is_indirect_callable<ExPolicy, F, Projected...>::value;
} // namespace hpx::parallel::traits
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@
namespace hpx::parallel::traits {

///////////////////////////////////////////////////////////////////////////
HPX_CXX_CORE_EXPORT template <typename F, typename Rng,
typename Enable = void>
template <typename F, typename Rng, typename Enable = void>
struct projected_range_result_of
{
};

HPX_CXX_CORE_EXPORT template <typename Proj, typename Rng>
template <typename Proj, typename Rng>
struct projected_range_result_of<Proj, Rng,
std::enable_if_t<std::ranges::range<Rng>>>
: detail::projected_result_of<std::decay_t<Proj>,
Expand All @@ -30,31 +29,29 @@ namespace hpx::parallel::traits {
};

///////////////////////////////////////////////////////////////////////////
HPX_CXX_CORE_EXPORT template <typename Proj, typename Rng,
typename Enable = void>
template <typename Proj, typename Rng, typename Enable = void>
struct is_projected_range : std::false_type
{
};

HPX_CXX_CORE_EXPORT template <typename Proj, typename Rng>
template <typename Proj, typename Rng>
struct is_projected_range<Proj, Rng,
std::enable_if_t<std::ranges::range<Rng>>>
: detail::is_projected<std::decay_t<Proj>, std::ranges::iterator_t<Rng>>
{
};

HPX_CXX_CORE_EXPORT template <typename Proj, typename Rng>
template <typename Proj, typename Rng>
inline constexpr bool is_projected_range_v =
is_projected_range<Proj, Rng>::value;

///////////////////////////////////////////////////////////////////////////
HPX_CXX_CORE_EXPORT template <typename Proj, typename Rng,
typename Enable = void>
template <typename Proj, typename Rng, typename Enable = void>
struct projected_range
{
};

HPX_CXX_CORE_EXPORT template <typename Proj, typename Rng>
template <typename Proj, typename Rng>
struct projected_range<Proj, Rng, std::enable_if_t<std::ranges::range<Rng>>>
{
using projector_type = std::decay_t<Proj>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

namespace hpx::parallel::detail {

HPX_CXX_CORE_EXPORT template <typename Iter, typename Sent,
typename Compare, typename Proj = hpx::identity>
template <typename Iter, typename Sent, typename Compare,
typename Proj = hpx::identity>
constexpr bool is_sorted_sequential(
Iter first, Sent last, Compare&& comp, Proj&& proj = Proj())
{
Expand All @@ -32,8 +32,8 @@ namespace hpx::parallel::detail {
return sorted;
}

HPX_CXX_CORE_EXPORT template <typename Iter, typename Sent,
typename Compare, typename Proj = hpx::identity>
template <typename Iter, typename Sent, typename Compare,
typename Proj = hpx::identity>
constexpr Iter is_sorted_until_sequential(
Iter first, Sent last, Compare&& comp, Proj&& proj = Proj())
{
Expand Down
Loading
Loading