Skip to content

Commit e248cc7

Browse files
HIP: Fix host-only constructors (#1801)
* Revert "Workaround for Hipcc error (reference to host function in host device function) (#1754)" This reverts commit 257cf87. * Add `__host__` directives where needed * Annotate Compiler & Issue Number * Formatting
1 parent 9505017 commit e248cc7

File tree

4 files changed

+38
-6
lines changed

4 files changed

+38
-6
lines changed

include/openPMD/snapshots/RandomAccessIterator.hpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,14 @@ class RandomAccessIterator
7272

7373
~RandomAccessIterator() override;
7474

75-
RandomAccessIterator(RandomAccessIterator const &other) = default;
75+
RandomAccessIterator(RandomAccessIterator const &other);
7676
RandomAccessIterator(RandomAccessIterator &&other) noexcept(
77-
noexcept(iterator_t(std::declval<iterator_t &&>()))) = default;
77+
noexcept(iterator_t(std::declval<iterator_t &&>())));
7878

79+
RandomAccessIterator &operator=(RandomAccessIterator const &other);
7980
RandomAccessIterator &
80-
operator=(RandomAccessIterator const &other) = default;
81-
RandomAccessIterator &operator=(RandomAccessIterator &&other) noexcept(
82-
noexcept(std::declval<iterator_t>().operator=(
83-
std::declval<iterator_t &&>()))) = default;
81+
operator=(RandomAccessIterator &&other) noexcept(noexcept(
82+
std::declval<iterator_t>().operator=(std::declval<iterator_t &&>())));
8483

8584
auto operator*() -> value_type &;
8685
auto operator*() const -> value_type const &;

src/auxiliary/UniquePtr.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ namespace auxiliary
6565
} // namespace auxiliary
6666

6767
template <typename T>
68+
#ifdef __HIPCC__ // ROCm 6.2.4 issue, see #1797
69+
__host__
70+
#endif
6871
UniquePtrWithLambda<T>::UniquePtrWithLambda() = default;
6972

7073
template <typename T>

src/backend/BaseRecord.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ namespace internal
5656
typename T_BaseRecord_,
5757
typename T_BaseRecordData_,
5858
typename T_BaseIterator>
59+
#ifdef __HIPCC__ // ROCm 6.2.4 issue, see #1797
60+
__host__
61+
#endif
5962
ScalarIterator<T_BaseRecord_, T_BaseRecordData_, T_BaseIterator>::
6063
ScalarIterator() = default;
6164

src/snapshots/RandomAccessIterator.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,33 @@ inline RandomAccessIterator<iterator_t>::RandomAccessIterator(iterator_t it)
99
template <typename iterator_t>
1010
RandomAccessIterator<iterator_t>::~RandomAccessIterator() = default;
1111

12+
template <typename iterator_t>
13+
#ifdef __HIPCC__ // ROCm 6.2.4 issue, see #1797
14+
__host__
15+
#endif
16+
RandomAccessIterator<iterator_t>::RandomAccessIterator(
17+
RandomAccessIterator const &other) = default;
18+
19+
template <typename iterator_t>
20+
#ifdef __HIPCC__ // ROCm 6.2.4 issue, see #1797
21+
__host__
22+
#endif
23+
RandomAccessIterator<iterator_t>::RandomAccessIterator(
24+
RandomAccessIterator
25+
&&other) noexcept(noexcept(iterator_t(std::declval<iterator_t &&>()))) =
26+
default;
27+
28+
template <typename iterator_t>
29+
RandomAccessIterator<iterator_t> &RandomAccessIterator<iterator_t>::operator=(
30+
RandomAccessIterator const &other) = default;
31+
32+
template <typename iterator_t>
33+
RandomAccessIterator<iterator_t> &RandomAccessIterator<iterator_t>::operator=(
34+
RandomAccessIterator
35+
&&other) noexcept(noexcept(std::declval<iterator_t>().
36+
operator=(std::declval<iterator_t &&>()))) =
37+
default;
38+
1239
template <typename iterator_t>
1340
auto RandomAccessIterator<iterator_t>::operator*() -> value_type &
1441
{

0 commit comments

Comments
 (0)