Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move _CCCL_COMPILER_ICC to the new macro #2849

Merged
merged 2 commits into from
Nov 18, 2024
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
4 changes: 2 additions & 2 deletions cub/cub/detail/detect_cuda_runtime.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
#endif // no system header

// CUDA headers might not be present when using NVRTC, see NVIDIA/cccl#2095 for detail
#if !defined(_CCCL_COMPILER_NVRTC)
#if !_CCCL_COMPILER(NVRTC)
# include <cuda_runtime_api.h>
#endif // !_CCCL_COMPILER_NVRTC
#endif // !_CCCL_COMPILER(NVRTC)

#ifdef DOXYGEN_SHOULD_SKIP_THIS // Only parse this during doxygen passes:

Expand Down
16 changes: 8 additions & 8 deletions cub/cub/iterator/cache_modified_input_iterator.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@
# pragma system_header
#endif // no system header

#ifdef _CCCL_COMPILER_NVRTC
#if _CCCL_COMPILER(NVRTC)
# include <cuda/std/iterator>
#else // _CCCL_COMPILER_NVRTC
#else // ^^^ _CCCL_COMPILER(NVRTC) ^^^ // vvv !_CCCL_COMPILER(NVRTC) vvv
# include <thrust/iterator/iterator_facade.h>
# include <thrust/iterator/iterator_traits.h>

# include <iostream>
# include <iterator>
#endif // _CCCL_COMPILER_NVRTC
#endif // !_CCCL_COMPILER(NVRTC)

#include <cub/thread/thread_load.cuh>
#include <cub/thread/thread_store.cuh>
Expand Down Expand Up @@ -123,15 +123,15 @@ public:
/// The type of a reference to an element the iterator can point to
using reference = ValueType;

#ifdef _CCCL_COMPILER_NVRTC
#if _CCCL_COMPILER(NVRTC)
using iterator_category = ::cuda::std::random_access_iterator_tag;
#else // _CCCL_COMPILER_NVRTC
#else // ^^^ _CCCL_COMPILER(NVRTC) ^^^ // vvv !_CCCL_COMPILER(NVRTC) vvv
using iterator_category = typename THRUST_NS_QUALIFIER::detail::iterator_facade_category<
THRUST_NS_QUALIFIER::device_system_tag,
THRUST_NS_QUALIFIER::random_access_traversal_tag,
value_type,
reference>::type;
#endif // _CCCL_COMPILER_NVRTC
#endif // _CCCL_COMPILER(NVRTC)

public:
/// Wrapped native pointer
Expand Down Expand Up @@ -228,12 +228,12 @@ public:
}

/// ostream operator
#if !defined(_CCCL_COMPILER_NVRTC)
#if !_CCCL_COMPILER(NVRTC)
friend std::ostream& operator<<(std::ostream& os, const self_type& /*itr*/)
{
return os;
}
#endif
#endif // !_CCCL_COMPILER(NVRTC)
};

CUB_NAMESPACE_END
14 changes: 7 additions & 7 deletions cub/cub/iterator/counting_input_iterator.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@

#include <cuda/std/iterator>

#ifndef _CCCL_COMPILER_NVRTC
#if !_CCCL_COMPILER(NVRTC)
# include <thrust/iterator/iterator_facade.h>
# include <thrust/iterator/iterator_traits.h>

# include <ostream>
#endif // _CCCL_COMPILER_NVRTC
#endif // !_CCCL_COMPILER(NVRTC)

CUB_NAMESPACE_BEGIN

Expand Down Expand Up @@ -110,15 +110,15 @@ public:
/// The type of a reference to an element the iterator can point to
using reference = ValueType;

#ifdef _CCCL_COMPILER_NVRTC
#if _CCCL_COMPILER(NVRTC)
using iterator_category = ::cuda::std::random_access_iterator_tag;
#else // _CCCL_COMPILER_NVRTC
#else // ^^^ _CCCL_COMPILER(NVRTC) ^^^ // vvv !_CCCL_COMPILER(NVRTC) vvv
using iterator_category = typename THRUST_NS_QUALIFIER::detail::iterator_facade_category<
THRUST_NS_QUALIFIER::any_system_tag,
THRUST_NS_QUALIFIER::random_access_traversal_tag,
value_type,
reference>::type;
#endif // _CCCL_COMPILER_NVRTC
#endif // _CCCL_COMPILER(NVRTC)

private:
ValueType val;
Expand Down Expand Up @@ -217,13 +217,13 @@ public:
}

/// ostream operator
#ifndef _CCCL_COMPILER_NVRTC
#if !_CCCL_COMPILER(NVRTC)
friend std::ostream& operator<<(std::ostream& os, const self_type& itr)
{
os << "[" << itr.val << "]";
return os;
}
#endif // _CCCL_COMPILER_NVRTC
#endif // !_CCCL_COMPILER(NVRTC)
};

CUB_NAMESPACE_END
4 changes: 2 additions & 2 deletions cub/cub/util_macro.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ _CCCL_DIAG_SUPPRESS_CLANG("-Wattributes")
# if !defined(_CCCL_CUDA_COMPILER_NVHPC)
_CCCL_DIAG_SUPPRESS_NVHPC(attribute_requires_external_linkage)
# endif // !_CCCL_CUDA_COMPILER_NVHPC
# if defined(_CCCL_COMPILER_ICC)
# if _CCCL_COMPILER(ICC)
# pragma nv_diag_suppress 1407 // the "__visibility__" attribute can only appear on functions and
// variables with external linkage'
# pragma warning(disable : 1890) // the "__visibility__" attribute can only appear on functions and
// variables with external linkage'
# endif // _CCCL_COMPILER_ICC
# endif // _CCCL_COMPILER(ICC)
#endif // !CUB_DISABLE_KERNEL_VISIBILITY_WARNING_SUPPRESSION

#ifndef CUB_DEFINE_KERNEL_GETTER
Expand Down
15 changes: 7 additions & 8 deletions cub/cub/util_type.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ _CCCL_DIAG_POP
# endif // _CCCL_CUDACC_AT_LEAST(11, 8)
#endif // _CCCL_HAS_NV_BF16

#ifdef _CCCL_COMPILER_NVRTC
#if _CCCL_COMPILER(NVRTC)
# include <cuda/std/iterator>
#else // !defined(_CCCL_COMPILER_NVRTC)
#else // ^^^ _CCCL_COMPILER(NVRTC) ^^^ // vvv !_CCCL_COMPILER(NVRTC) vvv
# include <iterator>
#endif // defined(_CCCL_COMPILER_NVRTC)
#endif // _CCCL_COMPILER(NVRTC)

CUB_NAMESPACE_BEGIN

Expand All @@ -74,8 +74,7 @@ CUB_NAMESPACE_BEGIN
# endif // !defined(__CUDACC_RTC_INT128__)
# else // !defined(__CUDACC_RTC__)
# if _CCCL_CUDACC_AT_LEAST(11, 5)
# if defined(_CCCL_COMPILER_GCC) || defined(_CCCL_COMPILER_CLANG) || defined(_CCCL_COMPILER_ICC) \
|| _CCCL_COMPILER(NVHPC)
# if defined(_CCCL_COMPILER_GCC) || defined(_CCCL_COMPILER_CLANG) || _CCCL_COMPILER(ICC) || _CCCL_COMPILER(NVHPC)
# define CUB_IS_INT128_ENABLED 1
# endif // GCC || CLANG || ICC || NVHPC
# endif // _CCCL_CUDACC_AT_LEAST(11, 5)
Expand All @@ -94,11 +93,11 @@ namespace detail
// only defer to the libcu++ implementation for NVRTC.
template <typename Iterator>
using value_t =
# ifdef _CCCL_COMPILER_NVRTC
# if _CCCL_COMPILER(NVRTC)
typename ::cuda::std::iterator_traits<Iterator>::value_type;
# else // !defined(_CCCL_COMPILER_NVRTC)
# else // ^^^ _CCCL_COMPILER(NVRTC) ^^^ // vvv !_CCCL_COMPILER(NVRTC) vvv
typename std::iterator_traits<Iterator>::value_type;
# endif // defined(_CCCL_COMPILER_NVRTC)
# endif // !_CCCL_COMPILER(NVRTC)

template <typename It, typename FallbackT, bool = ::cuda::std::is_void<::cuda::std::remove_pointer_t<It>>::value>
struct non_void_value_impl
Expand Down
6 changes: 3 additions & 3 deletions cudax/include/cuda/experimental/__detail/config.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@
// two attributes:
// - `_CUDAX_API` declares the function host/device and hides the symbol from the ABI
// - `_CUDAX_TRIVIAL_API` does the same while also forcing inlining and hiding the function from debuggers
#if defined(_CCCL_COMPILER_ICC) // ICC has issues with visibility attributes on symbols with internal linkage
#if _CCCL_COMPILER(ICC) // ICC has issues with visibility attributes on symbols with internal linkage
# define _CUDAX_API _CCCL_HOST_DEVICE
# define _CUDAX_HOST_API _CCCL_HOST
# define _CUDAX_DEVICE_API _CCCL_DEVICE
#else // ^^^ _CCCL_COMPILER_ICC ^^^ / vvv !_CCCL_COMPILER_ICC vvv
#else // ^^^ _CCCL_COMPILER(ICC) ^^^ / vvv !_CCCL_COMPILER(ICC) vvv
# define _CUDAX_API _CCCL_HOST_DEVICE _CCCL_VISIBILITY_HIDDEN _CCCL_EXCLUDE_FROM_EXPLICIT_INSTANTIATION
# define _CUDAX_HOST_API _CCCL_HOST _CCCL_VISIBILITY_HIDDEN _CCCL_EXCLUDE_FROM_EXPLICIT_INSTANTIATION
# define _CUDAX_DEVICE_API _CCCL_DEVICE _CCCL_VISIBILITY_HIDDEN _CCCL_EXCLUDE_FROM_EXPLICIT_INSTANTIATION
#endif // !_CCCL_COMPILER_ICC
#endif // !_CCCL_COMPILER(ICC)

// _CUDAX_TRIVIAL_API force-inlines a function, marks its visibility as hidden, and causes debuggers to skip it.
// This is useful for trivial internal functions that do dispatching or other plumbing work. It is particularly
Expand Down
6 changes: 3 additions & 3 deletions libcudacxx/include/cuda/__barrier/barrier_block_scope.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@

#include <nv/target>

#if defined(_CCCL_COMPILER_NVRTC)
#if _CCCL_COMPILER(NVRTC)
# define _LIBCUDACXX_OFFSET_IS_ZERO(type, member) !(&(((type*) 0)->member))
#else // ^^^ _CCCL_COMPILER_NVRTC ^^^ / vvv !_CCCL_COMPILER_NVRTC vvv
#else // ^^^ _CCCL_COMPILER(NVRTC) ^^^ / vvv !_CCCL_COMPILER(NVRTC) vvv
# define _LIBCUDACXX_OFFSET_IS_ZERO(type, member) !offsetof(type, member)
#endif // _CCCL_COMPILER_NVRTC
#endif // _CCCL_COMPILER(NVRTC)

_LIBCUDACXX_BEGIN_NAMESPACE_CUDA

Expand Down
4 changes: 2 additions & 2 deletions libcudacxx/include/cuda/std/__atomic/functions/host.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ _LIBCUDACXX_BEGIN_NAMESPACE_STD
_CCCL_DIAG_PUSH
_CCCL_DIAG_SUPPRESS_CLANG("-Watomic-alignment")

#if !defined(_CCCL_COMPILER_NVRTC)
#if !_CCCL_COMPILER(NVRTC)

template <typename _Tp>
struct _CCCL_ALIGNAS(sizeof(_Tp)) __atomic_alignment_wrapper
Expand Down Expand Up @@ -198,7 +198,7 @@ inline remove_cv_t<_Tp> __atomic_fetch_min_host(_Tp* __a, _Td __val, memory_orde
return __expected;
}

#endif // !defined(_CCCL_COMPILER_NVRTC)
#endif // !_CCCL_COMPILER(NVRTC)

_CCCL_DIAG_POP

Expand Down
18 changes: 9 additions & 9 deletions libcudacxx/include/cuda/std/__cccl/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
#include <cuda/std/__cccl/execution_space.h>
#include <cuda/std/__cccl/preprocessor.h>

#if !defined(_CCCL_COMPILER_NVRTC)
#if !_CCCL_COMPILER(NVRTC)
# include <assert.h>
#endif // !_CCCL_COMPILER_NVRTC
#endif // !_CCCL_COMPILER(NVRTC)

#include <nv/target>

Expand Down Expand Up @@ -62,7 +62,7 @@

//! Use the different standard library implementations to implement host side asserts
//! _CCCL_ASSERT_IMPL_HOST should never be used directly
#if defined(_CCCL_COMPILER_NVRTC) // There is no host standard library in nvrtc
#if _CCCL_COMPILER(NVRTC) // There is no host standard library in nvrtc
# define _CCCL_ASSERT_IMPL_HOST(expression, message) ((void) 0)
#elif _CCCL_HAS_INCLUDE(<yvals.h>) && defined(_CCCL_COMPILER_MSVC) // MSVC uses _STL_VERIFY from <yvals.h>
# include <yvals.h>
Expand All @@ -74,25 +74,25 @@ extern "C" {
# if !defined(_CCCL_CUDA_COMPILER_CLANG)
_CCCL_HOST_DEVICE
# endif // !_CCCL_CUDA_COMPILER_CLANG
void
__assert_fail(const char* __assertion, const char* __file, unsigned int __line, const char* __function) noexcept
void
__assert_fail(const char* __assertion, const char* __file, unsigned int __line, const char* __function) noexcept
__attribute__((__noreturn__));
}
# endif // NDEBUG
// ICC cannot deal with `__builtin_expect` in the constexpr evaluator, so just drop it
# if defined(_CCCL_COMPILER_ICC)
# if _CCCL_COMPILER(ICC)
# define _CCCL_ASSERT_IMPL_HOST(expression, message) \
static_cast<bool>(expression) ? (void) 0 : __assert_fail(message, __FILE__, __LINE__, __func__);
# else // ^^^ _CCCL_COMPILER_ICC ^^^ / vvv !_CCCL_COMPILER_ICC vvv
# else // ^^^ _CCCL_COMPILER(ICC) ^^^ / vvv !_CCCL_COMPILER(ICC) vvv
# define _CCCL_ASSERT_IMPL_HOST(expression, message) \
_CCCL_BUILTIN_EXPECT(static_cast<bool>(expression), 1) \
? (void) 0 : __assert_fail(message, __FILE__, __LINE__, __func__)
# endif // !_CCCL_COMPILER_ICC
# endif // !_CCCL_COMPILER(ICC)
#endif // !MSVC STL

//! Use custom implementations with nvcc on device and the host ones with clang-cuda and nvhpc
//! _CCCL_ASSERT_IMPL_DEVICE should never be used directly
#if defined(_CCCL_COMPILER_NVRTC)
#if _CCCL_COMPILER(NVRTC)
# define _CCCL_ASSERT_IMPL_DEVICE(expression, message) \
_CCCL_BUILTIN_EXPECT(static_cast<bool>(expression), 1) \
? (void) 0 : __assertfail(message, __FILE__, __LINE__, __func__, sizeof(char))
Expand Down
2 changes: 1 addition & 1 deletion libcudacxx/include/cuda/std/__cccl/attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
// Use a function like macro to imply that it must be followed by a semicolon
#if _CCCL_STD_VER >= 2017 && _CCCL_HAS_CPP_ATTRIBUTE(fallthrough)
# define _CCCL_FALLTHROUGH() [[fallthrough]]
#elif defined(_CCCL_COMPILER_NVRTC)
#elif _CCCL_COMPILER(NVRTC)
# define _CCCL_FALLTHROUGH() ((void) 0)
#elif _CCCL_HAS_CPP_ATTRIBUTE(clang::fallthrough)
# define _CCCL_FALLTHROUGH() [[clang::fallthrough]]
Expand Down
Loading
Loading