Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Fix some warning about usage of __host__ functions in __device__ code #1809

Merged
merged 2 commits into from
Oct 10, 2022
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
11 changes: 7 additions & 4 deletions thrust/device_new_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
#include <thrust/device_reference.h>
#include <thrust/device_new.h>
#include <thrust/device_delete.h>
#include <limits>

#include <cuda/std/cstdint>
#include <cuda/std/limits>

#include <stdexcept>

THRUST_NAMESPACE_BEGIN
Expand Down Expand Up @@ -61,8 +64,8 @@ template<typename T>
/*! \c const reference to allocated element, \c device_reference<const T>. */
typedef device_reference<const T> const_reference;

/*! Type of allocation size, \c std::size_t. */
typedef std::size_t size_type;
/*! Type of allocation size, \c ::cuda::std::size_t. */
typedef ::cuda::std::size_t size_type;

/*! Type of allocation difference, \c pointer::difference_type. */
typedef typename pointer::difference_type difference_type;
Expand Down Expand Up @@ -147,7 +150,7 @@ template<typename T>
__host__ __device__
inline size_type max_size() const
{
return std::numeric_limits<size_type>::max THRUST_PREVENT_MACRO_SUBSTITUTION () / sizeof(T);
return ::cuda::std::numeric_limits<size_type>::max THRUST_PREVENT_MACRO_SUBSTITUTION () / sizeof(T);
} // end max_size()

/*! Compares against another \p device_malloc_allocator for equality.
Expand Down
4 changes: 2 additions & 2 deletions thrust/optional.h
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@ class optional : private detail::optional_move_assign_base<T>,

*this = nullopt;
this->construct(std::forward<Args>(args)...);
return value();
return this->m_value;
}

/// \group emplace
Expand All @@ -1594,7 +1594,7 @@ class optional : private detail::optional_move_assign_base<T>,
emplace(std::initializer_list<U> il, Args &&... args) {
*this = nullopt;
this->construct(il, std::forward<Args>(args)...);
return value();
return this->m_value;
}

/// Swaps this optional with the other.
Expand Down