Skip to content

Commit c141de4

Browse files
committed
Minor fixes and optimizations
1 parent 64b1c0d commit c141de4

File tree

13 files changed

+169
-115
lines changed

13 files changed

+169
-115
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,6 +1894,9 @@ if(WIN32)
18941894
# Silence C++20 deprecation warnings
18951895
hpx_add_config_cond_define(_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS)
18961896

1897+
# Silence C++23 deprecation warnings
1898+
hpx_add_config_cond_define(_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS)
1899+
18971900
# ASan is available in Visual Studion starting V16.8
18981901
if((MSVC_VERSION GREATER_EQUAL 1928) AND HPX_WITH_SANITIZERS)
18991902
hpx_add_target_compile_option(

libs/core/algorithms/include/hpx/parallel/datapar/iterator_helpers.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2016 Hartmut Kaiser
1+
// Copyright (c) 2016-2025 Hartmut Kaiser
22
//
33
// SPDX-License-Identifier: BSL-1.0
44
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -30,7 +30,7 @@ namespace hpx::parallel::util::detail {
3030
template <typename Iter>
3131
struct is_data_aligned_impl
3232
{
33-
static HPX_FORCEINLINE bool call(Iter const& it) noexcept
33+
static HPX_FORCEINLINE bool call(Iter& it) noexcept
3434
{
3535
using value_type = typename std::iterator_traits<Iter>::value_type;
3636
using pack_type = traits::vector_pack_type_t<value_type>;
@@ -42,7 +42,7 @@ namespace hpx::parallel::util::detail {
4242
};
4343

4444
template <typename Iter>
45-
HPX_FORCEINLINE bool is_data_aligned(Iter const& it) noexcept
45+
HPX_FORCEINLINE bool is_data_aligned(Iter& it) noexcept
4646
{
4747
return is_data_aligned_impl<Iter>::call(it);
4848
}

libs/core/execution/include/hpx/execution/traits/detail/eve/vector_pack_load_store.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ namespace hpx::parallel::traits {
2323
struct vector_pack_load
2424
{
2525
template <typename Iter>
26-
HPX_HOST_DEVICE HPX_FORCEINLINE static V aligned(Iter const& iter)
26+
HPX_HOST_DEVICE HPX_FORCEINLINE static V aligned(Iter& iter)
2727
{
2828
return V(
2929
eve::as_aligned(std::addressof(*iter), eve::cardinal_t<V>{}));
3030
}
3131

3232
template <typename Iter>
33-
HPX_HOST_DEVICE HPX_FORCEINLINE static V unaligned(Iter const& iter)
33+
HPX_HOST_DEVICE HPX_FORCEINLINE static V unaligned(Iter& iter)
3434
{
3535
return *iter;
3636
}
@@ -42,15 +42,15 @@ namespace hpx::parallel::traits {
4242
{
4343
template <typename Iter>
4444
HPX_HOST_DEVICE HPX_FORCEINLINE static void aligned(
45-
V& value, Iter const& iter)
45+
V& value, Iter& iter)
4646
{
4747
eve::store(value,
4848
eve::as_aligned(std::addressof(*iter), eve::cardinal_t<V>{}));
4949
}
5050

5151
template <typename Iter>
5252
HPX_HOST_DEVICE HPX_FORCEINLINE static void unaligned(
53-
V& value, Iter const& iter)
53+
V& value, Iter& iter)
5454
{
5555
*iter = value;
5656
return;

libs/core/execution/include/hpx/execution/traits/detail/simd/vector_pack_load_store.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2021 Srinivas Yadav
2-
// Copyright (c) 2016-2017 Hartmut Kaiser
2+
// Copyright (c) 2016-2025 Hartmut Kaiser
33
//
44
// SPDX-License-Identifier: BSL-1.0
55
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -25,14 +25,14 @@ namespace hpx::parallel::traits {
2525
struct vector_pack_load
2626
{
2727
template <typename Iter>
28-
HPX_HOST_DEVICE HPX_FORCEINLINE static V aligned(Iter const& iter)
28+
HPX_HOST_DEVICE HPX_FORCEINLINE static V aligned(Iter& iter)
2929
{
3030
return V(
3131
std::addressof(*iter), datapar::experimental::vector_aligned);
3232
}
3333

3434
template <typename Iter>
35-
HPX_HOST_DEVICE HPX_FORCEINLINE static V unaligned(Iter const& iter)
35+
HPX_HOST_DEVICE HPX_FORCEINLINE static V unaligned(Iter& iter)
3636
{
3737
return *iter;
3838
}
@@ -44,15 +44,15 @@ namespace hpx::parallel::traits {
4444
{
4545
template <typename Iter>
4646
HPX_HOST_DEVICE HPX_FORCEINLINE static void aligned(
47-
V& value, Iter const& iter)
47+
V& value, Iter& iter)
4848
{
4949
value.copy_to(
5050
std::addressof(*iter), datapar::experimental::vector_aligned);
5151
}
5252

5353
template <typename Iter>
5454
HPX_HOST_DEVICE HPX_FORCEINLINE static void unaligned(
55-
V& value, Iter const& iter)
55+
V& value, Iter& iter)
5656
{
5757
*iter = value;
5858
}

libs/core/execution/include/hpx/execution/traits/detail/vc/vector_pack_load_store.hpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2016 Hartmut Kaiser
1+
// Copyright (c) 2016-2025 Hartmut Kaiser
22
// Copyright (c) 2016 Matthias Kretz
33
//
44
// SPDX-License-Identifier: BSL-1.0
@@ -69,13 +69,13 @@ namespace hpx::parallel::traits {
6969
using value_type = typename rebind_pack<V, ValueType>::type;
7070

7171
template <typename Iter>
72-
static value_type aligned(Iter const& iter)
72+
static value_type aligned(Iter& iter)
7373
{
7474
return value_type(std::addressof(*iter), Vc::Aligned);
7575
}
7676

7777
template <typename Iter>
78-
static value_type unaligned(Iter const& iter)
78+
static value_type unaligned(Iter& iter)
7979
{
8080
return value_type(std::addressof(*iter), Vc::Unaligned);
8181
}
@@ -87,13 +87,13 @@ namespace hpx::parallel::traits {
8787
using value_type = typename rebind_pack<V, Vc::Vector<T, Abi>>::type;
8888

8989
template <typename Iter>
90-
static value_type aligned(Iter const& iter)
90+
static value_type aligned(Iter& iter)
9191
{
9292
return *iter;
9393
}
9494

9595
template <typename Iter>
96-
static value_type unaligned(Iter const& iter)
96+
static value_type unaligned(Iter& iter)
9797
{
9898
return *iter;
9999
}
@@ -107,13 +107,13 @@ namespace hpx::parallel::traits {
107107
typename rebind_pack<Value, Vc::SimdArray<T, N, V, W>>::type;
108108

109109
template <typename Iter>
110-
static value_type aligned(Iter const& iter)
110+
static value_type aligned(Iter& iter)
111111
{
112112
return *iter;
113113
}
114114

115115
template <typename Iter>
116-
static value_type unaligned(Iter const& iter)
116+
static value_type unaligned(Iter& iter)
117117
{
118118
return *iter;
119119
}
@@ -124,13 +124,13 @@ namespace hpx::parallel::traits {
124124
struct vector_pack_store
125125
{
126126
template <typename Iter>
127-
static void aligned(V const& value, Iter const& iter)
127+
static void aligned(V& value, Iter& iter)
128128
{
129129
value.store(std::addressof(*iter), Vc::Aligned);
130130
}
131131

132132
template <typename Iter>
133-
static void unaligned(V const& value, Iter const& iter)
133+
static void unaligned(V& value, Iter& iter)
134134
{
135135
value.store(std::addressof(*iter), Vc::Unaligned);
136136
}
@@ -140,13 +140,13 @@ namespace hpx::parallel::traits {
140140
struct vector_pack_store<V, Vc::Vector<T, Abi>>
141141
{
142142
template <typename Iter>
143-
static void aligned(V const& value, Iter const& iter)
143+
static void aligned(V& value, Iter& iter)
144144
{
145145
*iter = value;
146146
}
147147

148148
template <typename Iter>
149-
static void unaligned(V const& value, Iter const& iter)
149+
static void unaligned(V& value, Iter& iter)
150150
{
151151
*iter = value;
152152
}
@@ -157,13 +157,13 @@ namespace hpx::parallel::traits {
157157
struct vector_pack_store<Value, Vc::SimdArray<T, N, V, W>>
158158
{
159159
template <typename Iter>
160-
static void aligned(Value const& value, Iter const& iter)
160+
static void aligned(Value& value, Iter& iter)
161161
{
162162
*iter = value;
163163
}
164164

165165
template <typename Iter>
166-
static void unaligned(Value const& value, Iter const& iter)
166+
static void unaligned(Value& value, Iter& iter)
167167
{
168168
*iter = value;
169169
}

libs/core/execution/include/hpx/execution/traits/detail/vc/vector_pack_type.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2016 Hartmut Kaiser
1+
// Copyright (c) 2016-2025 Hartmut Kaiser
22
// Copyright (c) 2016 Matthias Kretz
33
//
44
// SPDX-License-Identifier: BSL-1.0
@@ -74,7 +74,7 @@ namespace hpx::parallel::traits {
7474
////////////////////////////////////////////////////////////////////
7575
template <typename T>
7676
struct vector_pack_mask_type<T,
77-
typename std::enable_if_t<Vc::Traits::is_simd_vector<T>::value>>
77+
std::enable_if_t<Vc::Traits::is_simd_vector<T>::value>>
7878
{
7979
using type = typename T::mask_type;
8080
};

libs/core/executors/include/hpx/executors/detail/index_queue_spawning.hpp

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2019-2020 ETH Zurich
2-
// Copyright (c) 2007-2023 Hartmut Kaiser
2+
// Copyright (c) 2007-2025 Hartmut Kaiser
33
// Copyright (c) 2019 Agustin Berge
44
//
55
// SPDX-License-Identifier: BSL-1.0
@@ -53,7 +53,7 @@ namespace hpx::parallel::execution::detail {
5353
bool const allow_stealing;
5454

5555
template <std::size_t... Is, typename F, typename T, typename Ts>
56-
static constexpr void bulk_invoke_helper(
56+
HPX_FORCEINLINE static constexpr void bulk_invoke_helper(
5757
hpx::util::index_pack<Is...>, F&& f, T&& t, Ts&& ts)
5858
{
5959
HPX_INVOKE(HPX_FORWARD(F, f), HPX_FORWARD(T, t),
@@ -63,7 +63,8 @@ namespace hpx::parallel::execution::detail {
6363
// Perform the work in one element indexed by index. The index
6464
// represents a range of indices (iterators) in the given shape.
6565
template <typename F, typename Ts>
66-
void do_work_chunk(F&& f, Ts&& ts, std::uint32_t const index) const
66+
HPX_FORCEINLINE void do_work_chunk(
67+
F&& f, Ts&& ts, std::uint32_t const index) const
6768
{
6869
#if HPX_HAVE_ITTNOTIFY != 0 && !defined(HPX_HAVE_APEX)
6970
static hpx::util::itt::event notify_event(
@@ -104,7 +105,7 @@ namespace hpx::parallel::execution::detail {
104105
if (allow_stealing)
105106
{
106107
// Then steal from the opposite end of the neighboring queues
107-
static constexpr auto opposite_end =
108+
constexpr auto opposite_end =
108109
hpx::concurrency::detail::opposite_end_v<Which>;
109110

110111
for (std::uint32_t offset = 1; offset != state->num_threads;
@@ -123,20 +124,6 @@ namespace hpx::parallel::execution::detail {
123124
}
124125
}
125126

126-
// Execute task function
127-
void do_work() const
128-
{
129-
// schedule chunks from the end, if needed
130-
if (reverse_placement)
131-
{
132-
do_work<hpx::concurrency::detail::queue_end::right>();
133-
}
134-
else
135-
{
136-
do_work<hpx::concurrency::detail::queue_end::left>();
137-
}
138-
}
139-
140127
// Store an exception and mark that an exception was thrown in the
141128
// operation state. This function assumes that there is a current
142129
// exception.
@@ -150,7 +137,7 @@ namespace hpx::parallel::execution::detail {
150137
// Finish the work for one worker thread. If this is not the last worker
151138
// thread to finish, it will only decrement the counter. If it is the
152139
// last thread it will call set_exception if there is an exception.
153-
// Otherwise it will call set_value on the shared state.
140+
// Otherwise, it will call set_value on the shared state.
154141
void finish() const
155142
{
156143
if (--(state->tasks_remaining.data_) == 0)
@@ -186,7 +173,16 @@ namespace hpx::parallel::execution::detail {
186173
{
187174
try
188175
{
189-
do_work();
176+
// Execute task function
177+
if (reverse_placement)
178+
{
179+
// schedule chunks from the end, if needed
180+
do_work<hpx::concurrency::detail::queue_end::right>();
181+
}
182+
else
183+
{
184+
do_work<hpx::concurrency::detail::queue_end::left>();
185+
}
190186
}
191187
catch (std::bad_alloc const&)
192188
{

libs/core/iterator_support/include/hpx/iterator_support/counting_iterator.hpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2020-2023 Hartmut Kaiser
1+
// Copyright (c) 2020-2025 Hartmut Kaiser
22
//
33
// SPDX-License-Identifier: BSL-1.0
44
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -84,7 +84,7 @@ namespace hpx::util {
8484

8585
using type = iterator_adaptor<counting_iterator<Incrementable,
8686
CategoryOrTraversal, Difference>,
87-
Incrementable, Incrementable, traversal, Incrementable const&,
87+
Incrementable, Incrementable, traversal, Incrementable&,
8888
difference>;
8989
};
9090
} // namespace detail
@@ -122,6 +122,11 @@ namespace hpx::util {
122122
{
123123
return this->base_reference();
124124
}
125+
126+
HPX_HOST_DEVICE constexpr typename base_type::reference dereference()
127+
{
128+
return this->base_reference();
129+
}
125130
};
126131

127132
template <typename Incrementable, typename CategoryOrTraversal,
@@ -175,8 +180,12 @@ namespace hpx::util {
175180
static_cast<typename base_type::base_type>(n);
176181
}
177182

178-
HPX_HOST_DEVICE constexpr typename base_type::reference dereference()
179-
const noexcept
183+
HPX_HOST_DEVICE constexpr decltype(auto) dereference() const noexcept
184+
{
185+
return this->base_reference();
186+
}
187+
188+
HPX_HOST_DEVICE constexpr decltype(auto) dereference() noexcept
180189
{
181190
return this->base_reference();
182191
}

libs/core/iterator_support/include/hpx/iterator_support/iterator_adaptor.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2016-2023 Hartmut Kaiser
1+
// Copyright (c) 2016-2025 Hartmut Kaiser
22
//
33
// SPDX-License-Identifier: BSL-1.0
44
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -106,7 +106,7 @@ namespace hpx::util {
106106
//
107107
// Reference - the reference type of the resulting iterator, and in
108108
// particular, the result type of operator*(). If not supplied but
109-
// Value is supplied, Value& is used. Otherwise
109+
// Value is supplied, Value& is used. Otherwise,
110110
// iterator_traits<Base>::reference is used.
111111
//
112112
// Difference - the difference_type of the resulting iterator. If not
@@ -149,13 +149,13 @@ namespace hpx::util {
149149
Category, Reference, Difference, Pointer>;
150150

151151
// lvalue access to the Base object for Derived
152-
HPX_HOST_DEVICE HPX_FORCEINLINE constexpr Base const& base_reference()
153-
const noexcept
152+
HPX_HOST_DEVICE HPX_FORCEINLINE Base& base_reference() noexcept
154153
{
155154
return iterator_;
156155
}
157156

158-
HPX_HOST_DEVICE HPX_FORCEINLINE Base& base_reference() noexcept
157+
HPX_HOST_DEVICE HPX_FORCEINLINE constexpr Base const& base_reference()
158+
const noexcept
159159
{
160160
return iterator_;
161161
}

0 commit comments

Comments
 (0)