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 21, 2024
1 parent b1c5c74 commit 7d30965
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 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
6 changes: 6 additions & 0 deletions folly/synchronization/RelaxedAtomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 7d30965

Please sign in to comment.