Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 5 additions & 3 deletions libcudacxx/include/cuda/std/__functional/invoke.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <cuda/std/__type_traits/is_same.h>
#include <cuda/std/__type_traits/is_void.h>
#include <cuda/std/__type_traits/nat.h>
#include <cuda/std/__type_traits/remove_cvref.h>
#include <cuda/std/__utility/declval.h>
#include <cuda/std/__utility/forward.h>

Expand Down Expand Up @@ -192,15 +193,16 @@ struct _CCCL_TYPE_VISIBILITY_DEFAULT invoke_result //
{
#if _CCCL_CUDA_COMPILER(NVCC) && defined(__CUDACC_EXTENDED_LAMBDA__) && !_CCCL_DEVICE_COMPILATION()
# if _CCCL_CUDACC_BELOW(12, 3)
static_assert(!__nv_is_extended_device_lambda_closure_type(_Fp),
static_assert(!__nv_is_extended_device_lambda_closure_type(remove_cvref_t<_Fp>),
"Attempt to use an extended __device__ lambda in a context "
"that requires querying its return type in host code. Use a "
"named function object, an extended __host__ __device__ lambda, or "
"cuda::proclaim_return_type instead.");
# else // ^^^ _CCCL_CUDACC_BELOW(12, 3) ^^^ / vvv _CCCL_CUDACC_AT_LEAST(12, 3) vvv
static_assert(
!__nv_is_extended_device_lambda_closure_type(_Fp) || __nv_is_extended_host_device_lambda_closure_type(_Fp)
|| __nv_is_extended_device_lambda_with_preserved_return_type(_Fp),
!__nv_is_extended_device_lambda_closure_type(remove_cvref_t<_Fp>)
|| __nv_is_extended_host_device_lambda_closure_type(remove_cvref_t<_Fp>)
|| __nv_is_extended_device_lambda_with_preserved_return_type(remove_cvref_t<_Fp>),
"Attempt to use an extended __device__ lambda in a context "
"that requires querying its return type in host code. Use a "
"named function object, an extended __host__ __device__ lambda, "
Expand Down
8 changes: 4 additions & 4 deletions thrust/thrust/iterator/transform_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@
#include <thrust/iterator/iterator_traits.h>

#include <cuda/std/__functional/identity.h>
#include <cuda/std/__functional/invoke.h>
#include <cuda/std/__memory/construct_at.h>
#include <cuda/std/__type_traits/is_copy_assignable.h>
#include <cuda/std/__type_traits/is_copy_constructible.h>
#include <cuda/std/__type_traits/remove_cvref.h>
#include <cuda/std/__type_traits/remove_reference.h>
#include <cuda/std/__utility/declval.h>

THRUST_NAMESPACE_BEGIN

Expand All @@ -66,7 +66,7 @@ template <class UnaryFunc, class Iterator>
struct transform_iterator_reference
{
// by default, dereferencing the iterator yields the same as the function.
using type = decltype(::cuda::std::declval<UnaryFunc>()(::cuda::std::declval<it_value_t<Iterator>>()));
using type = ::cuda::std::invoke_result_t<UnaryFunc&, it_value_t<Iterator>>;
};

// for certain function objects, we need to tweak the reference type. Notably, identity functions must decay to values.
Expand All @@ -79,8 +79,8 @@ struct transform_iterator_reference<::cuda::std::identity, Iterator>
template <typename Eval, class Iterator>
struct transform_iterator_reference<functional::actor<Eval>, Iterator>
{
using type = ::cuda::std::remove_reference_t<decltype(::cuda::std::declval<functional::actor<Eval>>()(
::cuda::std::declval<it_value_t<Iterator>>()))>;
using type =
::cuda::std::remove_reference_t<::cuda::std::invoke_result_t<functional::actor<Eval>&, it_value_t<Iterator>>>;
};

// Type function to compute the iterator_adaptor instantiation to be used for transform_iterator
Expand Down
Loading