Skip to content

Commit

Permalink
NVRTC fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardmgruber committed Jan 21, 2025
1 parent cb0396a commit 6e6cf8d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
7 changes: 3 additions & 4 deletions thrust/thrust/detail/alignment.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@
#endif // no system header

#include <cuda/cmath>
#include <cuda/std/cstddef>
#include <cuda/std/type_traits>

#include <cstddef> // For `std::size_t` and `std::max_align_t`.

THRUST_NAMESPACE_BEGIN
namespace detail
{
Expand All @@ -49,7 +48,7 @@ using alignment_of = ::cuda::std::alignment_of<T>;
/// type whose alignment requirement is a divisor of `Align`.
///
/// The behavior is undefined if `Align` is not a power of 2.
template <std::size_t Align>
template <::cuda::std::size_t Align>
struct aligned_type
{
struct alignas(Align) type
Expand All @@ -74,7 +73,7 @@ _CCCL_HOST_DEVICE T aligned_reinterpret_cast(U u)
return reinterpret_cast<T>(reinterpret_cast<void*>(u));
}

_CCCL_HOST_DEVICE inline std::size_t aligned_storage_size(std::size_t n, std::size_t align)
_CCCL_HOST_DEVICE inline ::cuda::std::size_t aligned_storage_size(::cuda::std::size_t n, ::cuda::std::size_t align)
{
return ::cuda::ceil_div(n, align) * align;
}
Expand Down
22 changes: 11 additions & 11 deletions thrust/thrust/detail/type_deduction.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,29 @@
#endif // no system header
#include <thrust/detail/preprocessor.h>

#include <type_traits>
#include <utility>
#include <cuda/std/type_traits>
#include <cuda/std/utility>

///////////////////////////////////////////////////////////////////////////////

/// \def THRUST_FWD(x)
/// \brief Performs universal forwarding of a universal reference.
///
#define THRUST_FWD(x) ::std::forward<decltype(x)>(x)
#define THRUST_FWD(x) ::cuda::std::forward<decltype(x)>(x)

/// \def THRUST_MVCAP(x)
/// \brief Capture `x` into a lambda by moving.
///
#define THRUST_MVCAP(x) x = ::std::move(x)
#define THRUST_MVCAP(x) x = ::cuda::std::move(x)

/// \def THRUST_RETOF(invocable, ...)
/// \brief Expands to the type returned by invoking an instance of the invocable
/// type \a invocable with parameters of type \c __VA_ARGS__. Must
/// be called with 1 or fewer parameters to the invocable.
///
#define THRUST_RETOF(...) THRUST_PP_DISPATCH(THRUST_RETOF, __VA_ARGS__)
#define THRUST_RETOF1(C) decltype(::std::declval<C>()())
#define THRUST_RETOF2(C, V) decltype(::std::declval<C>()(::std::declval<V>()))
#define THRUST_RETOF1(C) decltype(::cuda::std::declval<C>()())
#define THRUST_RETOF2(C, V) decltype(::cuda::std::declval<C>()(::cuda::std::declval<V>()))

/// \def THRUST_RETURNS(...)
/// \brief Expands to a function definition that returns the expression
Expand Down Expand Up @@ -88,11 +88,11 @@
} \
/**/
#else
# define THRUST_DECLTYPE_RETURNS_WITH_SFINAE_CONDITION(condition, ...) \
noexcept(noexcept(__VA_ARGS__))->typename std::enable_if<condition, decltype(__VA_ARGS__)>::type \
{ \
return (__VA_ARGS__); \
} \
# define THRUST_DECLTYPE_RETURNS_WITH_SFINAE_CONDITION(condition, ...) \
noexcept(noexcept(__VA_ARGS__))->::cuda::std::enable_if_t<condition, decltype(__VA_ARGS__)> \
{ \
return (__VA_ARGS__); \
} \
/**/
#endif

Expand Down
2 changes: 1 addition & 1 deletion thrust/thrust/iterator/detail/any_system_tag.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct any_system_tag : thrust::execution_policy<any_system_tag>
// allow any_system_tag to convert to any type at all
// XXX make this safer using enable_if<is_tag<T>> upon c++11
template <typename T>
operator T() const
_CCCL_HOST_DEVICE operator T() const
{
return T();
}
Expand Down

0 comments on commit 6e6cf8d

Please sign in to comment.