Skip to content

Commit

Permalink
Update type_traits.h. (#402)
Browse files Browse the repository at this point in the history
* Update type_traits.h.

A regression was introduced in 2b80e29. In case of THRUST_DEVICE_SYSTEM_OMP build, the invoke_result_t is undefined due to missing #else branch.
See e.g. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1064730

* fix(detail/nv_target.h): include missing target macros when targetting a non-hip backend (i.e. openmp)

This change causes the HIP system target.h to be included when targetting a device system that is not HIP or CUDA.

---------

Co-authored-by: Nara Prasetya <[email protected]>
  • Loading branch information
LocutusOfBorg and Naraenda authored May 8, 2024
1 parent dc0a981 commit 791d013
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions thrust/detail/nv_target.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@
# include <thrust/system/hip/detail/nv/target.h>
#elif THRUST_DEVICE_SYSTEM == THRUST_DEVICE_SYSTEM_CUDA
# include <nv/target>
#else
// When using a different backend, e.g. OpenMP, we still need to define the target.
// We can simply reuse the HIP targets for this.
# include <thrust/system/hip/detail/nv/target.h>
#endif
2 changes: 2 additions & 0 deletions thrust/detail/type_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,8 @@ using invoke_result_t =
#else // 2017+
::cuda::std::invoke_result_t<Invokable, Args...>;
#endif
#else
std::invoke_result_t<Invokable, Args...>;
#endif

template <class F, class... Us>
Expand Down

0 comments on commit 791d013

Please sign in to comment.