Skip to content

Commit 682ef9f

Browse files
Resolve merge conflicts with upstream/master and apply clang-format
2 parents ad3fef0 + 37c665c commit 682ef9f

52 files changed

Lines changed: 983 additions & 530 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/linux_crosscompile_arm_eve_sve_release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
cmake --build build --target core
5151
cmake --build build --target tests.unit.modules.algorithms.datapar_algorithms
5252
cmake --build build --target tests.regressions.modules.algorithms.for_each_datapar
53+
cmake --build build --target tests.regressions.modules.algorithms.counting_iterator_datapar
5354
- name: Test
5455
shell: bash
5556
run: |

.github/workflows/linux_crosscompile_arm_sve_release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
cmake --build build --target core
5151
cmake --build build --target tests.unit.modules.algorithms.datapar_algorithms
5252
cmake --build build --target tests.regressions.modules.algorithms.for_each_datapar
53+
cmake --build build --target tests.regressions.modules.algorithms.counting_iterator_datapar
5354
- name: Test
5455
shell: bash
5556
run: |

libs/core/algorithms/include/hpx/parallel/algorithms/adjacent_difference.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ namespace hpx::parallel {
316316
std::size_t part_size) mutable {
317317
// VS2015RC bails out when op is captured by ref
318318
using hpx::get;
319-
util::loop_n<std::decay_t<ExPolicy>>(
319+
util::const_loop_n<std::decay_t<ExPolicy>>(
320320
part_begin, part_size, [op](auto&& it) mutable {
321321
get<2>(*it) =
322322
HPX_INVOKE(op, get<0>(*it), get<1>(*it));

libs/core/algorithms/include/hpx/parallel/algorithms/copy.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,8 @@ namespace hpx::parallel {
590590
// below makes gcc generate errors
591591

592592
// MSVC complains if proj is captured by ref below
593-
util::loop_n<std::decay_t<ExPolicy>>(part_begin, part_size,
593+
util::const_loop_n<std::decay_t<ExPolicy>>(part_begin,
594+
part_size,
594595
[&pred, proj, &curr](zip_iterator it) mutable -> void {
595596
bool f = hpx::invoke(
596597
pred, hpx::invoke(proj, get<0>(*it)));
@@ -606,8 +607,8 @@ namespace hpx::parallel {
606607
std::size_t part_size, std::size_t val) mutable {
607608
HPX_UNUSED(flags);
608609
std::advance(dest, val);
609-
util::loop_n<std::decay_t<ExPolicy>>(part_begin, part_size,
610-
[&dest](zip_iterator it) mutable {
610+
util::const_loop_n<std::decay_t<ExPolicy>>(part_begin,
611+
part_size, [&dest](zip_iterator it) mutable {
611612
if (get<1>(*it))
612613
*dest++ = get<0>(*it);
613614
});
@@ -789,8 +790,7 @@ namespace hpx {
789790
>
790791
)
791792
// clang-format on
792-
friend typename hpx::parallel::util::detail::algorithm_result<ExPolicy,
793-
FwdIter2>::type
793+
friend parallel::util::detail::algorithm_result_t<ExPolicy, FwdIter2>
794794
tag_fallback_invoke(hpx::copy_if_t, ExPolicy&& policy, FwdIter1 first,
795795
FwdIter1 last, FwdIter2 dest, Pred pred)
796796
{

libs/core/algorithms/include/hpx/parallel/algorithms/count.hpp

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -272,19 +272,19 @@ namespace hpx::parallel {
272272
count_iteration& operator=(count_iteration&&) = default;
273273

274274
template <typename Iter>
275-
HPX_HOST_DEVICE HPX_FORCEINLINE constexpr
276-
typename std::iterator_traits<Iter>::difference_type
277-
operator()(Iter part_begin, std::size_t part_size)
275+
HPX_HOST_DEVICE HPX_FORCEINLINE constexpr std::iterator_traits<
276+
Iter>::difference_type
277+
operator()(Iter part_begin, std::size_t part_size)
278278
{
279279
typename std::iterator_traits<Iter>::difference_type ret = 0;
280-
util::loop_n<execution_policy_type>(part_begin, part_size,
280+
util::const_loop_n<execution_policy_type>(part_begin, part_size,
281281
hpx::bind_back(*this, std::ref(ret)));
282282
return ret;
283283
}
284284

285285
template <typename Iter>
286-
HPX_HOST_DEVICE HPX_FORCEINLINE constexpr void operator()(Iter curr,
287-
typename std::iterator_traits<Iter>::difference_type& ret)
286+
HPX_HOST_DEVICE HPX_FORCEINLINE constexpr void operator()(
287+
Iter curr, std::iterator_traits<Iter>::difference_type& ret)
288288
{
289289
ret += traits::count_bits(
290290
HPX_INVOKE(op_, HPX_INVOKE(proj_, *curr)));
@@ -295,7 +295,7 @@ namespace hpx::parallel {
295295
HPX_CXX_CORE_EXPORT template <typename Value>
296296
struct count : public algorithm<count<Value>, Value>
297297
{
298-
typedef Value difference_type;
298+
using difference_type = Value;
299299

300300
constexpr count() noexcept
301301
: algorithm<count, Value>("count")
@@ -313,7 +313,7 @@ namespace hpx::parallel {
313313

314314
typename std::iterator_traits<InIterB>::difference_type ret = 0;
315315

316-
util::loop(HPX_FORWARD(ExPolicy, policy), first, last,
316+
util::const_loop(HPX_FORWARD(ExPolicy, policy), first, last,
317317
hpx::bind_back(HPX_MOVE(f1), std::ref(ret)));
318318

319319
return ret;
@@ -379,7 +379,7 @@ namespace hpx::parallel {
379379

380380
typename std::iterator_traits<InIterB>::difference_type ret = 0;
381381

382-
util::loop(HPX_FORWARD(ExPolicy, policy), first, last,
382+
util::const_loop(HPX_FORWARD(ExPolicy, policy), first, last,
383383
hpx::bind_back(HPX_MOVE(f1), std::ref(ret)));
384384

385385
return ret;
@@ -430,20 +430,16 @@ namespace hpx {
430430
private:
431431
template <typename ExPolicy, typename FwdIter,
432432
typename T = typename std::iterator_traits<FwdIter>::value_type>
433-
// clang-format off
434-
requires (
435-
hpx::is_execution_policy_v<ExPolicy> &&
436-
hpx::traits::is_iterator_v<FwdIter>
437-
)
438-
// clang-format on
433+
requires(hpx::is_execution_policy_v<ExPolicy> &&
434+
hpx::traits::is_iterator_v<FwdIter>)
439435
friend decltype(auto) tag_fallback_invoke(count_t, ExPolicy&& policy,
440436
FwdIter first, FwdIter last, T const& value)
441437
{
442438
static_assert(std::forward_iterator<FwdIter>,
443439
"Required at least forward iterator.");
444440

445441
using difference_type =
446-
typename std::iterator_traits<FwdIter>::difference_type;
442+
std::iterator_traits<FwdIter>::difference_type;
447443

448444
return hpx::parallel::detail::count<difference_type>().call(
449445
HPX_FORWARD(ExPolicy, policy), first, last, value,
@@ -452,19 +448,15 @@ namespace hpx {
452448

453449
template <typename InIter,
454450
typename T = typename std::iterator_traits<InIter>::value_type>
455-
// clang-format off
456-
requires (
457-
hpx::traits::is_iterator_v<InIter>
458-
)
459-
// clang-format on
460-
friend typename std::iterator_traits<InIter>::difference_type
461-
tag_fallback_invoke(count_t, InIter first, InIter last, T const& value)
451+
requires(hpx::traits::is_iterator_v<InIter>)
452+
friend decltype(auto) tag_fallback_invoke(
453+
count_t, InIter first, InIter last, T const& value)
462454
{
463455
static_assert(std::input_iterator<InIter>,
464456
"Required at least input iterator.");
465457

466458
using difference_type =
467-
typename std::iterator_traits<InIter>::difference_type;
459+
std::iterator_traits<InIter>::difference_type;
468460

469461
return hpx::parallel::detail::count<difference_type>().call(
470462
hpx::execution::seq, first, last, value, hpx::identity_v);
@@ -494,30 +486,25 @@ namespace hpx {
494486
"Required at least forward iterator.");
495487

496488
using difference_type =
497-
typename std::iterator_traits<FwdIter>::difference_type;
489+
std::iterator_traits<FwdIter>::difference_type;
498490

499491
return hpx::parallel::detail::count_if<difference_type>().call(
500492
HPX_FORWARD(ExPolicy, policy), first, last, HPX_MOVE(f),
501493
hpx::identity_v);
502494
}
503495

504496
template <typename InIter, typename F>
505-
// clang-format off
506-
requires (
507-
hpx::traits::is_iterator_v<InIter> &&
497+
requires(hpx::traits::is_iterator_v<InIter> &&
508498
hpx::is_invocable_v<F,
509-
typename std::iterator_traits<InIter>::value_type
510-
>
511-
)
512-
// clang-format on
513-
friend typename std::iterator_traits<InIter>::difference_type
514-
tag_fallback_invoke(count_if_t, InIter first, InIter last, F f)
499+
typename std::iterator_traits<InIter>::value_type>)
500+
friend decltype(auto) tag_fallback_invoke(
501+
count_if_t, InIter first, InIter last, F f)
515502
{
516503
static_assert(std::input_iterator<InIter>,
517504
"Required at least input iterator.");
518505

519506
using difference_type =
520-
typename std::iterator_traits<InIter>::difference_type;
507+
std::iterator_traits<InIter>::difference_type;
521508

522509
return hpx::parallel::detail::count_if<difference_type>().call(
523510
hpx::execution::seq, first, last, HPX_MOVE(f), hpx::identity_v);

libs/core/algorithms/include/hpx/parallel/algorithms/destroy.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ namespace hpx::parallel {
209209
return util::foreach_partitioner<ExPolicy>::call(
210210
HPX_FORWARD(ExPolicy, policy), first, count,
211211
[](Iter first, std::size_t count, std::size_t) {
212-
return util::loop_n<std::decay_t<ExPolicy>>(
212+
return util::const_loop_n<std::decay_t<ExPolicy>>(
213213
first, count, [](Iter it) -> void {
214214
std::destroy_at(std::addressof(*it));
215215
});

libs/core/algorithms/include/hpx/parallel/algorithms/detail/contains.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ namespace hpx::parallel::detail {
4848
Iterator first, T const& val, std::size_t count, Token& tok,
4949
Proj&& proj)
5050
{
51-
util::loop_n<ExPolicy>(
51+
util::const_loop_n<ExPolicy>(
5252
first, count, tok, [&val, &tok, &proj](auto const& cur) {
5353
if (HPX_INVOKE(proj, *cur) == val)
5454
{

libs/core/algorithms/include/hpx/parallel/algorithms/detail/equal.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace hpx::parallel::detail {
3434
friend constexpr void tag_fallback_invoke(sequential_equal_t,
3535
ZipIterator it, std::size_t part_count, Token& tok, F&& f)
3636
{
37-
util::loop_n<ExPolicy>(it, part_count, tok,
37+
util::const_loop_n<ExPolicy>(it, part_count, tok,
3838
[&f, &tok](auto const& curr) mutable -> void {
3939
auto t = *curr;
4040
if (!HPX_INVOKE(f, hpx::get<0>(t), hpx::get<1>(t)))
@@ -98,7 +98,7 @@ namespace hpx::parallel::detail {
9898
ZipIterator it, std::size_t part_count, Token& tok, F&& f,
9999
Proj1&& proj1, Proj2&& proj2)
100100
{
101-
util::loop_n<ExPolicy>(it, part_count, tok,
101+
util::const_loop_n<ExPolicy>(it, part_count, tok,
102102
[&f, &proj1, &proj2, &tok](auto const& curr) mutable -> void {
103103
auto t = *curr;
104104
if (!hpx::invoke(f, hpx::invoke(proj1, hpx::get<0>(t)),

libs/core/algorithms/include/hpx/parallel/algorithms/detail/find.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ namespace hpx::parallel::detail {
102102
sequential_find_if_t<ExPolicy>, FwdIter part_begin,
103103
std::size_t part_count, Token& tok, F&& op, Proj&& proj)
104104
{
105-
util::loop_n<std::decay_t<ExPolicy>>(part_begin, part_count, tok,
106-
[&op, &tok, &proj](auto const& curr) {
105+
util::const_loop_n<std::decay_t<ExPolicy>>(part_begin, part_count,
106+
tok, [&op, &tok, &proj](auto const& curr) {
107107
if (HPX_INVOKE(op, HPX_INVOKE(proj, *curr)))
108108
{
109109
tok.cancel();
@@ -184,8 +184,8 @@ namespace hpx::parallel::detail {
184184
sequential_find_if_not_t<ExPolicy>, FwdIter part_begin,
185185
std::size_t part_count, Token& tok, F&& op, Proj&& proj)
186186
{
187-
util::loop_n<std::decay_t<ExPolicy>>(part_begin, part_count, tok,
188-
[&op, &tok, &proj](auto const& curr) {
187+
util::const_loop_n<std::decay_t<ExPolicy>>(part_begin, part_count,
188+
tok, [&op, &tok, &proj](auto const& curr) {
189189
if (!HPX_INVOKE(op, HPX_INVOKE(proj, *curr)))
190190
{
191191
tok.cancel();

libs/core/algorithms/include/hpx/parallel/algorithms/detail/iota.hpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,23 +102,18 @@ namespace hpx::parallel::detail {
102102
{
103103
auto dist = hpx::parallel::detail::distance(first, last);
104104

105-
// clang-format off
106105
auto f = [value](FwdIter part_begin, std::size_t part_size,
107106
std::size_t global_index) {
108107
T cur_value = value + global_index;
109-
return util::loop_n<std::decay_t<Expolicy>>(
110-
part_begin,
111-
part_size,
108+
return util::const_loop_n<std::decay_t<Expolicy>>(
109+
part_begin, part_size,
112110
[&cur_value](FwdIter it) { *it = cur_value++; });
113111
};
114112

115-
return util::partitioner<Expolicy, FwdIter, FwdIter>::call_with_index(
116-
HPX_FORWARD(Expolicy, policy),
117-
first,
118-
dist, 1,
119-
std::move(f),
113+
return util::partitioner<Expolicy, FwdIter,
114+
FwdIter>::call_with_index(HPX_FORWARD(Expolicy, policy),
115+
first, dist, 1, std::move(f),
120116
[last = first + dist](auto&&) { return last; });
121-
// clang-format on
122117
}
123118
else
124119
{

0 commit comments

Comments
 (0)