Skip to content

Commit

Permalink
Fix compilation with nvcc
Browse files Browse the repository at this point in the history
  • Loading branch information
luhenry committed Feb 22, 2024
1 parent b1c5c74 commit 2363b37
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions folly/Conv.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ namespace detail {
template <class... T>
using LastElement = type_pack_element_t<sizeof...(T) - 1, T...>;

#ifdef _MSC_VER
// MSVC can't quite figure out the LastElementImpl::call() stuff
#if defined(_MSC_VER) || defined(__CUDACC__)
// MSVC and NVCC can't quite figure out the LastElementImpl::call() stuff
// in the base implementation, so we have to use tuples instead,
// which result in significantly more templates being compiled,
// though the runtime performance is the same.
Expand Down
8 changes: 7 additions & 1 deletion folly/synchronization/RelaxedAtomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ struct relaxed_atomic_base : protected std::atomic<T> {
};

template <typename T>
struct relaxed_atomic_integral_base : private relaxed_atomic_base<T> {
struct relaxed_atomic_integral_base : protected relaxed_atomic_base<T> {
private:
using atomic = std::atomic<T>;
using base = relaxed_atomic_base<T>;
Expand All @@ -108,7 +108,9 @@ struct relaxed_atomic_integral_base : private relaxed_atomic_base<T> {

using base::relaxed_atomic_base;
using base::operator=;
#ifndef __CUDACC__
using base::operator T;
#endif
using base::compare_exchange_strong;
using base::compare_exchange_weak;
using base::exchange;
Expand Down Expand Up @@ -206,7 +208,9 @@ struct relaxed_atomic : detail::relaxed_atomic_base<T> {

using base::relaxed_atomic_base;
using base::operator=;
#ifndef __CUDACC__
using base::operator T;
#endif
};

template <typename T>
Expand All @@ -220,7 +224,9 @@ struct relaxed_atomic<T*> : detail::relaxed_atomic_base<T*> {

using detail::relaxed_atomic_base<T*>::relaxed_atomic_base;
using base::operator=;
#ifndef __CUDACC__
using base::operator T*;
#endif

T* fetch_add(std::ptrdiff_t arg) noexcept {
return atomic::fetch_add(arg, std::memory_order_relaxed);
Expand Down

0 comments on commit 2363b37

Please sign in to comment.