Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workaround an nvcc bug #1681

Merged
merged 1 commit into from
Dec 10, 2021
Merged
Changes from all commits
Commits
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
20 changes: 17 additions & 3 deletions include/gridtools/common/tuple_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ namespace gridtools {
template <class Fun>
struct get_fun_result {
template <class... Ts>
using apply = decltype(std::declval<Fun const &>()(std::declval<Ts>()...));
using apply = decltype(std::declval<std::add_lvalue_reference_t<std::add_const_t<Fun>>>()(std::declval<Ts>()...));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's that about?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean is there any difference between the old and the new version?

};

template <class Tup>
Expand Down Expand Up @@ -1636,13 +1636,27 @@ namespace gridtools {
* convert_to<std::array>(some_tuple_like);
* convert_to<gridtools::array, int>(some_tuple_like);
*/
template <template <class...> class L>
template <template <class...> class L
#if defined(__NVCC__) && defined(__CUDACC_VER_MAJOR__) && \
(__CUDACC_VER_MAJOR__ < 11 || __CUDACC_VER_MAJOR__ == 11 && __CUDACC_VER_MINOR__ <= 5) \
&& __cplusplus >= 201703
// workaround against nvcc bug: https://godbolt.org/z/orrev1xnM
, int = 0, class = std::void_t<L<int, int>>
#endif
>
GT_TARGET GT_FORCE_INLINE GT_TARGET_CONSTEXPR detail::convert_to_f<_impl::to_tuple_converter_helper<L>>
convert_to() {
return {};
}

template <template <class...> class L, class Tup>
template <template <class...> class L
#if defined(__NVCC__) && defined(__CUDACC_VER_MAJOR__) && \
(__CUDACC_VER_MAJOR__ < 11 || __CUDACC_VER_MAJOR__ == 11 && __CUDACC_VER_MINOR__ <= 5) \
&& __cplusplus >= 201703
// workaround against nvcc bug: https://godbolt.org/z/orrev1xnM
, int = 0, class = std::void_t<L<int, int>>
#endif
, class Tup>
GT_TARGET GT_FORCE_INLINE GT_TARGET_CONSTEXPR auto convert_to(Tup && tup) {
return detail::convert_to_f<_impl::to_tuple_converter_helper<L>>{}(wstd::forward<Tup>(tup));
}
Expand Down