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

Commit

Permalink
Merge pull request #1809 from miscco/nvbug_3826028
Browse files Browse the repository at this point in the history
Fix some warning about usage of `__host__` functions in `__device__` code
  • Loading branch information
miscco authored Oct 10, 2022
2 parents 8189ed4 + 8972fa4 commit d641d63
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
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

0 comments on commit d641d63

Please sign in to comment.