From 7d3096578b41846b1b80454d72ac9435ff00d1a0 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Wed, 21 Feb 2024 17:24:47 +0000 Subject: [PATCH] Fix compilation with nvcc --- folly/Conv.h | 4 ++-- folly/synchronization/RelaxedAtomic.h | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/folly/Conv.h b/folly/Conv.h index e52507fb331..bad4311c4fe 100644 --- a/folly/Conv.h +++ b/folly/Conv.h @@ -286,8 +286,8 @@ namespace detail { template using LastElement = type_pack_element_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. diff --git a/folly/synchronization/RelaxedAtomic.h b/folly/synchronization/RelaxedAtomic.h index 9891310b38e..6c7cc76d183 100644 --- a/folly/synchronization/RelaxedAtomic.h +++ b/folly/synchronization/RelaxedAtomic.h @@ -108,7 +108,9 @@ struct relaxed_atomic_integral_base : private relaxed_atomic_base { 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; @@ -206,7 +208,9 @@ struct relaxed_atomic : detail::relaxed_atomic_base { using base::relaxed_atomic_base; using base::operator=; +#ifndef __CUDACC__ using base::operator T; +#endif }; template @@ -220,7 +224,9 @@ struct relaxed_atomic : detail::relaxed_atomic_base { using detail::relaxed_atomic_base::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);