Skip to content

Commit

Permalink
Revert iterator changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed Jan 6, 2025
1 parent 6eb3152 commit 6a1cc55
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 239 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,7 @@ namespace hpx {
template <typename, typename>
friend class const_partitioned_vector_local_view_iterator;

DataType& dereference()
{
HPX_ASSERT(!is_at_end());
return this->base_reference()->data();
}
DataType const& dereference() const
DataType& dereference() const
{
HPX_ASSERT(!is_at_end());
return this->base_reference()->data();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -765,13 +765,6 @@ namespace hpx::segmented {
using local_iterator =
typename partitioned_vector<T, Data>::local_iterator;

using const_segment_iterator =
typename partitioned_vector<T, Data>::const_segment_iterator;
using const_local_segment_iterator =
typename partitioned_vector<T, Data>::const_local_segment_iterator;
using const_local_iterator =
typename partitioned_vector<T, Data>::const_local_iterator;

// constructors
vector_iterator()
: data_(nullptr)
Expand Down Expand Up @@ -1012,34 +1005,20 @@ namespace hpx::traits {

// This function should specify the local iterator which is at the
// beginning of the partition data.
static local_raw_iterator begin(local_segment_iterator& seg_iter)
static local_raw_iterator begin(local_segment_iterator const& seg_iter)
{
return local_raw_iterator(
seg_iter->begin(), seg_iter.base()->local_data_);
}

static local_raw_const_iterator begin(
local_segment_iterator const& seg_iter)
{
return local_raw_const_iterator(
seg_iter->begin(), seg_iter.base()->local_data_);
}

// This function should specify the local iterator which is at the
// end of the partition data.
static local_raw_iterator end(local_segment_iterator& seg_iter)
static local_raw_iterator end(local_segment_iterator const& seg_iter)
{
return local_raw_iterator(
seg_iter->end(), seg_iter.base()->local_data_);
}

static local_raw_const_iterator end(
local_segment_iterator const& seg_iter)
{
return local_raw_const_iterator(
seg_iter->end(), seg_iter.base()->local_data_);
}

// Extract the base id for the segment referenced by the given segment
// iterator.
static id_type get_id(segment_iterator const& iter)
Expand Down
92 changes: 0 additions & 92 deletions libs/core/algorithms/include/hpx/parallel/datapar/zip_iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,6 @@ namespace hpx::parallel::util::detail {
{
return call(it, hpx::util::make_index_pack_t<sizeof...(Iter)>());
}

template <std::size_t... Is>
static HPX_FORCEINLINE constexpr bool call(
hpx::util::zip_iterator<Iter...>& it, hpx::util::index_pack<Is...>)
{
auto& t = it.get_iterator_tuple();
return (true && ... && is_data_aligned(hpx::get<Is>(t)));
}

static HPX_FORCEINLINE constexpr bool call(
hpx::util::zip_iterator<Iter...>& it)
{
return call(it, hpx::util::make_index_pack_t<sizeof...(Iter)>());
}
};

///////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -94,28 +80,6 @@ namespace hpx::parallel::traits {
typename std::iterator_traits<Iter>::value_type>::
unaligned(hpx::get<Is>(t))...);
}

template <typename Tuple, typename... Iter, std::size_t... Is>
constexpr Tuple aligned_pack(hpx::util::zip_iterator<Iter...>& iter,
hpx::util::index_pack<Is...>)
{
auto& t = iter.get_iterator_tuple();
return hpx::make_tuple(
vector_pack_load<hpx::tuple_element_t<Is, Tuple>,
typename std::iterator_traits<Iter>::value_type>::
aligned(hpx::get<Is>(t))...);
}

template <typename Tuple, typename... Iter, std::size_t... Is>
constexpr Tuple unaligned_pack(hpx::util::zip_iterator<Iter...>& iter,
hpx::util::index_pack<Is...>)
{
auto& t = iter.get_iterator_tuple();
return hpx::make_tuple(
vector_pack_load<hpx::tuple_element_t<Is, Tuple>,
typename std::iterator_traits<Iter>::value_type>::
unaligned(hpx::get<Is>(t))...);
}
} // namespace detail

template <typename... Vector, typename ValueType>
Expand All @@ -138,22 +102,6 @@ namespace hpx::parallel::traits {
return traits::detail::unaligned_pack<value_type>(
iter, hpx::util::make_index_pack_t<sizeof...(Iter)>());
}

template <typename... Iter>
static constexpr value_type aligned(
hpx::util::zip_iterator<Iter...>& iter)
{
return traits::detail::aligned_pack<value_type>(
iter, hpx::util::make_index_pack_t<sizeof...(Iter)>());
}

template <typename... Iter>
static constexpr value_type unaligned(
hpx::util::zip_iterator<Iter...>& iter)
{
return traits::detail::unaligned_pack<value_type>(
iter, hpx::util::make_index_pack_t<sizeof...(Iter)>());
}
};

///////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -182,30 +130,6 @@ namespace hpx::parallel::traits {
unaligned(hpx::get<Is>(value), hpx::get<Is>(t)),
...);
}

template <typename Tuple, typename... Iter, std::size_t... Is>
constexpr void aligned_pack(Tuple& value,
hpx::util::zip_iterator<Iter...>& iter,
hpx::util::index_pack<Is...>)
{
auto& t = iter.get_iterator_tuple();
(vector_pack_store<hpx::tuple_element_t<Is, Tuple>,
typename std::iterator_traits<Iter>::value_type>::
aligned(hpx::get<Is>(value), hpx::get<Is>(t)),
...);
}

template <typename Tuple, typename... Iter, std::size_t... Is>
constexpr void unaligned_pack(Tuple& value,
hpx::util::zip_iterator<Iter...>& iter,
hpx::util::index_pack<Is...>)
{
auto& t = iter.get_iterator_tuple();
(vector_pack_store<hpx::tuple_element_t<Is, Tuple>,
typename std::iterator_traits<Iter>::value_type>::
unaligned(hpx::get<Is>(value), hpx::get<Is>(t)),
...);
}
} // namespace detail

template <typename... Vector, typename ValueType>
Expand All @@ -226,22 +150,6 @@ namespace hpx::parallel::traits {
traits::detail::unaligned_pack(
value, iter, hpx::util::make_index_pack_t<sizeof...(Iter)>());
}

template <typename V, typename... Iter>
static constexpr void aligned(
V& value, hpx::util::zip_iterator<Iter...>& iter)
{
traits::detail::aligned_pack(
value, iter, hpx::util::make_index_pack_t<sizeof...(Iter)>());
}

template <typename V, typename... Iter>
static constexpr void unaligned(
V& value, hpx::util::zip_iterator<Iter...>& iter)
{
traits::detail::unaligned_pack(
value, iter, hpx::util::make_index_pack_t<sizeof...(Iter)>());
}
};
} // namespace hpx::parallel::traits

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ namespace hpx::util {

using type = iterator_adaptor<counting_iterator<Incrementable,
CategoryOrTraversal, Difference>,
Incrementable, Incrementable, traversal, Incrementable&,
Incrementable, Incrementable, traversal, Incrementable const&,
difference>;
};
} // namespace detail
Expand Down Expand Up @@ -122,11 +122,6 @@ namespace hpx::util {
{
return this->base_reference();
}

HPX_HOST_DEVICE constexpr typename base_type::reference dereference()
{
return this->base_reference();
}
};

template <typename Incrementable, typename CategoryOrTraversal,
Expand Down Expand Up @@ -180,12 +175,8 @@ namespace hpx::util {
static_cast<typename base_type::base_type>(n);
}

HPX_HOST_DEVICE constexpr decltype(auto) dereference() const noexcept
{
return this->base_reference();
}

HPX_HOST_DEVICE constexpr decltype(auto) dereference() noexcept
HPX_HOST_DEVICE constexpr typename base_type::reference dereference()
const noexcept
{
return this->base_reference();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,24 +143,19 @@ namespace hpx::util {
return iterator_;
}

HPX_HOST_DEVICE HPX_FORCEINLINE constexpr Base& base() noexcept
{
return iterator_;
}

protected:
// for convenience in derived classes
using iterator_adaptor_ = iterator_adaptor<Derived, Base, Value,
Category, Reference, Difference, Pointer>;

// lvalue access to the Base object for Derived
HPX_HOST_DEVICE HPX_FORCEINLINE Base& base_reference() noexcept
HPX_HOST_DEVICE HPX_FORCEINLINE constexpr Base const& base_reference()
const noexcept
{
return iterator_;
}

HPX_HOST_DEVICE HPX_FORCEINLINE constexpr Base const& base_reference()
const noexcept
HPX_HOST_DEVICE HPX_FORCEINLINE Base& base_reference() noexcept
{
return iterator_;
}
Expand Down
Loading

0 comments on commit 6a1cc55

Please sign in to comment.