[init] baseline7 from project_6
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___ALGORITHM_CLAMP_H
|
||||
#define _CUDA_STD___ALGORITHM_CLAMP_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__algorithm/comp.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _Tp, class _Compare>
|
||||
[[nodiscard]] _CCCL_API constexpr const _Tp&
|
||||
clamp(const _Tp& __v _CCCL_LIFETIMEBOUND,
|
||||
const _Tp& __lo _CCCL_LIFETIMEBOUND,
|
||||
const _Tp& __hi _CCCL_LIFETIMEBOUND,
|
||||
_Compare __comp)
|
||||
{
|
||||
_CCCL_ASSERT(!__comp(__hi, __lo), "Bad bounds passed to cuda::std::clamp");
|
||||
return __comp(__v, __lo) ? __lo : __comp(__hi, __v) ? __hi : __v;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr const _Tp&
|
||||
clamp(const _Tp& __v _CCCL_LIFETIMEBOUND, const _Tp& __lo _CCCL_LIFETIMEBOUND, const _Tp& __hi _CCCL_LIFETIMEBOUND)
|
||||
{
|
||||
_CCCL_ASSERT(!(__hi < __lo), "Bad bounds passed to cuda::std::clamp");
|
||||
return __v < __lo ? __lo : __hi < __v ? __hi : __v;
|
||||
}
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___ALGORITHM_CLAMP_H
|
||||
@@ -0,0 +1,58 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___ALGORITHM_COMP_H
|
||||
#define _CUDA_STD___ALGORITHM_COMP_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__type_traits/integral_constant.h>
|
||||
#if defined(_LIBCUDACXX_HAS_STRING)
|
||||
# include <cuda/std/__type_traits/predicate_traits.h>
|
||||
#endif // _LIBCUDACXX_HAS_STRING
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
struct __equal_to
|
||||
{
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _T1, class _T2>
|
||||
[[nodiscard]] _CCCL_API constexpr bool operator()(const _T1& __lhs, const _T2& __rhs) const
|
||||
noexcept(noexcept(__lhs == __rhs))
|
||||
{
|
||||
return __lhs == __rhs;
|
||||
}
|
||||
};
|
||||
|
||||
struct __less
|
||||
{
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _Tp, class _Up>
|
||||
[[nodiscard]] _CCCL_API constexpr bool operator()(const _Tp& __lhs, const _Up& __rhs) const
|
||||
noexcept(noexcept(__lhs < __rhs))
|
||||
{
|
||||
return __lhs < __rhs;
|
||||
}
|
||||
};
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___ALGORITHM_COMP_H
|
||||
@@ -0,0 +1,85 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___ALGORITHM_COMP_REF_TYPE_H
|
||||
#define _CUDA_STD___ALGORITHM_COMP_REF_TYPE_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__utility/declval.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
template <class _Compare>
|
||||
struct __debug_less
|
||||
{
|
||||
_Compare& __comp_;
|
||||
_CCCL_API constexpr __debug_less(_Compare& __c)
|
||||
: __comp_(__c)
|
||||
{}
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
[[nodiscard]] _CCCL_API constexpr bool operator()(const _Tp& __x, const _Up& __y)
|
||||
{
|
||||
bool __r = __comp_(__x, __y);
|
||||
if (__r)
|
||||
{
|
||||
__do_compare_assert(0, __y, __x);
|
||||
}
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
[[nodiscard]] _CCCL_API constexpr bool operator()(_Tp& __x, _Up& __y)
|
||||
{
|
||||
bool __r = __comp_(__x, __y);
|
||||
if (__r)
|
||||
{
|
||||
__do_compare_assert(0, __y, __x);
|
||||
}
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _LHS, class _RHS>
|
||||
_CCCL_API constexpr decltype((void) declval<_Compare&>()(declval<_LHS&>(), declval<_RHS&>()))
|
||||
__do_compare_assert(int, [[maybe_unused]] _LHS& __l, [[maybe_unused]] _RHS& __r)
|
||||
{
|
||||
_CCCL_ASSERT(!__comp_(__l, __r), "Comparator does not induce a strict weak ordering");
|
||||
}
|
||||
|
||||
template <class _LHS, class _RHS>
|
||||
_CCCL_API constexpr void __do_compare_assert(long, _LHS&, _RHS&)
|
||||
{}
|
||||
};
|
||||
|
||||
// Pass the comparator by lvalue reference. Or in debug mode, using a
|
||||
// debugging wrapper that stores a reference.
|
||||
#ifdef _CCCL_ENABLE_DEBUG_MODE
|
||||
template <class _Comp>
|
||||
using __comp_ref_type = __debug_less<_Comp>;
|
||||
#else // ^^^ _LIBCUDACXX_ENABLE_DEBUG_MODE ^^^ / vvv !_LIBCUDACXX_ENABLE_DEBUG_MODE vvv
|
||||
template <class _Comp>
|
||||
using __comp_ref_type = _Comp&;
|
||||
#endif // !_LIBCUDACXX_ENABLE_DEBUG_MODE
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___ALGORITHM_COMP_REF_TYPE_H
|
||||
@@ -0,0 +1,132 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___ALGORITHM_EQUAL_H
|
||||
#define _CUDA_STD___ALGORITHM_EQUAL_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__algorithm/comp.h>
|
||||
#include <cuda/std/__iterator/distance.h>
|
||||
#include <cuda/std/__iterator/iterator_traits.h>
|
||||
#include <cuda/std/__type_traits/add_lvalue_reference.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
|
||||
[[nodiscard]] _CCCL_API constexpr bool
|
||||
equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred)
|
||||
{
|
||||
bool __result = true;
|
||||
for (; __first1 != __last1; ++__first1, (void) ++__first2)
|
||||
{
|
||||
if (!__pred(*__first1, *__first2))
|
||||
{
|
||||
__result = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return __result;
|
||||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2>
|
||||
[[nodiscard]] _CCCL_API constexpr bool equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2)
|
||||
{
|
||||
return ::cuda::std::equal(__first1, __last1, __first2, __equal_to{});
|
||||
}
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _BinaryPredicate, class _InputIterator1, class _InputIterator2>
|
||||
[[nodiscard]] _CCCL_API constexpr bool __equal(
|
||||
_InputIterator1 __first1,
|
||||
_InputIterator1 __last1,
|
||||
_InputIterator2 __first2,
|
||||
_InputIterator2 __last2,
|
||||
_BinaryPredicate __pred,
|
||||
input_iterator_tag,
|
||||
input_iterator_tag)
|
||||
{
|
||||
bool __result = true;
|
||||
for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void) ++__first2)
|
||||
{
|
||||
if (!__pred(*__first1, *__first2))
|
||||
{
|
||||
__result = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return __result && __first1 == __last1 && __first2 == __last2;
|
||||
}
|
||||
|
||||
template <class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2>
|
||||
[[nodiscard]] _CCCL_API constexpr bool __equal(
|
||||
_RandomAccessIterator1 __first1,
|
||||
_RandomAccessIterator1 __last1,
|
||||
_RandomAccessIterator2 __first2,
|
||||
_RandomAccessIterator2 __last2,
|
||||
_BinaryPredicate __pred,
|
||||
random_access_iterator_tag,
|
||||
random_access_iterator_tag)
|
||||
{
|
||||
if (__last1 - __first1 != __last2 - __first2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return ::cuda::std::equal<_RandomAccessIterator1, _RandomAccessIterator2, add_lvalue_reference_t<_BinaryPredicate>>(
|
||||
__first1, __last1, __first2, __pred);
|
||||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
|
||||
[[nodiscard]] _CCCL_API constexpr bool
|
||||
equal(_InputIterator1 __first1,
|
||||
_InputIterator1 __last1,
|
||||
_InputIterator2 __first2,
|
||||
_InputIterator2 __last2,
|
||||
_BinaryPredicate __pred)
|
||||
{
|
||||
return ::cuda::std::__equal<add_lvalue_reference_t<_BinaryPredicate>>(
|
||||
__first1,
|
||||
__last1,
|
||||
__first2,
|
||||
__last2,
|
||||
__pred,
|
||||
__iterator_traits_category_or_concept_t<_InputIterator1>(),
|
||||
__iterator_traits_category_or_concept_t<_InputIterator2>());
|
||||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2>
|
||||
[[nodiscard]] _CCCL_API constexpr bool
|
||||
equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2)
|
||||
{
|
||||
return ::cuda::std::__equal(
|
||||
__first1,
|
||||
__last1,
|
||||
__first2,
|
||||
__last2,
|
||||
__equal_to{},
|
||||
__iterator_traits_category_or_concept_t<_InputIterator1>(),
|
||||
__iterator_traits_category_or_concept_t<_InputIterator2>());
|
||||
}
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___ALGORITHM_EQUAL_H
|
||||
@@ -0,0 +1,51 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___ALGORITHM_FILL_N_H
|
||||
#define _CUDA_STD___ALGORITHM_FILL_N_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__iterator/iterator_traits.h>
|
||||
#include <cuda/std/__utility/convert_to_integral.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _OutputIterator, class _Size, class _Tp>
|
||||
_CCCL_API constexpr _OutputIterator __fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_)
|
||||
{
|
||||
for (; __n > 0; ++__first, (void) --__n)
|
||||
{
|
||||
*__first = __value_;
|
||||
}
|
||||
return __first;
|
||||
}
|
||||
|
||||
template <class _OutputIterator, class _Size, class _Tp>
|
||||
_CCCL_API constexpr _OutputIterator fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_)
|
||||
{
|
||||
return ::cuda::std::__fill_n(__first, __convert_to_integral(__n), __value_);
|
||||
}
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___ALGORITHM_FILL_N_H
|
||||
@@ -0,0 +1,85 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___ALGORITHM_ITER_SWAP_H
|
||||
#define _CUDA_STD___ALGORITHM_ITER_SWAP_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__utility/declval.h>
|
||||
#include <cuda/std/__utility/forward.h>
|
||||
#include <cuda/std/__utility/swap.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
//! Intentionally not an algorithm to avoid breaking types that pull in `::std::iter_swap` via ADL
|
||||
_CCCL_BEGIN_NAMESPACE_CPO(__iter_swap)
|
||||
// "Poison pill" overload to intentionally create ambiguity with the unconstrained
|
||||
// `std::iter_swap` function.
|
||||
template <class _ForwardIterator1, class _ForwardIterator2>
|
||||
void iter_swap(_ForwardIterator1, _ForwardIterator2) = delete;
|
||||
|
||||
template <class _ForwardIterator1, class _ForwardIterator2>
|
||||
_CCCL_CONCEPT __unqualified_iter_swap =
|
||||
_CCCL_REQUIRES_EXPR((_ForwardIterator1, _ForwardIterator2), _ForwardIterator1&& __a, _ForwardIterator2&& __b)(
|
||||
iter_swap(::cuda::std::forward<_ForwardIterator1>(__a), ::cuda::std::forward<_ForwardIterator2>(__b)));
|
||||
|
||||
template <class _ForwardIterator1, class _ForwardIterator2>
|
||||
_CCCL_CONCEPT __readable_swappable =
|
||||
_CCCL_REQUIRES_EXPR((_ForwardIterator1, _ForwardIterator2), _ForwardIterator1 __a, _ForwardIterator2 __b)(
|
||||
requires(!__unqualified_iter_swap<_ForwardIterator1, _ForwardIterator2>), swap(*__a, *__b));
|
||||
|
||||
struct __fn
|
||||
{
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
_CCCL_TEMPLATE(class _ForwardIterator1, class _ForwardIterator2)
|
||||
_CCCL_REQUIRES(__unqualified_iter_swap<_ForwardIterator1, _ForwardIterator2>)
|
||||
_CCCL_API constexpr void operator()(_ForwardIterator1&& __a, _ForwardIterator2&& __b) const
|
||||
noexcept(noexcept(iter_swap(::cuda::std::declval<_ForwardIterator1>(), ::cuda::std::declval<_ForwardIterator2>())))
|
||||
{
|
||||
(void) iter_swap(::cuda::std::forward<_ForwardIterator1>(__a), ::cuda::std::forward<_ForwardIterator2>(__b));
|
||||
}
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
_CCCL_TEMPLATE(class _ForwardIterator1, class _ForwardIterator2)
|
||||
_CCCL_REQUIRES(__readable_swappable<_ForwardIterator1, _ForwardIterator2>)
|
||||
_CCCL_API constexpr void operator()(_ForwardIterator1&& __a, _ForwardIterator2&& __b) const
|
||||
noexcept(noexcept(swap(*::cuda::std::declval<_ForwardIterator1>(), *::cuda::std::declval<_ForwardIterator2>())))
|
||||
{
|
||||
swap(*__a, *__b);
|
||||
}
|
||||
};
|
||||
|
||||
_CCCL_END_NAMESPACE_CPO
|
||||
|
||||
inline namespace __cpo
|
||||
{
|
||||
// This is a global constant to avoid breaking types that pull in `::std::iter_swap` via ADL
|
||||
_CCCL_GLOBAL_CONSTANT auto iter_swap = __iter_swap::__fn{};
|
||||
|
||||
// We want to avoid using the CPO internally because of __tile__ access
|
||||
using __iter_swap_cpo = __iter_swap::__fn;
|
||||
} // namespace __cpo
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___ALGORITHM_ITER_SWAP_H
|
||||
@@ -0,0 +1,179 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___ALGORITHM_ITERATOR_OPERATIONS_H
|
||||
#define _CUDA_STD___ALGORITHM_ITERATOR_OPERATIONS_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__algorithm/iter_swap.h>
|
||||
#include <cuda/std/__algorithm/ranges_iterator_concept.h>
|
||||
#include <cuda/std/__iterator/advance.h>
|
||||
#include <cuda/std/__iterator/distance.h>
|
||||
#include <cuda/std/__iterator/incrementable_traits.h>
|
||||
#include <cuda/std/__iterator/iter_move.h>
|
||||
#include <cuda/std/__iterator/iter_swap.h>
|
||||
#include <cuda/std/__iterator/iterator_traits.h>
|
||||
#include <cuda/std/__iterator/next.h>
|
||||
#include <cuda/std/__iterator/prev.h>
|
||||
#include <cuda/std/__iterator/readable_traits.h>
|
||||
#include <cuda/std/__type_traits/enable_if.h>
|
||||
#include <cuda/std/__type_traits/is_reference.h>
|
||||
#include <cuda/std/__type_traits/is_same.h>
|
||||
#include <cuda/std/__type_traits/remove_cvref.h>
|
||||
#include <cuda/std/__utility/declval.h>
|
||||
#include <cuda/std/__utility/forward.h>
|
||||
#include <cuda/std/__utility/move.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
template <class _AlgPolicy>
|
||||
struct _IterOps;
|
||||
|
||||
struct _RangeAlgPolicy
|
||||
{};
|
||||
|
||||
template <>
|
||||
struct _IterOps<_RangeAlgPolicy>
|
||||
{
|
||||
template <class _Iter>
|
||||
using __value_type = iter_value_t<_Iter>;
|
||||
|
||||
template <class _Iter>
|
||||
using __difference_type = iter_difference_t<_Iter>;
|
||||
|
||||
static constexpr auto advance = ::cuda::std::ranges::__advance_cpo{};
|
||||
static constexpr auto distance = ::cuda::std::ranges::__distance_cpo{};
|
||||
static constexpr auto __iter_move = ::cuda::std::ranges::__iter_move_cpo{};
|
||||
static constexpr auto iter_swap = ::cuda::std::ranges::__iter_swap_cpo{};
|
||||
static constexpr auto next = ::cuda::std::ranges::__next_cpo{};
|
||||
static constexpr auto prev = ::cuda::std::ranges::__prev_cpo{};
|
||||
static constexpr auto __advance_to = ::cuda::std::ranges::__advance_cpo{};
|
||||
};
|
||||
|
||||
struct _ClassicAlgPolicy
|
||||
{};
|
||||
|
||||
template <>
|
||||
struct _IterOps<_ClassicAlgPolicy>
|
||||
{
|
||||
template <class _Iter>
|
||||
using __value_type = typename iterator_traits<_Iter>::value_type;
|
||||
|
||||
template <class _Iter>
|
||||
using __difference_type = typename iterator_traits<_Iter>::difference_type;
|
||||
|
||||
// advance
|
||||
template <class _Iter, class _Distance>
|
||||
_CCCL_API constexpr static void advance(_Iter& __iter, _Distance __count)
|
||||
{
|
||||
::cuda::std::advance(__iter, __count);
|
||||
}
|
||||
|
||||
// distance
|
||||
template <class _Iter>
|
||||
_CCCL_API constexpr static typename iterator_traits<_Iter>::difference_type distance(_Iter __first, _Iter __last)
|
||||
{
|
||||
return ::cuda::std::distance(__first, __last);
|
||||
}
|
||||
|
||||
template <class _Iter>
|
||||
using __deref_t = decltype(*::cuda::std::declval<_Iter&>());
|
||||
|
||||
template <class _Iter>
|
||||
using __move_t = decltype(::cuda::std::move(*::cuda::std::declval<_Iter&>()));
|
||||
|
||||
template <class _Iter>
|
||||
_CCCL_API constexpr static void __validate_iter_reference()
|
||||
{
|
||||
static_assert(
|
||||
is_same_v<__deref_t<_Iter>, typename iterator_traits<remove_cvref_t<_Iter>>::reference>,
|
||||
"It looks like your iterator's `iterator_traits<It>::reference` does not match the return type of "
|
||||
"dereferencing the iterator, i.e., calling `*it`. This is undefined behavior according to [input.iterators] "
|
||||
"and can lead to dangling reference issues at runtime, so we are flagging this.");
|
||||
}
|
||||
|
||||
// iter_move
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _Iter, enable_if_t<is_reference_v<__deref_t<_Iter>>, int> = 0>
|
||||
_CCCL_API constexpr static
|
||||
// If the result of dereferencing `_Iter` is a reference type, deduce the result of calling `::cuda::std::move` on
|
||||
// it. Note that the C++03 mode doesn't support `decltype(auto)` as the return type.
|
||||
__move_t<_Iter>
|
||||
__iter_move(_Iter&& __i)
|
||||
{
|
||||
__validate_iter_reference<_Iter>();
|
||||
|
||||
return ::cuda::std::move(*::cuda::std::forward<_Iter>(__i));
|
||||
}
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _Iter, enable_if_t<!is_reference_v<__deref_t<_Iter>>, int> = 0>
|
||||
_CCCL_API constexpr static
|
||||
// If the result of dereferencing `_Iter` is a value type, deduce the return value of this function to also be a
|
||||
// value -- otherwise, after `operator*` returns a temporary, this function would return a dangling reference to
|
||||
// that temporary. Note that the C++03 mode doesn't support `auto` as the return type.
|
||||
__deref_t<_Iter>
|
||||
__iter_move(_Iter&& __i)
|
||||
{
|
||||
__validate_iter_reference<_Iter>();
|
||||
|
||||
return *::cuda::std::forward<_Iter>(__i);
|
||||
}
|
||||
|
||||
// iter_swap
|
||||
template <class _Iter1, class _Iter2>
|
||||
_CCCL_API constexpr static void iter_swap(_Iter1&& __a, _Iter2&& __b)
|
||||
{
|
||||
::cuda::std::__iter_swap_cpo{}(::cuda::std::forward<_Iter1>(__a), ::cuda::std::forward<_Iter2>(__b));
|
||||
}
|
||||
|
||||
// next
|
||||
template <class _Iterator>
|
||||
_CCCL_API static constexpr _Iterator next(_Iterator, _Iterator __last)
|
||||
{
|
||||
return __last;
|
||||
}
|
||||
|
||||
template <class _Iter>
|
||||
_CCCL_API static constexpr remove_cvref_t<_Iter> next(_Iter&& __it, __difference_type<remove_cvref_t<_Iter>> __n = 1)
|
||||
{
|
||||
return ::cuda::std::next(::cuda::std::forward<_Iter>(__it), __n);
|
||||
}
|
||||
|
||||
// prev
|
||||
template <class _Iter>
|
||||
_CCCL_API static constexpr remove_cvref_t<_Iter> prev(_Iter&& __iter, __difference_type<remove_cvref_t<_Iter>> __n = 1)
|
||||
{
|
||||
return ::cuda::std::prev(::cuda::std::forward<_Iter>(__iter), __n);
|
||||
}
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _Iter>
|
||||
_CCCL_API static constexpr void __advance_to(_Iter& __first, _Iter __last)
|
||||
{
|
||||
__first = __last;
|
||||
}
|
||||
};
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___ALGORITHM_ITERATOR_OPERATIONS_H
|
||||
@@ -0,0 +1,70 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___ALGORITHM_LEXICOGRAPHICAL_COMPARE_H
|
||||
#define _CUDA_STD___ALGORITHM_LEXICOGRAPHICAL_COMPARE_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__algorithm/comp.h>
|
||||
#include <cuda/std/__algorithm/comp_ref_type.h>
|
||||
#include <cuda/std/__iterator/iterator_traits.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _Compare, class _InputIterator1, class _InputIterator2>
|
||||
[[nodiscard]] _CCCL_API constexpr bool __lexicographical_compare(
|
||||
_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp)
|
||||
{
|
||||
bool __result = false;
|
||||
for (; __first2 != __last2; ++__first1, (void) ++__first2)
|
||||
{
|
||||
if (__first1 == __last1 || __comp(*__first1, *__first2))
|
||||
{
|
||||
__result = true;
|
||||
break;
|
||||
}
|
||||
if (__comp(*__first2, *__first1))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return __result;
|
||||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2, class _Compare>
|
||||
[[nodiscard]] _CCCL_API constexpr bool lexicographical_compare(
|
||||
_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp)
|
||||
{
|
||||
return __lexicographical_compare<__comp_ref_type<_Compare>>(__first1, __last1, __first2, __last2, __comp);
|
||||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2>
|
||||
[[nodiscard]] _CCCL_API constexpr bool lexicographical_compare(
|
||||
_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2)
|
||||
{
|
||||
return ::cuda::std::lexicographical_compare(__first1, __last1, __first2, __last2, __less{});
|
||||
}
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___ALGORITHM_LEXICOGRAPHICAL_COMPARE_H
|
||||
@@ -0,0 +1,63 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___ALGORITHM_MAX_H
|
||||
#define _CUDA_STD___ALGORITHM_MAX_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__algorithm/comp.h>
|
||||
#include <cuda/std/__algorithm/comp_ref_type.h>
|
||||
#include <cuda/std/__algorithm/max_element.h>
|
||||
#include <cuda/std/initializer_list>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _Tp, class _Compare>
|
||||
[[nodiscard]] _CCCL_API constexpr const _Tp&
|
||||
max(const _Tp& __a _CCCL_LIFETIMEBOUND, const _Tp& __b _CCCL_LIFETIMEBOUND, _Compare __comp)
|
||||
{
|
||||
return __comp(__a, __b) ? __b : __a;
|
||||
}
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr const _Tp& max(const _Tp& __a _CCCL_LIFETIMEBOUND, const _Tp& __b _CCCL_LIFETIMEBOUND)
|
||||
{
|
||||
return __a < __b ? __b : __a;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare>
|
||||
[[nodiscard]] _CCCL_API constexpr _Tp max(initializer_list<_Tp> __t, _Compare __comp)
|
||||
{
|
||||
return *::cuda::std::__max_element<__comp_ref_type<_Compare>>(__t.begin(), __t.end(), __comp);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr _Tp max(initializer_list<_Tp> __t)
|
||||
{
|
||||
return *::cuda::std::max_element(__t.begin(), __t.end(), __less{});
|
||||
}
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___ALGORITHM_MAX_H
|
||||
@@ -0,0 +1,67 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___ALGORITHM_MAX_ELEMENT_H
|
||||
#define _CUDA_STD___ALGORITHM_MAX_ELEMENT_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__algorithm/comp.h>
|
||||
#include <cuda/std/__algorithm/comp_ref_type.h>
|
||||
#include <cuda/std/__iterator/iterator_traits.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _Compare, class _ForwardIterator>
|
||||
_CCCL_API constexpr _ForwardIterator __max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
|
||||
{
|
||||
static_assert(__has_forward_traversal<_ForwardIterator>, "::cuda::std::max_element requires a ForwardIterator");
|
||||
if (__first != __last)
|
||||
{
|
||||
_ForwardIterator __i = __first;
|
||||
while (++__i != __last)
|
||||
{
|
||||
if (__comp(*__first, *__i))
|
||||
{
|
||||
__first = __i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return __first;
|
||||
}
|
||||
|
||||
template <class _ForwardIterator, class _Compare>
|
||||
[[nodiscard]] _CCCL_API constexpr _ForwardIterator
|
||||
max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
|
||||
{
|
||||
return ::cuda::std::__max_element<__comp_ref_type<_Compare>>(__first, __last, __comp);
|
||||
}
|
||||
|
||||
template <class _ForwardIterator>
|
||||
[[nodiscard]] _CCCL_API constexpr _ForwardIterator max_element(_ForwardIterator __first, _ForwardIterator __last)
|
||||
{
|
||||
return ::cuda::std::max_element(__first, __last, __less{});
|
||||
}
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___ALGORITHM_MAX_ELEMENT_H
|
||||
@@ -0,0 +1,63 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___ALGORITHM_MIN_H
|
||||
#define _CUDA_STD___ALGORITHM_MIN_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__algorithm/comp.h>
|
||||
#include <cuda/std/__algorithm/comp_ref_type.h>
|
||||
#include <cuda/std/__algorithm/min_element.h>
|
||||
#include <cuda/std/initializer_list>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _Tp, class _Compare>
|
||||
[[nodiscard]] _CCCL_API constexpr const _Tp&
|
||||
min(const _Tp& __a _CCCL_LIFETIMEBOUND, const _Tp& __b _CCCL_LIFETIMEBOUND, _Compare __comp)
|
||||
{
|
||||
return __comp(__b, __a) ? __b : __a;
|
||||
}
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr const _Tp& min(const _Tp& __a _CCCL_LIFETIMEBOUND, const _Tp& __b _CCCL_LIFETIMEBOUND)
|
||||
{
|
||||
return __b < __a ? __b : __a;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare>
|
||||
[[nodiscard]] _CCCL_API constexpr _Tp min(initializer_list<_Tp> __t, _Compare __comp)
|
||||
{
|
||||
return *::cuda::std::__min_element<__comp_ref_type<_Compare>>(__t.begin(), __t.end(), __comp);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr _Tp min(initializer_list<_Tp> __t)
|
||||
{
|
||||
return *::cuda::std::min_element(__t.begin(), __t.end(), __less{});
|
||||
}
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___ALGORITHM_MIN_H
|
||||
@@ -0,0 +1,87 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___ALGORITHM_MIN_ELEMENT_H
|
||||
#define _CUDA_STD___ALGORITHM_MIN_ELEMENT_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__algorithm/comp.h>
|
||||
#include <cuda/std/__algorithm/comp_ref_type.h>
|
||||
#include <cuda/std/__functional/identity.h>
|
||||
#include <cuda/std/__functional/invoke.h>
|
||||
#include <cuda/std/__iterator/iterator_traits.h>
|
||||
#include <cuda/std/__type_traits/is_callable.h>
|
||||
#include <cuda/std/__utility/move.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _Comp, class _Iter, class _Sent, class _Proj>
|
||||
_CCCL_API constexpr _Iter __min_element(_Iter __first, _Sent __last, _Comp __comp, _Proj& __proj)
|
||||
{
|
||||
if (__first == __last)
|
||||
{
|
||||
return __first;
|
||||
}
|
||||
|
||||
_Iter __i = __first;
|
||||
while (++__i != __last)
|
||||
{
|
||||
if (::cuda::std::invoke(__comp, ::cuda::std::invoke(__proj, *__i), ::cuda::std::invoke(__proj, *__first)))
|
||||
{
|
||||
__first = __i;
|
||||
}
|
||||
}
|
||||
|
||||
return __first;
|
||||
}
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _Comp, class _Iter, class _Sent>
|
||||
_CCCL_API constexpr _Iter __min_element(_Iter __first, _Sent __last, _Comp __comp)
|
||||
{
|
||||
auto __proj = identity();
|
||||
return ::cuda::std::__min_element<_Comp>(::cuda::std::move(__first), ::cuda::std::move(__last), __comp, __proj);
|
||||
}
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _ForwardIterator, class _Compare>
|
||||
[[nodiscard]] _CCCL_API constexpr _ForwardIterator
|
||||
min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
|
||||
{
|
||||
static_assert(__has_forward_traversal<_ForwardIterator>, "std::min_element requires a ForwardIterator");
|
||||
static_assert(__is_callable<_Compare, decltype(*__first), decltype(*__first)>::value,
|
||||
"The comparator has to be callable");
|
||||
|
||||
return ::cuda::std::__min_element<__comp_ref_type<_Compare>>(
|
||||
::cuda::std::move(__first), ::cuda::std::move(__last), __comp);
|
||||
}
|
||||
|
||||
template <class _ForwardIterator>
|
||||
[[nodiscard]] _CCCL_API constexpr _ForwardIterator min_element(_ForwardIterator __first, _ForwardIterator __last)
|
||||
{
|
||||
return ::cuda::std::min_element(__first, __last, __less{});
|
||||
}
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___ALGORITHM_MIN_ELEMENT_H
|
||||
@@ -0,0 +1,65 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___ALGORITHM_RANGES_ITERATOR_CONCEPT_H
|
||||
#define _CUDA_STD___ALGORITHM_RANGES_ITERATOR_CONCEPT_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__iterator/concepts.h>
|
||||
#include <cuda/std/__iterator/iterator_traits.h>
|
||||
#include <cuda/std/__type_traits/remove_cvref.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD_RANGES
|
||||
|
||||
template <class _IterMaybeQualified>
|
||||
_CCCL_API constexpr auto __get_iterator_concept()
|
||||
{
|
||||
using _Iter = remove_cvref_t<_IterMaybeQualified>;
|
||||
|
||||
if constexpr (contiguous_iterator<_Iter>)
|
||||
{
|
||||
return contiguous_iterator_tag();
|
||||
}
|
||||
else if constexpr (random_access_iterator<_Iter>)
|
||||
{
|
||||
return random_access_iterator_tag();
|
||||
}
|
||||
else if constexpr (bidirectional_iterator<_Iter>)
|
||||
{
|
||||
return bidirectional_iterator_tag();
|
||||
}
|
||||
else if constexpr (forward_iterator<_Iter>)
|
||||
{
|
||||
return forward_iterator_tag();
|
||||
}
|
||||
else if constexpr (input_iterator<_Iter>)
|
||||
{
|
||||
return input_iterator_tag();
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Iter>
|
||||
using __iterator_concept = decltype(__get_iterator_concept<_Iter>());
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD_RANGES
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___ALGORITHM_RANGES_ITERATOR_CONCEPT_H
|
||||
@@ -0,0 +1,78 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___ALGORITHM_SWAP_RANGES_H
|
||||
#define _CUDA_STD___ALGORITHM_SWAP_RANGES_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__algorithm/iterator_operations.h>
|
||||
#include <cuda/std/__utility/move.h>
|
||||
#include <cuda/std/__utility/pair.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
// 2+2 iterators: the shorter size will be used.
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _AlgPolicy, class _ForwardIterator1, class _Sentinel1, class _ForwardIterator2, class _Sentinel2>
|
||||
_CCCL_API constexpr pair<_ForwardIterator1, _ForwardIterator2>
|
||||
__swap_ranges(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2 __first2, _Sentinel2 __last2)
|
||||
{
|
||||
while (__first1 != __last1 && __first2 != __last2)
|
||||
{
|
||||
_IterOps<_AlgPolicy>::iter_swap(__first1, __first2);
|
||||
++__first1;
|
||||
++__first2;
|
||||
}
|
||||
|
||||
return pair<_ForwardIterator1, _ForwardIterator2>(::cuda::std::move(__first1), ::cuda::std::move(__first2));
|
||||
}
|
||||
|
||||
// 2+1 iterators: size2 >= size1.
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _AlgPolicy, class _ForwardIterator1, class _Sentinel1, class _ForwardIterator2>
|
||||
_CCCL_API constexpr pair<_ForwardIterator1, _ForwardIterator2>
|
||||
__swap_ranges(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2 __first2)
|
||||
{
|
||||
while (__first1 != __last1)
|
||||
{
|
||||
_IterOps<_AlgPolicy>::iter_swap(__first1, __first2);
|
||||
++__first1;
|
||||
++__first2;
|
||||
}
|
||||
|
||||
return pair<_ForwardIterator1, _ForwardIterator2>(::cuda::std::move(__first1), ::cuda::std::move(__first2));
|
||||
}
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _ForwardIterator1, class _ForwardIterator2>
|
||||
_CCCL_API constexpr _ForwardIterator2
|
||||
swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2)
|
||||
{
|
||||
return ::cuda::std::__swap_ranges<_ClassicAlgPolicy>(
|
||||
::cuda::std::move(__first1), ::cuda::std::move(__last1), ::cuda::std::move(__first2))
|
||||
.second;
|
||||
}
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___ALGORITHM_SWAP_RANGES_H
|
||||
@@ -0,0 +1,95 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___ALGORITHM_UNWRAP_ITER_H
|
||||
#define _CUDA_STD___ALGORITHM_UNWRAP_ITER_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__iterator/iterator_traits.h>
|
||||
#include <cuda/std/__memory/pointer_traits.h>
|
||||
#include <cuda/std/__type_traits/enable_if.h>
|
||||
#include <cuda/std/__type_traits/is_copy_constructible.h>
|
||||
#include <cuda/std/__utility/declval.h>
|
||||
#include <cuda/std/__utility/move.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
// TODO: Change the name of __unwrap_iter_impl to something more appropriate
|
||||
// The job of __unwrap_iter is to remove iterator wrappers (like reverse_iterator or __wrap_iter),
|
||||
// to reduce the number of template instantiations and to enable pointer-based optimizations e.g. in ::cuda::std::copy.
|
||||
// In debug mode, we don't do this.
|
||||
//
|
||||
// Some algorithms (e.g. ::cuda::std::copy, but not ::cuda::std::sort) need to convert an
|
||||
// "unwrapped" result back into the original iterator type. Doing that is the job of __rewrap_iter.
|
||||
|
||||
// Default case - we can't unwrap anything
|
||||
template <class _Iter, bool = __has_contiguous_traversal<_Iter>>
|
||||
struct __unwrap_iter_impl
|
||||
{
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
static _CCCL_API constexpr _Iter __rewrap(_Iter, _Iter __iter)
|
||||
{
|
||||
return __iter;
|
||||
}
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
static _CCCL_API constexpr _Iter __unwrap(_Iter __i) noexcept
|
||||
{
|
||||
return __i;
|
||||
}
|
||||
};
|
||||
|
||||
// It's a contiguous iterator, so we can use a raw pointer instead
|
||||
template <class _Iter>
|
||||
struct __unwrap_iter_impl<_Iter, true>
|
||||
{
|
||||
using _ToAddressT = decltype(::cuda::std::__to_address(::cuda::std::declval<_Iter>()));
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
static _CCCL_API constexpr _Iter __rewrap(_Iter __orig_iter, _ToAddressT __unwrapped_iter)
|
||||
{
|
||||
return __orig_iter + (__unwrapped_iter - ::cuda::std::__to_address(__orig_iter));
|
||||
}
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
static _CCCL_API constexpr _ToAddressT __unwrap(_Iter __i) noexcept
|
||||
{
|
||||
return ::cuda::std::__to_address(__i);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Iter, class _Impl = __unwrap_iter_impl<_Iter>, enable_if_t<is_copy_constructible_v<_Iter>, int> = 0>
|
||||
_CCCL_API constexpr decltype(_Impl::__unwrap(::cuda::std::declval<_Iter>())) __unwrap_iter(_Iter __i) noexcept
|
||||
{
|
||||
return _Impl::__unwrap(__i);
|
||||
}
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _OrigIter, class _Iter, class _Impl = __unwrap_iter_impl<_OrigIter>>
|
||||
_CCCL_API constexpr _OrigIter __rewrap_iter(_OrigIter __orig_iter, _Iter __iter) noexcept
|
||||
{
|
||||
return _Impl::__rewrap(::cuda::std::move(__orig_iter), ::cuda::std::move(__iter));
|
||||
}
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___ALGORITHM_UNWRAP_ITER_H
|
||||
@@ -0,0 +1,86 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024-26 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___BIT_BIT_CAST_H
|
||||
#define _CUDA_STD___BIT_BIT_CAST_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/__type_traits/is_trivially_copyable.h>
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__cstring/memcpy.h>
|
||||
#include <cuda/std/__type_traits/is_default_constructible.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
// MSVC supports __builtin_bit_cast from 19.25 on
|
||||
#if _CCCL_CHECK_BUILTIN(builtin_bit_cast) || _CCCL_COMPILER(MSVC, >, 19, 25)
|
||||
# define _CCCL_BUILTIN_BIT_CAST(...) __builtin_bit_cast(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(builtin_bit_cast)
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
#if defined(_CCCL_BUILTIN_BIT_CAST)
|
||||
# define _CCCL_CONSTEXPR_BIT_CAST constexpr
|
||||
# define _CCCL_HAS_CONSTEXPR_BIT_CAST() 1
|
||||
#else // ^^^ _CCCL_BUILTIN_BIT_CAST ^^^ / vvv !_CCCL_BUILTIN_BIT_CAST vvv
|
||||
# define _CCCL_CONSTEXPR_BIT_CAST
|
||||
# define _CCCL_HAS_CONSTEXPR_BIT_CAST() 0
|
||||
#endif // !_CCCL_BUILTIN_BIT_CAST
|
||||
|
||||
#if _CCCL_COMPILER(GCC, >=, 8)
|
||||
_CCCL_DIAG_PUSH
|
||||
_CCCL_DIAG_SUPPRESS_GCC("-Wclass-memaccess")
|
||||
#endif // _CCCL_COMPILER(GCC, >=, 8)
|
||||
|
||||
template <class _To, class _From>
|
||||
[[nodiscard]] _CCCL_API inline _To __bit_cast_memcpy(const _From& __from) noexcept
|
||||
{
|
||||
static_assert(::cuda::std::is_default_constructible_v<_To>,
|
||||
"bit_cast memcpy fallback requires the destination type to be default constructible");
|
||||
_To __temp;
|
||||
::cuda::std::memcpy(&__temp, &__from, sizeof(_To));
|
||||
return __temp;
|
||||
}
|
||||
|
||||
#if _CCCL_COMPILER(GCC, >=, 8)
|
||||
_CCCL_DIAG_POP
|
||||
#endif // _CCCL_COMPILER(GCC, >=, 8)
|
||||
|
||||
_CCCL_TEMPLATE(class _To, class _From)
|
||||
_CCCL_REQUIRES((sizeof(_To) == sizeof(_From)) _CCCL_AND(::cuda::is_trivially_copyable_v<_To>)
|
||||
_CCCL_AND(::cuda::is_trivially_copyable_v<_From>))
|
||||
[[nodiscard]] _CCCL_API inline _CCCL_CONSTEXPR_BIT_CAST _To bit_cast(const _From& __from) noexcept
|
||||
{
|
||||
#if defined(_CCCL_BUILTIN_BIT_CAST)
|
||||
if constexpr (::cuda::std::is_trivially_copyable_v<_To> && ::cuda::std::is_trivially_copyable_v<_From>)
|
||||
{
|
||||
return _CCCL_BUILTIN_BIT_CAST(_To, __from);
|
||||
}
|
||||
else
|
||||
#endif // _CCCL_BUILTIN_BIT_CAST
|
||||
{
|
||||
return ::cuda::std::__bit_cast_memcpy<_To>(__from);
|
||||
}
|
||||
}
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___BIT_BIT_CAST_H
|
||||
@@ -0,0 +1,128 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CCCL_ARCH_H
|
||||
#define __CCCL_ARCH_H
|
||||
|
||||
#include <cuda/std/__cccl/compiler.h>
|
||||
#include <cuda/std/__cccl/preprocessor.h>
|
||||
|
||||
// The header provides the following macros to determine the host architecture:
|
||||
//
|
||||
// _CCCL_HOST_ARCH(ARM64) ARM64
|
||||
// _CCCL_HOST_ARCH(X86_64) X86 64 bit
|
||||
// CCCL_HOST_ARCH(ARM64) ARM64
|
||||
// CCCL_HOST_ARCH(X86_64) X86 64 bit
|
||||
|
||||
// Determine the host architecture
|
||||
|
||||
// Arm 64-bit
|
||||
#if (defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC) /*emulation*/)
|
||||
# define _CCCL_HOST_ARCH_ARM64_() 1
|
||||
#else
|
||||
# define _CCCL_HOST_ARCH_ARM64_() 0
|
||||
#endif
|
||||
|
||||
// X86 64-bit
|
||||
|
||||
// _M_X64 is defined even if we are compiling in Arm64 emulation mode
|
||||
#if (defined(_M_X64) && !defined(_M_ARM64EC)) || defined(__amd64__) || defined(__x86_64__)
|
||||
# define _CCCL_HOST_ARCH_X86_64_() 1
|
||||
#else
|
||||
# define _CCCL_HOST_ARCH_X86_64_() 0
|
||||
#endif
|
||||
|
||||
#define _CCCL_HOST_ARCH(...) _CCCL_HOST_ARCH_##__VA_ARGS__##_()
|
||||
|
||||
//! @def CCCL_HOST_ARCH(ARCH) /* implementation defined */
|
||||
//!
|
||||
//! @brief Detect the current host architecture.
|
||||
//!
|
||||
//! @param ARCH The name of the host architecture to test.
|
||||
//!
|
||||
//! @note This macro is made available when including any libcu++ header. Users that wish to
|
||||
//! include the smallest possible header for this macro should include `<cuda/std/version>`.
|
||||
//!
|
||||
//! For supported host architectures, the macro expands to an implementation-defined true value
|
||||
//! if the current host architecture matches, or false otherwise. These values may be used in
|
||||
//! boolean expressions (preprocessor or otherwise), but no other guarantees are made.
|
||||
//!
|
||||
//! Available values for `ARCH` include:
|
||||
//!
|
||||
//! - ``ARM64``: ARM 64-bit, including MSVC ARM64EC emulation.
|
||||
//! - ``X86_64``: X86 64-bit. This is false when compiling in MSVC ARM64EC emulation mode.
|
||||
//!
|
||||
//! Passing any other value will result in an undefined expansion, which may or may not be
|
||||
//! diagnosed by the compiler.
|
||||
//!
|
||||
//! @par Example
|
||||
//! @code
|
||||
//! #define MY_OTHER_MACRO 1
|
||||
//!
|
||||
//! // Expansion value can be used in ordinary macro conditionals
|
||||
//! #if CCCL_HOST_ARCH(X86_64) && MY_OTHER_MACRO
|
||||
//! // ...
|
||||
//! #endif
|
||||
//!
|
||||
//! // Can be negated as usual
|
||||
//! #if !CCCL_HOST_ARCH(ARM64)
|
||||
//! // ...
|
||||
//! #endif
|
||||
//! @endcode
|
||||
//!
|
||||
//! @return true if the specified host architecture is being compiled for, false otherwise.
|
||||
#ifdef _CCCL_DOXYGEN_INVOKED
|
||||
# define CCCL_HOST_ARCH(ARCH) /* implementation defined */
|
||||
#else
|
||||
# define CCCL_HOST_ARCH(__arch__) _CCCL_HOST_ARCH_##__arch__##_()
|
||||
#endif
|
||||
|
||||
// Note: the public API is single-arg to constrain the API and allow for future expansion. The
|
||||
// implementation is duplicated to guard against the architecture targets being accidentally
|
||||
// defined by the user.
|
||||
|
||||
// Determine the endianness
|
||||
|
||||
#define _CCCL_ENDIAN_LITTLE() 0xDEAD
|
||||
#define _CCCL_ENDIAN_BIG() 0xFACE
|
||||
#define _CCCL_ENDIAN_PDP() 0xBEEF
|
||||
|
||||
#if _CCCL_COMPILER(NVRTC) || (_CCCL_COMPILER(MSVC) && (_CCCL_HOST_ARCH(X86_64) || _CCCL_HOST_ARCH(ARM64))) \
|
||||
|| __LITTLE_ENDIAN__
|
||||
# define _CCCL_ENDIAN_NATIVE() _CCCL_ENDIAN_LITTLE()
|
||||
#elif __BIG_ENDIAN__
|
||||
# define _CCCL_ENDIAN_NATIVE() _CCCL_ENDIAN_BIG()
|
||||
#elif defined(__BYTE_ORDER__)
|
||||
# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define _CCCL_ENDIAN_NATIVE() _CCCL_ENDIAN_LITTLE()
|
||||
# elif __BYTE_ORDER__ == __ORDER_PDP_ENDIAN__
|
||||
# define _CCCL_ENDIAN_NATIVE() _CCCL_ENDIAN_PDP()
|
||||
# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define _CCCL_ENDIAN_NATIVE() _CCCL_ENDIAN_BIG()
|
||||
# endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
#elif __has_include(<endian.h>)
|
||||
# include <endian.h>
|
||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
# define _CCCL_ENDIAN_NATIVE() _CCCL_ENDIAN_LITTLE()
|
||||
# elif __BYTE_ORDER == __PDP_ENDIAN
|
||||
# define _CCCL_ENDIAN_NATIVE() _CCCL_ENDIAN_PDP()
|
||||
# elif __BYTE_ORDER == __BIG_ENDIAN
|
||||
# define _CCCL_ENDIAN_NATIVE() _CCCL_ENDIAN_BIG()
|
||||
# endif // __BYTE_ORDER == __BIG_ENDIAN
|
||||
#endif // ^^^ has endian.h ^^^
|
||||
|
||||
#if !defined(_CCCL_ENDIAN_NATIVE)
|
||||
_CCCL_WARNING("failed to determine the endianness of the host architecture, defaulting to little-endian")
|
||||
# define _CCCL_ENDIAN_NATIVE() _CCCL_ENDIAN_LITTLE()
|
||||
#endif // !_CCCL_ENDIAN_NATIVE
|
||||
|
||||
#define _CCCL_ENDIAN(_NAME) (_CCCL_ENDIAN_NATIVE() == _CCCL_ENDIAN_##_NAME())
|
||||
|
||||
#endif // __CCCL_ARCH_H
|
||||
169
qwen3_6_scripts/cccl_preload/include/cuda/std/__cccl/assert.h
Normal file
169
qwen3_6_scripts/cccl_preload/include/cuda/std/__cccl/assert.h
Normal file
@@ -0,0 +1,169 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CCCL_ASSERT_H
|
||||
#define __CCCL_ASSERT_H
|
||||
|
||||
#include <cuda/std/__cccl/compiler.h>
|
||||
#include <cuda/std/__cccl/system_header.h>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__cccl/attributes.h>
|
||||
#include <cuda/std/__cccl/builtin.h>
|
||||
#include <cuda/std/__cccl/execution_space.h>
|
||||
#include <cuda/std/__cccl/preprocessor.h>
|
||||
|
||||
#if _CCCL_HOSTED()
|
||||
# include <assert.h>
|
||||
#endif // _CCCL_HOSTED()
|
||||
|
||||
#include <nv/target>
|
||||
|
||||
#if defined(_DEBUG) || defined(DEBUG)
|
||||
# ifndef _CCCL_ENABLE_DEBUG_MODE
|
||||
# define _CCCL_ENABLE_DEBUG_MODE
|
||||
# endif // !_CCCL_ENABLE_DEBUG_MODE
|
||||
#endif // _DEBUG || DEBUG
|
||||
|
||||
// Automatically enable assertions when debug mode is enabled
|
||||
#ifdef _CCCL_ENABLE_DEBUG_MODE
|
||||
# ifndef CCCL_ENABLE_ASSERTIONS
|
||||
# define CCCL_ENABLE_ASSERTIONS
|
||||
# endif // !CCCL_ENABLE_ASSERTIONS
|
||||
#endif // _CCCL_ENABLE_DEBUG_MODE
|
||||
|
||||
//! Ensure that we switch on host assertions when all assertions are enabled
|
||||
#ifndef CCCL_ENABLE_HOST_ASSERTIONS
|
||||
# ifdef CCCL_ENABLE_ASSERTIONS
|
||||
# define CCCL_ENABLE_HOST_ASSERTIONS
|
||||
# endif // CCCL_ENABLE_ASSERTIONS
|
||||
#endif // !CCCL_ENABLE_HOST_ASSERTIONS
|
||||
|
||||
//! Ensure that we switch on device assertions when all assertions are enabled
|
||||
#ifndef CCCL_ENABLE_DEVICE_ASSERTIONS
|
||||
# if defined(CCCL_ENABLE_ASSERTIONS) || defined(__CUDACC_DEBUG__)
|
||||
# define CCCL_ENABLE_DEVICE_ASSERTIONS
|
||||
# endif // CCCL_ENABLE_ASSERTIONS
|
||||
#endif // !CCCL_ENABLE_DEVICE_ASSERTIONS
|
||||
|
||||
//! Use the different standard library implementations to implement host side asserts
|
||||
//! _CCCL_ASSERT_IMPL_HOST should never be used directly
|
||||
#if _CCCL_OS(QNX)
|
||||
# define _CCCL_ASSERT_IMPL_HOST(expression, message) ((void) 0)
|
||||
#elif _CCCL_COMPILER(NVRTC) // There is no host standard library in nvrtc
|
||||
# define _CCCL_ASSERT_IMPL_HOST(expression, message) ((void) 0)
|
||||
#elif __has_include(<yvals.h>) && _CCCL_OS(WINDOWS) // Windows uses _STL_VERIFY from <yvals.h>
|
||||
# include <yvals.h>
|
||||
# define _CCCL_ASSERT_IMPL_HOST(expression, message) _STL_VERIFY(expression, message)
|
||||
#else // ^^^ MSVC STL ^^^ / vvv !MSVC STL vvv
|
||||
# ifdef NDEBUG
|
||||
// Reintroduce the __assert_fail / __assert_rtn declaration
|
||||
extern "C" {
|
||||
# if !_CCCL_CUDA_COMPILER(CLANG)
|
||||
_CCCL_HOST_DEVICE
|
||||
# endif // !_CCCL_CUDA_COMPILER(CLANG)
|
||||
# if _CCCL_OS(APPLE)
|
||||
void __assert_rtn(const char* __function, const char* __assertion, const char* __file, unsigned int __line) noexcept
|
||||
__attribute__((__noreturn__));
|
||||
# else // ^^^ _CCCL_OS(APPLE) ^^^ / vvv !_CCCL_OS(APPLE) ^^^
|
||||
void __assert_fail(const char* __assertion, const char* __file, unsigned int __line, const char* __function) noexcept
|
||||
__attribute__((__noreturn__));
|
||||
# endif // !_CCCL_OS(APPLE)
|
||||
}
|
||||
# endif // NDEBUG
|
||||
|
||||
# if _CCCL_OS(APPLE)
|
||||
# define _CCCL_ASSERT_IMPL_HOST(expression, message) \
|
||||
_CCCL_BUILTIN_EXPECT(static_cast<bool>(expression), 1) \
|
||||
? (void) 0 : __assert_rtn(__func__, __FILE__, __LINE__, message)
|
||||
# elif _CCCL_OS(ANDROID)
|
||||
# define _CCCL_ASSERT_IMPL_HOST(expression, message) \
|
||||
_CCCL_BUILTIN_EXPECT(static_cast<bool>(expression), 1) \
|
||||
? (void) 0 : __assert2(__FILE__, __LINE__, __func__, message)
|
||||
# else // ^^^ _CCCL_OS(APPLE) ^^^ / vvv !_CCCL_OS(APPLE) ^^^
|
||||
# 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_OS(APPLE)
|
||||
#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 _CCCL_OS(QNX) || _CCCL_OS(APPLE)
|
||||
# define _CCCL_ASSERT_IMPL_DEVICE(expression, message) ((void) 0)
|
||||
#elif _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))
|
||||
#elif _CCCL_CUDA_COMPILER(NVCC) //! Use __assert_fail to implement device side asserts
|
||||
# if _CCCL_COMPILER(MSVC)
|
||||
# define _CCCL_ASSERT_IMPL_DEVICE(expression, message) \
|
||||
_CCCL_BUILTIN_EXPECT(static_cast<bool>(expression), 1) \
|
||||
? (void) 0 : _wassert(_CRT_WIDE(#message), __FILEW__, __LINE__)
|
||||
# elif _CCCL_OS(ANDROID)
|
||||
# define _CCCL_ASSERT_IMPL_DEVICE(expression, message) \
|
||||
_CCCL_BUILTIN_EXPECT(static_cast<bool>(expression), 1) \
|
||||
? (void) 0 : __assert2(__FILE__, __LINE__, __func__, message)
|
||||
# else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC) vvv
|
||||
# define _CCCL_ASSERT_IMPL_DEVICE(expression, message) \
|
||||
_CCCL_BUILTIN_EXPECT(static_cast<bool>(expression), 1) \
|
||||
? (void) 0 : __assert_fail(message, __FILE__, __LINE__, __func__)
|
||||
# endif // !_CCCL_COMPILER(MSVC)
|
||||
#elif _CCCL_CUDA_COMPILATION()
|
||||
# define _CCCL_ASSERT_IMPL_DEVICE(expression, message) _CCCL_ASSERT_IMPL_HOST(expression, message)
|
||||
#else // ^^^ _CCCL_CUDA_COMPILATION() ^^^ / vvv !_CCCL_CUDA_COMPILATION() vvv
|
||||
# define _CCCL_ASSERT_IMPL_DEVICE(expression, message) ((void) 0)
|
||||
#endif // !_CCCL_CUDA_COMPILATION()
|
||||
|
||||
//! _CCCL_ASSERT_HOST is enabled conditionally depending on CCCL_ENABLE_HOST_ASSERTIONS
|
||||
#ifdef CCCL_ENABLE_HOST_ASSERTIONS
|
||||
# define _CCCL_ASSERT_HOST(expression, message) _CCCL_ASSERT_IMPL_HOST(expression, message)
|
||||
#else // ^^^ CCCL_ENABLE_HOST_ASSERTIONS ^^^ / vvv !CCCL_ENABLE_HOST_ASSERTIONS vvv
|
||||
# define _CCCL_ASSERT_HOST(expression, message) ((void) 0)
|
||||
#endif // !CCCL_ENABLE_HOST_ASSERTIONS
|
||||
|
||||
//! _CCCL_ASSERT_DEVICE is enabled conditionally depending on CCCL_ENABLE_DEVICE_ASSERTIONS
|
||||
#ifdef CCCL_ENABLE_DEVICE_ASSERTIONS
|
||||
# define _CCCL_ASSERT_DEVICE(expression, message) _CCCL_ASSERT_IMPL_DEVICE(expression, message)
|
||||
#else // ^^^ CCCL_ENABLE_DEVICE_ASSERTIONS ^^^ / vvv !CCCL_ENABLE_DEVICE_ASSERTIONS vvv
|
||||
# define _CCCL_ASSERT_DEVICE(expression, message) ((void) 0)
|
||||
#endif // !CCCL_ENABLE_DEVICE_ASSERTIONS
|
||||
|
||||
//! _CCCL_VERIFY is enabled unconditionally and reserved for critical checks that are required to always be on
|
||||
//! _CCCL_ASSERT is enabled conditionally depending on CCCL_ENABLE_HOST_ASSERTIONS and CCCL_ENABLE_DEVICE_ASSERTIONS
|
||||
#if _CCCL_CUDA_COMPILER(NVHPC) // NVHPC can't have different behavior for host and device.
|
||||
// The host version of the assert will also work in device code.
|
||||
# define _CCCL_VERIFY(expression, message) _CCCL_ASSERT_IMPL_HOST(expression, message)
|
||||
# if defined(CCCL_ENABLE_HOST_ASSERTIONS) || defined(CCCL_ENABLE_DEVICE_ASSERTIONS)
|
||||
# define _CCCL_ASSERT(expression, message) _CCCL_ASSERT_HOST(expression, message)
|
||||
# else
|
||||
# define _CCCL_ASSERT(expression, message) ((void) 0)
|
||||
# endif
|
||||
#elif _CCCL_CUDA_COMPILATION()
|
||||
# if _CCCL_DEVICE_COMPILATION()
|
||||
# define _CCCL_VERIFY(expression, message) _CCCL_ASSERT_IMPL_DEVICE(expression, message)
|
||||
# define _CCCL_ASSERT(expression, message) _CCCL_ASSERT_DEVICE(expression, message)
|
||||
# else // ^^^ _CCCL_DEVICE_COMPILATION() ^^^ / vvv !_CCCL_DEVICE_COMPILATION() vvv
|
||||
# define _CCCL_VERIFY(expression, message) _CCCL_ASSERT_IMPL_HOST(expression, message)
|
||||
# define _CCCL_ASSERT(expression, message) _CCCL_ASSERT_HOST(expression, message)
|
||||
# endif // !_CCCL_DEVICE_COMPILATION()
|
||||
#else // ^^^ _CCCL_CUDA_COMPILATION() ^^^ / vvv !_CCCL_CUDA_COMPILATION() vvv
|
||||
# define _CCCL_VERIFY(expression, message) _CCCL_ASSERT_IMPL_HOST(expression, message)
|
||||
# define _CCCL_ASSERT(expression, message) _CCCL_ASSERT_HOST(expression, message)
|
||||
#endif // !_CCCL_CUDA_COMPILATION()
|
||||
|
||||
#endif // __CCCL_ASSERT_H
|
||||
@@ -0,0 +1,221 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CCCL_ATTRIBUTES_H
|
||||
#define __CCCL_ATTRIBUTES_H
|
||||
|
||||
#include <cuda/std/__cccl/compiler.h>
|
||||
#include <cuda/std/__cccl/system_header.h>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__cccl/diagnostic.h>
|
||||
#include <cuda/std/__cccl/dialect.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
#ifdef __has_attribute
|
||||
# define _CCCL_HAS_ATTRIBUTE(__x) __has_attribute(__x)
|
||||
#else // ^^^ __has_attribute ^^^ / vvv !__has_attribute vvv
|
||||
# define _CCCL_HAS_ATTRIBUTE(__x) 0
|
||||
#endif // !__has_attribute
|
||||
|
||||
#ifdef __has_cpp_attribute
|
||||
# define _CCCL_HAS_CPP_ATTRIBUTE(__x) __has_cpp_attribute(__x)
|
||||
#else // ^^^ __has_cpp_attribute ^^^ / vvv !__has_cpp_attribute vvv
|
||||
# define _CCCL_HAS_CPP_ATTRIBUTE(__x) 0
|
||||
#endif // !__has_cpp_attribute
|
||||
|
||||
#ifdef __has_declspec_attribute
|
||||
# define _CCCL_HAS_DECLSPEC_ATTRIBUTE(__x) __has_declspec_attribute(__x)
|
||||
#else // ^^^ __has_declspec_attribute ^^^ / vvv !__has_declspec_attribute vvv
|
||||
# define _CCCL_HAS_DECLSPEC_ATTRIBUTE(__x) 0
|
||||
#endif // !__has_declspec_attribute
|
||||
|
||||
// MSVC needs extra help with empty base classes
|
||||
#if _CCCL_COMPILER(MSVC) || _CCCL_HAS_DECLSPEC_ATTRIBUTE(empty_bases)
|
||||
# define _CCCL_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
|
||||
#else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC) vvv
|
||||
# define _CCCL_DECLSPEC_EMPTY_BASES
|
||||
#endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
#if _CCCL_HAS_ATTRIBUTE(__nodebug__)
|
||||
# define _CCCL_NODEBUG __attribute__((__nodebug__))
|
||||
#else // ^^^ _CCCL_HAS_ATTRIBUTE(__nodebug__) ^^^ / vvv !_CCCL_HAS_ATTRIBUTE(__nodebug__) vvv
|
||||
# define _CCCL_NODEBUG
|
||||
#endif // !_CCCL_HAS_ATTRIBUTE(__nodebug__)
|
||||
|
||||
// Debuggers do not step into functions marked with __attribute__((__artificial__)). This
|
||||
// is useful for small wrapper functions that just dispatch to other functions and that
|
||||
// are inlined into the caller.
|
||||
#if _CCCL_HAS_ATTRIBUTE(__artificial__) && !_CCCL_CUDA_COMPILER(NVCC)
|
||||
# define _CCCL_ARTIFICIAL __attribute__((__artificial__))
|
||||
#else // ^^^ _CCCL_HAS_ATTRIBUTE(__artificial__) ^^^ / vvv !_CCCL_HAS_ATTRIBUTE(__artificial__) vvv
|
||||
# define _CCCL_ARTIFICIAL
|
||||
#endif // !_CCCL_HAS_ATTRIBUTE(__artificial__)
|
||||
|
||||
// The nodebug attribute flattens aliases down to the actual type rather typename meow<T>::type
|
||||
#if _CCCL_CUDA_COMPILER(CLANG)
|
||||
# define _CCCL_NODEBUG_ALIAS _CCCL_NODEBUG
|
||||
#else // ^^^ _CCCL_CUDA_COMPILER(CLANG) ^^^ / vvv !_CCCL_CUDA_COMPILER(CLANG) vvv
|
||||
# define _CCCL_NODEBUG_ALIAS
|
||||
#endif // !_CCCL_CUDA_COMPILER(CLANG)
|
||||
|
||||
// _CCCL_ASSUME
|
||||
// NVCC does not properly respect [[assume()]], so use __builtin_assume, see nvbug5458663
|
||||
#if _CCCL_CUDA_COMPILER(NVCC) && _CCCL_DEVICE_COMPILATION()
|
||||
# define _CCCL_ASSUME(...) __builtin_assume(__VA_ARGS__)
|
||||
#elif _CCCL_HAS_CPP_ATTRIBUTE(assume)
|
||||
# define _CCCL_ASSUME(...) [[assume(__VA_ARGS__)]]
|
||||
#else
|
||||
# define _CCCL_ASSUME(...) _CCCL_BUILTIN_ASSUME(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#if _CCCL_TILE_COMPILATION() // nvbug6100910: __builtin_assume is not supported in tile mode
|
||||
# undef _CCCL_ASSUME
|
||||
# define _CCCL_ASSUME(...)
|
||||
#endif // _CCCL_TILE_COMPILATION()
|
||||
|
||||
// _CCCL_CONST
|
||||
|
||||
#if _CCCL_HAS_CPP_ATTRIBUTE(__gnu__::__const__)
|
||||
# define _CCCL_CONST [[__gnu__::__const__]]
|
||||
#else // ^^^ has gnu::const ^^^ / vvv no gnu::const vvv
|
||||
# define _CCCL_CONST _CCCL_PURE
|
||||
#endif // ^^^ no gnu::const ^^^
|
||||
|
||||
// _CCCL_DIAGNOSE_IF
|
||||
|
||||
#if _CCCL_HAS_ATTRIBUTE(__diagnose_if__)
|
||||
# define _CCCL_DIAGNOSE_IF(_COND, _MSG, _TYPE) __attribute__((__diagnose_if__(_COND, _MSG, _TYPE)))
|
||||
#else // ^^^ _CCCL_HAS_ATTRIBUTE(diagnose_if) ^^^ / vvv !_CCCL_HAS_ATTRIBUTE(diagnose_if) vvv
|
||||
# define _CCCL_DIAGNOSE_IF(_COND, _MSG, _TYPE)
|
||||
#endif // !_CCCL_HAS_ATTRIBUTE(diagnose_if)
|
||||
|
||||
// _CCCL_INTRINSIC
|
||||
|
||||
// MSVC provides a way to mark functions as intrinsic provided the function's body consists of a single
|
||||
// return statement of a cast expression (e.g., move(x) or forward<T>(u)).
|
||||
#if _CCCL_COMPILER(MSVC) && _CCCL_HAS_CPP_ATTRIBUTE(msvc::intrinsic)
|
||||
# define _CCCL_INTRINSIC [[msvc::intrinsic]]
|
||||
#else
|
||||
# define _CCCL_INTRINSIC
|
||||
#endif
|
||||
|
||||
// _CCCL_PURE
|
||||
|
||||
#if _CCCL_CUDA_COMPILER(NVCC, >=, 12, 5)
|
||||
# define _CCCL_PURE __nv_pure__
|
||||
#elif _CCCL_HAS_CPP_ATTRIBUTE(__gnu__::__pure__)
|
||||
# define _CCCL_PURE [[__gnu__::__pure__]]
|
||||
#elif _CCCL_COMPILER(MSVC)
|
||||
# define _CCCL_PURE __declspec(noalias)
|
||||
#else
|
||||
# define _CCCL_PURE
|
||||
#endif
|
||||
|
||||
// _CCCL_NO_CFI
|
||||
|
||||
#if !_CCCL_COMPILER(GCC)
|
||||
# define _CCCL_NO_CFI _CCCL_NO_SANITIZE("cfi")
|
||||
#else
|
||||
# define _CCCL_NO_CFI
|
||||
#endif
|
||||
|
||||
// _CCCL_NO_SANITIZE
|
||||
|
||||
#if _CCCL_HAS_ATTRIBUTE(__no_sanitize__)
|
||||
# define _CCCL_NO_SANITIZE(_STR) __attribute__((__no_sanitize__(_STR)))
|
||||
#else // ^^^ _CCCL_HAS_ATTRIBUTE(no_sanitize) ^^^ / vvv !_CCCL_HAS_ATTRIBUTE(no_sanitize) vvv
|
||||
# define _CCCL_NO_SANITIZE(_STR)
|
||||
#endif // !_CCCL_HAS_ATTRIBUTE(no_sanitize)
|
||||
|
||||
// _CCCL_NO_SPECIALIZATIONS
|
||||
|
||||
#if _CCCL_HAS_CPP_ATTRIBUTE(clang::__no_specializations__)
|
||||
# define _CCCL_NO_SPECIALIZATIONS_BECAUSE(_MSG) [[clang::__no_specializations__(_MSG)]]
|
||||
# define _CCCL_HAS_ATTRIBUTE_NO_SPECIALIZATIONS() 1
|
||||
#elif _CCCL_HAS_CPP_ATTRIBUTE(msvc::no_specializations)
|
||||
# define _CCCL_NO_SPECIALIZATIONS_BECAUSE(_MSG) [[msvc::no_specializations(_MSG)]]
|
||||
# define _CCCL_HAS_ATTRIBUTE_NO_SPECIALIZATIONS() 1
|
||||
#else // ^^^ has attribute no_specializations ^^^ / vvv hasn't attribute no_specializations vvv
|
||||
# define _CCCL_NO_SPECIALIZATIONS_BECAUSE(_MSG)
|
||||
# define _CCCL_HAS_ATTRIBUTE_NO_SPECIALIZATIONS() 0
|
||||
#endif // ^^^ hasn't attribute no_specializations ^^^
|
||||
|
||||
#define _CCCL_NO_SPECIALIZATIONS \
|
||||
_CCCL_NO_SPECIALIZATIONS_BECAUSE("Users are not allowed to specialize this cccl entity")
|
||||
|
||||
// _CCCL_LIFETIMEBOUND
|
||||
|
||||
#if _CCCL_HAS_CPP_ATTRIBUTE(clang::lifetimebound) || _CCCL_COMPILER(CLANG)
|
||||
# define _CCCL_LIFETIMEBOUND [[clang::lifetimebound]]
|
||||
#elif _CCCL_HAS_CPP_ATTRIBUTE(msvc::lifetimebound) || _CCCL_COMPILER(MSVC, >=, 19, 37)
|
||||
# define _CCCL_LIFETIMEBOUND [[msvc::lifetimebound]]
|
||||
#else
|
||||
# define _CCCL_LIFETIMEBOUND
|
||||
#endif
|
||||
|
||||
// _CCCL_NO_UNIQUE_ADDRESS
|
||||
|
||||
#if _CCCL_COMPILER(MSVC) || _CCCL_HAS_CPP_ATTRIBUTE(no_unique_address) < 201803L
|
||||
// MSVC implementation has lead to multiple issues with silent runtime corruption when passing data into kernels
|
||||
# define _CCCL_HAS_ATTRIBUTE_NO_UNIQUE_ADDRESS() 0
|
||||
# define _CCCL_NO_UNIQUE_ADDRESS
|
||||
#elif _CCCL_HAS_CPP_ATTRIBUTE(no_unique_address)
|
||||
# define _CCCL_HAS_ATTRIBUTE_NO_UNIQUE_ADDRESS() 1
|
||||
# define _CCCL_NO_UNIQUE_ADDRESS [[no_unique_address]]
|
||||
#else
|
||||
# define _CCCL_HAS_ATTRIBUTE_NO_UNIQUE_ADDRESS() 0
|
||||
# define _CCCL_NO_UNIQUE_ADDRESS
|
||||
#endif
|
||||
|
||||
// Passing objects with nested [[no_unique_address]] to kernels leads to data corruption.
|
||||
// This is caused by cudafe++ not honoring [[no_unique_address]] when compiling for C++17
|
||||
// with clang as the host compiler. See nvbug 5265027 for more details.
|
||||
#if _CCCL_HAS_ATTRIBUTE_NO_UNIQUE_ADDRESS() && _CCCL_COMPILER(CLANG) && _CCCL_STD_VER < 2020 \
|
||||
&& _CCCL_CUDA_COMPILER(NVCC)
|
||||
# undef _CCCL_HAS_ATTRIBUTE_NO_UNIQUE_ADDRESS
|
||||
# undef _CCCL_NO_UNIQUE_ADDRESS
|
||||
# define _CCCL_HAS_ATTRIBUTE_NO_UNIQUE_ADDRESS() 0
|
||||
# define _CCCL_NO_UNIQUE_ADDRESS
|
||||
#endif // _CCCL_HAS_ATTRIBUTE_NO_UNIQUE_ADDRESS() && _CCCL_COMPILER(CLANG)
|
||||
|
||||
// _CCCL_PREFERRED_NAME
|
||||
|
||||
#if _CCCL_HAS_ATTRIBUTE(__preferred_name__)
|
||||
# define _CCCL_PREFERRED_NAME(x) __attribute__((__preferred_name__(x)))
|
||||
#else
|
||||
# define _CCCL_PREFERRED_NAME(x)
|
||||
#endif
|
||||
|
||||
#if _CCCL_HAS_ATTRIBUTE(__require_constant_initialization__)
|
||||
# define _CCCL_REQUIRE_CONSTANT_INITIALIZATION __attribute__((__require_constant_initialization__))
|
||||
#else
|
||||
# define _CCCL_REQUIRE_CONSTANT_INITIALIZATION
|
||||
#endif
|
||||
|
||||
// _CCCL_RESTRICT
|
||||
|
||||
#if _CCCL_COMPILER(MSVC) // vvv _CCCL_COMPILER(MSVC) vvv
|
||||
# define _CCCL_RESTRICT __restrict
|
||||
#else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC) vvv
|
||||
# define _CCCL_RESTRICT __restrict__
|
||||
#endif // ^^^ !_CCCL_COMPILER(MSVC) ^^^
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // __CCCL_ATTRIBUTES_H
|
||||
474
qwen3_6_scripts/cccl_preload/include/cuda/std/__cccl/builtin.h
Normal file
474
qwen3_6_scripts/cccl_preload/include/cuda/std/__cccl/builtin.h
Normal file
@@ -0,0 +1,474 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CCCL_BUILTIN_H
|
||||
#define __CCCL_BUILTIN_H
|
||||
|
||||
#include <cuda/std/__cccl/compiler.h>
|
||||
#include <cuda/std/__cccl/preprocessor.h>
|
||||
#include <cuda/std/__cccl/system_header.h>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__cccl/cuda_capabilities.h>
|
||||
#include <cuda/std/__cccl/extended_data_types.h>
|
||||
#include <cuda/std/__cccl/host_std_lib.h>
|
||||
|
||||
//! This file consolidates all compiler builtin detection for CCCL.
|
||||
//!
|
||||
//! To work around older compilers not supporting `__has_builtin` we use `_CCCL_CHECK_BUILTIN` that detects more
|
||||
//! cases
|
||||
//!
|
||||
//! * We work around old clang versions (before clang-10) not supporting __has_builtin via _CCCL_CHECK_BUILTIN
|
||||
//! * We work around old intel versions (before 2021.3) not supporting __has_builtin via _CCCL_CHECK_BUILTIN
|
||||
//! * We work around old nvhpc versions (before 2022.11) not supporting __has_builtin via _CCCL_CHECK_BUILTIN
|
||||
//! * MSVC needs manual handling, has no real way of checking builtins so all is manual
|
||||
//! * GCC needs manual handling, before gcc-10 as that finally supports __has_builtin
|
||||
//!
|
||||
//! In case compiler support for a builtin is advertised but leads to regressions we explicitly undef the macro
|
||||
//!
|
||||
//! Finally, because `_CCCL_CHECK_BUILTIN` may lead to false positives, we move detection of new builtins over towards
|
||||
//! just using _CCCL_HAS_BUILTIN
|
||||
|
||||
#ifdef __has_builtin
|
||||
# define _CCCL_HAS_BUILTIN(__x) __has_builtin(__x)
|
||||
#else // ^^^ __has_builtin ^^^ / vvv !__has_builtin vvv
|
||||
# define _CCCL_HAS_BUILTIN(__x) 0
|
||||
#endif // !__has_builtin
|
||||
|
||||
#ifdef __has_feature
|
||||
# define _CCCL_HAS_FEATURE(__x) __has_feature(__x)
|
||||
#else // ^^^ __has_feature ^^^ / vvv !__has_feature vvv
|
||||
# define _CCCL_HAS_FEATURE(__x) 0
|
||||
#endif // !__has_feature
|
||||
|
||||
// '__is_identifier' returns '0' if '__x' is a reserved identifier provided by the compiler and '1' otherwise.
|
||||
#ifdef __is_identifier
|
||||
# define _CCCL_IS_IDENTIFIER(__x) __is_identifier(__x)
|
||||
#else // ^^^ __is_identifier ^^^ / vvv !__is_identifier vvv
|
||||
# define _CCCL_IS_IDENTIFIER(__x) 1
|
||||
#endif // !__is_identifier
|
||||
|
||||
#define _CCCL_HAS_KEYWORD(__x) !(_CCCL_IS_IDENTIFIER(__x))
|
||||
|
||||
// https://bugs.llvm.org/show_bug.cgi?id=44517
|
||||
#define _CCCL_CHECK_BUILTIN(__x) (_CCCL_HAS_BUILTIN(__##__x) || _CCCL_HAS_KEYWORD(__##__x) || _CCCL_HAS_FEATURE(__x))
|
||||
|
||||
// NVCC has issues with function pointers
|
||||
#if _CCCL_HAS_BUILTIN(__add_lvalue_reference) && _CCCL_CUDA_COMPILER(CLANG)
|
||||
# define _CCCL_BUILTIN_ADD_LVALUE_REFERENCE(...) __add_lvalue_reference(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__add_lvalue_reference)
|
||||
|
||||
// NVCC has issues with function pointers
|
||||
#if _CCCL_HAS_BUILTIN(__add_pointer) && _CCCL_CUDA_COMPILER(CLANG)
|
||||
# define _CCCL_BUILTIN_ADD_POINTER(...) __add_pointer(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__add_pointer)
|
||||
|
||||
// NVCC has issues with function pointers
|
||||
#if _CCCL_HAS_BUILTIN(__add_rvalue_reference) && _CCCL_CUDA_COMPILER(CLANG)
|
||||
# define _CCCL_BUILTIN_ADD_RVALUE_REFERENCE(...) __add_rvalue_reference(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__add_rvalue_reference)
|
||||
|
||||
// TODO: Enable using the builtin __array_rank when https://llvm.org/PR57133 is resolved
|
||||
#if 0 // _CCCL_CHECK_BUILTIN(array_rank)
|
||||
# define _CCCL_BUILTIN_ARRAY_RANK(...) __array_rank(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(array_rank)
|
||||
|
||||
// nvhpc has a bug where it supports __builtin_addressof but does not mark it via _CCCL_CHECK_BUILTIN
|
||||
#if _CCCL_CHECK_BUILTIN(builtin_addressof) || _CCCL_COMPILER(GCC, >=, 7) || _CCCL_COMPILER(MSVC) \
|
||||
|| _CCCL_COMPILER(NVHPC) || _CCCL_COMPILER(NVRTC, >=, 12, 3)
|
||||
# define _CCCL_BUILTIN_ADDRESSOF(...) __builtin_addressof(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(builtin_addressof)
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(builtin_assume) || _CCCL_COMPILER(CLANG) || _CCCL_COMPILER(NVHPC)
|
||||
# define _CCCL_BUILTIN_ASSUME(...) __builtin_assume(__VA_ARGS__)
|
||||
#elif _CCCL_COMPILER(GCC, >=, 13)
|
||||
# define _CCCL_BUILTIN_ASSUME(...) __attribute__((__assume__(__VA_ARGS__)))
|
||||
#elif _CCCL_COMPILER(MSVC)
|
||||
# define _CCCL_BUILTIN_ASSUME(...) __assume(__VA_ARGS__)
|
||||
#else
|
||||
# define _CCCL_BUILTIN_ASSUME(...)
|
||||
#endif // _CCCL_CHECK_BUILTIN(builtin_assume)
|
||||
|
||||
#if _CCCL_TILE_COMPILATION() // nvbug6100910: __builtin_assume is not supported in tile mode
|
||||
# undef _CCCL_BUILTIN_ASSUME
|
||||
# define _CCCL_BUILTIN_ASSUME(...)
|
||||
#endif // _CCCL_TILE_COMPILATION()
|
||||
|
||||
#if _CCCL_HAS_BUILTIN(__builtin_assume_aligned) || _CCCL_COMPILER(MSVC, >=, 19, 23) || _CCCL_COMPILER(GCC)
|
||||
# define _CCCL_BUILTIN_ASSUME_ALIGNED(...) __builtin_assume_aligned(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__builtin_assume_aligned)
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(builtin_constant_p) || _CCCL_COMPILER(GCC)
|
||||
# define _CCCL_BUILTIN_CONSTANT_P(...) __builtin_constant_p(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(builtin_constant_p)
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(builtin_expect) || _CCCL_COMPILER(MSVC) || _CCCL_COMPILER(GCC)
|
||||
# define _CCCL_BUILTIN_EXPECT(_EXPR, _VAL) __builtin_expect(_EXPR, _VAL)
|
||||
#else // ^^^ has __builtin_expect ^^^ / vvv no __builtin_expect vvv
|
||||
# define _CCCL_BUILTIN_EXPECT(_EXPR, _VAL) (_EXPR)
|
||||
#endif // ^^^ no __builtin_expect ^^^
|
||||
|
||||
#if _CCCL_TILE_COMPILATION() // nvbug6100927: __builtin_expect is unsupported in tile mode
|
||||
# undef _CCCL_BUILTIN_EXPECT
|
||||
# define _CCCL_BUILTIN_EXPECT(_EXPR, _VAL) (_EXPR)
|
||||
#endif // _CCCL_TILE_COMPILATION()
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(builtin_huge_valf) || _CCCL_COMPILER(MSVC) || _CCCL_COMPILER(GCC, <, 10)
|
||||
# define _CCCL_BUILTIN_HUGE_VALF() __builtin_huge_valf()
|
||||
#endif // _CCCL_CHECK_BUILTIN(builtin_huge_valf)
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(builtin_huge_val) || _CCCL_COMPILER(MSVC) || _CCCL_COMPILER(GCC, <, 10)
|
||||
# define _CCCL_BUILTIN_HUGE_VAL() __builtin_huge_val()
|
||||
#endif // _CCCL_CHECK_BUILTIN(builtin_huge_val)
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(builtin_huge_vall) || _CCCL_COMPILER(GCC, <, 10)
|
||||
# define _CCCL_BUILTIN_HUGE_VALL() __builtin_huge_vall()
|
||||
#elif _CCCL_COMPILER(MSVC)
|
||||
# define _CCCL_BUILTIN_HUGE_VALL() static_cast<long double>(__builtin_huge_val())
|
||||
#endif // _CCCL_CHECK_BUILTIN(builtin_huge_vall)
|
||||
|
||||
#if _CCCL_HAS_FLOAT128()
|
||||
# if _CCCL_CHECK_BUILTIN(builtin_huge_valf128) || _CCCL_COMPILER(GCC, >=, 7)
|
||||
# define _CCCL_BUILTIN_HUGE_VALF128() __builtin_huge_valf128()
|
||||
# endif // _CCCL_CHECK_BUILTIN(builtin_huge_valf128) || _CCCL_COMPILER(GCC, >=, 7)
|
||||
|
||||
// nvcc does not implement __builtin_huge_valf128
|
||||
# if _CCCL_CUDA_COMPILER(NVCC)
|
||||
# undef _CCCL_BUILTIN_HUGE_VALF128
|
||||
# endif // _CCCL_CUDA_COMPILER(NVCC)
|
||||
#endif // _CCCL_HAS_FLOAT128()
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(builtin_is_constant_evaluated) || _CCCL_COMPILER(GCC, >=, 9) || _CCCL_COMPILER(MSVC, >, 19, 24)
|
||||
# define _CCCL_BUILTIN_IS_CONSTANT_EVALUATED(...) __builtin_is_constant_evaluated(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(builtin_is_constant_evaluated)
|
||||
|
||||
#if _CCCL_TILE_COMPILATION() // nvbug6067464: __builtin_is_constant_evaluated is unsupported in tile mode
|
||||
# undef _CCCL_BUILTIN_IS_CONSTANT_EVALUATED
|
||||
#endif // _CCCL_TILE_COMPILATION()
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(builtin_is_corresponding_member)
|
||||
# define _CCCL_BUILTIN_IS_CORRESPONDING_MEMBER(_C1, _C2, _MPtr1, _MPtr2) \
|
||||
__builtin_is_corresponding_member(_MPtr1, _MPtr2)
|
||||
#elif _CCCL_COMPILER(MSVC, >=, 19, 29)
|
||||
// using __is_corresponding_member with msvc outside of constexpr context causes linker errors, see
|
||||
// https://developercommunity.visualstudio.com/t/Using-compiler-builtins-causes-linking-n/10888080
|
||||
// # define _CCCL_BUILTIN_IS_CORRESPONDING_MEMBER(_C1, _C2, _MPtr1, _MPtr2) __is_corresponding_member(_C1, _C2, _MPtr1,
|
||||
// _MPtr2)
|
||||
#endif // ^^^ _CCCL_COMPILER(MSVC, >=, 19, 29) ^^^
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(builtin_is_pointer_interconvertible_with_class)
|
||||
# define _CCCL_BUILTIN_IS_POINTER_INTERCONVERTIBLE_WITH_CLASS(_S, _MPtr) \
|
||||
__builtin_is_pointer_interconvertible_with_class(_MPtr)
|
||||
#elif _CCCL_COMPILER(MSVC, >=, 19, 29)
|
||||
// using __is_pointer_interconvertible_with_class with msvc outside of constexpr context causes linker errors, see
|
||||
// https://developercommunity.visualstudio.com/t/Using-compiler-builtins-causes-linking-n/10888080
|
||||
// # define _CCCL_BUILTIN_IS_POINTER_INTERCONVERTIBLE_WITH_CLASS(_S, _MPtr)
|
||||
// __is_pointer_interconvertible_with_class(_S, _MPtr)
|
||||
#endif // ^^^ _CCCL_COMPILER(MSVC, >=, 19, 29) ^^^
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(builtin_is_virtual_base_of)
|
||||
# define _CCCL_BUILTIN_IS_VIRTUAL_BASE_OF(...) __builtin_is_virtual_base_of(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(builtin_is_virtual_base_of)
|
||||
|
||||
// nvcc < 13.3 doesn't implement __builtin_is_virtual_base_of
|
||||
#if _CCCL_CUDA_COMPILER(NVCC, <, 13, 3)
|
||||
# undef _CCCL_BUILTIN_IS_VIRTUAL_BASE_OF
|
||||
#endif // _CCCL_CUDA_COMPILER(NVCC, <, 13, 3)
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(builtin_nanf) || _CCCL_COMPILER(MSVC) || _CCCL_COMPILER(GCC, <, 10)
|
||||
# define _CCCL_BUILTIN_NANF(...) __builtin_nanf(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(builtin_nanf)
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(builtin_nan) || _CCCL_COMPILER(MSVC) || _CCCL_COMPILER(GCC, <, 10)
|
||||
# define _CCCL_BUILTIN_NAN(...) __builtin_nan(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(builtin_nan)
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(builtin_nanl) || _CCCL_COMPILER(GCC, <, 10)
|
||||
# define _CCCL_BUILTIN_NANL(...) __builtin_nanl(__VA_ARGS__)
|
||||
#elif _CCCL_COMPILER(MSVC)
|
||||
# define _CCCL_BUILTIN_NANL(...) static_cast<long double>(__builtin_nan(__VA_ARGS__))
|
||||
#endif // _CCCL_CHECK_BUILTIN(builtin_nanl)
|
||||
|
||||
#if _CCCL_HAS_FLOAT128()
|
||||
# if _CCCL_CHECK_BUILTIN(builtin_nanf128) || _CCCL_COMPILER(GCC, >=, 7)
|
||||
# define _CCCL_BUILTIN_NANF128(...) __builtin_nanf128(__VA_ARGS__)
|
||||
# endif // _CCCL_CHECK_BUILTIN(builtin_nanf128) || _CCCL_COMPILER(GCC, >=, 7)
|
||||
|
||||
// nvcc does not implement __builtin_nanf128
|
||||
# if _CCCL_CUDA_COMPILER(NVCC)
|
||||
# undef _CCCL_BUILTIN_NANF128
|
||||
# endif // _CCCL_CUDA_COMPILER(NVCC)
|
||||
#endif // _CCCL_HAS_FLOAT128()
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(builtin_nansf) || _CCCL_COMPILER(MSVC) || _CCCL_COMPILER(GCC, <, 10)
|
||||
# define _CCCL_BUILTIN_NANSF(...) __builtin_nansf(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(builtin_nansf)
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(builtin_nans) || _CCCL_COMPILER(MSVC) || _CCCL_COMPILER(GCC, <, 10)
|
||||
# define _CCCL_BUILTIN_NANS(...) __builtin_nans(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(builtin_nans)
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(builtin_nansl) || _CCCL_COMPILER(GCC, <, 10)
|
||||
# define _CCCL_BUILTIN_NANSL(...) __builtin_nansl(__VA_ARGS__)
|
||||
#elif _CCCL_COMPILER(MSVC)
|
||||
# define _CCCL_BUILTIN_NANSL(...) static_cast<long double>(__builtin_nans(__VA_ARGS__))
|
||||
#endif // _CCCL_CHECK_BUILTIN(builtin_nansl)
|
||||
|
||||
#if _CCCL_HAS_FLOAT128()
|
||||
# if _CCCL_CHECK_BUILTIN(builtin_nansf128) || _CCCL_COMPILER(GCC, >=, 7)
|
||||
# define _CCCL_BUILTIN_NANSF128(...) __builtin_nansf128(__VA_ARGS__)
|
||||
# endif // _CCCL_CHECK_BUILTIN(builtin_nansf128) || _CCCL_COMPILER(GCC, >=, 7)
|
||||
|
||||
// nvcc does not implement __builtin_nansf128
|
||||
# if _CCCL_CUDA_COMPILER(NVCC)
|
||||
# undef _CCCL_BUILTIN_NANSF128
|
||||
# endif // _CCCL_CUDA_COMPILER(NVCC)
|
||||
#endif // _CCCL_HAS_FLOAT128()
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(builtin_memcmp) || _CCCL_COMPILER(GCC) || _CCCL_COMPILER(MSVC, >=, 19, 28)
|
||||
# define _CCCL_BUILTIN_MEMCMP(...) __builtin_memcmp(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(builtin_memcmp) || _CCCL_COMPILER(GCC) || _CCCL_COMPILER(MSVC, >=, 19, 28)
|
||||
|
||||
#if _CCCL_CUDA_COMPILER(NVCC) || _CCCL_CUDA_COMPILER(CLANG)
|
||||
# undef _CCCL_BUILTIN_MEMCMP
|
||||
#endif // _CCCL_CUDA_COMPILER(NVCC) || _CCCL_CUDA_COMPILER(CLANG)
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(builtin_memmove) || _CCCL_COMPILER(GCC)
|
||||
# define _CCCL_BUILTIN_MEMMOVE(...) __builtin_memmove(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(builtin_memmove) || _CCCL_COMPILER(GCC)
|
||||
|
||||
#if _CCCL_CUDA_COMPILER(NVCC)
|
||||
# undef _CCCL_BUILTIN_MEMMOVE
|
||||
#endif // _CCCL_CUDA_COMPILER(NVCC)
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(builtin_operator_new) && _CCCL_CHECK_BUILTIN(builtin_operator_delete) \
|
||||
&& _CCCL_CUDA_COMPILER(CLANG)
|
||||
# define _CCCL_BUILTIN_OPERATOR_DELETE(...) __builtin_operator_delete(__VA_ARGS__)
|
||||
# define _CCCL_BUILTIN_OPERATOR_NEW(...) __builtin_operator_new(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(builtin_operator_new) && _CCCL_CHECK_BUILTIN(builtin_operator_delete)
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(builtin_prefetch) || _CCCL_COMPILER(GCC)
|
||||
# define _CCCL_BUILTIN_PREFETCH(...) NV_IF_TARGET(NV_IS_HOST, __builtin_prefetch(__VA_ARGS__);)
|
||||
#else
|
||||
# define _CCCL_BUILTIN_PREFETCH(...)
|
||||
#endif // _CCCL_CHECK_BUILTIN(builtin_prefetch)
|
||||
|
||||
#if _CCCL_HAS_BUILTIN(__decay) && _CCCL_CUDA_COMPILER(CLANG)
|
||||
# define _CCCL_BUILTIN_DECAY(...) __decay(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__decay) && clang-cuda
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(has_nothrow_assign) || _CCCL_COMPILER(GCC, >=, 4, 3) || _CCCL_COMPILER(MSVC) \
|
||||
|| _CCCL_COMPILER(NVRTC)
|
||||
# define _CCCL_BUILTIN_HAS_NOTHROW_ASSIGN(...) __has_nothrow_assign(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(has_nothrow_assign) && gcc >= 4.3
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(has_nothrow_constructor) || _CCCL_COMPILER(GCC, >=, 4, 3) || _CCCL_COMPILER(MSVC) \
|
||||
|| _CCCL_COMPILER(NVRTC)
|
||||
# define _CCCL_BUILTIN_HAS_NOTHROW_CONSTRUCTOR(...) __has_nothrow_constructor(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(has_nothrow_constructor) && gcc >= 4.3
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(has_nothrow_copy) || _CCCL_COMPILER(GCC, >=, 4, 3) || _CCCL_COMPILER(MSVC) \
|
||||
|| _CCCL_COMPILER(NVRTC)
|
||||
# define _CCCL_BUILTIN_HAS_NOTHROW_COPY(...) __has_nothrow_copy(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(has_nothrow_copy) && gcc >= 4.3
|
||||
|
||||
#if _CCCL_HAS_BUILTIN(__integer_pack)
|
||||
# define _CCCL_BUILTIN_INTEGER_PACK(...) __integer_pack(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__integer_pack)
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(is_array)
|
||||
# define _CCCL_BUILTIN_IS_ARRAY(...) __is_array(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(is_array)
|
||||
|
||||
// clang prior to clang-19 gives wrong results for __is_array of _Tp[0]
|
||||
#if _CCCL_COMPILER(CLANG, <, 19)
|
||||
# undef _CCCL_BUILTIN_IS_ARRAY
|
||||
#endif // clang < 19
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(is_assignable) || _CCCL_COMPILER(MSVC) || _CCCL_COMPILER(GCC, >=, 9)
|
||||
# define _CCCL_BUILTIN_IS_ASSIGNABLE(...) __is_assignable(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(is_assignable) && gcc >= 9.0
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(is_constructible) || _CCCL_COMPILER(GCC, >=, 8) || _CCCL_COMPILER(MSVC) || _CCCL_COMPILER(NVRTC)
|
||||
# define _CCCL_BUILTIN_IS_CONSTRUCTIBLE(...) __is_constructible(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(is_constructible) && gcc >= 8.0
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(is_convertible_to) || _CCCL_COMPILER(MSVC) || _CCCL_COMPILER(NVRTC)
|
||||
# define _CCCL_BUILTIN_IS_CONVERTIBLE_TO(...) __is_convertible_to(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(is_convertible_to)
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(is_destructible) || _CCCL_COMPILER(MSVC)
|
||||
# define _CCCL_BUILTIN_IS_DESTRUCTIBLE(...) __is_destructible(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(is_destructible)
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(is_layout_compatible) || _CCCL_COMPILER(MSVC, >=, 19, 29)
|
||||
# define _CCCL_BUILTIN_IS_LAYOUT_COMPATIBLE(...) __is_layout_compatible(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(is_layout_compatible) || _CCCL_COMPILER(MSVC, >=, 19, 29)
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(is_lvalue_reference)
|
||||
# define _CCCL_BUILTIN_IS_LVALUE_REFERENCE(...) __is_lvalue_reference(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(is_lvalue_reference)
|
||||
|
||||
#if _CCCL_HAS_BUILTIN(__is_member_function_pointer)
|
||||
# define _CCCL_BUILTIN_IS_MEMBER_FUNCTION_POINTER(...) __is_member_function_pointer(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__is_member_function_pointer)
|
||||
|
||||
#if _CCCL_HAS_BUILTIN(__is_member_object_pointer)
|
||||
# define _CCCL_BUILTIN_IS_MEMBER_OBJECT_POINTER(...) __is_member_object_pointer(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__is_member_object_pointer)
|
||||
|
||||
#if _CCCL_HAS_BUILTIN(__is_member_pointer)
|
||||
# define _CCCL_BUILTIN_IS_MEMBER_POINTER(...) __is_member_pointer(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__is_member_pointer)
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(is_nothrow_assignable) || _CCCL_COMPILER(MSVC) || _CCCL_COMPILER(NVRTC)
|
||||
# define _CCCL_BUILTIN_IS_NOTHROW_ASSIGNABLE(...) __is_nothrow_assignable(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(is_nothrow_assignable)
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(is_nothrow_constructible) || _CCCL_COMPILER(MSVC) || _CCCL_COMPILER(NVRTC)
|
||||
# define _CCCL_BUILTIN_IS_NOTHROW_CONSTRUCTIBLE(...) __is_nothrow_constructible(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(is_nothrow_constructible)
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(is_nothrow_destructible) || _CCCL_COMPILER(MSVC) || _CCCL_COMPILER(NVRTC)
|
||||
# define _CCCL_BUILTIN_IS_NOTHROW_DESTRUCTIBLE(...) __is_nothrow_destructible(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(is_nothrow_destructible)
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(is_object)
|
||||
# define _CCCL_BUILTIN_IS_OBJECT(...) __is_object(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(is_object)
|
||||
|
||||
// Disabled due to libstdc++ conflict
|
||||
#if 0 // _CCCL_HAS_BUILTIN(__is_pointer)
|
||||
# define _CCCL_BUILTIN_IS_POINTER(...) __is_pointer(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__is_pointer)
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(is_pointer_interconvertible_base_of) || _CCCL_COMPILER(MSVC, >=, 19, 29)
|
||||
# define _CCCL_BUILTIN_IS_POINTER_INTERCONVERTIBLE_BASE_OF(...) __is_pointer_interconvertible_base_of(__VA_ARGS__)
|
||||
#endif // _CCCL_CHECK_BUILTIN(is_pointer_interconvertible_base_of) || _CCCL_COMPILER(MSVC, >=, 19, 29)
|
||||
|
||||
#if _CCCL_HAS_BUILTIN(__is_reference)
|
||||
# define _CCCL_BUILTIN_IS_REFERENCE(...) __is_reference(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__is_reference)
|
||||
|
||||
// Disabled due to libstdc++ conflict
|
||||
#if 0 // _CCCL_HAS_BUILTIN(__is_referenceable)
|
||||
# define _CCCL_BUILTIN_IS_REFERENCEABLE(...) __is_referenceable(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__is_referenceable)
|
||||
|
||||
#if _CCCL_HAS_BUILTIN(__is_rvalue_reference)
|
||||
# define _CCCL_BUILTIN_IS_RVALUE_REFERENCE(...) __is_rvalue_reference(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__is_rvalue_reference)
|
||||
|
||||
// Disabled due to libstdc++ conflict
|
||||
#if 0 // _CCCL_HAS_BUILTIN(__is_scalar)
|
||||
# define _CCCL_BUILTIN_IS_SCALAR(...) __is_scalar(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__is_scalar)
|
||||
|
||||
#if _CCCL_CHECK_BUILTIN(make_integer_seq) || _CCCL_COMPILER(MSVC, >=, 19, 23)
|
||||
# define _CCCL_BUILTIN_MAKE_INTEGER_SEQ(...) __make_integer_seq<__VA_ARGS__>
|
||||
#endif // _CCCL_CHECK_BUILTIN(make_integer_seq)
|
||||
|
||||
#if _CCCL_HAS_BUILTIN(__reference_constructs_from_temporary)
|
||||
# define _CCCL_BUILTIN_REFERENCE_CONSTRUCTS_FROM_TEMPORARY(...) __reference_constructs_from_temporary(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__reference_constructs_from_temporary)
|
||||
|
||||
#if _CCCL_HAS_BUILTIN(__reference_converts_from_temporary)
|
||||
# define _CCCL_BUILTIN_REFERENCE_CONVERTS_FROM_TEMPORARY(...) __reference_converts_from_temporary(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__reference_converts_from_temporary)
|
||||
|
||||
#if _CCCL_HAS_BUILTIN(__remove_const) && _CCCL_CUDA_COMPILER(CLANG)
|
||||
# define _CCCL_BUILTIN_REMOVE_CONST(...) __remove_const(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__remove_const)
|
||||
|
||||
#if _CCCL_HAS_BUILTIN(__remove_cv) && _CCCL_CUDA_COMPILER(CLANG)
|
||||
# define _CCCL_BUILTIN_REMOVE_CV(...) __remove_cv(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__remove_cv)
|
||||
|
||||
#if _CCCL_HAS_BUILTIN(__remove_cvref) && _CCCL_CUDA_COMPILER(CLANG)
|
||||
# define _CCCL_BUILTIN_REMOVE_CVREF(...) __remove_cvref(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__remove_cvref)
|
||||
|
||||
#if _CCCL_COMPILER(NVRTC, <, 12, 4) // NVRTC below 12.4 fails to properly compile that builtin
|
||||
# undef _CCCL_BUILTIN_REMOVE_CVREF
|
||||
#endif // _CCCL_COMPILER(NVRTC, <, 12, 4)
|
||||
|
||||
#if _CCCL_HAS_BUILTIN(__remove_extent) && _CCCL_CUDA_COMPILER(CLANG)
|
||||
# define _CCCL_BUILTIN_REMOVE_EXTENT(...) __remove_extent(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__remove_extent)
|
||||
|
||||
#if _CCCL_HAS_BUILTIN(__remove_pointer) && _CCCL_CUDA_COMPILER(CLANG)
|
||||
# define _CCCL_BUILTIN_REMOVE_POINTER(...) __remove_pointer(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__remove_pointer)
|
||||
|
||||
#if _CCCL_HAS_BUILTIN(__remove_reference)
|
||||
# define _CCCL_BUILTIN_REMOVE_REFERENCE_T(...) __remove_reference(__VA_ARGS__)
|
||||
#elif _CCCL_HAS_BUILTIN(__remove_reference_t) && _CCCL_CUDA_COMPILER(CLANG)
|
||||
# define _CCCL_BUILTIN_REMOVE_REFERENCE_T(...) __remove_reference_t(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__remove_reference_t)
|
||||
|
||||
#if _CCCL_COMPILER(NVRTC, <, 12, 4) // NVRTC below 12.4 fails to properly compile cuda::std::move with that
|
||||
# undef _CCCL_BUILTIN_REMOVE_REFERENCE_T
|
||||
#endif // _CCCL_COMPILER(NVRTC, <, 12, 4)
|
||||
|
||||
#if _CCCL_HAS_BUILTIN(__remove_volatile) && _CCCL_CUDA_COMPILER(CLANG)
|
||||
# define _CCCL_BUILTIN_REMOVE_VOLATILE(...) __remove_volatile(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__remove_volatile)
|
||||
|
||||
#if _CCCL_HAS_BUILTIN(__type_pack_element)
|
||||
# define _CCCL_BUILTIN_TYPE_PACK_ELEMENT(...) __type_pack_element<__VA_ARGS__>
|
||||
#endif // _CCCL_HAS_BUILTIN(__type_pack_element)
|
||||
|
||||
#if _CCCL_HAS_BUILTIN(__is_complete_type)
|
||||
# define _CCCL_BUILTIN_IS_COMPLETE_TYPE(...) __is_complete_type(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__is_complete_type)
|
||||
|
||||
#if _CCCL_HAS_BUILTIN(__builtin_clear_padding) \
|
||||
&& (_CCCL_HOST_COMPILATION() || !(_CCCL_COMPILER(GCC) || _CCCL_COMPILER(NVHPC)))
|
||||
# define _CCCL_BUILTIN_CLEAR_PADDING(...) __builtin_clear_padding(__VA_ARGS__)
|
||||
#endif // _CCCL_HAS_BUILTIN(__builtin_clear_padding) && (_CCCL_HOST_COMPILATION() || !(_CCCL_COMPILER(GCC) ||
|
||||
// _CCCL_COMPILER(NVHPC)))
|
||||
|
||||
// NVCC prior to 12.2 have trouble with pack expansion into __type_pack_element in an alias template
|
||||
#if _CCCL_CUDACC_BELOW(12, 2)
|
||||
# undef _CCCL_BUILTIN_TYPE_PACK_ELEMENT
|
||||
#endif // _CCCL_CUDACC_BELOW(12, 2)
|
||||
|
||||
#if _CCCL_COMPILER(MSVC) // To use __builtin_FUNCSIG(), both MSVC and nvcc need to support it
|
||||
# if _CCCL_COMPILER(MSVC, >=, 19, 35) && _CCCL_CUDACC_AT_LEAST(12, 3)
|
||||
# define _CCCL_BUILTIN_PRETTY_FUNCTION() __builtin_FUNCSIG()
|
||||
# else // ^^^ _CCCL_COMPILER(MSVC, >=, 19, 35) ^^^ / vvv _CCCL_COMPILER(MSVC, <, 19, 35) vvv
|
||||
# define _CCCL_BUILTIN_PRETTY_FUNCTION() __FUNCSIG__
|
||||
# define _CCCL_BROKEN_MSVC_FUNCSIG
|
||||
# endif // _CCCL_COMPILER(MSVC, <, 19, 35)
|
||||
#else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC) vvv
|
||||
# define _CCCL_BUILTIN_PRETTY_FUNCTION() __PRETTY_FUNCTION__
|
||||
#endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
// GCC's builtin_strlen isn't reliable at constexpr time
|
||||
// NVRTC does not expose builtin_strlen
|
||||
#if !_CCCL_COMPILER(GCC) && !_CCCL_COMPILER(NVRTC)
|
||||
# define _CCCL_BUILTIN_STRLEN(...) __builtin_strlen(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
// The new __nv_atomic builtins are available when __CUDACC_DEVICE_ATOMIC_BUILTINS__ is defined
|
||||
#if defined(__CUDACC_DEVICE_ATOMIC_BUILTINS__) && _CCCL_PTX_ARCH() >= 600 && !_CCCL_COMPILER(MSVC)
|
||||
# define _CCCL_HAS_NV_ATOMIC_BUILTINS() 1
|
||||
#else // ^^^ has intrinsics ^^^ / vvv no intrinsics
|
||||
# define _CCCL_HAS_NV_ATOMIC_BUILTINS() 0
|
||||
#endif // no intrinsics
|
||||
|
||||
#endif // __CCCL_BUILTIN_H
|
||||
238
qwen3_6_scripts/cccl_preload/include/cuda/std/__cccl/compiler.h
Normal file
238
qwen3_6_scripts/cccl_preload/include/cuda/std/__cccl/compiler.h
Normal file
@@ -0,0 +1,238 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CCCL_COMPILER_H
|
||||
#define __CCCL_COMPILER_H
|
||||
|
||||
#include <cuda/std/__cccl/preprocessor.h>
|
||||
|
||||
// Utility to compare version numbers. To use:
|
||||
// 1) Define a macro that makes a pair of (major, minor) numbers:
|
||||
// #define MYPRODUCT_MAKE_VERSION(_MAJOR, _MINOR) (_MAJOR * 100 + _MINOR)
|
||||
// 2) Define a macro that you will use to compare versions, e.g.:
|
||||
// #define MYPRODUCT(...) _CCCL_VERSION_COMPARE(MYPRODUCT, MYPRODUCT_##__VA_ARGS__)
|
||||
// Signatures:
|
||||
// MYPRODUCT(_PROD) - is the product _PROD version non-zero?
|
||||
// MYPRODUCT(_PROD, _OP, _MAJOR) - compare the product _PROD major version to _MAJOR using operator _OP
|
||||
// MYPRODUCT(_PROD, _OP, _MAJOR, _MINOR) - compare the product _PROD version to _MAJOR._MINOR using operator _OP
|
||||
// 3) Define the product version macros as a function-like macro that returns the version number or
|
||||
// _CCCL_VERSION_INVALID() if the version cannot be determined, e. g.:
|
||||
// #define MYPRODUCT_<_PROD>() (1, 2)
|
||||
// or
|
||||
// #define MYPRODUCT_<_PROD>() _CCCL_VERSION_INVALID()
|
||||
#define _CCCL_VERSION_MAJOR_(_MAJOR, _MINOR) _MAJOR
|
||||
#define _CCCL_VERSION_MAJOR(_PAIR) _CCCL_VERSION_MAJOR_ _PAIR
|
||||
#define _CCCL_VERSION_INVALID() (-1, -1)
|
||||
#define _CCCL_MAKE_VERSION(_PREFIX, _PAIR) (_CCCL_PP_EVAL(_CCCL_PP_CAT(_PREFIX, MAKE_VERSION), _CCCL_PP_EXPAND _PAIR))
|
||||
#define _CCCL_VERSION_IS_INVALID(_PAIR) (_CCCL_VERSION_MAJOR(_PAIR) == _CCCL_VERSION_MAJOR(_CCCL_VERSION_INVALID()))
|
||||
#define _CCCL_VERSION_COMPARE_1(_PREFIX, _VER) (!_CCCL_VERSION_IS_INVALID(_VER()))
|
||||
#define _CCCL_VERSION_COMPARE_3(_PREFIX, _VER, _OP, _MAJOR) \
|
||||
(!_CCCL_VERSION_IS_INVALID(_VER()) && (_CCCL_VERSION_MAJOR(_VER()) _OP _MAJOR))
|
||||
#define _CCCL_VERSION_COMPARE_4(_PREFIX, _VER, _OP, _MAJOR, _MINOR) \
|
||||
(!_CCCL_VERSION_IS_INVALID(_VER()) \
|
||||
&& (_CCCL_MAKE_VERSION(_PREFIX, _VER()) _OP _CCCL_MAKE_VERSION(_PREFIX, (_MAJOR, _MINOR))))
|
||||
#define _CCCL_VERSION_SELECT_COUNT(_ARG1, _ARG2, _ARG3, _ARG4, _ARG5, ...) _ARG5
|
||||
#define _CCCL_VERSION_SELECT2(_ARGS) _CCCL_VERSION_SELECT_COUNT _ARGS
|
||||
// MSVC traditonal preprocessor requires an extra level of indirection
|
||||
#define _CCCL_VERSION_SELECT(...) \
|
||||
_CCCL_VERSION_SELECT2( \
|
||||
(__VA_ARGS__, \
|
||||
_CCCL_VERSION_COMPARE_4, \
|
||||
_CCCL_VERSION_COMPARE_3, \
|
||||
_CCCL_VERSION_COMPARE_BAD_ARG_COUNT, \
|
||||
_CCCL_VERSION_COMPARE_1, \
|
||||
_CCCL_VERSION_COMPARE_BAD_ARG_COUNT))
|
||||
#define _CCCL_VERSION_COMPARE(_PREFIX, ...) _CCCL_VERSION_SELECT(__VA_ARGS__)(_PREFIX, __VA_ARGS__)
|
||||
|
||||
#define _CCCL_COMPILER_MAKE_VERSION(_MAJOR, _MINOR) ((_MAJOR) * 100 + (_MINOR))
|
||||
#define _CCCL_COMPILER(...) _CCCL_VERSION_COMPARE(_CCCL_COMPILER_, _CCCL_COMPILER_##__VA_ARGS__)
|
||||
|
||||
#define _CCCL_COMPILER_NVHPC() _CCCL_VERSION_INVALID()
|
||||
#define _CCCL_COMPILER_CLANG() _CCCL_VERSION_INVALID()
|
||||
#define _CCCL_COMPILER_GCC() _CCCL_VERSION_INVALID()
|
||||
#define _CCCL_COMPILER_MSVC() _CCCL_VERSION_INVALID()
|
||||
#define _CCCL_COMPILER_MSVC2019() _CCCL_VERSION_INVALID()
|
||||
#define _CCCL_COMPILER_MSVC2022() _CCCL_VERSION_INVALID()
|
||||
#define _CCCL_COMPILER_MSVC2026() _CCCL_VERSION_INVALID()
|
||||
#define _CCCL_COMPILER_NVRTC() _CCCL_VERSION_INVALID()
|
||||
|
||||
// Determine the host compiler and its version
|
||||
#if defined(__INTEL_COMPILER)
|
||||
# ifndef CCCL_IGNORE_DEPRECATED_COMPILER
|
||||
# warning \
|
||||
"The Intel C++ Compiler Classic (icc/icpc) is not supported by CCCL. Define CCCL_IGNORE_DEPRECATED_COMPILER to suppress this message."
|
||||
# endif // !CCCL_IGNORE_DEPRECATED_COMPILER
|
||||
#elif defined(__NVCOMPILER)
|
||||
# undef _CCCL_COMPILER_NVHPC
|
||||
# define _CCCL_COMPILER_NVHPC() (__NVCOMPILER_MAJOR__, __NVCOMPILER_MINOR__)
|
||||
#elif defined(__clang__)
|
||||
# undef _CCCL_COMPILER_CLANG
|
||||
# define _CCCL_COMPILER_CLANG() (__clang_major__, __clang_minor__)
|
||||
#elif defined(__GNUC__)
|
||||
# undef _CCCL_COMPILER_GCC
|
||||
# define _CCCL_COMPILER_GCC() (__GNUC__, __GNUC_MINOR__)
|
||||
#elif defined(_MSC_VER)
|
||||
// see https://learn.microsoft.com/en-us/cpp/overview/compiler-versions?view=msvc-180#version-macros
|
||||
# undef _CCCL_COMPILER_MSVC
|
||||
# define _CCCL_COMPILER_MSVC() (_MSC_VER / 100, _MSC_VER % 100)
|
||||
# if _CCCL_COMPILER(MSVC, <, 19, 20)
|
||||
# ifndef CCCL_IGNORE_DEPRECATED_COMPILER
|
||||
# error \
|
||||
"Visual Studio 2017 (MSC_VER < 1920) and older are not supported by CCCL. Define CCCL_IGNORE_DEPRECATED_COMPILER to suppress this error."
|
||||
# endif
|
||||
# endif // _CCCL_COMPILER(MSVC, <, 19, 20)
|
||||
# if _CCCL_COMPILER(MSVC, >=, 19, 20) && _CCCL_COMPILER(MSVC, <, 19, 30)
|
||||
# undef _CCCL_COMPILER_MSVC2019
|
||||
# define _CCCL_COMPILER_MSVC2019() _CCCL_COMPILER_MSVC()
|
||||
# endif // _CCCL_COMPILER(MSVC, >=, 19, 20) && _CCCL_COMPILER(MSVC, <, 19, 30)
|
||||
# if _CCCL_COMPILER(MSVC, >=, 19, 30) && _CCCL_COMPILER(MSVC, <, 19, 50)
|
||||
# undef _CCCL_COMPILER_MSVC2022
|
||||
# define _CCCL_COMPILER_MSVC2022() _CCCL_COMPILER_MSVC()
|
||||
# endif // _CCCL_COMPILER(MSVC, >=, 19, 30) && _CCCL_COMPILER(MSVC, <, 19, 50)
|
||||
# if _CCCL_COMPILER(MSVC, >=, 19, 50)
|
||||
# undef _CCCL_COMPILER_MSVC2026
|
||||
# define _CCCL_COMPILER_MSVC2026() _CCCL_COMPILER_MSVC()
|
||||
# endif // _CCCL_COMPILER(MSVC, >=, 19, 45)
|
||||
#elif defined(__CUDACC_RTC__)
|
||||
# undef _CCCL_COMPILER_NVRTC
|
||||
# define _CCCL_COMPILER_NVRTC() (__CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__)
|
||||
#endif
|
||||
|
||||
#if defined(__CUDACC__) || defined(_NVHPC_CUDA)
|
||||
# define _CCCL_CUDA_COMPILATION() 1
|
||||
#else // ^^^ compiling .cu file ^^^ / vvv not compiling .cu file vvv
|
||||
# define _CCCL_CUDA_COMPILATION() 0
|
||||
#endif // ^^^ not compiling .cu file ^^^
|
||||
|
||||
// The CUDA compiler version shares the implementation with the C++ compiler
|
||||
#define _CCCL_CUDA_COMPILER_MAKE_VERSION(_MAJOR, _MINOR) _CCCL_COMPILER_MAKE_VERSION(_MAJOR, _MINOR)
|
||||
#define _CCCL_CUDA_COMPILER(...) _CCCL_VERSION_COMPARE(_CCCL_CUDA_COMPILER_, _CCCL_CUDA_COMPILER_##__VA_ARGS__)
|
||||
|
||||
#define _CCCL_CUDA_COMPILER_NVCC() _CCCL_VERSION_INVALID()
|
||||
#define _CCCL_CUDA_COMPILER_NVHPC() _CCCL_VERSION_INVALID()
|
||||
#define _CCCL_CUDA_COMPILER_CLANG() _CCCL_VERSION_INVALID()
|
||||
#define _CCCL_CUDA_COMPILER_NVRTC() _CCCL_VERSION_INVALID()
|
||||
|
||||
// Determine the cuda compiler
|
||||
#if _CCCL_CUDA_COMPILATION()
|
||||
# if defined(__NVCC__)
|
||||
# undef _CCCL_CUDA_COMPILER_NVCC
|
||||
# define _CCCL_CUDA_COMPILER_NVCC() (__CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__)
|
||||
# elif defined(_NVHPC_CUDA)
|
||||
# undef _CCCL_CUDA_COMPILER_NVHPC
|
||||
# define _CCCL_CUDA_COMPILER_NVHPC() _CCCL_COMPILER_NVHPC()
|
||||
# elif defined(__CUDA__) && _CCCL_COMPILER(CLANG)
|
||||
# undef _CCCL_CUDA_COMPILER_CLANG
|
||||
# define _CCCL_CUDA_COMPILER_CLANG() _CCCL_COMPILER_CLANG()
|
||||
# elif _CCCL_COMPILER(NVRTC)
|
||||
# undef _CCCL_CUDA_COMPILER_NVRTC
|
||||
# define _CCCL_CUDA_COMPILER_NVRTC() _CCCL_COMPILER_NVRTC()
|
||||
# endif // ^^^ _CCCL_COMPILER(NVRTC) ^^^
|
||||
#endif // _CCCL_CUDA_COMPILATION()
|
||||
|
||||
// Determine if we are compiling host code, this includes both CUDA and C++ compilation
|
||||
// nvc++ does not define __CUDA_ARCH__, but it compiles both host and device code at the same time
|
||||
#if !defined(__CUDA_ARCH__)
|
||||
# define _CCCL_HOST_COMPILATION() 1
|
||||
#else // ^^^ compiling host code ^^^ / vvv not compiling host code vvv
|
||||
# define _CCCL_HOST_COMPILATION() 0
|
||||
#endif // ^^^ not compiling host code ^^^
|
||||
|
||||
#if (_CCCL_CUDA_COMPILATION() && defined(__CUDA_ARCH__)) || _CCCL_CUDA_COMPILER(NVHPC)
|
||||
# define _CCCL_DEVICE_COMPILATION() 1
|
||||
#else // ^^^ compiling device code ^^^ / vvv not compiling device code vvv
|
||||
# define _CCCL_DEVICE_COMPILATION() 0
|
||||
#endif // ^^^ not compiling device code ^^^
|
||||
|
||||
#if defined(__CUDACC_TILE__) && _CCCL_CUDA_COMPILER(NVCC, >, 13, 3)
|
||||
# define _CCCL_TILE_COMPILATION() 1
|
||||
#else // ^^^ compiling .cu file in tile mode ^^^ / vvv not compiling in tile mode vvv
|
||||
# define _CCCL_TILE_COMPILATION() 0
|
||||
#endif // ^^^ not compiling .cu file ^^^
|
||||
|
||||
#define _CCCL_CUDACC_MAKE_VERSION(_MAJOR, _MINOR) ((_MAJOR) * 1000 + (_MINOR) * 10)
|
||||
|
||||
// clang-cuda does not define __CUDACC_VER_MAJOR__ and friends. They are instead retrieved from the CUDA_VERSION macro
|
||||
// defined in "cuda.h". clang-cuda automatically pre-includes "__clang_cuda_runtime_wrapper.h" which includes "cuda.h"
|
||||
#if _CCCL_CUDA_COMPILER(NVCC) || _CCCL_CUDA_COMPILER(NVHPC) || _CCCL_CUDA_COMPILER(NVRTC)
|
||||
# define _CCCL_CUDACC() (__CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__)
|
||||
#elif _CCCL_CUDA_COMPILER(CLANG)
|
||||
# define _CCCL_CUDACC() (CUDA_VERSION / 1000, (CUDA_VERSION % 1000) / 10)
|
||||
#endif // ^^^ has cuda compiler ^^^
|
||||
|
||||
#if !defined(_CCCL_CUDACC) || !_CCCL_CUDA_COMPILATION()
|
||||
# undef _CCCL_CUDACC
|
||||
# define _CCCL_CUDACC() _CCCL_VERSION_INVALID()
|
||||
#endif // !_CCCL_CUDACC || !_CCCL_CUDA_COMPILATION()
|
||||
|
||||
#define _CCCL_CUDACC_EQUAL(...) _CCCL_VERSION_COMPARE(_CCCL_CUDACC_, _CCCL_CUDACC, ==, __VA_ARGS__)
|
||||
#define _CCCL_CUDACC_BELOW(...) _CCCL_VERSION_COMPARE(_CCCL_CUDACC_, _CCCL_CUDACC, <, __VA_ARGS__)
|
||||
#define _CCCL_CUDACC_AT_LEAST(...) _CCCL_VERSION_COMPARE(_CCCL_CUDACC_, _CCCL_CUDACC, >=, __VA_ARGS__)
|
||||
|
||||
#if _CCCL_CUDA_COMPILATION() && _CCCL_CUDACC_BELOW(12) && !defined(CCCL_IGNORE_DEPRECATED_CUDA_BELOW_12)
|
||||
# error "CUDA versions below 12 are not supported." \
|
||||
"Define CCCL_IGNORE_DEPRECATED_CUDA_BELOW_12 to suppress this message."
|
||||
#endif
|
||||
|
||||
// Define the pragma for the host compiler
|
||||
#if _CCCL_COMPILER(MSVC)
|
||||
# define _CCCL_PRAGMA(_ARG) __pragma(_ARG)
|
||||
#else
|
||||
# define _CCCL_PRAGMA(_ARG) _Pragma(_CCCL_TO_STRING(_ARG))
|
||||
#endif // _CCCL_COMPILER(MSVC)
|
||||
|
||||
// Define the proper object format for NVHPC and NVRTC
|
||||
#if (_CCCL_COMPILER(NVHPC) && defined(__linux__)) || _CCCL_COMPILER(NVRTC)
|
||||
# ifndef __ELF__
|
||||
# define __ELF__
|
||||
# endif // !__ELF__
|
||||
#endif // _CCCL_COMPILER(NVHPC) || _CCCL_COMPILER(NVRTC)
|
||||
|
||||
#if _CCCL_DEVICE_COMPILATION()
|
||||
# define _CCCL_PRAGMA_UNROLL(_N) _CCCL_PRAGMA(unroll _N)
|
||||
# define _CCCL_PRAGMA_UNROLL_FULL() _CCCL_PRAGMA(unroll)
|
||||
#elif _CCCL_COMPILER(NVHPC) || _CCCL_COMPILER(NVRTC) || _CCCL_COMPILER(CLANG)
|
||||
# define _CCCL_PRAGMA_UNROLL(_N) _CCCL_PRAGMA(unroll _N)
|
||||
# define _CCCL_PRAGMA_UNROLL_FULL() _CCCL_PRAGMA(unroll)
|
||||
#elif _CCCL_COMPILER(GCC, >=, 8)
|
||||
// gcc supports only #pragma GCC unroll, but that causes problems when compiling with nvcc. So, we use #pragma unroll
|
||||
// when compiling device code, and #pragma GCC unroll when compiling host code, but we need to suppress the warning
|
||||
// about the unknown pragma for nvcc.
|
||||
// #pragma GCC unroll does not support full unrolling, so we use the maximum value that it supports.
|
||||
# define _CCCL_PRAGMA_UNROLL(_N) \
|
||||
_CCCL_BEGIN_NV_DIAG_SUPPRESS(1675) _CCCL_PRAGMA(GCC unroll _N) _CCCL_END_NV_DIAG_SUPPRESS()
|
||||
# define _CCCL_PRAGMA_UNROLL_FULL() _CCCL_PRAGMA_UNROLL(65534)
|
||||
#else // ^^^ has pragma unroll support ^^^ / vvv no pragma unroll support vvv
|
||||
# define _CCCL_PRAGMA_UNROLL(_N)
|
||||
# define _CCCL_PRAGMA_UNROLL_FULL()
|
||||
#endif // ^^^ no pragma unroll support ^^^
|
||||
|
||||
#define _CCCL_PRAGMA_NOUNROLL() _CCCL_PRAGMA_UNROLL(1)
|
||||
|
||||
#if _CCCL_COMPILER(MSVC)
|
||||
# define _CCCL_WARNING(_MSG) _CCCL_PRAGMA(message(__FILE__ ":" _CCCL_TO_STRING(__LINE__) ": warning: " _MSG))
|
||||
#else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC) vvv
|
||||
# define _CCCL_WARNING(_MSG) _CCCL_PRAGMA(GCC warning _MSG)
|
||||
#endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
// Freestanding environment detection
|
||||
// NVRTC is treated as freestanding since it has no access to the host standard library
|
||||
#if defined(_CCCL_ENABLE_FREESTANDING) || _CCCL_COMPILER(NVRTC)
|
||||
# define _CCCL_FREESTANDING() 1
|
||||
# define _CCCL_HOSTED() 0
|
||||
# define _CCCL_HOSTJIT() (!_CCCL_COMPILER(NVRTC))
|
||||
# define _CCCL_NO_TYPEID
|
||||
#else // ^^^ _CCCL_ENABLE_FREESTANDING || _CCCL_COMPILER(NVRTC) ^^^ / vvv Hosted environment vvv
|
||||
# define _CCCL_FREESTANDING() 0
|
||||
# define _CCCL_HOSTED() 1
|
||||
# define _CCCL_HOSTJIT() 0
|
||||
#endif // Hosted environment
|
||||
|
||||
#endif // __CCCL_COMPILER_H
|
||||
@@ -0,0 +1,118 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CCCL_CUDA_CAPABILITIES
|
||||
#define __CCCL_CUDA_CAPABILITIES
|
||||
|
||||
#include <cuda/std/__cccl/system_header.h>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__cccl/cuda_toolkit.h>
|
||||
|
||||
#include <nv/target>
|
||||
|
||||
/// In device code, _CCCL_PTX_ARCH() expands to the PTX version for which we are compiling.
|
||||
/// In host code, _CCCL_PTX_ARCH()'s value is implementation defined.
|
||||
#if !defined(__CUDA_ARCH__)
|
||||
# define _CCCL_PTX_ARCH() 0
|
||||
#else
|
||||
# define _CCCL_PTX_ARCH() __CUDA_ARCH__
|
||||
#endif
|
||||
|
||||
#ifdef _CCCL_DOXYGEN_INVOKED // Only parse this during doxygen passes:
|
||||
//! When this macro is defined, Programmatic Dependent Launch (PDL) is disabled across CCCL
|
||||
# define CCCL_DISABLE_PDL
|
||||
#endif // _CCCL_DOXYGEN_INVOKED
|
||||
|
||||
#ifdef CCCL_DISABLE_PDL
|
||||
# define _CCCL_HAS_PDL() 0
|
||||
#else // CCCL_DISABLE_PDL
|
||||
# define _CCCL_HAS_PDL() 1
|
||||
#endif // CCCL_DISABLE_PDL
|
||||
|
||||
#if _CCCL_HAS_PDL()
|
||||
// Waits for the previous kernel to complete (when it reaches its final membar). Should be put before the first global
|
||||
// memory access in a kernel.
|
||||
# define _CCCL_PDL_GRID_DEPENDENCY_SYNC() NV_IF_TARGET(NV_PROVIDES_SM_90, ::cudaGridDependencySynchronize();)
|
||||
// Allows the subsequent kernel in the same stream to launch. Can be put anywhere in a kernel.
|
||||
// Heuristic(ahendriksen): put it after the last load.
|
||||
# define _CCCL_PDL_TRIGGER_NEXT_LAUNCH() NV_IF_TARGET(NV_PROVIDES_SM_90, ::cudaTriggerProgrammaticLaunchCompletion();)
|
||||
#else // _CCCL_HAS_PDL()
|
||||
# define _CCCL_PDL_GRID_DEPENDENCY_SYNC()
|
||||
# define _CCCL_PDL_TRIGGER_NEXT_LAUNCH()
|
||||
#endif // _CCCL_HAS_PDL()
|
||||
|
||||
// Check whether the relocatable device code (RDC) is being generated.
|
||||
#if defined(__CUDACC_RDC__) || defined(__CLANG_RDC__) || defined(_NVHPC_RDC)
|
||||
# define _CCCL_HAS_RDC() 1
|
||||
#else // ^^^ has RDC ^^^ / vvv no RDC vvv
|
||||
# define _CCCL_HAS_RDC() 0
|
||||
#endif // ^^^ no RDC ^^^
|
||||
|
||||
// Check whether extensible whole program is being compiled.
|
||||
#if defined(__CUDACC_EWP__)
|
||||
# define _CCCL_HAS_EWP() 1
|
||||
#else // ^^^ has EWP ^^^ / vvv no EWP vvv
|
||||
# define _CCCL_HAS_EWP() 0
|
||||
#endif // ^^^ no EWP ^^^
|
||||
|
||||
// Control whether device runtime APIs can be used, because they require libcudadevrt to be linked. Defaults to true
|
||||
// when RDC or EWP are enabled. Can be disabled by defining CCCL_DISABLE_DEVICE_RUNTIME.
|
||||
#if (_CCCL_HAS_RDC() || _CCCL_HAS_EWP()) && !defined(CCCL_DISABLE_DEVICE_RUNTIME)
|
||||
# define _CCCL_HAS_DEVICE_RUNTIME() 1
|
||||
#else // ^^^ has device runtime ^^^ / vvv no device runtime vvv
|
||||
# define _CCCL_HAS_DEVICE_RUNTIME() 0
|
||||
#endif // ^^^ no device runtime ^^^
|
||||
|
||||
// Some functions can be called from host or device code and launch kernels inside. Thus, they use CUDA Dynamic
|
||||
// Parallelism (CDP) and require compiling with Relocatable Device Code (RDC) or extensible whole program (EWP) and link
|
||||
// with device runtime library. CDP is unsupported with clang-cuda below 22.
|
||||
// TODO(bgruber): remove CUB_DISABLE_CDP in CCCL 4.0
|
||||
#if _CCCL_HAS_DEVICE_RUNTIME() && !defined(CCCL_DISABLE_CDP) && !defined(CUB_DISABLE_CDP) \
|
||||
&& !_CCCL_CUDA_COMPILER(CLANG, <, 22)
|
||||
// We have CDP, so host and device APIs can call kernels
|
||||
# define _CCCL_HAS_CDP() 1
|
||||
#else // ^^^ has CDP ^^^ / vvv no CDP vvv
|
||||
// We don't have CDP, only host APIs can call kernels
|
||||
# define _CCCL_HAS_CDP() 0
|
||||
#endif // ^^^ no CDP ^^^
|
||||
|
||||
// When RDC is enabled, __launch_bounds__ cannot be used reliably. See #902.
|
||||
#if !_CCCL_HAS_RDC() && !defined(CCCL_DISABLE_LAUNCH_BOUNDS)
|
||||
# define _CCCL_LAUNCH_BOUNDS(...) __launch_bounds__(__VA_ARGS__)
|
||||
#else // ^^^ has launch bounds attribute ^^^ / vvv no launch bounds attribute vvv
|
||||
# define _CCCL_LAUNCH_BOUNDS(...)
|
||||
#endif // ^^^ no launch bounds attribute ^^^
|
||||
|
||||
// __block_size__ attribute is available for nvcc and nvrtc 12.9+ for hopper+ architectures. For older nvcc and nvrtc,
|
||||
// we can fallback to __cluster_dims__ attribute only specifying the ncta per cluster.
|
||||
// This attribute should be used only for cluster launches.
|
||||
#if (_CCCL_CUDA_COMPILER(NVCC, >=, 12, 9) || _CCCL_CUDA_COMPILER(NVRTC, >=, 12, 9)) && _CCCL_PTX_ARCH() >= 900
|
||||
# define _CCCL_BLOCK_SIZE(_NTID, _NCTA_PER_CLUSTER) __block_size__(_NTID, _NCTA_PER_CLUSTER)
|
||||
#elif (_CCCL_CUDA_COMPILER(NVCC) || _CCCL_CUDA_COMPILER(NVRTC)) && _CCCL_PTX_ARCH() >= 900
|
||||
# define _CCCL_BLOCK_SIZE(_NTID, _NCTA_PER_CLUSTER) __cluster_dims__ _NCTA_PER_CLUSTER
|
||||
#else // ^^ has __block_size__ attribute ^^^ / vvv no __block_size__ attribute vvv
|
||||
# define _CCCL_BLOCK_SIZE(_NTID, _NCTA_PER_CLUSTER)
|
||||
#endif // ^^^ no __block_size__ attribute ^^^
|
||||
|
||||
#if _CCCL_HAS_CDP()
|
||||
# ifdef CUDA_FORCE_CDP1_IF_SUPPORTED
|
||||
# error "CUDA Dynamic Parallelism 1 is no longer supported. Please undefine CUDA_FORCE_CDP1_IF_SUPPORTED."
|
||||
# endif // CUDA_FORCE_CDP1_IF_SUPPORTED
|
||||
#endif // _CCCL_HAS_CDP()
|
||||
|
||||
#endif // __CCCL_CUDA_CAPABILITIES
|
||||
@@ -0,0 +1,56 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CCCL_CUDA_TOOLKIT_H
|
||||
#define __CCCL_CUDA_TOOLKIT_H
|
||||
|
||||
#include <cuda/std/__cccl/compiler.h>
|
||||
#include <cuda/std/__cccl/system_header.h>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#if _CCCL_CUDA_COMPILATION() || __has_include(<cuda_runtime_api.h>)
|
||||
# define _CCCL_HAS_CTK() 1
|
||||
#else // ^^^ has cuda toolkit ^^^ / vvv no cuda toolkit vvv
|
||||
# define _CCCL_HAS_CTK() 0
|
||||
#endif // ^^^ no cuda toolkit ^^^
|
||||
|
||||
// CUDA compilers preinclude cuda_runtime.h, so we need to include it here to get the CUDART_VERSION macro
|
||||
#if _CCCL_HAS_CTK() && !_CCCL_CUDA_COMPILATION()
|
||||
# include <cuda_runtime_api.h>
|
||||
#endif // _CCCL_HAS_CTK() && !_CCCL_CUDA_COMPILATION()
|
||||
|
||||
// Check compatibility of the CUDA compiler and CUDA toolkit headers
|
||||
// Some users might want to use a newer version of the CTK than the compiler ships. Enable that on their own peril
|
||||
#ifndef CCCL_DISABLE_CTK_COMPATIBILITY_CHECK
|
||||
# if _CCCL_CUDA_COMPILATION()
|
||||
# if !_CCCL_CUDACC_EQUAL((CUDART_VERSION / 1000), (CUDART_VERSION % 1000) / 10)
|
||||
# error "CUDA compiler and CUDA toolkit headers are incompatible, please check your include paths"
|
||||
# endif // !_CCCL_CUDACC_EQUAL((CUDART_VERSION / 1000), (CUDART_VERSION % 1000) / 10)
|
||||
# endif // _CCCL_CUDA_COMPILATION()
|
||||
#endif // CCCL_DISABLE_CTK_COMPATIBILITY_CHECK
|
||||
|
||||
#if _CCCL_HAS_CTK()
|
||||
# define _CCCL_CTK() (CUDART_VERSION / 1000, (CUDART_VERSION % 1000) / 10)
|
||||
#else // ^^^ has cuda toolkit ^^^ / vvv no cuda toolkit vvv
|
||||
# define _CCCL_CTK() _CCCL_VERSION_INVALID()
|
||||
#endif // ^^^ no cuda toolkit ^^^
|
||||
|
||||
#define _CCCL_CTK_MAKE_VERSION(_MAJOR, _MINOR) ((_MAJOR) * 1000 + (_MINOR) * 10)
|
||||
#define _CCCL_CTK_BELOW(...) _CCCL_VERSION_COMPARE(_CCCL_CTK_, _CCCL_CTK, <, __VA_ARGS__)
|
||||
#define _CCCL_CTK_AT_LEAST(...) _CCCL_VERSION_COMPARE(_CCCL_CTK_, _CCCL_CTK, >=, __VA_ARGS__)
|
||||
|
||||
#endif // __CCCL_CUDA_TOOLKIT_H
|
||||
@@ -0,0 +1,87 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CCCL_DEPRECATED_H
|
||||
#define __CCCL_DEPRECATED_H
|
||||
|
||||
#include <cuda/std/__cccl/attributes.h>
|
||||
#include <cuda/std/__cccl/compiler.h>
|
||||
#include <cuda/std/__cccl/dialect.h>
|
||||
#include <cuda/std/__cccl/system_header.h>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
// Check for deprecation opt outs
|
||||
#if defined(LIBCUDACXX_IGNORE_DEPRECATED_CPP_DIALECT)
|
||||
# if !defined(CCCL_IGNORE_DEPRECATED_CPP_DIALECT)
|
||||
# define CCCL_IGNORE_DEPRECATED_CPP_DIALECT
|
||||
# endif
|
||||
#endif // suppress all dialect deprecation warnings
|
||||
#if defined(LIBCUDACXX_IGNORE_DEPRECATED_CPP_14) || defined(CCCL_IGNORE_DEPRECATED_CPP_DIALECT)
|
||||
# if !defined(CCCL_IGNORE_DEPRECATED_CPP_14)
|
||||
# define CCCL_IGNORE_DEPRECATED_CPP_14
|
||||
# endif
|
||||
#endif // suppress all c++14 dialect deprecation warnings
|
||||
#if defined(LIBCUDACXX_IGNORE_DEPRECATED_CPP_11) || defined(CCCL_IGNORE_DEPRECATED_CPP_DIALECT) \
|
||||
|| defined(CCCL_IGNORE_DEPRECATED_CPP_14)
|
||||
# if !defined(CCCL_IGNORE_DEPRECATED_CPP_11)
|
||||
# define CCCL_IGNORE_DEPRECATED_CPP_11
|
||||
# endif
|
||||
#endif // suppress all c++11 dialect deprecation warnings
|
||||
#if defined(LIBCUDACXX_IGNORE_DEPRECATED_COMPILER) || defined(THRUST_IGNORE_DEPRECATED_COMPILER) \
|
||||
|| defined(CUB_IGNORE_DEPRECATED_COMPILER) || defined(CCCL_IGNORE_DEPRECATED_CPP_DIALECT) \
|
||||
|| defined(CCCL_IGNORE_DEPRECATED_CPP_14) || defined(CCCL_IGNORE_DEPRECATED_CPP_11)
|
||||
# if !defined(CCCL_IGNORE_DEPRECATED_COMPILER)
|
||||
# define CCCL_IGNORE_DEPRECATED_COMPILER
|
||||
# endif
|
||||
#endif // suppress all compiler deprecation warnings
|
||||
#if defined(LIBCUDACXX_IGNORE_DEPRECATED_API) || defined(THRUST_IGNORE_DEPRECATED_API) \
|
||||
|| defined(CUB_IGNORE_DEPRECATED_API)
|
||||
# if !defined(CCCL_IGNORE_DEPRECATED_API)
|
||||
# define CCCL_IGNORE_DEPRECATED_API
|
||||
# endif
|
||||
#endif // suppress all API deprecation warnings
|
||||
|
||||
#if defined(CCCL_IGNORE_DEPRECATED_API) || defined(_LIBCUDACXX_DISABLE_DEPRECATION_WARNINGS)
|
||||
//! deprecated [Since 2.8]
|
||||
# define CCCL_DEPRECATED
|
||||
//! deprecated [Since 2.8]
|
||||
# define CCCL_DEPRECATED_BECAUSE(MSG)
|
||||
#elif _CCCL_HAS_ATTRIBUTE(deprecated)
|
||||
//! deprecated [Since 2.8]
|
||||
# define CCCL_DEPRECATED __attribute__((deprecated))
|
||||
//! deprecated [Since 2.8]
|
||||
# define CCCL_DEPRECATED_BECAUSE(MSG) __attribute__((deprecated(MSG)))
|
||||
#else // ^^^ attribute deprecated ^^^ / vvv standard deprecated attribute vvv
|
||||
//! deprecated [Since 2.8]
|
||||
# define CCCL_DEPRECATED [[deprecated]]
|
||||
//! deprecated [Since 2.8]
|
||||
# define CCCL_DEPRECATED_BECAUSE(MSG) [[deprecated(MSG)]]
|
||||
#endif // ^^^ standard deprecated attribute ^^^
|
||||
|
||||
#if _CCCL_STD_VER >= 2020
|
||||
# define _CCCL_DEPRECATED_IN_CXX20 CCCL_DEPRECATED
|
||||
#else // ^^^ _CCCL_STD_VER >= 2020 ^^^ / vvv _CCCL_STD_VER < 2020 vvv
|
||||
# define _CCCL_DEPRECATED_IN_CXX20
|
||||
#endif // ^^^ _CCCL_STD_VER < 2020 ^^^
|
||||
|
||||
#if _CCCL_STD_VER >= 2023
|
||||
# define _CCCL_DEPRECATED_IN_CXX23 CCCL_DEPRECATED
|
||||
#else // ^^^ _CCCL_STD_VER >= 2023 ^^^ / vvv _CCCL_STD_VER < 2023 vvv
|
||||
# define _CCCL_DEPRECATED_IN_CXX23
|
||||
#endif // ^^^ _CCCL_STD_VER < 2023 ^^^
|
||||
|
||||
#endif // __CCCL_DEPRECATED_H
|
||||
@@ -0,0 +1,145 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CCCL_DIAGNOSTIC_H
|
||||
#define __CCCL_DIAGNOSTIC_H
|
||||
|
||||
#include <cuda/std/__cccl/compiler.h>
|
||||
#include <cuda/std/__cccl/system_header.h>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
// Enable us to selectively silence host compiler warnings
|
||||
#if _CCCL_COMPILER(CLANG)
|
||||
# define _CCCL_DIAG_PUSH _CCCL_PRAGMA(clang diagnostic push)
|
||||
# define _CCCL_DIAG_POP _CCCL_PRAGMA(clang diagnostic pop)
|
||||
# define _CCCL_DIAG_SUPPRESS_CLANG(_WARNING) _CCCL_PRAGMA(clang diagnostic ignored _WARNING)
|
||||
# define _CCCL_DIAG_SUPPRESS_GCC(_WARNING)
|
||||
# define _CCCL_DIAG_SUPPRESS_NVHPC(_WARNING)
|
||||
# define _CCCL_DIAG_SUPPRESS_MSVC(_WARNING)
|
||||
#elif _CCCL_COMPILER(GCC)
|
||||
# define _CCCL_DIAG_PUSH _CCCL_PRAGMA(GCC diagnostic push)
|
||||
# define _CCCL_DIAG_POP _CCCL_PRAGMA(GCC diagnostic pop)
|
||||
# define _CCCL_DIAG_SUPPRESS_CLANG(_WARNING)
|
||||
# define _CCCL_DIAG_SUPPRESS_GCC(_WARNING) _CCCL_PRAGMA(GCC diagnostic ignored _WARNING)
|
||||
# define _CCCL_DIAG_SUPPRESS_NVHPC(_WARNING)
|
||||
# define _CCCL_DIAG_SUPPRESS_MSVC(_WARNING)
|
||||
#elif _CCCL_COMPILER(NVHPC)
|
||||
# define _CCCL_DIAG_PUSH _CCCL_PRAGMA(diagnostic push)
|
||||
# define _CCCL_DIAG_POP _CCCL_PRAGMA(diagnostic pop)
|
||||
# define _CCCL_DIAG_SUPPRESS_CLANG(_WARNING)
|
||||
# define _CCCL_DIAG_SUPPRESS_GCC(_WARNING)
|
||||
# define _CCCL_DIAG_SUPPRESS_NVHPC(_WARNING) _CCCL_PRAGMA(diag_suppress _WARNING)
|
||||
# define _CCCL_DIAG_SUPPRESS_MSVC(_WARNING)
|
||||
#elif _CCCL_COMPILER(MSVC)
|
||||
# define _CCCL_DIAG_PUSH _CCCL_PRAGMA(warning(push))
|
||||
# define _CCCL_DIAG_POP _CCCL_PRAGMA(warning(pop))
|
||||
# define _CCCL_DIAG_SUPPRESS_CLANG(_WARNING)
|
||||
# define _CCCL_DIAG_SUPPRESS_GCC(_WARNING)
|
||||
# define _CCCL_DIAG_SUPPRESS_NVHPC(_WARNING)
|
||||
# define _CCCL_DIAG_SUPPRESS_MSVC(_WARNING) _CCCL_PRAGMA(warning(disable : _WARNING))
|
||||
#else
|
||||
# define _CCCL_DIAG_PUSH
|
||||
# define _CCCL_DIAG_POP
|
||||
# define _CCCL_DIAG_SUPPRESS_CLANG(_WARNING)
|
||||
# define _CCCL_DIAG_SUPPRESS_GCC(_WARNING)
|
||||
# define _CCCL_DIAG_SUPPRESS_NVHPC(_WARNING)
|
||||
# define _CCCL_DIAG_SUPPRESS_MSVC(_WARNING)
|
||||
#endif
|
||||
|
||||
// Enable us to selectively silence cuda compiler warnings
|
||||
#if _CCCL_CUDA_COMPILER(NVCC) || _CCCL_COMPILER(NVRTC)
|
||||
# if defined(__NVCC_DIAG_PRAGMA_SUPPORT__)
|
||||
# define _CCCL_NV_DIAG_PUSH() _CCCL_PRAGMA(nv_diagnostic push)
|
||||
# define _CCCL_NV_DIAG_POP() _CCCL_PRAGMA(nv_diagnostic pop)
|
||||
# define _CCCL_DIAG_SUPPRESS_NVCC(_WARNING) _CCCL_PRAGMA(nv_diag_suppress _WARNING)
|
||||
# define _CCCL_BEGIN_NV_DIAG_SUPPRESS(...) \
|
||||
_CCCL_NV_DIAG_PUSH() _CCCL_PP_FOR_EACH(_CCCL_DIAG_SUPPRESS_NVCC, __VA_ARGS__)
|
||||
# define _CCCL_END_NV_DIAG_SUPPRESS() _CCCL_NV_DIAG_POP()
|
||||
# else // ^^^ __NVCC_DIAG_PRAGMA_SUPPORT__ ^^^ / vvv !__NVCC_DIAG_PRAGMA_SUPPORT__ vvv
|
||||
# define _CCCL_NV_DIAG_PUSH() _CCCL_PRAGMA(diagnostic push)
|
||||
# define _CCCL_NV_DIAG_POP() _CCCL_PRAGMA(diagnostic pop)
|
||||
# define _CCCL_DIAG_SUPPRESS_NVCC(_WARNING) _CCCL_PRAGMA(diag_suppress _WARNING)
|
||||
# define _CCCL_BEGIN_NV_DIAG_SUPPRESS(...) \
|
||||
_CCCL_NV_DIAG_PUSH() _CCCL_PP_FOR_EACH(_CCCL_DIAG_SUPPRESS_NVCC, __VA_ARGS__)
|
||||
# define _CCCL_END_NV_DIAG_SUPPRESS() _CCCL_NV_DIAG_POP()
|
||||
# endif // !__NVCC_DIAG_PRAGMA_SUPPORT__
|
||||
#else // ^^^ _CCCL_CUDA_COMPILER(NVCC) ^^^ / vvv !_CCCL_CUDA_COMPILER(NVCC) vvv
|
||||
# define _CCCL_NV_DIAG_PUSH()
|
||||
# define _CCCL_NV_DIAG_POP()
|
||||
# define _CCCL_DIAG_SUPPRESS_NVCC(_WARNING)
|
||||
# define _CCCL_BEGIN_NV_DIAG_SUPPRESS(...)
|
||||
# define _CCCL_END_NV_DIAG_SUPPRESS()
|
||||
#endif // !_CCCL_CUDA_COMPILER(NVCC)
|
||||
|
||||
// Convenient shortcuts to silence common warnings
|
||||
#if _CCCL_COMPILER(CLANG)
|
||||
# define _CCCL_SUPPRESS_DEPRECATED_PUSH \
|
||||
_CCCL_DIAG_PUSH \
|
||||
_CCCL_DIAG_SUPPRESS_CLANG("-Wdeprecated") \
|
||||
_CCCL_DIAG_SUPPRESS_CLANG("-Wdeprecated-declarations") \
|
||||
_CCCL_BEGIN_NV_DIAG_SUPPRESS(1444, 20199)
|
||||
# define _CCCL_SUPPRESS_DEPRECATED_NVRTC_DIAG
|
||||
# define _CCCL_SUPPRESS_DEPRECATED_POP _CCCL_NV_DIAG_POP() _CCCL_DIAG_POP
|
||||
#elif _CCCL_COMPILER(GCC)
|
||||
# define _CCCL_SUPPRESS_DEPRECATED_PUSH \
|
||||
_CCCL_DIAG_PUSH \
|
||||
_CCCL_DIAG_SUPPRESS_GCC("-Wdeprecated") \
|
||||
_CCCL_DIAG_SUPPRESS_GCC("-Wdeprecated-declarations") \
|
||||
_CCCL_BEGIN_NV_DIAG_SUPPRESS(1444, 20199)
|
||||
# define _CCCL_SUPPRESS_DEPRECATED_NVRTC_DIAG
|
||||
# define _CCCL_SUPPRESS_DEPRECATED_POP _CCCL_NV_DIAG_POP() _CCCL_DIAG_POP
|
||||
#elif _CCCL_COMPILER(NVHPC)
|
||||
# define _CCCL_SUPPRESS_DEPRECATED_PUSH \
|
||||
_CCCL_DIAG_PUSH \
|
||||
_CCCL_DIAG_SUPPRESS_NVHPC(deprecated_entity) \
|
||||
_CCCL_DIAG_SUPPRESS_NVHPC(deprecated_entity_with_custom_message) \
|
||||
_CCCL_BEGIN_NV_DIAG_SUPPRESS(1444, 20199)
|
||||
# define _CCCL_SUPPRESS_DEPRECATED_NVRTC_DIAG
|
||||
# define _CCCL_SUPPRESS_DEPRECATED_POP _CCCL_NV_DIAG_POP() _CCCL_DIAG_POP
|
||||
#elif _CCCL_COMPILER(MSVC)
|
||||
# define _CCCL_SUPPRESS_DEPRECATED_PUSH \
|
||||
_CCCL_DIAG_PUSH \
|
||||
_CCCL_DIAG_SUPPRESS_MSVC(4996) \
|
||||
_CCCL_BEGIN_NV_DIAG_SUPPRESS(1444)
|
||||
# define _CCCL_SUPPRESS_DEPRECATED_NVRTC_DIAG
|
||||
# define _CCCL_SUPPRESS_DEPRECATED_POP _CCCL_NV_DIAG_POP() _CCCL_DIAG_POP
|
||||
#elif _CCCL_COMPILER(NVRTC)
|
||||
# if _CCCL_COMPILER(NVRTC, >=, 13, 3) && defined(__NVCC_DIAG_PRAGMA_SUPPORT__)
|
||||
# define _CCCL_SUPPRESS_DEPRECATED_PUSH _CCCL_NV_DIAG_PUSH()
|
||||
// NVRTC 13.3 does not honor nv_diag_suppress when it is emitted in the same macro expansion as
|
||||
// nv_diagnostic push. Keep the suppression in a separate source-level macro invocation.
|
||||
// See https://github.com/NVIDIA/cccl/issues/9170 and nvbug 6239043.
|
||||
# define _CCCL_SUPPRESS_DEPRECATED_NVRTC_DIAG _Pragma("nv_diag_suppress 1444,20199")
|
||||
# else // ^^^ NVRTC >= 13.3 with __NVCC_DIAG_PRAGMA_SUPPORT__ ^^^
|
||||
# define _CCCL_SUPPRESS_DEPRECATED_PUSH _CCCL_BEGIN_NV_DIAG_SUPPRESS(1444, 20199)
|
||||
# define _CCCL_SUPPRESS_DEPRECATED_NVRTC_DIAG
|
||||
# endif // ^^^ NVRTC >= 13.3 with __NVCC_DIAG_PRAGMA_SUPPORT__ ^^^
|
||||
# define _CCCL_SUPPRESS_DEPRECATED_POP _CCCL_NV_DIAG_POP()
|
||||
#else // unknown compiler
|
||||
# define _CCCL_SUPPRESS_DEPRECATED_PUSH
|
||||
# define _CCCL_SUPPRESS_DEPRECATED_NVRTC_DIAG
|
||||
# define _CCCL_SUPPRESS_DEPRECATED_POP
|
||||
#endif // unknown compiler
|
||||
|
||||
#if _CCCL_COMPILER(MSVC)
|
||||
# define _CCCL_HAS_PRAGMA_MSVC_WARNING
|
||||
# if !defined(_LIBCUDACXX_DISABLE_PRAGMA_MSVC_WARNING)
|
||||
# define _CCCL_USE_PRAGMA_MSVC_WARNING
|
||||
# endif // !_LIBCUDACXX_DISABLE_PRAGMA_MSVC_WARNING
|
||||
#endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
#endif // __CCCL_DIAGNOSTIC_H
|
||||
230
qwen3_6_scripts/cccl_preload/include/cuda/std/__cccl/dialect.h
Normal file
230
qwen3_6_scripts/cccl_preload/include/cuda/std/__cccl/dialect.h
Normal file
@@ -0,0 +1,230 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CCCL_DIALECT_H
|
||||
#define __CCCL_DIALECT_H
|
||||
|
||||
#include <cuda/std/__cccl/compiler.h>
|
||||
#include <cuda/std/__cccl/system_header.h>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__cccl/builtin.h>
|
||||
#include <cuda/std/__cccl/host_std_lib.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Determine the C++ standard dialect
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#if _CCCL_COMPILER(MSVC)
|
||||
# if _MSVC_LANG <= 201103L
|
||||
# define _CCCL_STD_VER 2011
|
||||
# elif _MSVC_LANG <= 201402L
|
||||
# define _CCCL_STD_VER 2014
|
||||
# elif _MSVC_LANG <= 201703L
|
||||
# define _CCCL_STD_VER 2017
|
||||
# elif _MSVC_LANG <= 202002L
|
||||
# define _CCCL_STD_VER 2020
|
||||
# else
|
||||
# define _CCCL_STD_VER 2023 // current year, or date of c++2b ratification
|
||||
# endif
|
||||
#else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC) vvv
|
||||
# if __cplusplus <= 199711L
|
||||
# define _CCCL_STD_VER 2003
|
||||
# elif __cplusplus <= 201103L
|
||||
# define _CCCL_STD_VER 2011
|
||||
# elif __cplusplus <= 201402L
|
||||
# define _CCCL_STD_VER 2014
|
||||
# elif __cplusplus <= 201703L
|
||||
# define _CCCL_STD_VER 2017
|
||||
# elif __cplusplus <= 202002L
|
||||
# define _CCCL_STD_VER 2020
|
||||
# elif __cplusplus <= 202302L
|
||||
# define _CCCL_STD_VER 2023
|
||||
# else
|
||||
# define _CCCL_STD_VER 2024 // current year, or date of c++2c ratification
|
||||
# endif
|
||||
#endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Conditionally enable constexpr per standard dialect
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if _CCCL_STD_VER >= 2020
|
||||
# define _CCCL_CONSTEXPR_CXX20 constexpr
|
||||
#else // ^^^ C++20 ^^^ / vvv C++17 vvv
|
||||
# define _CCCL_CONSTEXPR_CXX20
|
||||
#endif // _CCCL_STD_VER <= 2017
|
||||
|
||||
#if _CCCL_STD_VER >= 2023
|
||||
# define _CCCL_CONSTEXPR_CXX23 constexpr
|
||||
#else // ^^^ C++23 ^^^ / vvv C++20 vvv
|
||||
# define _CCCL_CONSTEXPR_CXX23
|
||||
#endif // _CCCL_STD_VER <= 2020
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Detect whether we can use some language features based on standard dialect
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// concepts are only available from C++20 onwards
|
||||
#if _CCCL_STD_VER <= 2017 || __cpp_concepts < 201907L
|
||||
# define _CCCL_HAS_CONCEPTS() 0
|
||||
#else // ^^^ no concepts ^^^ / vvv has concepts vvv
|
||||
# define _CCCL_HAS_CONCEPTS() 1
|
||||
#endif // ^^^ has concepts ^^^
|
||||
|
||||
// Three way comparison is only available from C++20 onwards
|
||||
#if _CCCL_STD_VER <= 2017 || __cpp_impl_three_way_comparison < 201907L
|
||||
# define _CCCL_NO_THREE_WAY_COMPARISON
|
||||
#endif // _CCCL_STD_VER <= 2017 || __cpp_impl_three_way_comparison < 201907L
|
||||
|
||||
// Some compilers turn on pack indexing in pre-C++26 code. We want to use it if it is
|
||||
// available.
|
||||
#if __cpp_pack_indexing >= 202311L && !_CCCL_CUDA_COMPILER(NVCC) && !_CCCL_COMPILER(CLANG, <, 20)
|
||||
# define _CCCL_HAS_PACK_INDEXING() 1
|
||||
#else // ^^^ has pack indexing ^^^ / vvv no pack indexing vvv
|
||||
# define _CCCL_HAS_PACK_INDEXING() 0
|
||||
#endif // no pack indexing
|
||||
|
||||
#if _CCCL_STD_VER <= 2017 || __cpp_consteval < 201811L
|
||||
# define _CCCL_NO_CONSTEVAL
|
||||
# define _CCCL_CONSTEVAL constexpr
|
||||
#else
|
||||
# define _CCCL_CONSTEVAL consteval
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Conditionally use certain language features depending on availability
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// We need to treat host and device separately
|
||||
#if _CCCL_DEVICE_COMPILATION() && !_CCCL_CUDA_COMPILER(NVHPC)
|
||||
# define _CCCL_GLOBAL_CONSTANT _CCCL_DEVICE constexpr
|
||||
#else // ^^^ _CCCL_DEVICE_COMPILATION() && !_CCCL_CUDA_COMPILER(NVHPC) ^^^ /
|
||||
// vvv !_CCCL_DEVICE_COMPILATION() || _CCCL_CUDA_COMPILER(NVHPC) vvv
|
||||
# define _CCCL_GLOBAL_CONSTANT inline constexpr
|
||||
#endif // !_CCCL_DEVICE_COMPILATION() || _CCCL_CUDA_COMPILER(NVHPC)
|
||||
|
||||
#if _CCCL_STD_VER >= 2020 && __cpp_constinit >= 201907L
|
||||
# define _CCCL_CONSTINIT constinit
|
||||
#else // ^^^ has constinit ^^^ / vvv no constinit vvv
|
||||
# define _CCCL_CONSTINIT _CCCL_REQUIRE_CONSTANT_INITIALIZATION
|
||||
#endif // ^^^ no constinit ^^^
|
||||
|
||||
// nvcc and nvrtc don't implement multiarg operator[] even in C++23 mode
|
||||
#if __cpp_multidimensional_subscript >= 202110L && !_CCCL_CUDA_COMPILER(NVCC) && !_CCCL_CUDA_COMPILER(NVRTC)
|
||||
# define _CCCL_HAS_MULTIARG_OPERATOR_BRACKETS() 1
|
||||
#else // ^^^ has multiarg operator[] ^^^ / vvv no multiarg operator[] vvv
|
||||
# define _CCCL_HAS_MULTIARG_OPERATOR_BRACKETS() 0
|
||||
#endif // ^^^ no mutiarg operator[] ^^^
|
||||
|
||||
// clang 16+, gcc 13+ and nvc++ 25.9+ backport the static subscript operator back to c++17.
|
||||
#if __cpp_multidimensional_subscript >= 202211L \
|
||||
|| ((_CCCL_COMPILER(CLANG, >=, 16) || _CCCL_COMPILER(GCC, >=, 13) \
|
||||
|| (_CCCL_COMPILER(NVHPC, >=, 25, 9) && _CCCL_HOST_STD_LIB(LIBSTDCXX, >=, 12))) \
|
||||
&& (!_CCCL_CUDA_COMPILATION() || _CCCL_CUDA_COMPILER(CLANG)))
|
||||
# define _CCCL_HAS_STATIC_SUBSCRIPT_OPERATOR() 1
|
||||
#else // ^^^ has static operator[] ^^^ / vvv no static operator[] vvv
|
||||
# define _CCCL_HAS_STATIC_SUBSCRIPT_OPERATOR() 0
|
||||
#endif // ^^^ no static operator[] ^^^
|
||||
|
||||
// nvcc 13+, clang 16+ and gcc 13+ backport the static call operator back to c++17.
|
||||
#if __cpp_static_call_operator >= 202207L \
|
||||
|| ((_CCCL_COMPILER(CLANG, >=, 16) || _CCCL_COMPILER(GCC, >=, 13) \
|
||||
|| (_CCCL_COMPILER(NVHPC, >=, 26, 1) && _CCCL_HOST_STD_LIB(LIBSTDCXX, >=, 13))) \
|
||||
&& (!_CCCL_CUDA_COMPILATION() || _CCCL_CUDA_COMPILER(NVCC, >=, 13, 0) || _CCCL_CUDA_COMPILER(CLANG)))
|
||||
# define _CCCL_HAS_STATIC_CALL_OPERATOR() 1
|
||||
#else // ^^^ has static operator() ^^^ / vvv no static operator() vvv
|
||||
# define _CCCL_HAS_STATIC_CALL_OPERATOR() 0
|
||||
#endif // ^^^ no static operator() ^^^
|
||||
|
||||
// if consteval requires C++23, but most compilers support it even in C++20 mode while emitting some warnings. Those are
|
||||
// silenced in prologue/epilogue. nvcc is happy about using it in C++20 since 13.0, but only when compiling host code.
|
||||
// nvc++ requires libstdc++ at least 12 to support if consteval.
|
||||
#if _CCCL_STD_VER == 2020 \
|
||||
&& (_CCCL_COMPILER(GCC, >=, 12) || _CCCL_COMPILER(CLANG) \
|
||||
|| (_CCCL_COMPILER(NVHPC) && _CCCL_HOST_STD_LIB(LIBSTDCXX, >=, 12)))
|
||||
# define _CCCL_HAS_IF_CONSTEVAL_IN_CXX20() 1
|
||||
#else
|
||||
# define _CCCL_HAS_IF_CONSTEVAL_IN_CXX20() 0
|
||||
#endif
|
||||
|
||||
// nvcc before 13 doesn't support if consteval at all. Since 13, it accepts if consteval in host code (clang doesn't
|
||||
// work) and since 13.1 it works in device code, too.
|
||||
#if _CCCL_CUDA_COMPILER(NVCC, <, 13) || (_CCCL_CUDA_COMPILER(NVCC, <, 13, 1) && _CCCL_DEVICE_COMPILATION()) \
|
||||
|| (_CCCL_CUDA_COMPILER(NVCC) && _CCCL_COMPILER(CLANG))
|
||||
# undef _CCCL_HAS_IF_CONSTEVAL_IN_CXX20
|
||||
# define _CCCL_HAS_IF_CONSTEVAL_IN_CXX20() 0
|
||||
#endif // ^^^ disable if consteval in c++20 for nvcc ^^^
|
||||
|
||||
#if __cpp_if_consteval >= 202106L || _CCCL_HAS_IF_CONSTEVAL_IN_CXX20()
|
||||
# define _CCCL_IF_CONSTEVAL if consteval
|
||||
# define _CCCL_IF_CONSTEVAL_DEFAULT _CCCL_IF_CONSTEVAL
|
||||
# define _CCCL_IF_NOT_CONSTEVAL if !consteval
|
||||
# define _CCCL_IF_NOT_CONSTEVAL_DEFAULT _CCCL_IF_NOT_CONSTEVAL
|
||||
#elif defined(_CCCL_BUILTIN_IS_CONSTANT_EVALUATED)
|
||||
# if _CCCL_HOST_COMPILATION() && _CCCL_COMPILER(GCC)
|
||||
# define _CCCL_BEGIN_IF_CONSTEVAL_SUPPRESS() _CCCL_DIAG_PUSH _CCCL_DIAG_SUPPRESS_GCC("-Wtautological-compare")
|
||||
# define _CCCL_END_IF_CONSTEVAL_SUPPRESS() _CCCL_DIAG_POP
|
||||
# else // ^^^ _CCCL_HOST_COMPILATION() && _CCCL_COMPILER(GCC) ^^^ /
|
||||
// vvv !_CCCL_HOST_COMPILATION() || ! _CCCL_COMPILER(GCC) vvv
|
||||
# define _CCCL_BEGIN_IF_CONSTEVAL_SUPPRESS()
|
||||
# define _CCCL_END_IF_CONSTEVAL_SUPPRESS()
|
||||
# endif // ^^^ !_CCCL_HOST_COMPILATION() || ! _CCCL_COMPILER(GCC) ^^^
|
||||
|
||||
# define _CCCL_IF_CONSTEVAL \
|
||||
_CCCL_BEGIN_IF_CONSTEVAL_SUPPRESS() if (_CCCL_BUILTIN_IS_CONSTANT_EVALUATED()) _CCCL_END_IF_CONSTEVAL_SUPPRESS()
|
||||
# define _CCCL_IF_CONSTEVAL_DEFAULT _CCCL_IF_CONSTEVAL
|
||||
# define _CCCL_IF_NOT_CONSTEVAL \
|
||||
_CCCL_BEGIN_IF_CONSTEVAL_SUPPRESS() if (!_CCCL_BUILTIN_IS_CONSTANT_EVALUATED()) _CCCL_END_IF_CONSTEVAL_SUPPRESS()
|
||||
# define _CCCL_IF_NOT_CONSTEVAL_DEFAULT _CCCL_IF_NOT_CONSTEVAL
|
||||
#else // ^^^ has is constant evaluated ^^^ / vvv no is constant evaluated vvv
|
||||
# define _CCCL_IF_CONSTEVAL if constexpr (false)
|
||||
# define _CCCL_IF_CONSTEVAL_DEFAULT if constexpr (true)
|
||||
# define _CCCL_IF_NOT_CONSTEVAL if constexpr (true)
|
||||
# define _CCCL_IF_NOT_CONSTEVAL_DEFAULT if constexpr (false)
|
||||
#endif // ^^^ no is constant evaluated ^^^
|
||||
|
||||
#if _CCCL_STD_VER >= 2020 && __cpp_char8_t >= 201811L
|
||||
# define _CCCL_HAS_CHAR8_T() 1
|
||||
#else // ^^^ has char8_t ^^^ / vvv no char8_t vvv
|
||||
# define _CCCL_HAS_CHAR8_T() 0
|
||||
#endif // ^^^ no char8_t ^^^
|
||||
|
||||
// We currently do not support any of the STL wchar facilities
|
||||
#define _CCCL_HAS_WCHAR_T() 0
|
||||
|
||||
// Fixme: replace the condition with (!_CCCL_DEVICE_COMPILATION())
|
||||
// FIXME: Enable this for clang-cuda in a followup
|
||||
#if !_CCCL_CUDA_COMPILATION() && !defined(CCCL_DISABLE_LONG_DOUBLE_SUPPORT)
|
||||
# define _CCCL_HAS_LONG_DOUBLE() 1
|
||||
#else // ^^^ has long double ^^^ / vvv no long double vvv
|
||||
# define _CCCL_HAS_LONG_DOUBLE() 0
|
||||
#endif // ^^^ no long double ^^^
|
||||
|
||||
// clang-21+ and gcc-16+ allow structured bindings to introduce a pack since C++17.
|
||||
#if __cpp_structured_bindings >= 202411L || _CCCL_COMPILER(CLANG, >=, 21) || _CCCL_COMPILER(GCC, >=, 16)
|
||||
# define _CCCL_HAS_STRUCTURED_BINDINGS_PACK() 1
|
||||
#else // ^^^ has structured bindings with pack ^^^ / vvv no structured bindings with pack vvv
|
||||
# define _CCCL_HAS_STRUCTURED_BINDINGS_PACK() 0
|
||||
#endif // ^^^ no structured bindings with pack ^^^
|
||||
|
||||
// nvcc doesn't implement structured bindings pack yet.
|
||||
#if _CCCL_CUDA_COMPILER(NVCC)
|
||||
# undef _CCCL_HAS_STRUCTURED_BINDINGS_PACK
|
||||
# define _CCCL_HAS_STRUCTURED_BINDINGS_PACK() 0
|
||||
#endif // _CCCL_CUDA_COMPILER(NVCC)
|
||||
|
||||
#endif // __CCCL_DIALECT_H
|
||||
390
qwen3_6_scripts/cccl_preload/include/cuda/std/__cccl/epilogue.h
Normal file
390
qwen3_6_scripts/cccl_preload/include/cuda/std/__cccl/epilogue.h
Normal file
@@ -0,0 +1,390 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// !!! DO NOT EDIT THIS FILE !!! This file is generated by utils/generate_prologue_epilogue.py.
|
||||
|
||||
// NO include guards here (this file is included multiple times)
|
||||
|
||||
#include <cuda/std/__cccl/compiler.h>
|
||||
#include <cuda/std/__cccl/diagnostic.h>
|
||||
|
||||
#if !defined(_CCCL_PROLOGUE_INCLUDED)
|
||||
# error "cccl internal error: <cuda/std/__cccl/prologue.h> must be included before <cuda/std/__cccl/epilogue.h>"
|
||||
#endif
|
||||
#undef _CCCL_PROLOGUE_INCLUDED
|
||||
|
||||
_CCCL_NV_DIAG_POP()
|
||||
_CCCL_DIAG_POP
|
||||
|
||||
// __declspec modifiers
|
||||
|
||||
#if defined(align)
|
||||
# error \
|
||||
"cccl internal error: macro `align` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_align)
|
||||
# pragma pop_macro("align")
|
||||
# undef _CCCL_POP_MACRO_align
|
||||
#endif
|
||||
|
||||
#if defined(allocate)
|
||||
# error \
|
||||
"cccl internal error: macro `allocate` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_allocate)
|
||||
# pragma pop_macro("allocate")
|
||||
# undef _CCCL_POP_MACRO_allocate
|
||||
#endif
|
||||
|
||||
#if defined(allocator)
|
||||
# error \
|
||||
"cccl internal error: macro `allocator` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_allocator)
|
||||
# pragma pop_macro("allocator")
|
||||
# undef _CCCL_POP_MACRO_allocator
|
||||
#endif
|
||||
|
||||
#if defined(appdomain)
|
||||
# error \
|
||||
"cccl internal error: macro `appdomain` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_appdomain)
|
||||
# pragma pop_macro("appdomain")
|
||||
# undef _CCCL_POP_MACRO_appdomain
|
||||
#endif
|
||||
|
||||
#if defined(code_seg)
|
||||
# error \
|
||||
"cccl internal error: macro `code_seg` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_code_seg)
|
||||
# pragma pop_macro("code_seg")
|
||||
# undef _CCCL_POP_MACRO_code_seg
|
||||
#endif
|
||||
|
||||
#if defined(deprecated)
|
||||
# error \
|
||||
"cccl internal error: macro `deprecated` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_deprecated)
|
||||
# pragma pop_macro("deprecated")
|
||||
# undef _CCCL_POP_MACRO_deprecated
|
||||
#endif
|
||||
|
||||
#if defined(dllimport)
|
||||
# error \
|
||||
"cccl internal error: macro `dllimport` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_dllimport)
|
||||
# pragma pop_macro("dllimport")
|
||||
# undef _CCCL_POP_MACRO_dllimport
|
||||
#endif
|
||||
|
||||
#if defined(dllexport)
|
||||
# error \
|
||||
"cccl internal error: macro `dllexport` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_dllexport)
|
||||
# pragma pop_macro("dllexport")
|
||||
# undef _CCCL_POP_MACRO_dllexport
|
||||
#endif
|
||||
|
||||
#if defined(empty_bases)
|
||||
# error \
|
||||
"cccl internal error: macro `empty_bases` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_empty_bases)
|
||||
# pragma pop_macro("empty_bases")
|
||||
# undef _CCCL_POP_MACRO_empty_bases
|
||||
#endif
|
||||
|
||||
#if defined(hybrid_patchable)
|
||||
# error \
|
||||
"cccl internal error: macro `hybrid_patchable` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_hybrid_patchable)
|
||||
# pragma pop_macro("hybrid_patchable")
|
||||
# undef _CCCL_POP_MACRO_hybrid_patchable
|
||||
#endif
|
||||
|
||||
#if defined(jitintrinsic)
|
||||
# error \
|
||||
"cccl internal error: macro `jitintrinsic` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_jitintrinsic)
|
||||
# pragma pop_macro("jitintrinsic")
|
||||
# undef _CCCL_POP_MACRO_jitintrinsic
|
||||
#endif
|
||||
|
||||
#if defined(lifetimebound)
|
||||
# error \
|
||||
"cccl internal error: macro `lifetimebound` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_lifetimebound)
|
||||
# pragma pop_macro("lifetimebound")
|
||||
# undef _CCCL_POP_MACRO_lifetimebound
|
||||
#endif
|
||||
|
||||
#if defined(naked)
|
||||
# error \
|
||||
"cccl internal error: macro `naked` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_naked)
|
||||
# pragma pop_macro("naked")
|
||||
# undef _CCCL_POP_MACRO_naked
|
||||
#endif
|
||||
|
||||
#if defined(noalias)
|
||||
# error \
|
||||
"cccl internal error: macro `noalias` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_noalias)
|
||||
# pragma pop_macro("noalias")
|
||||
# undef _CCCL_POP_MACRO_noalias
|
||||
#endif
|
||||
|
||||
#if defined(noinline)
|
||||
# error \
|
||||
"cccl internal error: macro `noinline` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_noinline)
|
||||
# pragma pop_macro("noinline")
|
||||
# undef _CCCL_POP_MACRO_noinline
|
||||
#endif
|
||||
|
||||
#if defined(noreturn)
|
||||
# error \
|
||||
"cccl internal error: macro `noreturn` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_noreturn)
|
||||
# pragma pop_macro("noreturn")
|
||||
# undef _CCCL_POP_MACRO_noreturn
|
||||
#endif
|
||||
|
||||
#if defined(nothrow)
|
||||
# error \
|
||||
"cccl internal error: macro `nothrow` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_nothrow)
|
||||
# pragma pop_macro("nothrow")
|
||||
# undef _CCCL_POP_MACRO_nothrow
|
||||
#endif
|
||||
|
||||
#if defined(novtable)
|
||||
# error \
|
||||
"cccl internal error: macro `novtable` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_novtable)
|
||||
# pragma pop_macro("novtable")
|
||||
# undef _CCCL_POP_MACRO_novtable
|
||||
#endif
|
||||
|
||||
#if defined(no_sanitize_address)
|
||||
# error \
|
||||
"cccl internal error: macro `no_sanitize_address` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_no_sanitize_address)
|
||||
# pragma pop_macro("no_sanitize_address")
|
||||
# undef _CCCL_POP_MACRO_no_sanitize_address
|
||||
#endif
|
||||
|
||||
#if defined(process)
|
||||
# error \
|
||||
"cccl internal error: macro `process` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_process)
|
||||
# pragma pop_macro("process")
|
||||
# undef _CCCL_POP_MACRO_process
|
||||
#endif
|
||||
|
||||
#if defined(property)
|
||||
# error \
|
||||
"cccl internal error: macro `property` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_property)
|
||||
# pragma pop_macro("property")
|
||||
# undef _CCCL_POP_MACRO_property
|
||||
#endif
|
||||
|
||||
#if defined(restrict)
|
||||
# error \
|
||||
"cccl internal error: macro `restrict` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_restrict)
|
||||
# pragma pop_macro("restrict")
|
||||
# undef _CCCL_POP_MACRO_restrict
|
||||
#endif
|
||||
|
||||
#if defined(safebuffers)
|
||||
# error \
|
||||
"cccl internal error: macro `safebuffers` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_safebuffers)
|
||||
# pragma pop_macro("safebuffers")
|
||||
# undef _CCCL_POP_MACRO_safebuffers
|
||||
#endif
|
||||
|
||||
#if defined(selectany)
|
||||
# error \
|
||||
"cccl internal error: macro `selectany` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_selectany)
|
||||
# pragma pop_macro("selectany")
|
||||
# undef _CCCL_POP_MACRO_selectany
|
||||
#endif
|
||||
|
||||
#if defined(spectre)
|
||||
# error \
|
||||
"cccl internal error: macro `spectre` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_spectre)
|
||||
# pragma pop_macro("spectre")
|
||||
# undef _CCCL_POP_MACRO_spectre
|
||||
#endif
|
||||
|
||||
#if defined(thread)
|
||||
# error \
|
||||
"cccl internal error: macro `thread` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_thread)
|
||||
# pragma pop_macro("thread")
|
||||
# undef _CCCL_POP_MACRO_thread
|
||||
#endif
|
||||
|
||||
#if defined(uuid)
|
||||
# error \
|
||||
"cccl internal error: macro `uuid` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_uuid)
|
||||
# pragma pop_macro("uuid")
|
||||
# undef _CCCL_POP_MACRO_uuid
|
||||
#endif
|
||||
|
||||
// [[msvc::attribute]] attributes
|
||||
|
||||
#if defined(msvc)
|
||||
# error \
|
||||
"cccl internal error: macro `msvc` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_msvc)
|
||||
# pragma pop_macro("msvc")
|
||||
# undef _CCCL_POP_MACRO_msvc
|
||||
#endif
|
||||
|
||||
#if defined(flatten)
|
||||
# error \
|
||||
"cccl internal error: macro `flatten` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_flatten)
|
||||
# pragma pop_macro("flatten")
|
||||
# undef _CCCL_POP_MACRO_flatten
|
||||
#endif
|
||||
|
||||
#if defined(forceinline)
|
||||
# error \
|
||||
"cccl internal error: macro `forceinline` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_forceinline)
|
||||
# pragma pop_macro("forceinline")
|
||||
# undef _CCCL_POP_MACRO_forceinline
|
||||
#endif
|
||||
|
||||
#if defined(forceinline_calls)
|
||||
# error \
|
||||
"cccl internal error: macro `forceinline_calls` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_forceinline_calls)
|
||||
# pragma pop_macro("forceinline_calls")
|
||||
# undef _CCCL_POP_MACRO_forceinline_calls
|
||||
#endif
|
||||
|
||||
#if defined(intrinsic)
|
||||
# error \
|
||||
"cccl internal error: macro `intrinsic` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_intrinsic)
|
||||
# pragma pop_macro("intrinsic")
|
||||
# undef _CCCL_POP_MACRO_intrinsic
|
||||
#endif
|
||||
|
||||
#if defined(noinline)
|
||||
# error \
|
||||
"cccl internal error: macro `noinline` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_noinline)
|
||||
# pragma pop_macro("noinline")
|
||||
# undef _CCCL_POP_MACRO_noinline
|
||||
#endif
|
||||
|
||||
#if defined(noinline_calls)
|
||||
# error \
|
||||
"cccl internal error: macro `noinline_calls` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_noinline_calls)
|
||||
# pragma pop_macro("noinline_calls")
|
||||
# undef _CCCL_POP_MACRO_noinline_calls
|
||||
#endif
|
||||
|
||||
#if defined(no_tls_guard)
|
||||
# error \
|
||||
"cccl internal error: macro `no_tls_guard` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_no_tls_guard)
|
||||
# pragma pop_macro("no_tls_guard")
|
||||
# undef _CCCL_POP_MACRO_no_tls_guard
|
||||
#endif
|
||||
|
||||
// Windows nasty macros
|
||||
|
||||
#if defined(min)
|
||||
# error \
|
||||
"cccl internal error: macro `min` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_min)
|
||||
# pragma pop_macro("min")
|
||||
# undef _CCCL_POP_MACRO_min
|
||||
#endif
|
||||
|
||||
#if defined(max)
|
||||
# error \
|
||||
"cccl internal error: macro `max` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_max)
|
||||
# pragma pop_macro("max")
|
||||
# undef _CCCL_POP_MACRO_max
|
||||
#endif
|
||||
|
||||
#if defined(interface)
|
||||
# error \
|
||||
"cccl internal error: macro `interface` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_interface)
|
||||
# pragma pop_macro("interface")
|
||||
# undef _CCCL_POP_MACRO_interface
|
||||
#endif
|
||||
|
||||
// sal.h on Windows
|
||||
|
||||
#if defined(__valid)
|
||||
# error \
|
||||
"cccl internal error: macro `__valid` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO___valid)
|
||||
# pragma pop_macro("__valid")
|
||||
# undef _CCCL_POP_MACRO___valid
|
||||
#endif
|
||||
|
||||
#if defined(__callback)
|
||||
# error \
|
||||
"cccl internal error: macro `__callback` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO___callback)
|
||||
# pragma pop_macro("__callback")
|
||||
# undef _CCCL_POP_MACRO___callback
|
||||
#endif
|
||||
|
||||
// other macros
|
||||
|
||||
#if defined(clang)
|
||||
# error \
|
||||
"cccl internal error: macro `clang` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_clang)
|
||||
# pragma pop_macro("clang")
|
||||
# undef _CCCL_POP_MACRO_clang
|
||||
#endif
|
||||
|
||||
// sys/sysmacros.h on linux
|
||||
|
||||
#if defined(major)
|
||||
# error \
|
||||
"cccl internal error: macro `major` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_major)
|
||||
# pragma pop_macro("major")
|
||||
# undef _CCCL_POP_MACRO_major
|
||||
#endif
|
||||
|
||||
#if defined(minor)
|
||||
# error \
|
||||
"cccl internal error: macro `minor` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_minor)
|
||||
# pragma pop_macro("minor")
|
||||
# undef _CCCL_POP_MACRO_minor
|
||||
#endif
|
||||
|
||||
#if defined(makedev)
|
||||
# error \
|
||||
"cccl internal error: macro `makedev` was redefined between <cuda/std/__cccl/prologue.h> and <cuda/std/__cccl/epilogue.h>"
|
||||
#elif defined(_CCCL_POP_MACRO_makedev)
|
||||
# pragma pop_macro("makedev")
|
||||
# undef _CCCL_POP_MACRO_makedev
|
||||
#endif
|
||||
|
||||
// NO include guards here (this file is included multiple times)
|
||||
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CCCL_EXCEPTIONS_H
|
||||
#define __CCCL_EXCEPTIONS_H
|
||||
|
||||
#include <cuda/std/__cccl/compiler.h>
|
||||
#include <cuda/std/__cccl/execution_space.h>
|
||||
#include <cuda/std/__cccl/system_header.h>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#if defined(CCCL_DISABLE_EXCEPTIONS) // Escape hatch for users to manually disable exceptions
|
||||
# define _CCCL_HAS_EXCEPTIONS() 0
|
||||
#elif _CCCL_COMPILER(NVRTC) // NVRTC has no exceptions
|
||||
# define _CCCL_HAS_EXCEPTIONS() 0
|
||||
#elif _CCCL_COMPILER(MSVC) // MSVC needs special checks for `_HAS_EXCEPTIONS` and `_CPPUNWIND`
|
||||
# define _CCCL_HAS_EXCEPTIONS() ((_HAS_EXCEPTIONS != 0) && (_CPPUNWIND != 0)) // disabled with /EH
|
||||
#else // other compilers use `__EXCEPTIONS`
|
||||
# define _CCCL_HAS_EXCEPTIONS() (__EXCEPTIONS) // disabled with -fno-exceptions
|
||||
#endif // has exceptions
|
||||
|
||||
#if _CCCL_HAS_EXCEPTIONS() && __cpp_constexpr_exceptions >= 202411L
|
||||
# define _CCCL_HAS_CONSTEXPR_EXCEPTIONS() 1
|
||||
#else // ^^^ has constexpr exceptions ^^^ / vvv no constexpr exceptions vvv
|
||||
# define _CCCL_HAS_CONSTEXPR_EXCEPTIONS() 0
|
||||
#endif // ^^^ no constexpr exceptions ^^^
|
||||
|
||||
#endif // __CCCL_EXCEPTIONS_H
|
||||
@@ -0,0 +1,87 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CCCL_EXECUTION_SPACE_H
|
||||
#define __CCCL_EXECUTION_SPACE_H
|
||||
|
||||
#include <cuda/std/__cccl/compiler.h>
|
||||
#include <cuda/std/__cccl/system_header.h>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__cccl/cuda_capabilities.h>
|
||||
|
||||
#if _CCCL_CUDA_COMPILATION()
|
||||
# define _CCCL_HOST __host__
|
||||
# define _CCCL_DEVICE __device__
|
||||
# define _CCCL_HOST_DEVICE __host__ __device__
|
||||
#else // ^^^ _CCCL_CUDA_COMPILATION ^^^ / vvv !_CCCL_CUDA_COMPILATION vvv
|
||||
# define _CCCL_HOST
|
||||
# define _CCCL_DEVICE
|
||||
# define _CCCL_HOST_DEVICE
|
||||
#endif // !_CCCL_CUDA_COMPILATION
|
||||
|
||||
#if _CCCL_TILE_COMPILATION()
|
||||
# define _CCCL_TILE __tile__
|
||||
#else // ^^^ _CCCL_TILE_COMPILATION() ^^^ / vvv !_CCCL_TILE_COMPILATION() vvv
|
||||
# define _CCCL_TILE
|
||||
#endif // ^^^ !_CCCL_TILE_COMPILATION() ^^^
|
||||
|
||||
// clang-cuda before version 22 requires __host__ __device__ annotations on deduction guides
|
||||
#if _CCCL_CUDA_COMPILER(CLANG, <, 22)
|
||||
# define _CCCL_DEDUCTION_GUIDE_ATTRIBUTES _CCCL_HOST_DEVICE
|
||||
#else // ^^^ _CCCL_CUDA_COMPILER(CLANG, <, 22) ^^^ / vvv !_CCCL_CUDA_COMPILER(CLANG, <, 22) vvv
|
||||
# define _CCCL_DEDUCTION_GUIDE_ATTRIBUTES
|
||||
#endif // ^^ !_CCCL_CUDA_COMPILER(CLANG, <, 22) ^^^
|
||||
|
||||
// Global variables of non builtin types are only device accessible if they are marked as `__device__`
|
||||
#if _CCCL_DEVICE_COMPILATION() && !_CCCL_CUDA_COMPILER(NVHPC)
|
||||
# define _CCCL_GLOBAL_VARIABLE _CCCL_DEVICE
|
||||
#else // ^^^ _CCCL_DEVICE_COMPILATION() && !_CCCL_CUDA_COMPILER(NVHPC) ^^^ /
|
||||
// vvv !_CCCL_DEVICE_COMPILATION() || _CCCL_CUDA_COMPILER(NVHPC) vvv
|
||||
# define _CCCL_GLOBAL_VARIABLE
|
||||
#endif // ^^^ !_CCCL_DEVICE_COMPILATION() || _CCCL_CUDA_COMPILER(NVHPC) ^^^
|
||||
|
||||
#if (_CCCL_CUDA_COMPILER(NVCC, >=, 12, 8) || _CCCL_CUDA_COMPILER(NVRTC) || _CCCL_CUDA_COMPILER(CLANG, >=, 20)) \
|
||||
&& _CCCL_PTX_ARCH() >= 700
|
||||
# define _CCCL_HAS_GRID_CONSTANT() 1
|
||||
# define _CCCL_GRID_CONSTANT __grid_constant__
|
||||
#else // ^^^ has __grid_constant__ ^^^ / vvv no __grid_constant__ vvv
|
||||
# define _CCCL_HAS_GRID_CONSTANT() 0
|
||||
# define _CCCL_GRID_CONSTANT
|
||||
#endif // ^^^ no __grid_constant__ ^^^
|
||||
|
||||
#if !defined(_CCCL_EXEC_CHECK_DISABLE)
|
||||
# if _CCCL_CUDA_COMPILER(NVCC)
|
||||
# define _CCCL_EXEC_CHECK_DISABLE _CCCL_PRAGMA(nv_exec_check_disable)
|
||||
# else
|
||||
# define _CCCL_EXEC_CHECK_DISABLE
|
||||
# endif // _CCCL_CUDA_COMPILER(NVCC)
|
||||
#endif // !_CCCL_EXEC_CHECK_DISABLE
|
||||
|
||||
#if _CCCL_CUDA_COMPILER(NVHPC)
|
||||
# define _CCCL_TARGET_CONSTEXPR
|
||||
#else // ^^^ _CCCL_CUDA_COMPILER(NVHPC) ^^^ / vvv !_CCCL_CUDA_COMPILER(NVHPC) vvv
|
||||
# define _CCCL_TARGET_CONSTEXPR constexpr
|
||||
#endif // ^^^ !_CCCL_CUDA_COMPILER(NVHPC) ^^^
|
||||
|
||||
//! @brief List of all known PTX architectures supported by this CCCL version.
|
||||
#define _CCCL_KNOWN_CUDA_ARCH_LIST 50, 52, 53, 60, 61, 62, 70, 75, 80, 86, 87, 88, 89, 90, 100, 103, 110, 120, 121
|
||||
|
||||
//! @brief List of all known architecture specific architectures supported by this CCCL version.
|
||||
#define _CCCL_KNOWN_CUDA_ARCH_SPECIFIC_LIST 90, 100, 103, 110, 120, 121
|
||||
|
||||
#endif // __CCCL_EXECUTION_SPACE_H
|
||||
@@ -0,0 +1,148 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CCCL_EXTENDED_DATA_TYPES_H
|
||||
#define __CCCL_EXTENDED_DATA_TYPES_H
|
||||
|
||||
#include <cuda/std/__cccl/compiler.h>
|
||||
#include <cuda/std/__cccl/system_header.h>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__cccl/architecture.h>
|
||||
#include <cuda/std/__cccl/cuda_capabilities.h>
|
||||
#include <cuda/std/__cccl/cuda_toolkit.h>
|
||||
#include <cuda/std/__cccl/diagnostic.h>
|
||||
#include <cuda/std/__cccl/os.h>
|
||||
#include <cuda/std/__cccl/preprocessor.h>
|
||||
|
||||
#define _CCCL_HAS_INT128() 0
|
||||
#define _CCCL_HAS_NVFP4() 0
|
||||
#define _CCCL_HAS_NVFP6() 0
|
||||
#define _CCCL_HAS_NVFP8() 0
|
||||
#define _CCCL_HAS_NVFP16() 0
|
||||
#define _CCCL_HAS_NVBF16() 0
|
||||
#define _CCCL_HAS_FLOAT128() 0
|
||||
|
||||
#if _CCCL_TILE_COMPILATION() // TODO(miscco): Fix access to extended floating point types
|
||||
# define CCCL_DISABLE_NVFP4_SUPPORT
|
||||
# define CCCL_DISABLE_NVFP6_SUPPORT
|
||||
# define CCCL_DISABLE_NVFP8_SUPPORT
|
||||
# define CCCL_DISABLE_INT128_SUPPORT
|
||||
# define CCCL_DISABLE_FLOAT128_SUPPORT
|
||||
#endif // _CCCL_TILE_COMPILATION()
|
||||
|
||||
#if !defined(CCCL_DISABLE_INT128_SUPPORT) && _CCCL_OS(LINUX) \
|
||||
&& ((_CCCL_COMPILER(NVRTC) && defined(__CUDACC_RTC_INT128__)) || defined(__SIZEOF_INT128__))
|
||||
# undef _CCCL_HAS_INT128
|
||||
# define _CCCL_HAS_INT128() 1
|
||||
#endif
|
||||
|
||||
#if __has_include(<cuda_fp16.h>) && (_CCCL_HAS_CTK() || defined(LIBCUDACXX_ENABLE_HOST_NVFP16)) \
|
||||
&& !defined(CCCL_DISABLE_FP16_SUPPORT)
|
||||
# undef _CCCL_HAS_NVFP16
|
||||
# define _CCCL_HAS_NVFP16() 1
|
||||
struct __half;
|
||||
struct __half2;
|
||||
#endif
|
||||
|
||||
#if __has_include(<cuda_bf16.h>) && _CCCL_HAS_NVFP16() && !defined(CCCL_DISABLE_BF16_SUPPORT)
|
||||
# undef _CCCL_HAS_NVBF16
|
||||
# define _CCCL_HAS_NVBF16() 1
|
||||
struct __nv_bfloat16;
|
||||
struct __nv_bfloat162;
|
||||
#endif
|
||||
|
||||
#if __has_include(<cuda_fp8.h>) && _CCCL_HAS_NVFP16() && _CCCL_HAS_NVBF16() && !defined(CCCL_DISABLE_NVFP8_SUPPORT)
|
||||
# undef _CCCL_HAS_NVFP8
|
||||
# define _CCCL_HAS_NVFP8() 1
|
||||
struct __nv_fp8_e5m2;
|
||||
struct __nv_fp8x2_e5m2;
|
||||
struct __nv_fp8x4_e5m2;
|
||||
|
||||
struct __nv_fp8_e4m3;
|
||||
struct __nv_fp8x2_e4m3;
|
||||
struct __nv_fp8x4_e4m3;
|
||||
|
||||
# if _CCCL_CTK_AT_LEAST(12, 8)
|
||||
struct __nv_fp8_e8m0;
|
||||
struct __nv_fp8x2_e8m0;
|
||||
struct __nv_fp8x4_e8m0;
|
||||
# endif // _CCCL_CTK_AT_LEAST(12, 8)
|
||||
#endif
|
||||
|
||||
#if __has_include(<cuda_fp6.h>) && _CCCL_HAS_NVFP8() && !_CCCL_CUDA_COMPILER(NVHPC) \
|
||||
&& !defined(CCCL_DISABLE_NVFP6_SUPPORT)
|
||||
# undef _CCCL_HAS_NVFP6
|
||||
# define _CCCL_HAS_NVFP6() 1
|
||||
struct __nv_fp6_e3m2;
|
||||
struct __nv_fp6x2_e3m2;
|
||||
struct __nv_fp6x4_e3m2;
|
||||
|
||||
struct __nv_fp6_e2m3;
|
||||
struct __nv_fp6x2_e2m3;
|
||||
struct __nv_fp6x4_e2m3;
|
||||
#endif
|
||||
|
||||
#if __has_include(<cuda_fp4.h>) && _CCCL_HAS_NVFP6() && !defined(CCCL_DISABLE_NVFP4_SUPPORT)
|
||||
# undef _CCCL_HAS_NVFP4
|
||||
# define _CCCL_HAS_NVFP4() 1
|
||||
struct __nv_fp4_e2m1;
|
||||
struct __nv_fp4x2_e2m1;
|
||||
struct __nv_fp4x4_e2m1;
|
||||
#endif
|
||||
|
||||
#define _CCCL_HAS_NVFP4_E2M1() _CCCL_HAS_NVFP4()
|
||||
#define _CCCL_HAS_NVFP6_E2M3() _CCCL_HAS_NVFP6()
|
||||
#define _CCCL_HAS_NVFP6_E3M2() _CCCL_HAS_NVFP6()
|
||||
#define _CCCL_HAS_NVFP8_E4M3() _CCCL_HAS_NVFP8()
|
||||
#define _CCCL_HAS_NVFP8_E5M2() _CCCL_HAS_NVFP8()
|
||||
#define _CCCL_HAS_NVFP8_E8M0() (_CCCL_HAS_NVFP8() && _CCCL_CTK_AT_LEAST(12, 8))
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* __float128
|
||||
**********************************************************************************************************************/
|
||||
|
||||
#if !defined(CCCL_DISABLE_FLOAT128_SUPPORT) && _CCCL_HAS_INT128() && _CCCL_OS(LINUX) && !_CCCL_HOST_ARCH(ARM64) \
|
||||
&& !_CCCL_TILE_COMPILATION()
|
||||
// Detect host compiler support
|
||||
# if (defined(__CUDACC_RTC_FLOAT128__) || defined(__SIZEOF_FLOAT128__) || defined(__FLOAT128__))
|
||||
# if _CCCL_DEVICE_COMPILATION()
|
||||
// Only NVCC and NVRTC 12.8+ on architectures at least SM100 supports __float128 on device
|
||||
# if (_CCCL_CUDA_COMPILER(NVCC, >=, 12, 8) || _CCCL_CUDA_COMPILER(NVRTC, >=, 12, 8)) && _CCCL_PTX_ARCH() >= 1000
|
||||
# undef _CCCL_HAS_FLOAT128
|
||||
# define _CCCL_HAS_FLOAT128() 1
|
||||
# endif // _CCCL_CUDA_COMPILER(NVCC) && _CCCL_PTX_ARCH() >= 1000
|
||||
# else // ^^^ _CCCL_DEVICE_COMPILATION() ^^^ / vvv !_CCCL_DEVICE_COMPILATION() vvv
|
||||
# undef _CCCL_HAS_FLOAT128
|
||||
# define _CCCL_HAS_FLOAT128() 1
|
||||
# endif // ^^^ !_CCCL_DEVICE_COMPILATION() ^^^
|
||||
# endif // Host compiler support
|
||||
#endif // !defined(CCCL_DISABLE_FLOAT128_SUPPORT) && _CCCL_HAS_INT128() && _CCCL_OS(LINUX) && !_CCCL_HOST_ARCH(ARM64)
|
||||
|
||||
// gcc does not allow to use q/Q floating point literals when __STRICT_ANSI__ is defined. They may be allowed by
|
||||
// -fext-numeric-literals, but there is no way to detect it in the preprocessor. The user is required to define
|
||||
// CCCL_GCC_HAS_EXTENDED_NUMERIC_LITERALS in this case. Otherwise, we disable the __float128 support.
|
||||
//
|
||||
// Note: since GCC 13, we could use f128/F128 literals, but for values > DBL_MAX, the compilation with nvcc fails due to
|
||||
// "floating constant is out of range".
|
||||
#if _CCCL_HAS_FLOAT128() && _CCCL_COMPILER(GCC) && defined(__STRICT_ANSI__) \
|
||||
&& !defined(CCCL_GCC_HAS_EXTENDED_NUMERIC_LITERALS)
|
||||
# undef _CCCL_HAS_FLOAT128
|
||||
# define _CCCL_HAS_FLOAT128() 0
|
||||
#endif // _CCCL_HAS_FLOAT128()
|
||||
|
||||
#endif // __CCCL_EXTENDED_DATA_TYPES_H
|
||||
@@ -0,0 +1,61 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CCCL_HOST_STD_LIB_H
|
||||
#define __CCCL_HOST_STD_LIB_H
|
||||
|
||||
#include <cuda/std/__cccl/compiler.h>
|
||||
#include <cuda/std/__cccl/preprocessor.h>
|
||||
#include <cuda/std/__cccl/system_header.h>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#define _CCCL_HOST_STD_LIB_LIBSTDCXX() _CCCL_VERSION_INVALID()
|
||||
#define _CCCL_HOST_STD_LIB_LIBCXX() _CCCL_VERSION_INVALID()
|
||||
#define _CCCL_HOST_STD_LIB_STL() _CCCL_VERSION_INVALID()
|
||||
|
||||
// include a minimal header
|
||||
#if __has_include(<version>)
|
||||
# include <version>
|
||||
#elif __has_include(<ciso646>)
|
||||
# include <ciso646>
|
||||
#endif // ^^^ __has_include(<ciso646>) ^^^
|
||||
|
||||
#define _CCCL_HOST_STD_LIB_MAKE_VERSION(_MAJOR, _MINOR) ((_MAJOR) * 100 + (_MINOR))
|
||||
#define _CCCL_HOST_STD_LIB(...) _CCCL_VERSION_COMPARE(_CCCL_HOST_STD_LIB_, _CCCL_HOST_STD_LIB_##__VA_ARGS__)
|
||||
|
||||
#if _CCCL_HOSTED()
|
||||
# if defined(_MSVC_STL_VERSION)
|
||||
# undef _CCCL_HOST_STD_LIB_STL
|
||||
# define _CCCL_HOST_STD_LIB_STL() (_MSVC_STL_VERSION, 0)
|
||||
# elif defined(__GLIBCXX__)
|
||||
# undef _CCCL_HOST_STD_LIB_LIBSTDCXX
|
||||
# define _CCCL_HOST_STD_LIB_LIBSTDCXX() (_GLIBCXX_RELEASE, 0)
|
||||
# elif defined(_LIBCPP_VERSION)
|
||||
# undef _CCCL_HOST_STD_LIB_LIBCXX
|
||||
// since llvm-16, the version scheme has been changed from MMppp to MMmmpp
|
||||
# if _LIBCPP_VERSION / 10000 < 2
|
||||
# define _CCCL_HOST_STD_LIB_LIBCXX() (_LIBCPP_VERSION / 1000, 0)
|
||||
# else
|
||||
# define _CCCL_HOST_STD_LIB_LIBCXX() (_LIBCPP_VERSION / 10000, (_LIBCPP_VERSION / 100) % 100)
|
||||
# endif
|
||||
# endif // ^^^ _LIBCPP_VERSION ^^^
|
||||
#endif // _CCCL_HOSTED()
|
||||
|
||||
#define _CCCL_HAS_HOST_STD_LIB() \
|
||||
(_CCCL_HOST_STD_LIB(LIBSTDCXX) || _CCCL_HOST_STD_LIB(LIBCXX) || _CCCL_HOST_STD_LIB(STL))
|
||||
|
||||
#endif // __CCCL_HOST_STD_LIB_H
|
||||
@@ -0,0 +1,71 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CCCL_IS_NON_NARROWING_CONVERTIBLE_H
|
||||
#define __CCCL_IS_NON_NARROWING_CONVERTIBLE_H
|
||||
|
||||
#include <cuda/std/__cccl/compiler.h>
|
||||
|
||||
//! There is compiler bug that results in incorrect results for the below `__is_non_narrowing_convertible` check.
|
||||
//! This breaks some common functionality, so this *must* be included outside of a system header. See nvbug4867473.
|
||||
#if defined(_CCCL_FORCE_SYSTEM_HEADER_GCC) || defined(_CCCL_FORCE_SYSTEM_HEADER_CLANG) \
|
||||
|| defined(_CCCL_FORCE_SYSTEM_HEADER_MSVC)
|
||||
# error \
|
||||
"This header must be included only within the <cuda/std/__cccl/system_header>. This most likely means a mix and match of different versions of CCCL."
|
||||
#endif // system header detected
|
||||
|
||||
namespace __cccl_internal
|
||||
{
|
||||
#if _CCCL_CUDA_COMPILATION()
|
||||
template <class _Tp>
|
||||
__host__ __device__ _Tp&& __cccl_declval(int);
|
||||
template <class _Tp>
|
||||
__host__ __device__ _Tp __cccl_declval(long);
|
||||
template <class _Tp>
|
||||
__host__ __device__ decltype(__cccl_internal::__cccl_declval<_Tp>(0)) __cccl_declval() noexcept;
|
||||
|
||||
// This requires a type to be implicitly convertible (also non-arithmetic)
|
||||
template <class _Tp>
|
||||
__host__ __device__ void __cccl_accepts_implicit_conversion(_Tp) noexcept;
|
||||
#else // ^^^ CUDA compilation ^^^ / vvv no CUDA compilation
|
||||
template <class _Tp>
|
||||
_Tp&& __cccl_declval(int);
|
||||
template <class _Tp>
|
||||
_Tp __cccl_declval(long);
|
||||
template <class _Tp>
|
||||
decltype(__cccl_internal::__cccl_declval<_Tp>(0)) __cccl_declval() noexcept;
|
||||
|
||||
// This requires a type to be implicitly convertible (also non-arithmetic)
|
||||
template <class _Tp>
|
||||
void __cccl_accepts_implicit_conversion(_Tp) noexcept;
|
||||
#endif // no CUDA compilation
|
||||
|
||||
template <class...>
|
||||
using __cccl_void_t = void;
|
||||
|
||||
template <class _Dest, class _Source, class = void>
|
||||
struct __is_non_narrowing_convertible
|
||||
{
|
||||
static constexpr bool value = false;
|
||||
};
|
||||
|
||||
// This also prohibits narrowing conversion in case of arithmetic types
|
||||
template <class _Dest, class _Source>
|
||||
struct __is_non_narrowing_convertible<_Dest,
|
||||
_Source,
|
||||
__cccl_void_t<decltype(__cccl_internal::__cccl_accepts_implicit_conversion<_Dest>(
|
||||
__cccl_internal::__cccl_declval<_Source>())),
|
||||
decltype(_Dest{__cccl_internal::__cccl_declval<_Source>()})>>
|
||||
{
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
} // namespace __cccl_internal
|
||||
|
||||
#endif // __CCCL_IS_NON_NARROWING_CONVERTIBLE_H
|
||||
120
qwen3_6_scripts/cccl_preload/include/cuda/std/__cccl/os.h
Normal file
120
qwen3_6_scripts/cccl_preload/include/cuda/std/__cccl/os.h
Normal file
@@ -0,0 +1,120 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CCCL_OS_H
|
||||
#define __CCCL_OS_H
|
||||
|
||||
// The header provides the following macros to determine the host architecture:
|
||||
//
|
||||
// _CCCL_OS(WINDOWS)
|
||||
// _CCCL_OS(LINUX)
|
||||
// _CCCL_OS(ANDROID)
|
||||
// _CCCL_OS(QNX)
|
||||
|
||||
// Determine the host compiler and its version
|
||||
#if defined(_WIN32) || defined(_WIN64) /* _WIN64 for NVRTC */
|
||||
# define _CCCL_OS_WINDOWS_() 1
|
||||
#else
|
||||
# define _CCCL_OS_WINDOWS_() 0
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) || defined(__LP64__) /* __LP64__ for NVRTC */
|
||||
# define _CCCL_OS_LINUX_() 1
|
||||
#else
|
||||
# define _CCCL_OS_LINUX_() 0
|
||||
#endif
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
# define _CCCL_OS_ANDROID_() 1
|
||||
#else
|
||||
# define _CCCL_OS_ANDROID_() 0
|
||||
#endif
|
||||
|
||||
#if defined(__QNX__) || defined(__QNXNTO__)
|
||||
# define _CCCL_OS_QNX_() 1
|
||||
#else
|
||||
# define _CCCL_OS_QNX_() 0
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) || defined(__APPLE_CC__)
|
||||
# define _CCCL_OS_APPLE_() 1
|
||||
#else
|
||||
# define _CCCL_OS_APPLE_() 0
|
||||
#endif
|
||||
|
||||
#define _CCCL_OS(...) _CCCL_OS_##__VA_ARGS__##_()
|
||||
|
||||
//! @def CCCL_OS(os) /* implementation defined */
|
||||
//!
|
||||
//! @brief Detect the current operating system.
|
||||
//!
|
||||
//! @param os The name of the operating system to test.
|
||||
//!
|
||||
//! @note This macro is made available when including any libcu++ header. Users that wish to
|
||||
//! include the smallest possible header for this macro should include `<cuda/std/version>`.
|
||||
//!
|
||||
//! For supported operating systems, the macro expands to an implementation-defined true value
|
||||
//! if the current operating system matches, or false otherwise. These values may be used in
|
||||
//! boolean expressions (preprocessor or otherwise), but no other guarantees are made.
|
||||
//!
|
||||
//! Available values for `os` include:
|
||||
//!
|
||||
//! - ``WINDOWS``: Windows, either in 32-bit or 64-bit mode.
|
||||
//! - ``LINUX``: Any kind of Linux installation. Note that other unix-based operating systems will
|
||||
//! also match against this.
|
||||
//! - ``ANDROID``: Android operating system.
|
||||
//! - ``QNX``: QNX real-time operating system.
|
||||
//! - ``APPLE``: macOS (Intel or Apple Silicon).
|
||||
//!
|
||||
//! Passing any other value will result in an undefined expansion, which may or may not be
|
||||
//! diagnosed by the compiler.
|
||||
//!
|
||||
//! @note Some operating systems may satisfy multiple conditions. For example macOS and Android
|
||||
//! satisfy both `APPLE`/`ANDROID` and `LINUX`.
|
||||
//!
|
||||
//! @par Example
|
||||
//! @code
|
||||
//! #define MY_OTHER_MACRO 1
|
||||
//!
|
||||
//! // Expansion value can be used in ordinary macro conditionals
|
||||
//! #if CCCL_OS(WINDOWS) && MY_OTHER_MACRO
|
||||
//! // ...
|
||||
//! #endif
|
||||
//!
|
||||
//! // Can be negated as usual
|
||||
//! #if !CCCL_OS(QNX)
|
||||
//! // ...
|
||||
//! #endif
|
||||
//!
|
||||
//! #if CCCL_OS(APPLE)
|
||||
//! // Will be visible only on macOS
|
||||
//! #endif
|
||||
//!
|
||||
//! #if CCCL_OS(ANDROID)
|
||||
//! // Will be visible only on Android
|
||||
//! #endif
|
||||
//!
|
||||
//! #if CCCL_OS(LINUX) && !CCCL_OS(APPLE) && !CCCL_OS(ANDROID)
|
||||
//! // Only visible on Linux
|
||||
//! #endif
|
||||
//! @endcode
|
||||
//!
|
||||
//! @return true if the specified OS is begin compiled for, false otherwise.
|
||||
#ifdef _CCCL_DOXYGEN_INVOKED
|
||||
# define CCCL_OS(os) /* implementation defined */
|
||||
#else
|
||||
# define CCCL_OS(__os__) _CCCL_OS_##__os__##_()
|
||||
#endif
|
||||
|
||||
// Note: the public API is single-arg to constrain the API and allow for future expansion. The
|
||||
// implementation is duplicated to guard against the OS targets being accidentally defined by
|
||||
// the user.
|
||||
|
||||
#endif // __CCCL_OS_H
|
||||
1366
qwen3_6_scripts/cccl_preload/include/cuda/std/__cccl/preprocessor.h
Normal file
1366
qwen3_6_scripts/cccl_preload/include/cuda/std/__cccl/preprocessor.h
Normal file
File diff suppressed because it is too large
Load Diff
348
qwen3_6_scripts/cccl_preload/include/cuda/std/__cccl/prologue.h
Normal file
348
qwen3_6_scripts/cccl_preload/include/cuda/std/__cccl/prologue.h
Normal file
@@ -0,0 +1,348 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// !!! DO NOT EDIT THIS FILE !!! This file is generated by utils/generate_prologue_epilogue.py.
|
||||
|
||||
// NO include guards here (this file is included multiple times)
|
||||
|
||||
#if defined(_CCCL_PROLOGUE_INCLUDED)
|
||||
# error \
|
||||
"cccl internal error: <cuda/std/__cccl/epilogue.h> must be included before next <cuda/std/__cccl/prologue.h> is reincluded"
|
||||
#endif
|
||||
#define _CCCL_PROLOGUE_INCLUDED() 1
|
||||
|
||||
#include <cuda/std/__cccl/compiler.h>
|
||||
#include <cuda/std/__cccl/diagnostic.h>
|
||||
#include <cuda/std/__cccl/dialect.h>
|
||||
|
||||
// __declspec modifiers
|
||||
|
||||
#if defined(align)
|
||||
# pragma push_macro("align")
|
||||
# undef align
|
||||
# define _CCCL_POP_MACRO_align
|
||||
#endif // defined(align)
|
||||
|
||||
#if defined(allocate)
|
||||
# pragma push_macro("allocate")
|
||||
# undef allocate
|
||||
# define _CCCL_POP_MACRO_allocate
|
||||
#endif // defined(allocate)
|
||||
|
||||
#if defined(allocator)
|
||||
# pragma push_macro("allocator")
|
||||
# undef allocator
|
||||
# define _CCCL_POP_MACRO_allocator
|
||||
#endif // defined(allocator)
|
||||
|
||||
#if defined(appdomain)
|
||||
# pragma push_macro("appdomain")
|
||||
# undef appdomain
|
||||
# define _CCCL_POP_MACRO_appdomain
|
||||
#endif // defined(appdomain)
|
||||
|
||||
#if defined(code_seg)
|
||||
# pragma push_macro("code_seg")
|
||||
# undef code_seg
|
||||
# define _CCCL_POP_MACRO_code_seg
|
||||
#endif // defined(code_seg)
|
||||
|
||||
#if defined(deprecated)
|
||||
# pragma push_macro("deprecated")
|
||||
# undef deprecated
|
||||
# define _CCCL_POP_MACRO_deprecated
|
||||
#endif // defined(deprecated)
|
||||
|
||||
#if defined(dllimport)
|
||||
# pragma push_macro("dllimport")
|
||||
# undef dllimport
|
||||
# define _CCCL_POP_MACRO_dllimport
|
||||
#endif // defined(dllimport)
|
||||
|
||||
#if defined(dllexport)
|
||||
# pragma push_macro("dllexport")
|
||||
# undef dllexport
|
||||
# define _CCCL_POP_MACRO_dllexport
|
||||
#endif // defined(dllexport)
|
||||
|
||||
#if defined(empty_bases)
|
||||
# pragma push_macro("empty_bases")
|
||||
# undef empty_bases
|
||||
# define _CCCL_POP_MACRO_empty_bases
|
||||
#endif // defined(empty_bases)
|
||||
|
||||
#if defined(hybrid_patchable)
|
||||
# pragma push_macro("hybrid_patchable")
|
||||
# undef hybrid_patchable
|
||||
# define _CCCL_POP_MACRO_hybrid_patchable
|
||||
#endif // defined(hybrid_patchable)
|
||||
|
||||
#if defined(jitintrinsic)
|
||||
# pragma push_macro("jitintrinsic")
|
||||
# undef jitintrinsic
|
||||
# define _CCCL_POP_MACRO_jitintrinsic
|
||||
#endif // defined(jitintrinsic)
|
||||
|
||||
#if defined(lifetimebound)
|
||||
# pragma push_macro("lifetimebound")
|
||||
# undef lifetimebound
|
||||
# define _CCCL_POP_MACRO_lifetimebound
|
||||
#endif // defined(lifetimebound)
|
||||
|
||||
#if defined(naked)
|
||||
# pragma push_macro("naked")
|
||||
# undef naked
|
||||
# define _CCCL_POP_MACRO_naked
|
||||
#endif // defined(naked)
|
||||
|
||||
#if defined(noalias)
|
||||
# pragma push_macro("noalias")
|
||||
# undef noalias
|
||||
# define _CCCL_POP_MACRO_noalias
|
||||
#endif // defined(noalias)
|
||||
|
||||
#if defined(noinline)
|
||||
# pragma push_macro("noinline")
|
||||
# undef noinline
|
||||
# define _CCCL_POP_MACRO_noinline
|
||||
#endif // defined(noinline)
|
||||
|
||||
#if defined(noreturn)
|
||||
# pragma push_macro("noreturn")
|
||||
# undef noreturn
|
||||
# define _CCCL_POP_MACRO_noreturn
|
||||
#endif // defined(noreturn)
|
||||
|
||||
#if defined(nothrow)
|
||||
# pragma push_macro("nothrow")
|
||||
# undef nothrow
|
||||
# define _CCCL_POP_MACRO_nothrow
|
||||
#endif // defined(nothrow)
|
||||
|
||||
#if defined(novtable)
|
||||
# pragma push_macro("novtable")
|
||||
# undef novtable
|
||||
# define _CCCL_POP_MACRO_novtable
|
||||
#endif // defined(novtable)
|
||||
|
||||
#if defined(no_sanitize_address)
|
||||
# pragma push_macro("no_sanitize_address")
|
||||
# undef no_sanitize_address
|
||||
# define _CCCL_POP_MACRO_no_sanitize_address
|
||||
#endif // defined(no_sanitize_address)
|
||||
|
||||
#if defined(process)
|
||||
# pragma push_macro("process")
|
||||
# undef process
|
||||
# define _CCCL_POP_MACRO_process
|
||||
#endif // defined(process)
|
||||
|
||||
#if defined(property)
|
||||
# pragma push_macro("property")
|
||||
# undef property
|
||||
# define _CCCL_POP_MACRO_property
|
||||
#endif // defined(property)
|
||||
|
||||
#if defined(restrict)
|
||||
# pragma push_macro("restrict")
|
||||
# undef restrict
|
||||
# define _CCCL_POP_MACRO_restrict
|
||||
#endif // defined(restrict)
|
||||
|
||||
#if defined(safebuffers)
|
||||
# pragma push_macro("safebuffers")
|
||||
# undef safebuffers
|
||||
# define _CCCL_POP_MACRO_safebuffers
|
||||
#endif // defined(safebuffers)
|
||||
|
||||
#if defined(selectany)
|
||||
# pragma push_macro("selectany")
|
||||
# undef selectany
|
||||
# define _CCCL_POP_MACRO_selectany
|
||||
#endif // defined(selectany)
|
||||
|
||||
#if defined(spectre)
|
||||
# pragma push_macro("spectre")
|
||||
# undef spectre
|
||||
# define _CCCL_POP_MACRO_spectre
|
||||
#endif // defined(spectre)
|
||||
|
||||
#if defined(thread)
|
||||
# pragma push_macro("thread")
|
||||
# undef thread
|
||||
# define _CCCL_POP_MACRO_thread
|
||||
#endif // defined(thread)
|
||||
|
||||
#if defined(uuid)
|
||||
# pragma push_macro("uuid")
|
||||
# undef uuid
|
||||
# define _CCCL_POP_MACRO_uuid
|
||||
#endif // defined(uuid)
|
||||
|
||||
// [[msvc::attribute]] attributes
|
||||
|
||||
#if defined(msvc)
|
||||
# pragma push_macro("msvc")
|
||||
# undef msvc
|
||||
# define _CCCL_POP_MACRO_msvc
|
||||
#endif // defined(msvc)
|
||||
|
||||
#if defined(flatten)
|
||||
# pragma push_macro("flatten")
|
||||
# undef flatten
|
||||
# define _CCCL_POP_MACRO_flatten
|
||||
#endif // defined(flatten)
|
||||
|
||||
#if defined(forceinline)
|
||||
# pragma push_macro("forceinline")
|
||||
# undef forceinline
|
||||
# define _CCCL_POP_MACRO_forceinline
|
||||
#endif // defined(forceinline)
|
||||
|
||||
#if defined(forceinline_calls)
|
||||
# pragma push_macro("forceinline_calls")
|
||||
# undef forceinline_calls
|
||||
# define _CCCL_POP_MACRO_forceinline_calls
|
||||
#endif // defined(forceinline_calls)
|
||||
|
||||
#if defined(intrinsic)
|
||||
# pragma push_macro("intrinsic")
|
||||
# undef intrinsic
|
||||
# define _CCCL_POP_MACRO_intrinsic
|
||||
#endif // defined(intrinsic)
|
||||
|
||||
#if defined(noinline)
|
||||
# pragma push_macro("noinline")
|
||||
# undef noinline
|
||||
# define _CCCL_POP_MACRO_noinline
|
||||
#endif // defined(noinline)
|
||||
|
||||
#if defined(noinline_calls)
|
||||
# pragma push_macro("noinline_calls")
|
||||
# undef noinline_calls
|
||||
# define _CCCL_POP_MACRO_noinline_calls
|
||||
#endif // defined(noinline_calls)
|
||||
|
||||
#if defined(no_tls_guard)
|
||||
# pragma push_macro("no_tls_guard")
|
||||
# undef no_tls_guard
|
||||
# define _CCCL_POP_MACRO_no_tls_guard
|
||||
#endif // defined(no_tls_guard)
|
||||
|
||||
// Windows nasty macros
|
||||
|
||||
#if defined(min)
|
||||
# pragma push_macro("min")
|
||||
# undef min
|
||||
# define _CCCL_POP_MACRO_min
|
||||
#endif // defined(min)
|
||||
|
||||
#if defined(max)
|
||||
# pragma push_macro("max")
|
||||
# undef max
|
||||
# define _CCCL_POP_MACRO_max
|
||||
#endif // defined(max)
|
||||
|
||||
#if defined(interface)
|
||||
# pragma push_macro("interface")
|
||||
# undef interface
|
||||
# define _CCCL_POP_MACRO_interface
|
||||
#endif // defined(interface)
|
||||
|
||||
// sal.h on Windows
|
||||
|
||||
#if defined(__valid)
|
||||
# pragma push_macro("__valid")
|
||||
# undef __valid
|
||||
# define _CCCL_POP_MACRO___valid
|
||||
#endif // defined(__valid)
|
||||
|
||||
#if defined(__callback)
|
||||
# pragma push_macro("__callback")
|
||||
# undef __callback
|
||||
# define _CCCL_POP_MACRO___callback
|
||||
#endif // defined(__callback)
|
||||
|
||||
// other macros
|
||||
|
||||
#if defined(clang)
|
||||
# pragma push_macro("clang")
|
||||
# undef clang
|
||||
# define _CCCL_POP_MACRO_clang
|
||||
#endif // defined(clang)
|
||||
|
||||
// sys/sysmacros.h on linux
|
||||
|
||||
#if defined(major)
|
||||
# pragma push_macro("major")
|
||||
# undef major
|
||||
# define _CCCL_POP_MACRO_major
|
||||
#endif // defined(major)
|
||||
|
||||
#if defined(minor)
|
||||
# pragma push_macro("minor")
|
||||
# undef minor
|
||||
# define _CCCL_POP_MACRO_minor
|
||||
#endif // defined(minor)
|
||||
|
||||
#if defined(makedev)
|
||||
# pragma push_macro("makedev")
|
||||
# undef makedev
|
||||
# define _CCCL_POP_MACRO_makedev
|
||||
#endif // defined(makedev)
|
||||
|
||||
_CCCL_DIAG_PUSH
|
||||
_CCCL_NV_DIAG_PUSH()
|
||||
|
||||
// disable some msvc warnings
|
||||
// https://github.com/microsoft/STL/blob/master/stl/inc/yvals_core.h#L353
|
||||
// warning C4100: 'quack': unreferenced formal parameter
|
||||
// warning C4127: conditional expression is constant
|
||||
// warning C4180: qualifier applied to function type has no meaning; ignored
|
||||
// warning C4197: 'purr': top-level volatile in cast is ignored
|
||||
// warning C4324: 'roar': structure was padded due to alignment specifier
|
||||
// warning C4455: literal suffix identifiers that do not start with an underscore are reserved
|
||||
// warning C4503: 'hum': decorated name length exceeded, name was truncated
|
||||
// warning C4522: 'woof' : multiple assignment operators specified
|
||||
// warning C4668: 'meow' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
|
||||
// warning C4800: 'boo': forcing value to bool 'true' or 'false' (performance warning)
|
||||
// warning C4996: 'meow': was declared deprecated
|
||||
_CCCL_DIAG_SUPPRESS_MSVC(4100 4127 4180 4197 4296 4324 4455 4503 4522 4668 4800 4996)
|
||||
|
||||
// Suppress compiler warnings about C++ extensions.
|
||||
|
||||
#if _CCCL_COMPILER(GCC, >=, 12)
|
||||
_CCCL_DIAG_SUPPRESS_GCC("-Wc++20-extensions")
|
||||
_CCCL_DIAG_SUPPRESS_GCC("-Wc++23-extensions")
|
||||
#endif // _CCCL_COMPILER(GCC, >=, 12)
|
||||
#if _CCCL_COMPILER(GCC, >=, 14)
|
||||
_CCCL_DIAG_SUPPRESS_GCC("-Wc++26-extensions")
|
||||
#endif // _CCCL_COMPILER(GCC, >=, 14)
|
||||
|
||||
_CCCL_DIAG_SUPPRESS_CLANG("-Wc++20-extensions")
|
||||
#if _CCCL_COMPILER(CLANG, >=, 17)
|
||||
_CCCL_DIAG_SUPPRESS_CLANG("-Wc++23-extensions")
|
||||
_CCCL_DIAG_SUPPRESS_CLANG("-Wc++26-extensions")
|
||||
#else // ^^^ _CCCL_COMPILER(CLANG, >=, 17) ^^^ / vvv _CCCL_COMPILER(CLANG, <, 17) vvv
|
||||
_CCCL_DIAG_SUPPRESS_CLANG("-Wc++2b-extensions")
|
||||
#endif // ^^^ _CCCL_COMPILER(CLANG, <, 17) ^^^
|
||||
|
||||
// Suppress `if consteval`-related warnings.
|
||||
|
||||
_CCCL_DIAG_SUPPRESS_NVHPC(if_consteval_nonstandard)
|
||||
_CCCL_DIAG_SUPPRESS_NVHPC(is_constant_evaluated_in_nonconstexpr_context)
|
||||
_CCCL_DIAG_SUPPRESS_NVHPC(if_consteval_in_nonconstexpr_function)
|
||||
|
||||
_CCCL_DIAG_SUPPRESS_NVCC(3215) // "if consteval" and "if not consteval" are not standard in this mode
|
||||
_CCCL_DIAG_SUPPRESS_NVCC(3206) // "if consteval" and "if not consteval" are meaningless in a non-constexpr function
|
||||
_CCCL_DIAG_SUPPRESS_NVCC(3060) // call to __builtin_is_constant_evaluated appearing in a non-constexpr function always
|
||||
// produces "false"
|
||||
|
||||
// NO include guards here (this file is included multiple times)
|
||||
369
qwen3_6_scripts/cccl_preload/include/cuda/std/__cccl/ptx_isa.h
Normal file
369
qwen3_6_scripts/cccl_preload/include/cuda/std/__cccl/ptx_isa.h
Normal file
@@ -0,0 +1,369 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CCCL_PTX_ISA_H_
|
||||
#define __CCCL_PTX_ISA_H_
|
||||
|
||||
#include <cuda/std/__cccl/compiler.h>
|
||||
#include <cuda/std/__cccl/system_header.h>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <nv/target> // __CUDA_MINIMUM_ARCH__ and friends
|
||||
|
||||
/*
|
||||
* Targeting macros
|
||||
*
|
||||
* Information from:
|
||||
* https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#release-notes
|
||||
*/
|
||||
|
||||
// The first define is for future major versions of CUDACC.
|
||||
// We make sure that these get the highest known PTX ISA version.
|
||||
// For clang cuda check
|
||||
// https://github.com/llvm/llvm-project/blob/release/<VER>.x/clang/lib/Driver/ToolChains/Cuda.cpp getNVPTXTargetFeatures
|
||||
#if _CCCL_CUDACC_AT_LEAST(14, 0) && !_CCCL_CUDA_COMPILER(CLANG)
|
||||
# define __cccl_ptx_isa 940ULL
|
||||
// PTX ISA 9.4 is available from CUDA 13.4
|
||||
#elif _CCCL_CUDACC_AT_LEAST(13, 4) && !_CCCL_CUDA_COMPILER(CLANG)
|
||||
# define __cccl_ptx_isa 940ULL
|
||||
// PTX ISA 9.3 is available from CUDA 13.3
|
||||
#elif _CCCL_CUDACC_AT_LEAST(13, 3) && !_CCCL_CUDA_COMPILER(CLANG)
|
||||
# define __cccl_ptx_isa 930ULL
|
||||
// PTX ISA 9.2 is available from CUDA 13.2
|
||||
#elif _CCCL_CUDACC_AT_LEAST(13, 2) && !_CCCL_CUDA_COMPILER(CLANG)
|
||||
# define __cccl_ptx_isa 920ULL
|
||||
// PTX ISA 9.1 is available from CUDA 13.1
|
||||
#elif _CCCL_CUDACC_AT_LEAST(13, 1) && !_CCCL_CUDA_COMPILER(CLANG)
|
||||
# define __cccl_ptx_isa 910ULL
|
||||
// PTX ISA 9.0 is available from CUDA 13.0, driver r580
|
||||
#elif _CCCL_CUDACC_AT_LEAST(13, 0) && !_CCCL_CUDA_COMPILER(CLANG)
|
||||
# define __cccl_ptx_isa 900ULL
|
||||
// PTX ISA 8.8 is available from CUDA 12.9, driver r575
|
||||
#elif _CCCL_CUDACC_AT_LEAST(12, 9) && !_CCCL_CUDA_COMPILER(CLANG, <, 22)
|
||||
# define __cccl_ptx_isa 880ULL
|
||||
// PTX ISA 8.7 is available from CUDA 12.8, driver r570
|
||||
#elif _CCCL_CUDACC_AT_LEAST(12, 8) && !_CCCL_CUDA_COMPILER(CLANG, <, 20)
|
||||
# define __cccl_ptx_isa 870ULL
|
||||
// PTX ISA 8.5 is available from CUDA 12.5, driver r555
|
||||
#elif _CCCL_CUDACC_AT_LEAST(12, 5) && !_CCCL_CUDA_COMPILER(CLANG, <, 19)
|
||||
# define __cccl_ptx_isa 850ULL
|
||||
// PTX ISA 8.4 is available from CUDA 12.4, driver r550
|
||||
#elif _CCCL_CUDACC_AT_LEAST(12, 4) && !_CCCL_CUDA_COMPILER(CLANG, <, 19)
|
||||
# define __cccl_ptx_isa 840ULL
|
||||
// PTX ISA 8.3 is available from CUDA 12.3, driver r545
|
||||
#elif _CCCL_CUDACC_AT_LEAST(12, 3) && !_CCCL_CUDA_COMPILER(CLANG, <, 18)
|
||||
# define __cccl_ptx_isa 830ULL
|
||||
// PTX ISA 8.2 is available from CUDA 12.2, driver r535
|
||||
#elif _CCCL_CUDACC_AT_LEAST(12, 2) && !_CCCL_CUDA_COMPILER(CLANG, <, 18)
|
||||
# define __cccl_ptx_isa 820ULL
|
||||
// PTX ISA 8.1 is available from CUDA 12.1, driver r530
|
||||
#elif _CCCL_CUDACC_AT_LEAST(12, 1) && !_CCCL_CUDA_COMPILER(CLANG, <, 17)
|
||||
# define __cccl_ptx_isa 810ULL
|
||||
// PTX ISA 8.0 is available from CUDA 12.0, driver r525
|
||||
#elif _CCCL_CUDACC_AT_LEAST(12, 0) && !_CCCL_CUDA_COMPILER(CLANG, <, 17)
|
||||
# define __cccl_ptx_isa 800ULL
|
||||
// PTX ISA 7.8 is available from CUDA 11.8, driver r520
|
||||
#elif _CCCL_CUDACC_AT_LEAST(11, 8) && !_CCCL_CUDA_COMPILER(CLANG, <, 16)
|
||||
# define __cccl_ptx_isa 780ULL
|
||||
// PTX ISA 7.7 is available from CUDA 11.7, driver r515
|
||||
#elif _CCCL_CUDACC_AT_LEAST(11, 7) && !_CCCL_CUDA_COMPILER(CLANG, <, 16)
|
||||
# define __cccl_ptx_isa 770ULL
|
||||
// PTX ISA 7.6 is available from CUDA 11.6, driver r510
|
||||
#elif _CCCL_CUDACC_AT_LEAST(11, 6) && !_CCCL_CUDA_COMPILER(CLANG, <, 16)
|
||||
# define __cccl_ptx_isa 760ULL
|
||||
// PTX ISA 7.5 is available from CUDA 11.5, driver r495
|
||||
#elif _CCCL_CUDACC_AT_LEAST(11, 5) && !_CCCL_CUDA_COMPILER(CLANG, <, 14)
|
||||
# define __cccl_ptx_isa 750ULL
|
||||
// PTX ISA 7.4 is available from CUDA 11.4, driver r470
|
||||
#elif _CCCL_CUDACC_AT_LEAST(11, 4) && !_CCCL_CUDA_COMPILER(CLANG, <, 14)
|
||||
# define __cccl_ptx_isa 740ULL
|
||||
// PTX ISA 7.3 is available from CUDA 11.3, driver r465
|
||||
#elif _CCCL_CUDACC_AT_LEAST(11, 3) && !_CCCL_CUDA_COMPILER(CLANG, <, 14)
|
||||
# define __cccl_ptx_isa 730ULL
|
||||
// PTX ISA 7.2 is available from CUDA 11.2, driver r460
|
||||
#elif _CCCL_CUDACC_AT_LEAST(11, 2) && !_CCCL_CUDA_COMPILER(CLANG, <, 13)
|
||||
# define __cccl_ptx_isa 720ULL
|
||||
// PTX ISA 7.1 is available from CUDA 11.1, driver r455
|
||||
#elif _CCCL_CUDACC_AT_LEAST(11, 1) && !_CCCL_CUDA_COMPILER(CLANG, <, 13)
|
||||
# define __cccl_ptx_isa 710ULL
|
||||
// PTX ISA 7.0 is available from CUDA 11.0, driver r445
|
||||
#elif _CCCL_CUDACC_AT_LEAST(11, 0) && !_CCCL_CUDA_COMPILER(CLANG, <, 12)
|
||||
# define __cccl_ptx_isa 700ULL
|
||||
// Fallback case. Define the ISA version to be zero. This ensures that the macro is always defined.
|
||||
#else
|
||||
# define __cccl_ptx_isa 0ULL
|
||||
#endif
|
||||
|
||||
// We define certain feature test macros depending on availability. When
|
||||
// __CUDA_MINIMUM_ARCH__ is not available, we define the following features
|
||||
// depending on PTX ISA. This permits checking for the feature in host code.
|
||||
// When __CUDA_MINIMUM_ARCH__ is available, we only enable the feature when the
|
||||
// hardware supports it.
|
||||
#if __cccl_ptx_isa >= 800
|
||||
# if (!defined(__CUDA_MINIMUM_ARCH__)) || (defined(__CUDA_MINIMUM_ARCH__) && 900 <= __CUDA_MINIMUM_ARCH__)
|
||||
# define __cccl_lib_local_barrier_arrive_tx
|
||||
# define __cccl_lib_experimental_ctk12_cp_async_exposure
|
||||
# endif
|
||||
#endif // __cccl_ptx_isa >= 800
|
||||
|
||||
// NVRTC ships a built-in copy of <nv/detail/__target_macros>, so including CCCL's version of this header will omit the
|
||||
// content since the header guards are already defined. To make older NVRTC versions have a few newer feature macros
|
||||
// required for the PTX tests, we define them here outside the header guards.
|
||||
// TODO(bgruber): limit this workaround to NVRTC versions older than the first one shipping those macros
|
||||
#if _CCCL_COMPILER(NVRTC)
|
||||
|
||||
// missing SM_88
|
||||
# if !defined(NV_PROVIDES_SM_88)
|
||||
# define _NV_TARGET_VAL_SM_88 880
|
||||
# define NV_PROVIDES_SM_88 __NV_PROVIDES_SM_88
|
||||
# define NV_IS_EXACTLY_SM_88 __NV_IS_EXACTLY_SM_88
|
||||
# if (__CUDA_ARCH__ == _NV_TARGET_VAL_SM_88)
|
||||
# define _NV_TARGET_BOOL___NV_IS_EXACTLY_SM_88 1
|
||||
# define _NV_TARGET___NV_IS_EXACTLY_SM_88 1
|
||||
# else
|
||||
# define _NV_TARGET_BOOL___NV_IS_EXACTLY_SM_88 0
|
||||
# define _NV_TARGET___NV_IS_EXACTLY_SM_88 0
|
||||
# endif
|
||||
# if (__CUDA_ARCH__ >= _NV_TARGET_VAL_SM_88)
|
||||
# define _NV_TARGET___NV_PROVIDES_SM_88 1
|
||||
# define _NV_TARGET_BOOL___NV_PROVIDES_SM_88 1
|
||||
# else
|
||||
# define _NV_TARGET___NV_PROVIDES_SM_88 0
|
||||
# define _NV_TARGET_BOOL___NV_PROVIDES_SM_88 0
|
||||
# endif
|
||||
# endif // !NV_PROVIDES_SM_88
|
||||
|
||||
// missing SM_90a
|
||||
# ifndef NV_HAS_FEATURE_SM_90a
|
||||
# define NV_HAS_FEATURE_SM_90a __NV_HAS_FEATURE_SM_90a
|
||||
# if defined(__CUDA_ARCH_FEAT_SM90_ALL) || (defined(__CUDA_ARCH_SPECIFIC__) && (__CUDA_ARCH_SPECIFIC__ == 900))
|
||||
# define _NV_TARGET_BOOL___NV_HAS_FEATURE_SM_90a 1
|
||||
# else
|
||||
# define _NV_TARGET_BOOL___NV_HAS_FEATURE_SM_90a 0
|
||||
# endif
|
||||
# endif // NV_HAS_FEATURE_SM_90a
|
||||
|
||||
// missing SM_100
|
||||
# ifndef NV_PROVIDES_SM_100
|
||||
# define _NV_TARGET_VAL_SM_100 1000
|
||||
# define NV_PROVIDES_SM_100 __NV_PROVIDES_SM_100
|
||||
# define NV_IS_EXACTLY_SM_100 __NV_IS_EXACTLY_SM_100
|
||||
# if (__CUDA_ARCH__ == _NV_TARGET_VAL_SM_100)
|
||||
# define _NV_TARGET_BOOL___NV_IS_EXACTLY_SM_100 1
|
||||
# define _NV_TARGET___NV_IS_EXACTLY_SM_100 1
|
||||
# else
|
||||
# define _NV_TARGET_BOOL___NV_IS_EXACTLY_SM_100 0
|
||||
# define _NV_TARGET___NV_IS_EXACTLY_SM_100 0
|
||||
# endif
|
||||
# if (__CUDA_ARCH__ >= _NV_TARGET_VAL_SM_100)
|
||||
# define _NV_TARGET___NV_PROVIDES_SM_100 1
|
||||
# define _NV_TARGET_BOOL___NV_PROVIDES_SM_100 1
|
||||
# else
|
||||
# define _NV_TARGET___NV_PROVIDES_SM_100 0
|
||||
# define _NV_TARGET_BOOL___NV_PROVIDES_SM_100 0
|
||||
# endif
|
||||
# endif // !NV_PROVIDES_SM_100
|
||||
|
||||
// missing SM_100a
|
||||
# ifndef NV_HAS_FEATURE_SM_100a
|
||||
# define NV_HAS_FEATURE_SM_100a __NV_HAS_FEATURE_SM_100a
|
||||
# if defined(__CUDA_ARCH_FEAT_SM100_ALL) || (defined(__CUDA_ARCH_SPECIFIC__) && (__CUDA_ARCH_SPECIFIC__ == 1000))
|
||||
# define _NV_TARGET_BOOL___NV_HAS_FEATURE_SM_100a 1
|
||||
# else
|
||||
# define _NV_TARGET_BOOL___NV_HAS_FEATURE_SM_100a 0
|
||||
# endif
|
||||
# endif // !NV_HAS_FEATURE_SM_100a
|
||||
|
||||
// missing SM_103
|
||||
# ifndef NV_PROVIDES_SM_103
|
||||
# define _NV_TARGET_VAL_SM_103 1030
|
||||
# define NV_PROVIDES_SM_103 __NV_PROVIDES_SM_103
|
||||
# define NV_IS_EXACTLY_SM_103 __NV_IS_EXACTLY_SM_103
|
||||
# if (__CUDA_ARCH__ == _NV_TARGET_VAL_SM_103)
|
||||
# define _NV_TARGET_BOOL___NV_IS_EXACTLY_SM_103 1
|
||||
# define _NV_TARGET___NV_IS_EXACTLY_SM_103 1
|
||||
# else
|
||||
# define _NV_TARGET_BOOL___NV_IS_EXACTLY_SM_103 0
|
||||
# define _NV_TARGET___NV_IS_EXACTLY_SM_103 0
|
||||
# endif
|
||||
# if (__CUDA_ARCH__ >= _NV_TARGET_VAL_SM_103)
|
||||
# define _NV_TARGET___NV_PROVIDES_SM_103 1
|
||||
# define _NV_TARGET_BOOL___NV_PROVIDES_SM_103 1
|
||||
# else
|
||||
# define _NV_TARGET___NV_PROVIDES_SM_103 0
|
||||
# define _NV_TARGET_BOOL___NV_PROVIDES_SM_103 0
|
||||
# endif
|
||||
# endif // !NV_PROVIDES_SM_103
|
||||
|
||||
// missing SM_103
|
||||
# ifndef NV_HAS_FEATURE_SM_103a
|
||||
# define NV_HAS_FEATURE_SM_103a __NV_HAS_FEATURE_SM_103a
|
||||
# if defined(__CUDA_ARCH_FEAT_SM103_ALL) || (defined(__CUDA_ARCH_SPECIFIC__) && (__CUDA_ARCH_SPECIFIC__ == 1030))
|
||||
# define _NV_TARGET_BOOL___NV_HAS_FEATURE_SM_103a 1
|
||||
# else
|
||||
# define _NV_TARGET_BOOL___NV_HAS_FEATURE_SM_103a 0
|
||||
# endif
|
||||
# endif // !NV_HAS_FEATURE_SM_103a
|
||||
|
||||
// missing SM_110
|
||||
# ifndef NV_PROVIDES_SM_110
|
||||
# define _NV_TARGET_VAL_SM_110 1100
|
||||
# define NV_PROVIDES_SM_110 __NV_PROVIDES_SM_110
|
||||
# define NV_IS_EXACTLY_SM_110 __NV_IS_EXACTLY_SM_110
|
||||
# if (__CUDA_ARCH__ == _NV_TARGET_VAL_SM_110)
|
||||
# define _NV_TARGET_BOOL___NV_IS_EXACTLY_SM_110 1
|
||||
# define _NV_TARGET___NV_IS_EXACTLY_SM_110 1
|
||||
# else
|
||||
# define _NV_TARGET_BOOL___NV_IS_EXACTLY_SM_110 0
|
||||
# define _NV_TARGET___NV_IS_EXACTLY_SM_110 0
|
||||
# endif
|
||||
# if (__CUDA_ARCH__ >= _NV_TARGET_VAL_SM_110)
|
||||
# define _NV_TARGET___NV_PROVIDES_SM_110 1
|
||||
# define _NV_TARGET_BOOL___NV_PROVIDES_SM_110 1
|
||||
# else
|
||||
# define _NV_TARGET___NV_PROVIDES_SM_110 0
|
||||
# define _NV_TARGET_BOOL___NV_PROVIDES_SM_110 0
|
||||
# endif
|
||||
# endif // !NV_PROVIDES_SM_110
|
||||
|
||||
// missing SM_110a
|
||||
# ifndef NV_HAS_FEATURE_SM_110a
|
||||
# define NV_HAS_FEATURE_SM_110a __NV_HAS_FEATURE_SM_110a
|
||||
# if defined(__CUDA_ARCH_FEAT_SM110_ALL) || (defined(__CUDA_ARCH_SPECIFIC__) && (__CUDA_ARCH_SPECIFIC__ == 1100))
|
||||
# define _NV_TARGET_BOOL___NV_HAS_FEATURE_SM_110a 1
|
||||
# else
|
||||
# define _NV_TARGET_BOOL___NV_HAS_FEATURE_SM_110a 0
|
||||
# endif
|
||||
# endif // NV_HAS_FEATURE_SM_110a
|
||||
|
||||
// missing SM_120
|
||||
# ifndef NV_PROVIDES_SM_120
|
||||
# define _NV_TARGET_VAL_SM_120 1200
|
||||
# define NV_PROVIDES_SM_120 __NV_PROVIDES_SM_120
|
||||
# define NV_IS_EXACTLY_SM_120 __NV_IS_EXACTLY_SM_120
|
||||
# if (__CUDA_ARCH__ == _NV_TARGET_VAL_SM_120)
|
||||
# define _NV_TARGET_BOOL___NV_IS_EXACTLY_SM_120 1
|
||||
# define _NV_TARGET___NV_IS_EXACTLY_SM_120 1
|
||||
# else
|
||||
# define _NV_TARGET_BOOL___NV_IS_EXACTLY_SM_120 0
|
||||
# define _NV_TARGET___NV_IS_EXACTLY_SM_120 0
|
||||
# endif
|
||||
# if (__CUDA_ARCH__ >= _NV_TARGET_VAL_SM_120)
|
||||
# define _NV_TARGET___NV_PROVIDES_SM_120 1
|
||||
# define _NV_TARGET_BOOL___NV_PROVIDES_SM_120 1
|
||||
# else
|
||||
# define _NV_TARGET___NV_PROVIDES_SM_120 0
|
||||
# define _NV_TARGET_BOOL___NV_PROVIDES_SM_120 0
|
||||
# endif
|
||||
# endif // !NV_PROVIDES_SM_120
|
||||
|
||||
// missing SM_120a
|
||||
# ifndef NV_HAS_FEATURE_SM_120a
|
||||
# define NV_HAS_FEATURE_SM_120a __NV_HAS_FEATURE_SM_120a
|
||||
# if defined(__CUDA_ARCH_FEAT_SM120_ALL) || (defined(__CUDA_ARCH_SPECIFIC__) && (__CUDA_ARCH_SPECIFIC__ == 1200))
|
||||
# define _NV_TARGET_BOOL___NV_HAS_FEATURE_SM_120a 1
|
||||
# else
|
||||
# define _NV_TARGET_BOOL___NV_HAS_FEATURE_SM_120a 0
|
||||
# endif
|
||||
# endif // _CCCL_COMPILER(NVRTC)
|
||||
|
||||
// missing SM_121
|
||||
# if !defined(NV_PROVIDES_SM_121)
|
||||
# define _NV_TARGET_VAL_SM_121 1210
|
||||
# define NV_PROVIDES_SM_121 __NV_PROVIDES_SM_121
|
||||
# define NV_IS_EXACTLY_SM_121 __NV_IS_EXACTLY_SM_121
|
||||
# if (__CUDA_ARCH__ == _NV_TARGET_VAL_SM_121)
|
||||
# define _NV_TARGET_BOOL___NV_IS_EXACTLY_SM_121 1
|
||||
# define _NV_TARGET___NV_IS_EXACTLY_SM_121 1
|
||||
# else
|
||||
# define _NV_TARGET_BOOL___NV_IS_EXACTLY_SM_121 0
|
||||
# define _NV_TARGET___NV_IS_EXACTLY_SM_121 0
|
||||
# endif
|
||||
# if (__CUDA_ARCH__ >= _NV_TARGET_VAL_SM_121)
|
||||
# define _NV_TARGET___NV_PROVIDES_SM_121 1
|
||||
# define _NV_TARGET_BOOL___NV_PROVIDES_SM_121 1
|
||||
# else
|
||||
# define _NV_TARGET___NV_PROVIDES_SM_121 0
|
||||
# define _NV_TARGET_BOOL___NV_PROVIDES_SM_121 0
|
||||
# endif
|
||||
# endif // !NV_PROVIDES_SM_121
|
||||
|
||||
// missing SM_121a
|
||||
# ifndef NV_HAS_FEATURE_SM_121a
|
||||
# define NV_HAS_FEATURE_SM_121a __NV_HAS_FEATURE_SM_121a
|
||||
# if defined(__CUDA_ARCH_FEAT_SM121_ALL) || (defined(__CUDA_ARCH_SPECIFIC__) && (__CUDA_ARCH_SPECIFIC__ == 1210))
|
||||
# define _NV_TARGET_BOOL___NV_HAS_FEATURE_SM_121a 1
|
||||
# else
|
||||
# define _NV_TARGET_BOOL___NV_HAS_FEATURE_SM_121a 0
|
||||
# endif
|
||||
# endif // NV_HAS_FEATURE_SM_121a
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// family-specific SM versions
|
||||
|
||||
// missing SM_100f
|
||||
# ifndef NV_HAS_FEATURE_SM_100f
|
||||
# define NV_HAS_FEATURE_SM_100f __NV_HAS_FEATURE_SM_100f
|
||||
# if defined(__CUDA_ARCH_FAMILY_SPECIFIC__) && (__CUDA_ARCH_FAMILY_SPECIFIC__ == 1000)
|
||||
# define _NV_TARGET_BOOL___NV_HAS_FEATURE_SM_100f 1
|
||||
# else
|
||||
# define _NV_TARGET_BOOL___NV_HAS_FEATURE_SM_100f 0
|
||||
# endif
|
||||
# endif // NV_HAS_FEATURE_SM_100
|
||||
|
||||
// missing SM_103f
|
||||
# ifndef NV_HAS_FEATURE_SM_103f
|
||||
# define NV_HAS_FEATURE_SM_103f __NV_HAS_FEATURE_SM_103f
|
||||
# if defined(__CUDA_ARCH_FAMILY_SPECIFIC__) && (__CUDA_ARCH_FAMILY_SPECIFIC__ == 1030)
|
||||
# define _NV_TARGET_BOOL___NV_HAS_FEATURE_SM_103f 1
|
||||
# else
|
||||
# define _NV_TARGET_BOOL___NV_HAS_FEATURE_SM_103f 0
|
||||
# endif
|
||||
# endif // NV_HAS_FEATURE_SM_103f
|
||||
|
||||
// missing SM_110f
|
||||
# ifndef NV_HAS_FEATURE_SM_110f
|
||||
# define NV_HAS_FEATURE_SM_110f __NV_HAS_FEATURE_SM_110f
|
||||
# if defined(__CUDA_ARCH_FAMILY_SPECIFIC__) && (__CUDA_ARCH_FAMILY_SPECIFIC__ == 1100)
|
||||
# define _NV_TARGET_BOOL___NV_HAS_FEATURE_SM_110f 1
|
||||
# else
|
||||
# define _NV_TARGET_BOOL___NV_HAS_FEATURE_SM_110f 0
|
||||
# endif
|
||||
# endif // NV_HAS_FEATURE_SM_110f
|
||||
|
||||
// missing SM_120f
|
||||
# ifndef NV_HAS_FEATURE_SM_120f
|
||||
# define NV_HAS_FEATURE_SM_120f __NV_HAS_FEATURE_SM_120f
|
||||
# if defined(__CUDA_ARCH_FAMILY_SPECIFIC__) && (__CUDA_ARCH_FAMILY_SPECIFIC__ == 1200)
|
||||
# define _NV_TARGET_BOOL___NV_HAS_FEATURE_SM_120f 1
|
||||
# else
|
||||
# define _NV_TARGET_BOOL___NV_HAS_FEATURE_SM_120f 0
|
||||
# endif
|
||||
# endif // NV_HAS_FEATURE_SM_120f
|
||||
|
||||
// missing SM_121f
|
||||
# ifndef NV_HAS_FEATURE_SM_121f
|
||||
# define NV_HAS_FEATURE_SM_121f __NV_HAS_FEATURE_SM_121f
|
||||
# if defined(__CUDA_ARCH_FAMILY_SPECIFIC__) && (__CUDA_ARCH_FAMILY_SPECIFIC__ == 1210)
|
||||
# define _NV_TARGET_BOOL___NV_HAS_FEATURE_SM_121f 1
|
||||
# else
|
||||
# define _NV_TARGET_BOOL___NV_HAS_FEATURE_SM_121f 0
|
||||
# endif
|
||||
# endif // NV_HAS_FEATURE_SM_121f
|
||||
|
||||
#endif // _CCCL_COMPILER(NVRTC)
|
||||
#endif // __CCCL_PTX_ISA_H_
|
||||
72
qwen3_6_scripts/cccl_preload/include/cuda/std/__cccl/rtti.h
Normal file
72
qwen3_6_scripts/cccl_preload/include/cuda/std/__cccl/rtti.h
Normal file
@@ -0,0 +1,72 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CCCL_RTTI_H
|
||||
#define __CCCL_RTTI_H
|
||||
|
||||
#include <cuda/std/__cccl/compiler.h>
|
||||
#include <cuda/std/__cccl/system_header.h>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__cccl/builtin.h>
|
||||
|
||||
// NOTE: some compilers support the `typeid` feature but not the `dynamic_cast`
|
||||
// feature. This is why we have separate macros for each.
|
||||
|
||||
#ifndef _CCCL_NO_RTTI
|
||||
# if defined(CCCL_DISABLE_RTTI) // Escape hatch for users to manually disable RTTI
|
||||
# define _CCCL_NO_RTTI
|
||||
# elif defined(__CUDA_ARCH__)
|
||||
# define _CCCL_NO_RTTI // No RTTI in CUDA device code
|
||||
# elif _CCCL_COMPILER(NVRTC)
|
||||
# define _CCCL_NO_RTTI
|
||||
# elif _CCCL_COMPILER(MSVC)
|
||||
# if _CPPRTTI == 0
|
||||
# define _CCCL_NO_RTTI
|
||||
# endif
|
||||
# elif _CCCL_COMPILER(CLANG)
|
||||
# if !_CCCL_HAS_FEATURE(cxx_rtti)
|
||||
# define _CCCL_NO_RTTI
|
||||
# endif
|
||||
# else
|
||||
# if __GXX_RTTI == 0 && __cpp_rtti == 0
|
||||
# define _CCCL_NO_RTTI
|
||||
# endif
|
||||
# endif
|
||||
#endif // !_CCCL_NO_RTTI
|
||||
|
||||
#ifndef _CCCL_NO_TYPEID
|
||||
# if defined(CCCL_DISABLE_RTTI) // CCCL_DISABLE_RTTI disables typeid also
|
||||
# define _CCCL_NO_TYPEID
|
||||
# elif defined(__CUDA_ARCH__)
|
||||
# define _CCCL_NO_TYPEID // No typeid in CUDA device code
|
||||
# elif _CCCL_COMPILER(NVRTC)
|
||||
# define _CCCL_NO_TYPEID
|
||||
# elif _CCCL_COMPILER(MSVC)
|
||||
// No-op, MSVC always supports typeid even when RTTI is disabled
|
||||
# elif _CCCL_COMPILER(CLANG)
|
||||
# if !_CCCL_HAS_FEATURE(cxx_rtti)
|
||||
# define _CCCL_NO_TYPEID
|
||||
# endif
|
||||
# else
|
||||
# if __GXX_RTTI == 0 && __cpp_rtti == 0
|
||||
# define _CCCL_NO_TYPEID
|
||||
# endif
|
||||
# endif
|
||||
#endif // !_CCCL_NO_TYPEID
|
||||
|
||||
#endif // __CCCL_RTTI_H
|
||||
@@ -0,0 +1,83 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CCCL_SEQUENCE_ACCESS_H
|
||||
#define __CCCL_SEQUENCE_ACCESS_H
|
||||
|
||||
#include <cuda/std/__cccl/compiler.h>
|
||||
#include <cuda/std/__cccl/system_header.h>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
// We need to define hidden friends for {cr,r,}{begin,end} of our containers as we will otherwise encounter ambigouities
|
||||
#define _CCCL_SYNTHESIZE_SEQUENCE_ACCESS(_ClassName, _ConstIter) \
|
||||
[[nodiscard]] _CCCL_API friend iterator begin(_ClassName& __sequence) noexcept(noexcept(__sequence.begin())) \
|
||||
{ \
|
||||
return __sequence.begin(); \
|
||||
} \
|
||||
[[nodiscard]] _CCCL_API friend _ConstIter begin(const _ClassName& __sequence) noexcept(noexcept(__sequence.begin())) \
|
||||
{ \
|
||||
return __sequence.begin(); \
|
||||
} \
|
||||
[[nodiscard]] _CCCL_API friend iterator end(_ClassName& __sequence) noexcept(noexcept(__sequence.end())) \
|
||||
{ \
|
||||
return __sequence.end(); \
|
||||
} \
|
||||
[[nodiscard]] _CCCL_API friend _ConstIter end(const _ClassName& __sequence) noexcept(noexcept(__sequence.end())) \
|
||||
{ \
|
||||
return __sequence.end(); \
|
||||
} \
|
||||
[[nodiscard]] _CCCL_API friend _ConstIter cbegin(const _ClassName& __sequence) noexcept( \
|
||||
noexcept(__sequence.begin())) \
|
||||
{ \
|
||||
return __sequence.begin(); \
|
||||
} \
|
||||
[[nodiscard]] _CCCL_API friend _ConstIter cend(const _ClassName& __sequence) noexcept(noexcept(__sequence.end())) \
|
||||
{ \
|
||||
return __sequence.end(); \
|
||||
}
|
||||
#define _CCCL_SYNTHESIZE_SEQUENCE_REVERSE_ACCESS(_ClassName, _ConstRevIter) \
|
||||
[[nodiscard]] _CCCL_API friend reverse_iterator rbegin(_ClassName& __sequence) noexcept( \
|
||||
noexcept(__sequence.rbegin())) \
|
||||
{ \
|
||||
return __sequence.rbegin(); \
|
||||
} \
|
||||
[[nodiscard]] _CCCL_API friend _ConstRevIter rbegin(const _ClassName& __sequence) noexcept( \
|
||||
noexcept(__sequence.rbegin())) \
|
||||
{ \
|
||||
return __sequence.rbegin(); \
|
||||
} \
|
||||
[[nodiscard]] _CCCL_API friend reverse_iterator rend(_ClassName& __sequence) noexcept(noexcept(__sequence.rend())) \
|
||||
{ \
|
||||
return __sequence.rend(); \
|
||||
} \
|
||||
[[nodiscard]] _CCCL_API friend _ConstRevIter rend(const _ClassName& __sequence) noexcept( \
|
||||
noexcept(__sequence.rend())) \
|
||||
{ \
|
||||
return __sequence.rend(); \
|
||||
} \
|
||||
[[nodiscard]] _CCCL_API friend _ConstRevIter crbegin(const _ClassName& __sequence) noexcept( \
|
||||
noexcept(__sequence.rbegin())) \
|
||||
{ \
|
||||
return __sequence.rbegin(); \
|
||||
} \
|
||||
[[nodiscard]] _CCCL_API friend _ConstRevIter crend(const _ClassName& __sequence) noexcept( \
|
||||
noexcept(__sequence.rend())) \
|
||||
{ \
|
||||
return __sequence.rend(); \
|
||||
}
|
||||
|
||||
#endif // __CCCL_SEQUENCE_ACCESS_H
|
||||
@@ -0,0 +1,38 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CCCL_SYSTEM_HEADER_H
|
||||
#define __CCCL_SYSTEM_HEADER_H
|
||||
|
||||
#include <cuda/std/__cccl/compiler.h>
|
||||
#include <cuda/std/__cccl/is_non_narrowing_convertible.h> // IWYU pragma: export
|
||||
|
||||
// Enforce that cccl headers are treated as system headers
|
||||
#if _CCCL_COMPILER(GCC) || _CCCL_COMPILER(NVHPC)
|
||||
# define _CCCL_FORCE_SYSTEM_HEADER_GCC
|
||||
#elif _CCCL_COMPILER(CLANG)
|
||||
# define _CCCL_FORCE_SYSTEM_HEADER_CLANG
|
||||
#elif _CCCL_COMPILER(MSVC)
|
||||
# define _CCCL_FORCE_SYSTEM_HEADER_MSVC
|
||||
#endif // other compilers
|
||||
|
||||
// Potentially enable that cccl headers are treated as system headers
|
||||
#if !defined(_CCCL_NO_SYSTEM_HEADER) && !(_CCCL_COMPILER(MSVC) && defined(_LIBCUDACXX_DISABLE_PRAGMA_MSVC_WARNING)) \
|
||||
&& !_CCCL_COMPILER(NVRTC) && !defined(_LIBCUDACXX_DISABLE_PRAGMA_GCC_SYSTEM_HEADER)
|
||||
# if _CCCL_COMPILER(GCC) || _CCCL_COMPILER(NVHPC)
|
||||
# define _CCCL_IMPLICIT_SYSTEM_HEADER_GCC
|
||||
# elif _CCCL_COMPILER(CLANG)
|
||||
# define _CCCL_IMPLICIT_SYSTEM_HEADER_CLANG
|
||||
# elif _CCCL_COMPILER(MSVC)
|
||||
# define _CCCL_IMPLICIT_SYSTEM_HEADER_MSVC
|
||||
# endif // other compilers
|
||||
#endif // Use system header
|
||||
|
||||
#endif // __CCCL_SYSTEM_HEADER_H
|
||||
@@ -0,0 +1,31 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CCCL_UNREACHABLE_H
|
||||
#define __CCCL_UNREACHABLE_H
|
||||
|
||||
#include <cuda/std/__cccl/compiler.h>
|
||||
#include <cuda/std/__cccl/system_header.h>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#if _CCCL_COMPILER(MSVC) && !_CCCL_DEVICE_COMPILATION()
|
||||
# define _CCCL_UNREACHABLE() __assume(0)
|
||||
#else
|
||||
# define _CCCL_UNREACHABLE() __builtin_unreachable()
|
||||
#endif
|
||||
|
||||
#endif // __CCCL_UNREACHABLE_H
|
||||
@@ -0,0 +1,26 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
// This file is somewhat automatically generated. Disable clang-format.
|
||||
// clang-format off
|
||||
|
||||
|
||||
#ifndef __CCCL_VERSION_H
|
||||
#define __CCCL_VERSION_H
|
||||
|
||||
#define CCCL_VERSION 3005000
|
||||
#define CCCL_MAJOR_VERSION (CCCL_VERSION / 1000000)
|
||||
#define CCCL_MINOR_VERSION (((CCCL_VERSION / 1000) % 1000))
|
||||
#define CCCL_PATCH_VERSION (CCCL_VERSION % 1000)
|
||||
|
||||
#if CCCL_PATCH_VERSION > 99
|
||||
# error "CCCL patch version cannot be greater than 99 for compatibility with Thrust/CUB's MMMmmmpp format."
|
||||
#endif
|
||||
|
||||
#endif // __CCCL_VERSION_H
|
||||
@@ -0,0 +1,198 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CCCL_VISIBILITY_H
|
||||
#define __CCCL_VISIBILITY_H
|
||||
|
||||
#ifndef _CUDA__CCCL_CONFIG
|
||||
# error "<__cccl/visibility.h> should only be included in from <cuda/__cccl_config>"
|
||||
#endif // _CUDA__CCCL_CONFIG
|
||||
|
||||
#include <cuda/std/__cccl/compiler.h>
|
||||
#include <cuda/std/__cccl/system_header.h>
|
||||
|
||||
// We want to ensure that all warning emitting from this header are suppressed
|
||||
#if defined(_CCCL_FORCE_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_FORCE_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_FORCE_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__cccl/attributes.h>
|
||||
#include <cuda/std/__cccl/cuda_capabilities.h>
|
||||
#include <cuda/std/__cccl/execution_space.h>
|
||||
#include <cuda/std/__cccl/os.h>
|
||||
|
||||
// For unknown reasons, nvc++ need to selectively disable this warning
|
||||
// We do not want to use our usual macro because that would have push / pop semantics
|
||||
#if _CCCL_COMPILER(NVHPC)
|
||||
# pragma nv_diag_suppress 1407
|
||||
#endif // _CCCL_COMPILER(NVHPC)
|
||||
|
||||
// Enable us to hide kernels
|
||||
#if _CCCL_OS(WINDOWS) || _CCCL_COMPILER(NVRTC)
|
||||
# define _CCCL_VISIBILITY_HIDDEN
|
||||
#else // ^^^ _CCCL_COMPILER(NVRTC) ^^^ / vvv _CCCL_COMPILER(NVRTC) vvv
|
||||
# define _CCCL_VISIBILITY_HIDDEN __attribute__((__visibility__("hidden")))
|
||||
#endif // !_CCCL_COMPILER(NVRTC)
|
||||
|
||||
#if _CCCL_COMPILER(NVRTC)
|
||||
# define _CCCL_VISIBILITY_DEFAULT
|
||||
#elif _CCCL_OS(WINDOWS)
|
||||
# define _CCCL_VISIBILITY_DEFAULT __declspec(dllimport)
|
||||
#else // ^^^ _CCCL_COMPILER(NVRTC) ^^^ / vvv !_CCCL_COMPILER(NVRTC) vvv
|
||||
# define _CCCL_VISIBILITY_DEFAULT __attribute__((__visibility__("default")))
|
||||
#endif // !_CCCL_COMPILER(NVRTC)
|
||||
|
||||
#if _CCCL_COMPILER(NVRTC)
|
||||
# define _CCCL_VISIBILITY_EXPORT
|
||||
#elif _CCCL_OS(WINDOWS)
|
||||
# define _CCCL_VISIBILITY_EXPORT __declspec(dllexport)
|
||||
#else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC) vvv
|
||||
# define _CCCL_VISIBILITY_EXPORT _CCCL_VISIBILITY_DEFAULT
|
||||
#endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
#if _CCCL_OS(WINDOWS) || _CCCL_COMPILER(NVRTC)
|
||||
# define _CCCL_TYPE_VISIBILITY_DEFAULT
|
||||
# define _CCCL_TYPE_VISIBILITY_HIDDEN
|
||||
#elif _CCCL_HAS_ATTRIBUTE(__type_visibility__)
|
||||
# define _CCCL_TYPE_VISIBILITY_DEFAULT __attribute__((__type_visibility__("default")))
|
||||
# define _CCCL_TYPE_VISIBILITY_HIDDEN __attribute__((__type_visibility__("hidden")))
|
||||
#else // ^^^ _CCCL_HAS_ATTRIBUTE(__type_visibility__) ^^^ / vvv !_CCCL_HAS_ATTRIBUTE(__type_visibility__) vvv
|
||||
# define _CCCL_TYPE_VISIBILITY_DEFAULT _CCCL_VISIBILITY_DEFAULT
|
||||
# define _CCCL_TYPE_VISIBILITY_HIDDEN _CCCL_VISIBILITY_HIDDEN
|
||||
#endif // !_CCCL_COMPILER(NVRTC)
|
||||
|
||||
#if _CCCL_COMPILER(MSVC)
|
||||
# define _CCCL_FORCEINLINE __forceinline
|
||||
# define _CCCL_FORCEINLINE_LAMBDA
|
||||
#else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC) vvv
|
||||
# define _CCCL_FORCEINLINE __inline__ __attribute__((__always_inline__))
|
||||
# define _CCCL_FORCEINLINE_LAMBDA __attribute__((__always_inline__))
|
||||
#endif // ^^^ !_CCCL_COMPILER(MSVC) ^^^
|
||||
|
||||
#if _CCCL_COMPILER(NVRTC)
|
||||
# define _CCCL_NOINLINE __attribute__((noinline))
|
||||
#elif _CCCL_OS(WINDOWS)
|
||||
# define _CCCL_NOINLINE __declspec(noinline)
|
||||
#else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv _CCCL_COMPILER(MSVC) vvv
|
||||
// We can't use __noinline__ here because of CTK defining this macro.
|
||||
# define _CCCL_NOINLINE __attribute__((noinline))
|
||||
#endif // ^^^ !_CCCL_COMPILER(MSVC) ^^^
|
||||
|
||||
#if _CCCL_DEVICE_COMPILATION()
|
||||
# define _CCCL_NOINLINE_DEVICE _CCCL_NOINLINE
|
||||
#else // ^^^ _CCCL_DEVICE_COMPILATION() ^^^ / vvv !_CCCL_DEVICE_COMPILATION() vvv
|
||||
# define _CCCL_NOINLINE_DEVICE
|
||||
#endif // ^^^ !_CCCL_DEVICE_COMPILATION() ^^^
|
||||
|
||||
#if _CCCL_HAS_ATTRIBUTE(__exclude_from_explicit_instantiation__)
|
||||
# define _CCCL_EXCLUDE_FROM_EXPLICIT_INSTANTIATION __attribute__((__exclude_from_explicit_instantiation__))
|
||||
#else // ^^^ exclude_from_explicit_instantiation ^^^ / vvv !exclude_from_explicit_instantiation vvv
|
||||
// NVCC complains mightily about being unable to inline functions if we use _CCCL_FORCEINLINE here
|
||||
# define _CCCL_EXCLUDE_FROM_EXPLICIT_INSTANTIATION
|
||||
#endif // !exclude_from_explicit_instantiation
|
||||
|
||||
#if _CCCL_COMPILER(NVHPC) // NVHPC has issues with visibility attributes on symbols with internal linkage
|
||||
# define _CCCL_HIDE_FROM_ABI inline
|
||||
#else // ^^^ _CCCL_COMPILER(NVHPC) ^^^ / vvv !_CCCL_COMPILER(NVHPC) vvv
|
||||
# define _CCCL_HIDE_FROM_ABI _CCCL_VISIBILITY_HIDDEN _CCCL_EXCLUDE_FROM_EXPLICIT_INSTANTIATION inline
|
||||
#endif // !_CCCL_COMPILER(NVHPC)
|
||||
|
||||
// Note: we will allow the user to redefine _CCCL_KERNEL_ATTRIBUTES until CCCL 4.0, since they may have
|
||||
// redefined CUB_DETAIL_KERNEL_ATTRIBUTES or THRUST_DETAIL_KERNEL_ATTRIBUTES.
|
||||
#if !defined(_CCCL_KERNEL_ATTRIBUTES)
|
||||
# define _CCCL_KERNEL_ATTRIBUTES __global__ _CCCL_VISIBILITY_HIDDEN
|
||||
#endif // !_CCCL_KERNEL_ATTRIBUTES
|
||||
|
||||
#if defined(CUB_DETAIL_KERNEL_ATTRIBUTES) || defined(THRUST_DETAIL_KERNEL_ATTRIBUTES)
|
||||
# error \
|
||||
"Redefining CCCL's kernel attributes via CUB_DETAIL_KERNEL_ATTRIBUTES or THRUST_DETAIL_KERNEL_ATTRIBUTES is not allowed. If you absolutely rely on this, you can override them by defining _CCCL_KERNEL_ATTRIBUTES, but this will be disallowed in CCCL 4.0."
|
||||
#endif // !_CCCL_KERNEL_ATTRIBUTES
|
||||
|
||||
//! @brief \c _CCCL_HIDE_FROM_ABI and \c _CCCL_FORCEINLINE cannot be used together because
|
||||
//! they both try to add `inline` to the function declaration. The following macros slice
|
||||
//! the function attributes differently to avoid this problem:
|
||||
//! - \c _CCCL_API declares the function host/device and hides the symbol from the ABI
|
||||
//! - \c _CCCL_NODEBUG_API does the same while also hiding the function from
|
||||
//! debuggers and marking the function as \c inline.
|
||||
//! - \c _CCCL_TRIVIAL_API does the same as \c _CCCL_NODEBUG_API while also force-inlining
|
||||
//! the function.
|
||||
#if _CCCL_COMPILER(NVHPC) // NVHPC has issues with visibility attributes on symbols with internal linkage
|
||||
# define _CCCL_API _CCCL_HOST_DEVICE
|
||||
# define _CCCL_HOST_DEVICE_API _CCCL_HOST_DEVICE
|
||||
# define _CCCL_HOST_API _CCCL_HOST
|
||||
# define _CCCL_DEVICE_API _CCCL_DEVICE
|
||||
# define _CCCL_TILE_API _CCCL_TILE
|
||||
#else // ^^^ _CCCL_COMPILER(NVHPC) ^^^ / vvv !_CCCL_COMPILER(NVHPC) vvv
|
||||
# define _CCCL_API _CCCL_TILE _CCCL_HOST_DEVICE _CCCL_VISIBILITY_HIDDEN _CCCL_EXCLUDE_FROM_EXPLICIT_INSTANTIATION
|
||||
# define _CCCL_HOST_DEVICE_API _CCCL_HOST_DEVICE _CCCL_VISIBILITY_HIDDEN _CCCL_EXCLUDE_FROM_EXPLICIT_INSTANTIATION
|
||||
# define _CCCL_HOST_API _CCCL_HOST _CCCL_VISIBILITY_HIDDEN _CCCL_EXCLUDE_FROM_EXPLICIT_INSTANTIATION
|
||||
# define _CCCL_DEVICE_API _CCCL_DEVICE _CCCL_VISIBILITY_HIDDEN _CCCL_EXCLUDE_FROM_EXPLICIT_INSTANTIATION
|
||||
# define _CCCL_TILE_API _CCCL_TILE _CCCL_VISIBILITY_HIDDEN _CCCL_EXCLUDE_FROM_EXPLICIT_INSTANTIATION
|
||||
#endif // !_CCCL_COMPILER(NVHPC)
|
||||
|
||||
//! @brief \c _CCCL_NODEBUG_API marks a function's visibility as hidden and causes
|
||||
//! debuggers to skip it. This is useful for functions like \c cuda::std::move that
|
||||
//! debuggers should not step into. If a \c _CCCL_NODEBUG_API function \c F calls a normal
|
||||
//! function \c G, stepping into \c F in a debugger will skip over \c F and step directly
|
||||
//! into \c G. In a stacktrace, \c F will still be shone, but you will not be able to
|
||||
//! set the debugger's active frame to \c F.
|
||||
#define _CCCL_NODEBUG_API _CCCL_API _CCCL_ARTIFICIAL _CCCL_NODEBUG inline
|
||||
#define _CCCL_NODEBUG_HOST_API _CCCL_HOST_API _CCCL_ARTIFICIAL _CCCL_NODEBUG inline
|
||||
#define _CCCL_NODEBUG_DEVICE_API _CCCL_DEVICE_API _CCCL_ARTIFICIAL _CCCL_NODEBUG inline
|
||||
|
||||
//! @brief \c _CCCL_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 useful in the definition of
|
||||
//! customization point objects.
|
||||
#define _CCCL_TRIVIAL_API _CCCL_API _CCCL_ARTIFICIAL _CCCL_NODEBUG _CCCL_FORCEINLINE
|
||||
#define _CCCL_TRIVIAL_HOST_API _CCCL_HOST_API _CCCL_ARTIFICIAL _CCCL_NODEBUG _CCCL_FORCEINLINE
|
||||
#define _CCCL_TRIVIAL_DEVICE_API _CCCL_DEVICE_API _CCCL_ARTIFICIAL _CCCL_NODEBUG _CCCL_FORCEINLINE
|
||||
|
||||
// Some functions have their addresses appear in public types (e.g., in
|
||||
// `cuda::__overrides_for` specializations). If the function is declared
|
||||
// `__attribute__((visibility("hidden")))`, and if the address appears, say, in the type
|
||||
// of a member of a class that is declared `__attribute__((visibility("default")))`, GCC
|
||||
// complains bitterly. So we avoid declaring those functions `hidden`. Instead of the
|
||||
// typical `_CCCL_API` macro, we use `_CCCL_PUBLIC_API` for those functions.
|
||||
#if _CCCL_OS(WINDOWS)
|
||||
# define _CCCL_PUBLIC_API _CCCL_HOST_DEVICE
|
||||
# define _CCCL_PUBLIC_HOST_API _CCCL_HOST
|
||||
# define _CCCL_PUBLIC_DEVICE_API _CCCL_DEVICE
|
||||
#else // ^^^ _CCCL_OS(WINDOWS) ^^^ / vvv !_CCCL_OS(WINDOWS) vvv
|
||||
# define _CCCL_PUBLIC_API _CCCL_HOST_DEVICE _CCCL_VISIBILITY_DEFAULT
|
||||
# define _CCCL_PUBLIC_HOST_API _CCCL_HOST _CCCL_VISIBILITY_DEFAULT
|
||||
# define _CCCL_PUBLIC_DEVICE_API _CCCL_DEVICE _CCCL_VISIBILITY_DEFAULT
|
||||
#endif // !_CCCL_OS(WINDOWS)
|
||||
|
||||
#ifdef _CCCL_DOXYGEN_INVOKED // Only for documentation
|
||||
//! If defined, usage of CUDA Dynamic Parallelism is disabled and APIs launching kernels can only be called from the
|
||||
//! host
|
||||
# define CCCL_DISABLE_CDP
|
||||
#endif // _CCCL_DOXYGEN_INVOKED
|
||||
|
||||
#if _CCCL_HAS_CDP()
|
||||
// We have CDP, so host and device APIs can call kernels
|
||||
# define _CCCL_CDP_API _CCCL_API
|
||||
#else // ^^^ _CCCL_HAS_CDP() ^^^ / vvv !_CCCL_HAS_CDP() vvv
|
||||
// We don't have CDP, only host APIs can call kernels
|
||||
# define _CCCL_CDP_API _CCCL_HOST_API
|
||||
#endif // ^^^ !_CCCL_HAS_CDP() ^^^
|
||||
|
||||
//! _LIBCUDACXX_HIDE_FROM_ABI is for backwards compatibility for external projects.
|
||||
//! _CCCL_API and its variants are the preferred way to declare functions
|
||||
//! that should be hidden from the ABI.
|
||||
//! Defined here to suppress any warnings from the definition
|
||||
#define _LIBCUDACXX_HIDE_FROM_ABI _CCCL_API inline
|
||||
|
||||
#endif // __CCCL_VISIBILITY_H
|
||||
@@ -0,0 +1,56 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___CONCEPTS_ARITHMETIC_H
|
||||
#define _CUDA_STD___CONCEPTS_ARITHMETIC_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__type_traits/is_arithmetic.h>
|
||||
#include <cuda/std/__type_traits/is_floating_point.h>
|
||||
#include <cuda/std/__type_traits/is_integral.h>
|
||||
#include <cuda/std/__type_traits/is_signed.h>
|
||||
#include <cuda/std/__type_traits/is_signed_integer.h>
|
||||
#include <cuda/std/__type_traits/is_unsigned_integer.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
// [concepts.arithmetic], arithmetic concepts
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT integral = is_integral_v<_Tp>;
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT signed_integral = integral<_Tp> && is_signed_v<_Tp>;
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT unsigned_integral = integral<_Tp> && !signed_integral<_Tp>;
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT floating_point = is_floating_point_v<_Tp>;
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT __cccl_signed_integer = __cccl_is_signed_integer_v<_Tp>;
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CONCEPTS_ARITHMETIC_H
|
||||
@@ -0,0 +1,64 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___CONCEPTS_ASSIGNABLE_H
|
||||
#define _CUDA_STD___CONCEPTS_ASSIGNABLE_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/common_reference_with.h>
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__concepts/same_as.h>
|
||||
#include <cuda/std/__type_traits/is_reference.h>
|
||||
#include <cuda/std/__type_traits/make_const_lvalue_ref.h>
|
||||
#include <cuda/std/__utility/forward.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
#if _CCCL_HAS_CONCEPTS()
|
||||
|
||||
// [concept.assignable]
|
||||
|
||||
template <class _Lhs, class _Rhs>
|
||||
concept assignable_from =
|
||||
is_lvalue_reference_v<_Lhs> && common_reference_with<__make_const_lvalue_ref<_Lhs>, __make_const_lvalue_ref<_Rhs>>
|
||||
&& requires(_Lhs __lhs, _Rhs&& __rhs) {
|
||||
{ __lhs = ::cuda::std::forward<_Rhs>(__rhs) } -> same_as<_Lhs>;
|
||||
};
|
||||
|
||||
#else // ^^^ _CCCL_HAS_CONCEPTS() ^^^ / vvv !_CCCL_HAS_CONCEPTS() vvv
|
||||
|
||||
template <class _Lhs, class _Rhs>
|
||||
_CCCL_CONCEPT_FRAGMENT(
|
||||
__assignable_from_,
|
||||
requires(_Lhs __lhs,
|
||||
_Rhs&& __rhs)(requires(is_lvalue_reference_v<_Lhs>),
|
||||
requires(common_reference_with<__make_const_lvalue_ref<_Lhs>, __make_const_lvalue_ref<_Rhs>>),
|
||||
requires(same_as<_Lhs, decltype(__lhs = ::cuda::std::forward<_Rhs>(__rhs))>)));
|
||||
|
||||
template <class _Lhs, class _Rhs>
|
||||
_CCCL_CONCEPT assignable_from = _CCCL_FRAGMENT(__assignable_from_, _Lhs, _Rhs);
|
||||
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CONCEPTS_ASSIGNABLE_H
|
||||
@@ -0,0 +1,63 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___CONCEPTS_BOOLEAN_TESTABLE_H
|
||||
#define _CUDA_STD___CONCEPTS_BOOLEAN_TESTABLE_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__concepts/convertible_to.h>
|
||||
#include <cuda/std/__utility/forward.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
#if _CCCL_HAS_CONCEPTS()
|
||||
|
||||
// [concepts.booleantestable]
|
||||
|
||||
template <class _Tp>
|
||||
concept __boolean_testable_impl = convertible_to<_Tp, bool>;
|
||||
|
||||
template <class _Tp>
|
||||
concept __boolean_testable = __boolean_testable_impl<_Tp> && requires(_Tp&& __t) {
|
||||
{ !::cuda::std::forward<_Tp>(__t) } -> __boolean_testable_impl;
|
||||
};
|
||||
|
||||
#else // ^^^ _CCCL_HAS_CONCEPTS() ^^^ / vvv !_CCCL_HAS_CONCEPTS() vvv
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT __boolean_testable_impl = convertible_to<_Tp, bool>;
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT_FRAGMENT(
|
||||
__boolean_testable_,
|
||||
requires(_Tp&& __t)(requires(__boolean_testable_impl<_Tp>),
|
||||
requires(__boolean_testable_impl<decltype(!::cuda::std::forward<_Tp>(__t))>)));
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT __boolean_testable = _CCCL_FRAGMENT(__boolean_testable_, _Tp);
|
||||
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CONCEPTS_BOOLEAN_TESTABLE_H
|
||||
@@ -0,0 +1,45 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___CONCEPTS_CLASS_OR_ENUM_H
|
||||
#define _CUDA_STD___CONCEPTS_CLASS_OR_ENUM_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__type_traits/is_class.h>
|
||||
#include <cuda/std/__type_traits/is_enum.h>
|
||||
#include <cuda/std/__type_traits/is_union.h>
|
||||
#include <cuda/std/__type_traits/remove_cvref.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT __class_or_enum = is_class_v<_Tp> || is_union_v<_Tp> || is_enum_v<_Tp>;
|
||||
|
||||
// Work around Clang bug https://llvm.org/PR52970
|
||||
// TODO: remove this workaround once libc++ no longer has to support Clang 13 (it was fixed in Clang 14).
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT __workaround_52970 = is_class_v<remove_cvref_t<_Tp>> || is_union_v<remove_cvref_t<_Tp>>;
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CONCEPTS_CLASS_OR_ENUM_H
|
||||
@@ -0,0 +1,69 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___CONCEPTS_COMMON_REFERENCE_WITH_H
|
||||
#define _CUDA_STD___CONCEPTS_COMMON_REFERENCE_WITH_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__concepts/convertible_to.h>
|
||||
#include <cuda/std/__concepts/same_as.h>
|
||||
#include <cuda/std/__type_traits/common_reference.h>
|
||||
#include <cuda/std/__type_traits/copy_cv.h>
|
||||
#include <cuda/std/__type_traits/copy_cvref.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
#if _CCCL_HAS_CONCEPTS()
|
||||
|
||||
// [concept.commonref]
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
concept common_reference_with =
|
||||
same_as<common_reference_t<_Tp, _Up>, common_reference_t<_Up, _Tp>>
|
||||
&& convertible_to<_Tp, common_reference_t<_Tp, _Up>> && convertible_to<_Up, common_reference_t<_Tp, _Up>>;
|
||||
|
||||
#else // ^^^ _CCCL_HAS_CONCEPTS() ^^^ / vvv !_CCCL_HAS_CONCEPTS() vvv
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_CCCL_CONCEPT_FRAGMENT(__common_reference_exists_,
|
||||
requires()(typename(common_reference_t<_Tp, _Up>), typename(common_reference_t<_Up, _Tp>)));
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_CCCL_CONCEPT _Common_reference_exists = _CCCL_FRAGMENT(__common_reference_exists_, _Tp, _Up);
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_CCCL_CONCEPT_FRAGMENT(
|
||||
__common_reference_with_,
|
||||
requires()(requires(_Common_reference_exists<_Tp, _Up>),
|
||||
requires(same_as<common_reference_t<_Tp, _Up>, common_reference_t<_Up, _Tp>>),
|
||||
requires(convertible_to<_Tp, common_reference_t<_Tp, _Up>>),
|
||||
requires(convertible_to<_Up, common_reference_t<_Tp, _Up>>)));
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_CCCL_CONCEPT common_reference_with = _CCCL_FRAGMENT(__common_reference_with_, _Tp, _Up);
|
||||
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CONCEPTS_COMMON_REFERENCE_WITH_H
|
||||
@@ -0,0 +1,389 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Copyright (c) Facebook, Inc. and its affiliates.
|
||||
// Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA___CONCEPTS_CONCEPT_MACROS_H
|
||||
#define _CUDA___CONCEPTS_CONCEPT_MACROS_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// _CCCL_TEMPLATE
|
||||
// Usage:
|
||||
// _CCCL_TEMPLATE(typename A, typename _Bp)
|
||||
// _CCCL_REQUIRES( Concept1<A> _CCCL_AND Concept2<_Bp>)
|
||||
// void foo(A a, _Bp b)
|
||||
// {}
|
||||
|
||||
// Barebones enable if implementation to use outside of cuda::std
|
||||
template <bool>
|
||||
struct __cccl_select
|
||||
{};
|
||||
|
||||
template <>
|
||||
struct __cccl_select<true>
|
||||
{
|
||||
template <class _Tp>
|
||||
using type = _Tp;
|
||||
};
|
||||
|
||||
template <bool _Bp, class _Tp = void>
|
||||
using __cccl_enable_if_t = typename __cccl_select<_Bp>::template type<_Tp>;
|
||||
|
||||
template <class _Tp, bool _Bp>
|
||||
using __cccl_requires_t = typename __cccl_select<_Bp>::template type<_Tp>;
|
||||
|
||||
#if _CCCL_HAS_CONCEPTS() || defined(_CCCL_DOXYGEN_INVOKED)
|
||||
# define _CCCL_TEMPLATE(...) template <__VA_ARGS__>
|
||||
# define _CCCL_REQUIRES(...) requires __VA_ARGS__
|
||||
# define _CCCL_AND &&
|
||||
# define _CCCL_TRAILING_REQUIRES_IMPL_(...) requires __VA_ARGS__
|
||||
# define _CCCL_TRAILING_REQUIRES(...) ->__VA_ARGS__ _CCCL_TRAILING_REQUIRES_IMPL_
|
||||
# define _CCCL_CONCEPT concept
|
||||
#else // ^^^ _CCCL_HAS_CONCEPTS() ^^^ / vvv !_CCCL_HAS_CONCEPTS() vvv
|
||||
# define _CCCL_TEMPLATE(...) template <__VA_ARGS__
|
||||
# define _CCCL_REQUIRES(...) , bool __cccl_true_ = true, __cccl_enable_if_t < __VA_ARGS__ && __cccl_true_, int > = 0 >
|
||||
# define _CCCL_AND &&__cccl_true_, int > = 0, __cccl_enable_if_t <
|
||||
# define _CCCL_TRAILING_REQUIRES(...) ->__cccl_requires_t < __VA_ARGS__ _CCCL_TRAILING_REQUIRES_IMPL_
|
||||
# define _CCCL_TRAILING_REQUIRES_IMPL_(...) , __VA_ARGS__ >
|
||||
# define _CCCL_CONCEPT inline constexpr bool
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^
|
||||
|
||||
// The following concepts emulation macros need variable template support
|
||||
|
||||
template <class...>
|
||||
struct __cccl_tag;
|
||||
|
||||
template <class>
|
||||
_CCCL_API constexpr bool __cccl_is_true()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
#if _CCCL_COMPILER(MSVC)
|
||||
template <bool _Bp>
|
||||
_CCCL_API inline __cccl_enable_if_t<_Bp> __cccl_requires()
|
||||
{}
|
||||
#else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC) vvv
|
||||
template <bool _Bp, __cccl_enable_if_t<_Bp, int> = 0>
|
||||
inline constexpr int __cccl_requires = 0;
|
||||
#endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
extern _Tp __cccl_make_dependent;
|
||||
|
||||
template <class _Impl, class... _Args>
|
||||
using __cccl_requires_expr_impl = decltype(__cccl_make_dependent<_Impl, _Args...>);
|
||||
|
||||
template <typename _Tp>
|
||||
_CCCL_API constexpr void __cccl_unused(_Tp&&) noexcept
|
||||
{}
|
||||
|
||||
// So that we can refer to the ::cuda::std namespace below
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
// We put an alias for ::cuda::std here because of a bug in nvcc <12.2
|
||||
// where a requirement such as:
|
||||
//
|
||||
// { expression } -> ::concept<type>
|
||||
//
|
||||
// where ::concept is a fully qualified name, would not compile. The
|
||||
// ::cuda::std macro is fully qualified.
|
||||
namespace __cccl_unqualified_cuda_std = ::cuda::std; // NOLINT(misc-unused-alias-decls)
|
||||
|
||||
#if _CCCL_CUDACC_BELOW(12, 2)
|
||||
# define _CCCL_CONCEPT_VSTD __cccl_unqualified_cuda_std // must not be fully qualified
|
||||
#else
|
||||
# define _CCCL_CONCEPT_VSTD ::cuda::std
|
||||
#endif
|
||||
|
||||
// GCC < 14 can't mangle noexcept expressions. See
|
||||
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70790.
|
||||
#if _CCCL_COMPILER(GCC, <, 14)
|
||||
# define _CCCL_HAS_NOEXCEPT_MANGLING() 0
|
||||
#else
|
||||
# define _CCCL_HAS_NOEXCEPT_MANGLING() 1
|
||||
#endif
|
||||
|
||||
// We use this macro to ignore the result of required expressions. It is needed because
|
||||
// gcc < 10 complains about ignored [[nodiscard]] expressions when emulating concepts.
|
||||
#if _CCCL_COMPILER(GCC, <, 10)
|
||||
# define _CCCL_CONCEPT_IGNORE_RESULT_(...) static_cast<void>(__VA_ARGS__)
|
||||
#else
|
||||
# define _CCCL_CONCEPT_IGNORE_RESULT_(...) __VA_ARGS__
|
||||
#endif
|
||||
|
||||
// The "0" or "1" suffixes indicate whether _REQ is parenthesized or not.
|
||||
#define _CCCL_CONCEPT_REQUIREMENT_0(_REQ) _CCCL_PP_SWITCH(_CCCL_CONCEPT_REQUIREMENT, _REQ)
|
||||
#define _CCCL_CONCEPT_REQUIREMENT_1(_REQ) _CCCL_CONCEPT_IGNORE_RESULT_ _REQ
|
||||
|
||||
// Permissible requirements are of the form (where ... indicates that the pattern can
|
||||
// contain commas):
|
||||
//
|
||||
// - EXPR
|
||||
// - (EXPR...)
|
||||
// - noexcept(EXPR...)
|
||||
// - requires(BOOL-EXPR...)
|
||||
// - typename(TYPE...)
|
||||
// - _Same_as(TYPE...) EXPR...
|
||||
// - _Satisfies(CONCEPT...) EXPR...
|
||||
//
|
||||
// The last 4 are handled below:
|
||||
#define _CCCL_CONCEPT_REQUIREMENT_SWITCH_requires _CCCL_PP_CASE(_CCCL_SWITCH_REQUIRES)
|
||||
#define _CCCL_CONCEPT_REQUIREMENT_SWITCH_noexcept _CCCL_PP_CASE(_CCCL_SWITCH_NOEXCEPT)
|
||||
#define _CCCL_CONCEPT_REQUIREMENT_SWITCH_typename _CCCL_PP_CASE(_CCCL_SWITCH_TYPENAME)
|
||||
#define _CCCL_CONCEPT_REQUIREMENT_SWITCH__Same_as _CCCL_PP_CASE(_CCCL_SWITCH_SAME_AS)
|
||||
#define _CCCL_CONCEPT_REQUIREMENT_SWITCH__Satisfies _CCCL_PP_CASE(_CCCL_SWITCH_SATISFIES)
|
||||
|
||||
// Converts "requires(ARGS...)" to "ARGS..."
|
||||
#define _CCCL_CONCEPT_EAT_REQUIRES_(...) _CCCL_PP_CAT(_CCCL_CONCEPT_EAT_REQUIRES_, __VA_ARGS__)
|
||||
#define _CCCL_CONCEPT_EAT_REQUIRES_requires(...) __VA_ARGS__
|
||||
|
||||
// Converts "noexcept(ARGS...)" to "ARGS..."
|
||||
#define _CCCL_CONCEPT_EAT_NOEXCEPT_(...) _CCCL_PP_CAT(_CCCL_CONCEPT_EAT_NOEXCEPT_, __VA_ARGS__)
|
||||
#define _CCCL_CONCEPT_EAT_NOEXCEPT_noexcept(...) __VA_ARGS__
|
||||
|
||||
// Converts "typename(TYPE...)" to "TYPE..."
|
||||
#define _CCCL_CONCEPT_EAT_TYPENAME_(_REQ) _CCCL_PP_CAT2(_CCCL_CONCEPT_EAT_TYPENAME_, _REQ)
|
||||
#define _CCCL_CONCEPT_EAT_TYPENAME_typename(...) __VA_ARGS__
|
||||
|
||||
// Converts "[typename]opt TYPE..." to "typename TYPE..."
|
||||
#define _CCCL_CONCEPT_TRY_ADD_TYPENAME_(...) _CCCL_PP_SWITCH2(_CCCL_CONCEPT_TRY_ADD_TYPENAME, __VA_ARGS__)
|
||||
#define _CCCL_CONCEPT_TRY_ADD_TYPENAME_SWITCH_typename _CCCL_PP_CASE(_CCCL_SWITCH_TYPENAME)
|
||||
#define _CCCL_CONCEPT_TRY_ADD_TYPENAME_CASE__CCCL_SWITCH_DEFAULT(...) typename __VA_ARGS__
|
||||
#define _CCCL_CONCEPT_TRY_ADD_TYPENAME_CASE__CCCL_SWITCH_TYPENAME(...) __VA_ARGS__
|
||||
|
||||
// Converts "_Same_as(TYPE) EXPR..." to "EXPR..."
|
||||
#define _CCCL_CONCEPT_EAT_SAME_AS_(...) _CCCL_PP_CAT(_CCCL_CONCEPT_EAT_SAME_AS_, __VA_ARGS__)
|
||||
#define _CCCL_CONCEPT_EAT_SAME_AS__Same_as(...)
|
||||
|
||||
// Converts "_Same_as(TYPE) EXPR..." to "TYPE" (The ridiculous concatenation of _CCCL with
|
||||
// _PP_EXPAND(__VA_ARGS__) is the only way to get MSVC's broken preprocessor to do macro
|
||||
// expansion here.)
|
||||
#define _CCCL_CONCEPT_GET_TYPE_FROM_SAME_AS_(...) \
|
||||
_CCCL_PP_CAT(_CCCL, _CCCL_PP_EVAL(_CCCL_PP_FIRST, _CCCL_PP_CAT(_CCCL_CONCEPT_GET_TYPE_FROM_SAME_AS_, __VA_ARGS__)))
|
||||
#define _CCCL_CONCEPT_GET_TYPE_FROM_SAME_AS__Same_as(...) _PP_EXPAND(__VA_ARGS__),
|
||||
|
||||
// Converts "_Satisfies(TYPE) EXPR..." to "EXPR..."
|
||||
#define _CCCL_CONCEPT_EAT_SATISFIES_(...) _CCCL_PP_CAT(_CCCL_CONCEPT_EAT_SATISFIES_, __VA_ARGS__)
|
||||
#define _CCCL_CONCEPT_EAT_SATISFIES__Satisfies(...)
|
||||
|
||||
// Converts "_Satisfies(TYPE) EXPR..." to "TYPE" (The ridiculous concatenation of _CCCL
|
||||
// with _PP_EXPAND(__VA_ARGS__) is the only way to get MSVC's broken preprocessor to do macro
|
||||
// expansion here.)
|
||||
#define _CCCL_CONCEPT_GET_CONCEPT_FROM_SATISFIES_(...) \
|
||||
_CCCL_PP_CAT(_CCCL, \
|
||||
_CCCL_PP_EVAL(_CCCL_PP_FIRST, _CCCL_PP_CAT(_CCCL_CONCEPT_GET_CONCEPT_FROM_SATISFIES_, __VA_ARGS__)))
|
||||
#define _CCCL_CONCEPT_GET_CONCEPT_FROM_SATISFIES__Satisfies(...) _PP_EXPAND(__VA_ARGS__),
|
||||
|
||||
// Here are the implementations of the internal macros, first for when concepts
|
||||
// are available, and then for when they're not.
|
||||
#if _CCCL_HAS_CONCEPTS() || defined(_CCCL_DOXYGEN_INVOKED)
|
||||
|
||||
// "_CCCL_CONCEPT_FRAGMENT(NAME, ARGS...)(REQS...)" expands into
|
||||
// "concept NAME = requires(ARGS...) { _CCCL_CONCEPT_REQUIREMENT_(REQS)... }"
|
||||
# define _CCCL_CONCEPT_FRAGMENT(_NAME, ...) concept _NAME = _CCCL_CONCEPT_FRAGMENT_REQUIREMENTS_##__VA_ARGS__
|
||||
# define _CCCL_CONCEPT_FRAGMENT_REQUIREMENTS_requires(...) requires(__VA_ARGS__) _CCCL_CONCEPT_FRAGMENT_REQUIREMENTS_
|
||||
# define _CCCL_CONCEPT_FRAGMENT_REQUIREMENTS_(...) {_CCCL_PP_FOR_EACH(_CCCL_CONCEPT_REQUIREMENT_, __VA_ARGS__)}
|
||||
|
||||
// Converts "EXPR" to "_CCCL_CONCEPT_REQUIREMENT_0(EXPR)", and
|
||||
// "(EXPR)" to "_CCCL_CONCEPT_REQUIREMENT_1((EXPR))"
|
||||
# define _CCCL_CONCEPT_REQUIREMENT_(_REQ) \
|
||||
_CCCL_PP_CAT(_CCCL_CONCEPT_REQUIREMENT_, _CCCL_PP_IS_PAREN(_REQ)) \
|
||||
(_REQ);
|
||||
|
||||
// The following macros handle the various special forms of requirements:
|
||||
# define _CCCL_CONCEPT_REQUIREMENT_CASE__CCCL_SWITCH_DEFAULT(_REQ) _REQ
|
||||
# define _CCCL_CONCEPT_REQUIREMENT_CASE__CCCL_SWITCH_REQUIRES(_REQ) requires _CCCL_CONCEPT_EAT_REQUIRES_(_REQ)
|
||||
# define _CCCL_CONCEPT_REQUIREMENT_CASE__CCCL_SWITCH_NOEXCEPT(_REQ) \
|
||||
_CCCL_PP_EXPAND({ _CCCL_CONCEPT_EAT_NOEXCEPT_(_REQ) } noexcept)
|
||||
# define _CCCL_CONCEPT_REQUIREMENT_CASE__CCCL_SWITCH_TYPENAME(_REQ) \
|
||||
_CCCL_CONCEPT_TRY_ADD_TYPENAME_(_CCCL_CONCEPT_EAT_TYPENAME_(_REQ))
|
||||
# define _CCCL_CONCEPT_REQUIREMENT_CASE__CCCL_SWITCH_SAME_AS(_REQ) \
|
||||
{_CCCL_CONCEPT_EAT_SAME_AS_(_REQ)}->_CCCL_CONCEPT_VSTD::same_as<_CCCL_CONCEPT_GET_TYPE_FROM_SAME_AS_(_REQ)>
|
||||
# define _CCCL_CONCEPT_REQUIREMENT_CASE__CCCL_SWITCH_SATISFIES(_REQ) \
|
||||
{_CCCL_CONCEPT_EAT_SATISFIES_(_REQ)}->_CCCL_CONCEPT_GET_CONCEPT_FROM_SATISFIES_(_REQ)
|
||||
|
||||
# define _CCCL_FRAGMENT(_NAME, ...) _NAME<__VA_ARGS__>
|
||||
|
||||
#else // ^^^ _CCCL_HAS_CONCEPTS() ^^^ / vvv !_CCCL_HAS_CONCEPTS() vvv
|
||||
|
||||
// "_CCCL_CONCEPT_FRAGMENT(Foo, ARGS...)(REQS...)" expands into:
|
||||
//
|
||||
// _CCCL_API inline auto Foo_CCCL_CONCEPT_FRAGMENT_impl_(ARGS...)
|
||||
// -> __cccl_enable_if_t<
|
||||
// ::__cccl_is_true<decltype(_CCCL_CONCEPT_REQUIREMENT_(REQS)..., void())>()>
|
||||
// {}
|
||||
//
|
||||
// template <class... As>
|
||||
// _CCCL_API inline auto Foo_CCCL_CONCEPT_FRAGMENT_(::__cccl_tag<As...>*,
|
||||
// decltype(&Foo_CCCL_CONCEPT_FRAGMENT_impl_<As...>))
|
||||
// -> char(&)[1];
|
||||
//
|
||||
// template <class... As>
|
||||
// _CCCL_API inline auto Foo_CCCL_CONCEPT_FRAGMENT_(...)
|
||||
// -> char(&)[2]
|
||||
//
|
||||
# define _CCCL_CONCEPT_FRAGMENT(_NAME, ...) \
|
||||
_CCCL_API inline auto _NAME##_CCCL_CONCEPT_FRAGMENT_impl_ _CCCL_CONCEPT_FRAGMENT_REQUIREMENTS_##__VA_ARGS__> {} \
|
||||
template <class... _As> \
|
||||
_CCCL_API inline auto _NAME##_CCCL_CONCEPT_FRAGMENT_( \
|
||||
::__cccl_tag<_As...>*, decltype(&_NAME##_CCCL_CONCEPT_FRAGMENT_impl_<_As...>)) -> char (&)[1]; \
|
||||
_CCCL_API inline auto _NAME##_CCCL_CONCEPT_FRAGMENT_(...) -> char (&)[2]
|
||||
# define _CCCL_CONCEPT_FRAGMENT_REQUIREMENTS_requires(...) \
|
||||
(__VA_ARGS__)->__cccl_enable_if_t < _CCCL_CONCEPT_FRAGMENT_REQUIREMENTS_IMPL_
|
||||
# define _CCCL_CONCEPT_FRAGMENT_REQUIREMENTS_IMPL_(...) \
|
||||
::__cccl_is_true<decltype(_CCCL_PP_FOR_EACH(_CCCL_CONCEPT_REQUIREMENT_, __VA_ARGS__) void())>()
|
||||
|
||||
// Called with each individual requirement in the list of requirements
|
||||
# define _CCCL_CONCEPT_REQUIREMENT_(_REQ) \
|
||||
void(), _CCCL_PP_CAT(_CCCL_CONCEPT_REQUIREMENT_, _CCCL_PP_IS_PAREN(_REQ))(_REQ),
|
||||
|
||||
// The following macros handle the various special forms of requirements:
|
||||
# define _CCCL_CONCEPT_REQUIREMENT_CASE__CCCL_SWITCH_DEFAULT(_REQ) _CCCL_CONCEPT_IGNORE_RESULT_(_REQ)
|
||||
# define _CCCL_CONCEPT_REQUIREMENT_CASE__CCCL_SWITCH_REQUIRES(_REQ) \
|
||||
::__cccl_requires<_CCCL_CONCEPT_EAT_REQUIRES_(_REQ)>
|
||||
# define _CCCL_CONCEPT_REQUIREMENT_CASE__CCCL_SWITCH_NOEXCEPT(_REQ) _CCCL_CONCEPT_NOEXCEPT_REQUIREMENT_(_REQ)
|
||||
# define _CCCL_CONCEPT_REQUIREMENT_CASE__CCCL_SWITCH_TYPENAME(_REQ) \
|
||||
static_cast<::__cccl_tag<_CCCL_CONCEPT_EAT_TYPENAME_(_REQ)>*>(nullptr)
|
||||
# define _CCCL_CONCEPT_REQUIREMENT_CASE__CCCL_SWITCH_SAME_AS(_REQ) \
|
||||
::__cccl_requires<::cuda::std::same_as<_CCCL_CONCEPT_SAME_AS_REQUIREMENT_(_REQ)>>
|
||||
# define _CCCL_CONCEPT_REQUIREMENT_CASE__CCCL_SWITCH_SATISFIES(_REQ) \
|
||||
::__cccl_requires < _CCCL_CONCEPT_GET_CONCEPT_FROM_SATISFIES_(_REQ) < decltype(_CCCL_CONCEPT_EAT_SATISFIES_(_REQ)) \
|
||||
>>
|
||||
|
||||
// Converts "_Same_as(TYPE) EXPR..." to "TYPE, decltype(EXPR...)"
|
||||
# define _CCCL_CONCEPT_SAME_AS_REQUIREMENT_(_REQ) \
|
||||
_CCCL_CONCEPT_GET_TYPE_FROM_SAME_AS_(_REQ), decltype(_CCCL_CONCEPT_EAT_SAME_AS_(_REQ))
|
||||
|
||||
# if _CCCL_HAS_NOEXCEPT_MANGLING()
|
||||
// Converts "noexcept(EXPR)" to "::__cccl_requires<noexcept(EXPR)>"
|
||||
# define _CCCL_CONCEPT_NOEXCEPT_REQUIREMENT_(_REQ) ::__cccl_requires<_REQ>
|
||||
# else
|
||||
// If the compiler cannot mangle noexcept expressions, just check that the expression is
|
||||
// well-formed. This converts "noexcept(EXPR)" to "static_cast<void>(EXPR)"
|
||||
# define _CCCL_CONCEPT_NOEXCEPT_REQUIREMENT_(_REQ) _CCCL_CONCEPT_IGNORE_RESULT_(_CCCL_CONCEPT_EAT_NOEXCEPT_(_REQ))
|
||||
# endif
|
||||
|
||||
// "_CCCL_FRAGMENT(Foo, Args...)" expands to
|
||||
// "(1 == sizeof(Foo_CCCL_CONCEPT_FRAGMENT_(static_cast<::__cccl_tag<Args...>*>(nullptr), nullptr)))"
|
||||
# define _CCCL_FRAGMENT(_NAME, ...) \
|
||||
(1 == sizeof(_NAME##_CCCL_CONCEPT_FRAGMENT_(static_cast<::__cccl_tag<__VA_ARGS__>*>(nullptr), nullptr)))
|
||||
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// _CCCL_REQUIRES_EXPR
|
||||
// Usage:
|
||||
// template <typename T>
|
||||
// _CCCL_CONCEPT equality_comparable =
|
||||
// _CCCL_REQUIRES_EXPR((T), T const& lhs, T const& rhs) (
|
||||
// lhs == rhs,
|
||||
// lhs != rhs
|
||||
// );
|
||||
//
|
||||
// Can only be used as the last requirement in a concept definition.
|
||||
#if _CCCL_HAS_CONCEPTS() || defined(_CCCL_DOXYGEN_INVOKED)
|
||||
|
||||
# define _CCCL_REQUIRES_EXPR(_TY, ...) requires(__VA_ARGS__) _CCCL_REQUIRES_EXPR_IMPL_
|
||||
# define _CCCL_REQUIRES_EXPR_IMPL_(...) {_CCCL_PP_FOR_EACH(_CCCL_CONCEPT_REQUIREMENT_, __VA_ARGS__)}
|
||||
|
||||
#else // ^^^ _CCCL_HAS_CONCEPTS() ^^^ / vvv !_CCCL_HAS_CONCEPTS() vvv
|
||||
|
||||
# define _CCCL_REQUIRES_EXPR(_TY, ...) _CCCL_REQUIRES_EXPR_IMPL(_TY, _CCCL_REQUIRES_EXPR_ID(_TY), __VA_ARGS__)
|
||||
# define _CCCL_REQUIRES_EXPR_IMPL(_TY, _ID, ...) \
|
||||
::__cccl_requires_expr_impl< \
|
||||
struct _CCCL_PP_CAT(__cccl_requires_expr_detail_, _ID) _CCCL_REQUIRES_EXPR_TPARAM_REFS \
|
||||
_TY>::__cccl_is_satisfied(static_cast<::__cccl_tag<void _CCCL_REQUIRES_EXPR_TPARAM_REFS _TY>*>(nullptr), 0); \
|
||||
struct _CCCL_PP_CAT(__cccl_requires_expr_detail_, _ID) \
|
||||
{ \
|
||||
using __cccl_self_t = _CCCL_PP_CAT(__cccl_requires_expr_detail_, _ID); \
|
||||
template <class _CCCL_REQUIRES_EXPR_TPARAM_DEFNS _TY> \
|
||||
_CCCL_API inline static auto __cccl_well_formed(__VA_ARGS__) _CCCL_REQUIRES_EXPR_REQUIREMENTS_
|
||||
|
||||
// Expands "T1, T2, variadic T3" to ", class T1, class T2, class... T3"
|
||||
# define _CCCL_REQUIRES_EXPR_TPARAM_DEFNS(...) _CCCL_PP_FOR_EACH(_CCCL_REQUIRES_EXPR_TPARAM_DEFN, __VA_ARGS__)
|
||||
|
||||
// Expands "TY" to ", class TY" and "variadic TY" to ", class... TY"
|
||||
# define _CCCL_REQUIRES_EXPR_TPARAM_DEFN(_TY) , _CCCL_PP_SWITCH2(_CCCL_REQUIRES_EXPR_TPARAM_DEFN, _TY)
|
||||
# define _CCCL_REQUIRES_EXPR_TPARAM_DEFN_SWITCH_variadic _CCCL_PP_CASE(_CCCL_SWITCH_VARIADIC)
|
||||
# define _CCCL_REQUIRES_EXPR_TPARAM_DEFN_CASE__CCCL_SWITCH_DEFAULT(_TY) class _TY
|
||||
# define _CCCL_REQUIRES_EXPR_TPARAM_DEFN_CASE__CCCL_SWITCH_VARIADIC(_TY) \
|
||||
class... _CCCL_PP_CAT(_CCCL_REQUIRES_EXPR_EAT_VARIADIC_, _TY)
|
||||
|
||||
// Expands "T1, T2, variadic T3" to ", T1, T2, T3..."
|
||||
# define _CCCL_REQUIRES_EXPR_TPARAM_REFS(...) _CCCL_PP_FOR_EACH(_CCCL_REQUIRES_EXPR_TPARAM_REF, __VA_ARGS__)
|
||||
|
||||
// Expands "TY" to ", TY" and "variadic TY" to ", TY..."
|
||||
# define _CCCL_REQUIRES_EXPR_TPARAM_REF(_TY) , _CCCL_PP_SWITCH2(_CCCL_REQUIRES_EXPR_TPARAM_REF, _TY)
|
||||
# define _CCCL_REQUIRES_EXPR_TPARAM_REF_SWITCH_variadic _CCCL_PP_CASE(_CCCL_SWITCH_VARIADIC)
|
||||
# define _CCCL_REQUIRES_EXPR_TPARAM_REF_CASE__CCCL_SWITCH_DEFAULT(_TY) _TY
|
||||
# define _CCCL_REQUIRES_EXPR_TPARAM_REF_CASE__CCCL_SWITCH_VARIADIC(_TY) \
|
||||
_CCCL_PP_CAT(_CCCL_REQUIRES_EXPR_EAT_VARIADIC_, _TY)...
|
||||
|
||||
// NVRTC does not support __COUNTER__ so we need a better way of defining unique identifiers
|
||||
# if _CCCL_COMPILER(NVRTC)
|
||||
|
||||
// Expands ((Ty...), Ty...) into _CCCL_REQUIRES_EXPR_ID_NO_PAREN(Ty...)
|
||||
# define _CCCL_REQUIRES_EXPR_ID(_TY, ...) _CCCL_REQUIRES_EXPR_ID_NO_PAREN _TY
|
||||
|
||||
// Expands "T1, T2, variadic T3" to "T1_T2_T3_##__LINE__"
|
||||
# define _CCCL_REQUIRES_EXPR_ID_NO_PAREN(...) \
|
||||
_CCCL_REQUIRES_EXPR_ID_CONCAT_ALL(_CCCL_PP_FOR_EACH(_CCCL_REQUIRES_EXPR_ID_IMPL, __VA_ARGS__), _CCCL_COUNTER())
|
||||
|
||||
// Expands "T1, T2, T3" to "T1T2T3"
|
||||
# define _CCCL_REQUIRES_EXPR_ID_CONCAT_ALL_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, ...) \
|
||||
_0##_1##_2##_3##_4##_5##_6##_7##_8##_9
|
||||
# define _CCCL_REQUIRES_EXPR_ID_CONCAT_ALL(...) \
|
||||
_CCCL_PP_EVAL(_CCCL_REQUIRES_EXPR_ID_CONCAT_ALL_IMPL, __VA_ARGS__, , , , , , , , , )
|
||||
|
||||
// Expands "TY" to "TY" and "variadic TY" to "TY"
|
||||
# define _CCCL_REQUIRES_EXPR_ID_IMPL(_TY) , _CCCL_PP_SWITCH2(_CCCL_REQUIRES_EXPR_ID_IMPL, _TY)
|
||||
# define _CCCL_REQUIRES_EXPR_ID_IMPL_SWITCH_variadic _CCCL_PP_CASE(_CCCL_SWITCH_VARIADIC)
|
||||
# define _CCCL_REQUIRES_EXPR_ID_IMPL_CASE__CCCL_SWITCH_DEFAULT(_TY) _TY
|
||||
# define _CCCL_REQUIRES_EXPR_ID_IMPL_CASE__CCCL_SWITCH_VARIADIC(_TY) \
|
||||
_CCCL_PP_CAT(_CCCL_REQUIRES_EXPR_EAT_VARIADIC_, _TY)
|
||||
|
||||
# else // ^^^ _CCCL_COMPILER(NVRTC) ^^^^/ vvv !_CCCL_COMPILER(NVRTC)
|
||||
# define _CCCL_REQUIRES_EXPR_ID(...) _CCCL_COUNTER()
|
||||
# endif // !_CCCL_COMPILER(NVRTC)
|
||||
|
||||
# define _CCCL_REQUIRES_EXPR_EAT_VARIADIC_variadic
|
||||
|
||||
# define _CCCL_REQUIRES_EXPR_REQUIREMENTS_(...) \
|
||||
->decltype(_CCCL_PP_FOR_EACH(_CCCL_CONCEPT_REQUIREMENT_, __VA_ARGS__) void()) {} \
|
||||
template <class... _Args, class = decltype(&__cccl_self_t::__cccl_well_formed<_Args...>)> \
|
||||
_CCCL_API static constexpr bool __cccl_is_satisfied(::__cccl_tag<_Args...>*, int) \
|
||||
{ \
|
||||
return true; \
|
||||
} \
|
||||
_CCCL_API static constexpr bool __cccl_is_satisfied(void*, long) \
|
||||
{ \
|
||||
return false; \
|
||||
} \
|
||||
}
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif //_CUDA___CONCEPTS_CONCEPT_MACROS_H
|
||||
@@ -0,0 +1,174 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___CONCEPTS_CONSTRUCTIBLE_H
|
||||
#define _CUDA_STD___CONCEPTS_CONSTRUCTIBLE_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__concepts/convertible_to.h>
|
||||
#include <cuda/std/__concepts/destructible.h>
|
||||
#include <cuda/std/__concepts/same_as.h>
|
||||
#include <cuda/std/__type_traits/add_lvalue_reference.h>
|
||||
#include <cuda/std/__type_traits/is_callable.h>
|
||||
#include <cuda/std/__type_traits/is_constructible.h>
|
||||
#include <cuda/std/__type_traits/is_nothrow_constructible.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
#if _CCCL_HAS_CONCEPTS()
|
||||
|
||||
// [concept.constructible]
|
||||
template <class _Tp, class... _Args>
|
||||
concept constructible_from = destructible<_Tp> && is_constructible_v<_Tp, _Args...>;
|
||||
|
||||
// [concept.default.init]
|
||||
template <class _Tp>
|
||||
concept __default_initializable = requires { ::new _Tp; };
|
||||
|
||||
template <class _Tp>
|
||||
concept default_initializable = constructible_from<_Tp> && requires { _Tp{}; } && __default_initializable<_Tp>;
|
||||
|
||||
// [concept.moveconstructible]
|
||||
template <class _Tp>
|
||||
concept move_constructible = constructible_from<_Tp, _Tp> && convertible_to<_Tp, _Tp>;
|
||||
|
||||
// [concept.copyconstructible]
|
||||
template <class _Tp>
|
||||
concept copy_constructible =
|
||||
move_constructible<_Tp> && constructible_from<_Tp, _Tp&> && convertible_to<_Tp&, _Tp>
|
||||
&& constructible_from<_Tp, const _Tp&> && convertible_to<const _Tp&, _Tp> && constructible_from<_Tp, const _Tp>
|
||||
&& convertible_to<const _Tp, _Tp>;
|
||||
|
||||
#else // ^^^ _CCCL_HAS_CONCEPTS() ^^^ / vvv !_CCCL_HAS_CONCEPTS() vvv
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
_CCCL_CONCEPT_FRAGMENT(__constructible_from_,
|
||||
requires()(requires(destructible<_Tp>), requires(is_constructible_v<_Tp, _Args...>)));
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
_CCCL_CONCEPT constructible_from = _CCCL_FRAGMENT(__constructible_from_, _Tp, _Args...);
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT_FRAGMENT(__default_initializable_, requires()((::new _Tp)));
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT __default_initializable = _CCCL_FRAGMENT(__default_initializable_, _Tp);
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT_FRAGMENT(_Default_initializable_,
|
||||
requires(_Tp = _Tp{})(requires(constructible_from<_Tp>), requires(__default_initializable<_Tp>)));
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT default_initializable = _CCCL_FRAGMENT(_Default_initializable_, _Tp);
|
||||
|
||||
// [concept.moveconstructible]
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT_FRAGMENT(__move_constructible_,
|
||||
requires()(requires(constructible_from<_Tp, _Tp>), requires(convertible_to<_Tp, _Tp>)));
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT move_constructible = _CCCL_FRAGMENT(__move_constructible_, _Tp);
|
||||
|
||||
// [concept.copyconstructible]
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT_FRAGMENT(
|
||||
__copy_constructible_,
|
||||
requires()(
|
||||
requires(move_constructible<_Tp>),
|
||||
requires(constructible_from<_Tp, add_lvalue_reference_t<_Tp>>&& convertible_to<add_lvalue_reference_t<_Tp>, _Tp>),
|
||||
requires(constructible_from<_Tp, const add_lvalue_reference_t<_Tp>>&&
|
||||
convertible_to<const add_lvalue_reference_t<_Tp>, _Tp>),
|
||||
requires(constructible_from<_Tp, const _Tp>&& convertible_to<const _Tp, _Tp>)));
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT copy_constructible = _CCCL_FRAGMENT(__copy_constructible_, _Tp);
|
||||
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
//! The code below provides the following concepts in the ::cuda:: namespace:
|
||||
//!
|
||||
//! - `__list_initializable_from`
|
||||
//! - `__nothrow_list_initializable_from`
|
||||
//! - `__initializable_from`
|
||||
//! - `__nothrow_initializable_from`
|
||||
//! - `__emplaceable_from`
|
||||
//! - `__nothrow_emplaceable_from`
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA
|
||||
|
||||
// constructible_from using list initialization syntax.
|
||||
template <class _Tp, class... _Args>
|
||||
_CCCL_CONCEPT __list_initializable_from =
|
||||
_CCCL_REQUIRES_EXPR((_Tp, variadic _Args), _Args&&... __args)(_Tp{static_cast<_Args&&>(__args)...});
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
_CCCL_CONCEPT __nothrow_list_initializable_from =
|
||||
_CCCL_REQUIRES_EXPR((_Tp, variadic _Args), _Args&&... __args)(noexcept(_Tp{static_cast<_Args&&>(__args)...}));
|
||||
|
||||
//! Constructible from arguments using either direct non-list initialization or direct
|
||||
//! list initialization.
|
||||
template <class _Tp, class... _Args>
|
||||
_CCCL_CONCEPT __initializable_from =
|
||||
::cuda::std::constructible_from<_Tp, _Args...> || __list_initializable_from<_Tp, _Args...>;
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
_CCCL_CONCEPT __nothrow_initializable_from =
|
||||
__initializable_from<_Tp, _Args...>
|
||||
&& (::cuda::std::constructible_from<_Tp, _Args...>
|
||||
? ::cuda::std::is_nothrow_constructible_v<_Tp, _Args...>
|
||||
: __nothrow_list_initializable_from<_Tp, _Args...>);
|
||||
|
||||
#if !_CCCL_COMPILER(MSVC) && !_CCCL_CUDA_COMPILER(NVCC, <, 12, 9)
|
||||
|
||||
//! Constructible with direct non-list initialization syntax from the result of
|
||||
//! a function call expression (often useful for immovable types).
|
||||
template <class _Tp, class _Fn, class... _Args>
|
||||
_CCCL_CONCEPT __emplaceable_from = _CCCL_REQUIRES_EXPR((_Tp, _Fn, variadic _Args), _Fn&& __fn, _Args&&... __args)(
|
||||
_Tp(static_cast<_Fn&&>(__fn)(static_cast<_Args&&>(__args)...)));
|
||||
|
||||
template <class _Tp, class _Fn, class... _Args>
|
||||
_CCCL_CONCEPT __nothrow_emplaceable_from =
|
||||
_CCCL_REQUIRES_EXPR((_Tp, _Fn, variadic _Args), _Fn&& __fn, _Args&&... __args)(
|
||||
noexcept(_Tp(static_cast<_Fn&&>(__fn)(static_cast<_Args&&>(__args)...))));
|
||||
|
||||
#else // ^^^ !_CCCL_COMPILER(MSVC) ^^^ / vvv _CCCL_COMPILER(MSVC) vvv
|
||||
|
||||
//! Constructible with direct non-list initialization syntax from the result of
|
||||
//! a function call expression (often useful for immovable types). MSVC cannot
|
||||
//! use the above formulation because it has poor support for deferred materialization
|
||||
//! of temporary object (aka, guaranteed copy elision).
|
||||
template <class _Tp, class _Fn, class... _Args>
|
||||
_CCCL_CONCEPT __emplaceable_from = _CCCL_REQUIRES_EXPR((_Tp, _Fn, variadic _Args), _Fn&& __fn, _Args&&... __args)(
|
||||
_Same_as(_Tp) static_cast<_Fn&&>(__fn)(static_cast<_Args&&>(__args)...));
|
||||
|
||||
template <class _Tp, class _Fn, class... _Args>
|
||||
_CCCL_CONCEPT __nothrow_emplaceable_from =
|
||||
__emplaceable_from<_Tp, _Fn, _Args...> && ::cuda::std::__is_nothrow_callable_v<_Fn, _Args...>;
|
||||
|
||||
#endif // ^^^ _CCCL_COMPILER(MSVC) ^^^
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CONCEPTS_CONSTRUCTIBLE_H
|
||||
@@ -0,0 +1,70 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023-24 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___CONCEPTS_CONVERTIBLE_TO_H
|
||||
#define _CUDA_STD___CONCEPTS_CONVERTIBLE_TO_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__type_traits/is_convertible.h>
|
||||
#include <cuda/std/__utility/declval.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
// [concept.convertible]
|
||||
|
||||
#if _CCCL_HAS_CONCEPTS()
|
||||
|
||||
template <class _From, class _To>
|
||||
concept convertible_to = is_convertible_v<_From, _To> && requires { static_cast<_To>(::cuda::std::declval<_From>()); };
|
||||
|
||||
#else // ^^^ _CCCL_HAS_CONCEPTS() ^^^ / vvv !_CCCL_HAS_CONCEPTS() vvv
|
||||
|
||||
# if _CCCL_COMPILER(MSVC)
|
||||
_CCCL_BEGIN_NV_DIAG_SUPPRESS(1211) // nonstandard cast to array type ignored
|
||||
# endif // _CCCL_COMPILER(MSVC)
|
||||
_CCCL_BEGIN_NV_DIAG_SUPPRESS(171) // invalid type conversion, e.g. [with _From=int **, _To=const int *const *]
|
||||
|
||||
// We cannot put this conversion check with the other constraint, as types with deleted operator will break here
|
||||
template <class _From, class _To>
|
||||
_CCCL_CONCEPT_FRAGMENT(__test_conversion_, requires()(static_cast<_To>(::cuda::std::declval<_From>())));
|
||||
|
||||
template <class _From, class _To>
|
||||
_CCCL_CONCEPT __test_conversion = _CCCL_FRAGMENT(__test_conversion_, _From, _To);
|
||||
|
||||
template <class _From, class _To>
|
||||
_CCCL_CONCEPT_FRAGMENT(__convertible_to_,
|
||||
requires()(requires(is_convertible_v<_From, _To>), requires(__test_conversion<_From, _To>)));
|
||||
|
||||
template <class _From, class _To>
|
||||
_CCCL_CONCEPT convertible_to = _CCCL_FRAGMENT(__convertible_to_, _From, _To);
|
||||
|
||||
# if _CCCL_COMPILER(MSVC)
|
||||
_CCCL_END_NV_DIAG_SUPPRESS() // nonstandard cast to array type ignored
|
||||
# endif // _CCCL_COMPILER(MSVC)
|
||||
_CCCL_END_NV_DIAG_SUPPRESS() // invalid type conversion, e.g. [with _From=int **, _To=const int *const *]
|
||||
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CONCEPTS_CONVERTIBLE_TO_H
|
||||
@@ -0,0 +1,60 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___CONCEPTS_COPYABLE_H
|
||||
#define _CUDA_STD___CONCEPTS_COPYABLE_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/assignable.h>
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__concepts/constructible.h>
|
||||
#include <cuda/std/__concepts/movable.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
#if _CCCL_HAS_CONCEPTS()
|
||||
|
||||
// [concepts.object]
|
||||
|
||||
template <class _Tp>
|
||||
concept copyable = copy_constructible<_Tp> && movable<_Tp> && assignable_from<_Tp&, _Tp&>
|
||||
&& assignable_from<_Tp&, const _Tp&> && assignable_from<_Tp&, const _Tp>;
|
||||
|
||||
#else // ^^^ _CCCL_HAS_CONCEPTS() ^^^ / vvv !_CCCL_HAS_CONCEPTS() vvv
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT_FRAGMENT(
|
||||
__copyable_,
|
||||
requires()(requires(copy_constructible<_Tp>),
|
||||
requires(movable<_Tp>),
|
||||
requires(assignable_from<_Tp&, _Tp&>),
|
||||
requires(assignable_from<_Tp&, const _Tp&>),
|
||||
requires(assignable_from<_Tp&, const _Tp>)));
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT copyable = _CCCL_FRAGMENT(__copyable_, _Tp);
|
||||
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CONCEPTS_COPYABLE_H
|
||||
@@ -0,0 +1,56 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___CONCEPTS_DERIVED_FROM_H
|
||||
#define _CUDA_STD___CONCEPTS_DERIVED_FROM_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__type_traits/add_pointer.h>
|
||||
#include <cuda/std/__type_traits/is_base_of.h>
|
||||
#include <cuda/std/__type_traits/is_convertible.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
#if _CCCL_HAS_CONCEPTS()
|
||||
|
||||
// [concept.derived]
|
||||
|
||||
template <class _Dp, class _Bp>
|
||||
concept derived_from = is_base_of_v<_Bp, _Dp> && is_convertible_v<const volatile _Dp*, const volatile _Bp*>;
|
||||
|
||||
#else // ^^^ _CCCL_HAS_CONCEPTS() ^^^ / vvv !_CCCL_HAS_CONCEPTS() vvv
|
||||
|
||||
template <class _Dp, class _Bp>
|
||||
_CCCL_CONCEPT_FRAGMENT(
|
||||
__derived_from_,
|
||||
requires()(requires(is_base_of_v<_Bp, _Dp>),
|
||||
requires(is_convertible_v<add_pointer_t<const volatile _Dp>, add_pointer_t<const volatile _Bp>>)));
|
||||
|
||||
template <class _Dp, class _Bp>
|
||||
_CCCL_CONCEPT derived_from = _CCCL_FRAGMENT(__derived_from_, _Dp, _Bp);
|
||||
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CONCEPTS_DERIVED_FROM_H
|
||||
@@ -0,0 +1,76 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___CONCEPTS_DESTRUCTIBLE_H
|
||||
#define _CUDA_STD___CONCEPTS_DESTRUCTIBLE_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__type_traits/enable_if.h>
|
||||
#include <cuda/std/__type_traits/is_destructible.h>
|
||||
#include <cuda/std/__type_traits/is_nothrow_destructible.h>
|
||||
#include <cuda/std/__type_traits/is_object.h>
|
||||
#include <cuda/std/__type_traits/void_t.h>
|
||||
#include <cuda/std/__utility/declval.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
#if _CCCL_COMPILER(MSVC)
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT destructible = __is_nothrow_destructible(_Tp);
|
||||
|
||||
#else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC) vvv
|
||||
|
||||
template <class _Tp, class = void, class = void>
|
||||
inline constexpr bool __destructible_impl = false;
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __destructible_impl<_Tp,
|
||||
enable_if_t<is_object_v<_Tp>>,
|
||||
# if _CCCL_COMPILER(GCC)
|
||||
enable_if_t<is_destructible_v<_Tp>>>
|
||||
# else // ^^^ _CCCL_COMPILER(GCC) ^^^ / vvv !_CCCL_COMPILER(GCC) vvv
|
||||
void_t<decltype(::cuda::std::declval<_Tp>().~_Tp())>>
|
||||
# endif // !_CCCL_COMPILER(GCC)
|
||||
= noexcept(::cuda::std::declval<_Tp>().~_Tp());
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __destructible = __destructible_impl<_Tp>;
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __destructible<_Tp&> = true;
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __destructible<_Tp&&> = true;
|
||||
|
||||
template <class _Tp, size_t _Nm>
|
||||
inline constexpr bool __destructible<_Tp[_Nm]> = __destructible<_Tp>;
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT destructible = __destructible<_Tp>;
|
||||
|
||||
#endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CONCEPTS_DESTRUCTIBLE_H
|
||||
@@ -0,0 +1,98 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___CONCEPTS_EQUALITY_COMPARABLE_H
|
||||
#define _CUDA_STD___CONCEPTS_EQUALITY_COMPARABLE_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/boolean_testable.h>
|
||||
#include <cuda/std/__concepts/common_reference_with.h>
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__type_traits/common_reference.h>
|
||||
#include <cuda/std/__type_traits/is_comparable.h>
|
||||
#include <cuda/std/__type_traits/make_const_lvalue_ref.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
#if _CCCL_HAS_CONCEPTS()
|
||||
|
||||
// [concept.equalitycomparable]
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
concept __weakly_equality_comparable_with =
|
||||
requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) {
|
||||
{ __t == __u } -> __boolean_testable;
|
||||
{ __t != __u } -> __boolean_testable;
|
||||
{ __u == __t } -> __boolean_testable;
|
||||
{ __u != __t } -> __boolean_testable;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
concept equality_comparable = __weakly_equality_comparable_with<_Tp, _Tp>;
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
concept equality_comparable_with =
|
||||
equality_comparable<_Tp> && equality_comparable<_Up>
|
||||
&& common_reference_with<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>>
|
||||
&& equality_comparable<common_reference_t<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>>>
|
||||
&& __weakly_equality_comparable_with<_Tp, _Up>;
|
||||
|
||||
#else // ^^^ _CCCL_HAS_CONCEPTS() ^^^ / vvv !_CCCL_HAS_CONCEPTS() vvv
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT _With_lvalue_reference = _CCCL_REQUIRES_EXPR((_Tp))(typename(__make_const_lvalue_ref<_Tp>));
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_CCCL_CONCEPT_FRAGMENT(
|
||||
__weakly_equality_comparable_with_,
|
||||
requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u)(
|
||||
requires(_With_lvalue_reference<_Tp>),
|
||||
requires(_With_lvalue_reference<_Up>),
|
||||
_Satisfies(__boolean_testable) __t == __u,
|
||||
_Satisfies(__boolean_testable) __t != __u,
|
||||
_Satisfies(__boolean_testable) __u == __t,
|
||||
_Satisfies(__boolean_testable) __u != __t));
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_CCCL_CONCEPT __weakly_equality_comparable_with = _CCCL_FRAGMENT(__weakly_equality_comparable_with_, _Tp, _Up);
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT equality_comparable = __weakly_equality_comparable_with<_Tp, _Tp>;
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_CCCL_CONCEPT_FRAGMENT(
|
||||
__equality_comparable_with_,
|
||||
requires()(
|
||||
requires(equality_comparable<_Tp>),
|
||||
requires(equality_comparable<_Up>),
|
||||
requires(common_reference_with<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>>),
|
||||
requires(equality_comparable<common_reference_t<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>>>),
|
||||
requires(__weakly_equality_comparable_with<_Tp, _Up>)));
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_CCCL_CONCEPT equality_comparable_with = _CCCL_FRAGMENT(__equality_comparable_with_, _Tp, _Up);
|
||||
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CONCEPTS_EQUALITY_COMPARABLE_H
|
||||
@@ -0,0 +1,80 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___CONCEPTS_INVOCABLE_H
|
||||
#define _CUDA_STD___CONCEPTS_INVOCABLE_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__functional/invoke.h>
|
||||
#include <cuda/std/__type_traits/remove_cvref.h>
|
||||
#include <cuda/std/__utility/forward.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
#if _CCCL_HAS_CONCEPTS()
|
||||
|
||||
// [concept.invocable]
|
||||
|
||||
template <class _Fn, class... _Args>
|
||||
concept invocable = requires(_Fn&& __fn, _Args&&... __args) {
|
||||
::cuda::std::invoke(::cuda::std::forward<_Fn>(__fn), ::cuda::std::forward<_Args>(__args)...); // not required to be
|
||||
// equality preserving
|
||||
};
|
||||
|
||||
// [concept.regular.invocable]
|
||||
|
||||
template <class _Fn, class... _Args>
|
||||
concept regular_invocable = invocable<_Fn, _Args...>;
|
||||
|
||||
template <class _Fun, class... _Args>
|
||||
concept __invoke_constructible = requires(_Fun&& __fun, _Args&&... __args) {
|
||||
static_cast<remove_cvref_t<invoke_result_t<_Fun, _Args...>>>(
|
||||
::cuda::std::invoke(::cuda::std::forward<_Fun>(__fun), ::cuda::std::forward<_Args>(__args)...));
|
||||
};
|
||||
|
||||
#else // ^^^ _CCCL_HAS_CONCEPTS() ^^^ / vvv !_CCCL_HAS_CONCEPTS() vvv
|
||||
|
||||
template <class _Fn, class... _Args>
|
||||
_CCCL_CONCEPT_FRAGMENT(_Invocable_,
|
||||
requires(_Fn&& __fn, _Args&&... __args)((::cuda::std::invoke(
|
||||
::cuda::std::forward<_Fn>(__fn), ::cuda::std::forward<_Args>(__args)...))));
|
||||
|
||||
template <class _Fn, class... _Args>
|
||||
_CCCL_CONCEPT invocable = _CCCL_FRAGMENT(_Invocable_, _Fn, _Args...);
|
||||
|
||||
template <class _Fn, class... _Args>
|
||||
_CCCL_CONCEPT regular_invocable = invocable<_Fn, _Args...>;
|
||||
|
||||
template <class _Fun, class... _Args>
|
||||
_CCCL_CONCEPT_FRAGMENT(
|
||||
__invoke_constructible_,
|
||||
requires(_Fun&& __fun, _Args&&... __args)((static_cast<remove_cvref_t<invoke_result_t<_Fun, _Args...>>>(
|
||||
::cuda::std::invoke(::cuda::std::forward<_Fun>(__fun), ::cuda::std::forward<_Args>(__args)...)))));
|
||||
template <class _Fun, class... _Args>
|
||||
_CCCL_CONCEPT __invoke_constructible = _CCCL_FRAGMENT(__invoke_constructible_, _Fun, _Args...);
|
||||
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CONCEPTS_INVOCABLE_H
|
||||
@@ -0,0 +1,58 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___CONCEPTS_MOVABLE_H
|
||||
#define _CUDA_STD___CONCEPTS_MOVABLE_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/assignable.h>
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__concepts/constructible.h>
|
||||
#include <cuda/std/__concepts/swappable.h>
|
||||
#include <cuda/std/__type_traits/is_object.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
#if _CCCL_HAS_CONCEPTS()
|
||||
|
||||
template <class _Tp>
|
||||
concept movable = is_object_v<_Tp> && move_constructible<_Tp> && assignable_from<_Tp&, _Tp> && swappable<_Tp>;
|
||||
|
||||
#else // ^^^ _CCCL_HAS_CONCEPTS() ^^^ / vvv !_CCCL_HAS_CONCEPTS() vvv
|
||||
|
||||
// [concepts.object]
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT_FRAGMENT(
|
||||
_Movable_,
|
||||
requires()(requires(is_object_v<_Tp>),
|
||||
requires(move_constructible<_Tp>),
|
||||
requires(assignable_from<_Tp&, _Tp>),
|
||||
requires(swappable<_Tp>)));
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT movable = _CCCL_FRAGMENT(_Movable_, _Tp);
|
||||
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CONCEPTS_MOVABLE_H
|
||||
@@ -0,0 +1,54 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___CONCEPTS_PREDICATE_H
|
||||
#define _CUDA_STD___CONCEPTS_PREDICATE_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/boolean_testable.h>
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__concepts/invocable.h>
|
||||
#include <cuda/std/__functional/invoke.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
#if _CCCL_HAS_CONCEPTS()
|
||||
|
||||
template <class _Fn, class... _Args>
|
||||
concept predicate = regular_invocable<_Fn, _Args...> && __boolean_testable<invoke_result_t<_Fn, _Args...>>;
|
||||
|
||||
#else // ^^^ _CCCL_HAS_CONCEPTS() ^^^ / vvv !_CCCL_HAS_CONCEPTS() vvv
|
||||
|
||||
// [concept.predicate]
|
||||
template <class _Fn, class... _Args>
|
||||
_CCCL_CONCEPT_FRAGMENT(
|
||||
_Predicate_,
|
||||
requires()(requires(regular_invocable<_Fn, _Args...>), requires(__boolean_testable<invoke_result_t<_Fn, _Args...>>)));
|
||||
|
||||
template <class _Fn, class... _Args>
|
||||
_CCCL_CONCEPT predicate = _CCCL_FRAGMENT(_Predicate_, _Fn, _Args...);
|
||||
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CONCEPTS_PREDICATE_H
|
||||
@@ -0,0 +1,54 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___CONCEPTS_REGULAR_H
|
||||
#define _CUDA_STD___CONCEPTS_REGULAR_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__concepts/equality_comparable.h>
|
||||
#include <cuda/std/__concepts/semiregular.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
#if _CCCL_HAS_CONCEPTS()
|
||||
|
||||
// [concept.object]
|
||||
|
||||
template <class _Tp>
|
||||
concept regular = semiregular<_Tp> && equality_comparable<_Tp>;
|
||||
|
||||
#else // ^^^ _CCCL_HAS_CONCEPTS() ^^^ / vvv !_CCCL_HAS_CONCEPTS() vvv
|
||||
|
||||
// [concept.object]
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT_FRAGMENT(__regular_, requires()(requires(semiregular<_Tp>), requires(equality_comparable<_Tp>)));
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT regular = _CCCL_FRAGMENT(__regular_, _Tp);
|
||||
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CONCEPTS_REGULAR_H
|
||||
@@ -0,0 +1,77 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___CONCEPTS_RELATION_H
|
||||
#define _CUDA_STD___CONCEPTS_RELATION_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__concepts/predicate.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
#if _CCCL_HAS_CONCEPTS()
|
||||
|
||||
// [concept.relation]
|
||||
|
||||
template <class _Rp, class _Tp, class _Up>
|
||||
concept relation =
|
||||
predicate<_Rp, _Tp, _Tp> && predicate<_Rp, _Up, _Up> && predicate<_Rp, _Tp, _Up> && predicate<_Rp, _Up, _Tp>;
|
||||
|
||||
// [concept.equiv]
|
||||
|
||||
template <class _Rp, class _Tp, class _Up>
|
||||
concept equivalence_relation = relation<_Rp, _Tp, _Up>;
|
||||
|
||||
// [concept.strictweakorder]
|
||||
|
||||
template <class _Rp, class _Tp, class _Up>
|
||||
concept strict_weak_order = relation<_Rp, _Tp, _Up>;
|
||||
|
||||
#else // ^^^ _CCCL_HAS_CONCEPTS() ^^^ / vvv !_CCCL_HAS_CONCEPTS() vvv
|
||||
|
||||
template <class _Rp, class _Tp, class _Up>
|
||||
_CCCL_CONCEPT_FRAGMENT(
|
||||
__relation_,
|
||||
requires()(requires(predicate<_Rp, _Tp, _Tp>),
|
||||
requires(predicate<_Rp, _Up, _Up>),
|
||||
requires(predicate<_Rp, _Tp, _Up>),
|
||||
requires(predicate<_Rp, _Up, _Tp>)));
|
||||
|
||||
template <class _Rp, class _Tp, class _Up>
|
||||
_CCCL_CONCEPT relation = _CCCL_FRAGMENT(__relation_, _Rp, _Tp, _Up);
|
||||
|
||||
// [concept.equiv]
|
||||
|
||||
template <class _Rp, class _Tp, class _Up>
|
||||
_CCCL_CONCEPT equivalence_relation = relation<_Rp, _Tp, _Up>;
|
||||
|
||||
// [concept.strictweakorder]
|
||||
|
||||
template <class _Rp, class _Tp, class _Up>
|
||||
_CCCL_CONCEPT strict_weak_order = relation<_Rp, _Tp, _Up>;
|
||||
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CONCEPTS_RELATION_H
|
||||
@@ -0,0 +1,39 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___CONCEPTS_SAME_AS_H
|
||||
#define _CUDA_STD___CONCEPTS_SAME_AS_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__type_traits/is_same.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
// [concept.same]
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_CCCL_CONCEPT same_as = is_same_v<_Tp, _Up> && is_same_v<_Up, _Tp>;
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CONCEPTS_SAME_AS_H
|
||||
@@ -0,0 +1,54 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___CONCEPTS_SEMIREGULAR_H
|
||||
#define _CUDA_STD___CONCEPTS_SEMIREGULAR_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__concepts/constructible.h>
|
||||
#include <cuda/std/__concepts/copyable.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
#if _CCCL_HAS_CONCEPTS()
|
||||
|
||||
// [concept.object]
|
||||
|
||||
template <class _Tp>
|
||||
concept semiregular = copyable<_Tp> && default_initializable<_Tp>;
|
||||
|
||||
#else // ^^^ _CCCL_HAS_CONCEPTS() ^^^ / vvv !_CCCL_HAS_CONCEPTS() vvv
|
||||
|
||||
// [concept.object]
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT_FRAGMENT(__semiregular_, requires()(requires(copyable<_Tp>), requires(default_initializable<_Tp>)));
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT semiregular = _CCCL_FRAGMENT(__semiregular_, _Tp);
|
||||
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CONCEPTS_SEMIREGULAR_H
|
||||
@@ -0,0 +1,209 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___CONCEPTS_SWAPPABLE_H
|
||||
#define _CUDA_STD___CONCEPTS_SWAPPABLE_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/assignable.h>
|
||||
#include <cuda/std/__concepts/class_or_enum.h>
|
||||
#include <cuda/std/__concepts/common_reference_with.h>
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__concepts/constructible.h>
|
||||
#include <cuda/std/__type_traits/extent.h>
|
||||
#include <cuda/std/__type_traits/integral_constant.h>
|
||||
#include <cuda/std/__type_traits/is_nothrow_move_assignable.h>
|
||||
#include <cuda/std/__type_traits/is_nothrow_move_constructible.h>
|
||||
#include <cuda/std/__type_traits/remove_cvref.h>
|
||||
#include <cuda/std/__type_traits/type_identity.h>
|
||||
#include <cuda/std/__type_traits/void_t.h>
|
||||
#include <cuda/std/__utility/declval.h>
|
||||
#include <cuda/std/__utility/exchange.h>
|
||||
#include <cuda/std/__utility/forward.h>
|
||||
#include <cuda/std/__utility/move.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
#if _CCCL_COMPILER(MSVC)
|
||||
_CCCL_BEGIN_NV_DIAG_SUPPRESS(461) // nonstandard cast to array type ignored
|
||||
#endif // _CCCL_COMPILER(MSVC)
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD_RANGES
|
||||
|
||||
// [concept.swappable]
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CPO(__swap)
|
||||
|
||||
template <class _Tp>
|
||||
void swap(_Tp&, _Tp&) = delete;
|
||||
|
||||
#if _CCCL_HAS_CONCEPTS()
|
||||
template <class _Tp, class _Up>
|
||||
concept __unqualified_swappable_with =
|
||||
(__class_or_enum<remove_cvref_t<_Tp>> || __class_or_enum<remove_cvref_t<_Up>>)
|
||||
&& requires(_Tp&& __t, _Up&& __u) { swap(::cuda::std::forward<_Tp>(__t), ::cuda::std::forward<_Up>(__u)); };
|
||||
|
||||
template <class _Tp>
|
||||
concept __exchangeable =
|
||||
!__unqualified_swappable_with<_Tp&, _Tp&> && move_constructible<_Tp> && assignable_from<_Tp&, _Tp>;
|
||||
|
||||
#else // ^^^ _CCCL_HAS_CONCEPTS() ^^^ / vvv !_CCCL_HAS_CONCEPTS() vvv
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_CCCL_CONCEPT_FRAGMENT(
|
||||
__unqualified_swappable_with_,
|
||||
requires(_Tp&& __t, _Up&& __u)((swap(::cuda::std::forward<_Tp>(__t), ::cuda::std::forward<_Up>(__u)))));
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_CCCL_CONCEPT __unqualified_swappable_with = _CCCL_FRAGMENT(__unqualified_swappable_with_, _Tp, _Up);
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT_FRAGMENT(__exchangeable_,
|
||||
requires()(requires(!__unqualified_swappable_with<_Tp&, _Tp&>),
|
||||
requires(move_constructible<_Tp>),
|
||||
requires(assignable_from<_Tp&, _Tp>)));
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT __exchangeable = _CCCL_FRAGMENT(__exchangeable_, _Tp);
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^
|
||||
|
||||
#if _CCCL_HAS_CONCEPTS() && !_CCCL_COMPILER(NVHPC) // nvbug4051640
|
||||
struct __fn;
|
||||
|
||||
_CCCL_BEGIN_NV_DIAG_SUPPRESS(2642)
|
||||
template <class _Tp, class _Up, size_t _Size>
|
||||
concept __swappable_arrays =
|
||||
!__unqualified_swappable_with<_Tp (&)[_Size], _Up (&)[_Size]> && extent_v<_Tp> == extent_v<_Up>
|
||||
&& requires(_Tp (&__t)[_Size], _Up (&__u)[_Size], const __fn& __swap) { __swap(__t[0], __u[0]); };
|
||||
_CCCL_END_NV_DIAG_SUPPRESS()
|
||||
|
||||
#else // ^^^ _CCCL_HAS_CONCEPTS() && !_CCCL_COMPILER(NVHPC) ^^^ / vvv !_CCCL_HAS_CONCEPTS() || _CCCL_COMPILER(NVHPC) vvv
|
||||
template <class _Tp, class _Up, size_t _Size, class = void>
|
||||
inline constexpr bool __swappable_arrays = false;
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^ || _CCCL_COMPILER(NVHPC)
|
||||
|
||||
template <class _Tp, class _Up, class = void>
|
||||
inline constexpr bool __noexcept_swappable_arrays = false;
|
||||
|
||||
struct __fn
|
||||
{
|
||||
// 2.1 `S` is `(void)swap(E1, E2)`* if `E1` or `E2` has class or enumeration type and...
|
||||
// *The name `swap` is used here unqualified.
|
||||
_CCCL_TEMPLATE(class _Tp, class _Up)
|
||||
_CCCL_REQUIRES(__unqualified_swappable_with<_Tp, _Up>)
|
||||
_CCCL_API constexpr void operator()(_Tp&& __t, _Up&& __u) const
|
||||
noexcept(noexcept(swap(::cuda::std::forward<_Tp>(__t), ::cuda::std::forward<_Up>(__u))))
|
||||
{
|
||||
swap(::cuda::std::forward<_Tp>(__t), ::cuda::std::forward<_Up>(__u));
|
||||
}
|
||||
|
||||
// 2.2 Otherwise, if `E1` and `E2` are lvalues of array types with equal extent and...
|
||||
_CCCL_TEMPLATE(class _Tp, class _Up, size_t _Size)
|
||||
_CCCL_REQUIRES(__swappable_arrays<_Tp, _Up, _Size>)
|
||||
_CCCL_API constexpr void operator()(_Tp (&__t)[_Size], _Up (&__u)[_Size]) const
|
||||
noexcept(__noexcept_swappable_arrays<_Tp, _Up>)
|
||||
{
|
||||
// TODO(cjdb): replace with `::cuda::std::ranges::swap_ranges`.
|
||||
for (size_t __i = 0; __i < _Size; ++__i)
|
||||
{
|
||||
(*this)(__t[__i], __u[__i]);
|
||||
}
|
||||
}
|
||||
|
||||
// 2.3 Otherwise, if `E1` and `E2` are lvalues of the same type `T` that models...
|
||||
_CCCL_TEMPLATE(class _Tp)
|
||||
_CCCL_REQUIRES(__exchangeable<_Tp>)
|
||||
_CCCL_API constexpr void operator()(_Tp& __x, _Tp& __y) const
|
||||
noexcept(is_nothrow_move_constructible_v<_Tp> && is_nothrow_move_assignable_v<_Tp>)
|
||||
{
|
||||
__y = ::cuda::std::exchange(__x, ::cuda::std::move(__y));
|
||||
}
|
||||
};
|
||||
|
||||
#if !_CCCL_HAS_CONCEPTS() || _CCCL_COMPILER(NVHPC)
|
||||
template <class _Tp, class _Up, class _Size>
|
||||
_CCCL_CONCEPT_FRAGMENT(
|
||||
__swappable_arrays_,
|
||||
requires(_Tp (&__t)[_Size::value], _Up (&__u)[_Size::value], const __fn& __swap)(
|
||||
requires(!__unqualified_swappable_with<_Tp (&)[_Size::value], _Up (&)[_Size::value]>),
|
||||
requires(extent_v<_Tp> == extent_v<_Up>),
|
||||
(__swap(__t[0], __u[0]))));
|
||||
|
||||
template <class _Tp, class _Up, size_t _Size>
|
||||
inline constexpr bool __swappable_arrays<_Tp, _Up, _Size, void_t<type_identity_t<_Tp>>> =
|
||||
_CCCL_FRAGMENT(__swappable_arrays_, _Tp, _Up, ::cuda::std::integral_constant<size_t, _Size>);
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^ || _CCCL_COMPILER(NVHPC)
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
inline constexpr bool __noexcept_swappable_arrays<_Tp, _Up, void_t<type_identity_t<_Tp>>> =
|
||||
noexcept(__swap::__fn{}(::cuda::std::declval<_Tp&>(), ::cuda::std::declval<_Up&>()));
|
||||
|
||||
_CCCL_END_NAMESPACE_CPO
|
||||
|
||||
inline namespace __cpo
|
||||
{
|
||||
_CCCL_GLOBAL_CONSTANT auto swap = __swap::__fn{};
|
||||
|
||||
// We want to avoid using the CPO internally because of __tile__ access
|
||||
using __swap_cpo = __swap::__fn;
|
||||
} // namespace __cpo
|
||||
_CCCL_END_NAMESPACE_CUDA_STD_RANGES
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
#if _CCCL_HAS_CONCEPTS()
|
||||
template <class _Tp>
|
||||
concept swappable = requires(_Tp& __a, _Tp& __b) { ::cuda::std::ranges::__swap_cpo{}(__a, __b); };
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
concept swappable_with = common_reference_with<_Tp, _Up> && requires(_Tp&& __t, _Up&& __u) {
|
||||
::cuda::std::ranges::__swap_cpo{}(::cuda::std::forward<_Tp>(__t), ::cuda::std::forward<_Tp>(__t));
|
||||
::cuda::std::ranges::__swap_cpo{}(::cuda::std::forward<_Up>(__u), ::cuda::std::forward<_Up>(__u));
|
||||
::cuda::std::ranges::__swap_cpo{}(::cuda::std::forward<_Tp>(__t), ::cuda::std::forward<_Up>(__u));
|
||||
::cuda::std::ranges::__swap_cpo{}(::cuda::std::forward<_Up>(__u), ::cuda::std::forward<_Tp>(__t));
|
||||
};
|
||||
#else // ^^^ _CCCL_HAS_CONCEPTS() ^^^ / vvv !_CCCL_HAS_CONCEPTS() vvv
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT_FRAGMENT(__swappable_, requires(_Tp& __a, _Tp& __b)((::cuda::std::ranges::__swap_cpo{}(__a, __b))));
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT swappable = _CCCL_FRAGMENT(__swappable_, _Tp);
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_CCCL_CONCEPT_FRAGMENT(
|
||||
__swappable_with_,
|
||||
requires(_Tp&& __t, _Up&& __u)(
|
||||
requires(common_reference_with<_Tp, _Up>),
|
||||
(::cuda::std::ranges::__swap_cpo{}(::cuda::std::forward<_Tp>(__t), ::cuda::std::forward<_Tp>(__t))),
|
||||
(::cuda::std::ranges::__swap_cpo{}(::cuda::std::forward<_Up>(__u), ::cuda::std::forward<_Up>(__u))),
|
||||
(::cuda::std::ranges::__swap_cpo{}(::cuda::std::forward<_Tp>(__t), ::cuda::std::forward<_Up>(__u))),
|
||||
(::cuda::std::ranges::__swap_cpo{}(::cuda::std::forward<_Up>(__u), ::cuda::std::forward<_Tp>(__t)))));
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_CCCL_CONCEPT swappable_with = _CCCL_FRAGMENT(__swappable_with_, _Tp, _Up);
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#if _CCCL_COMPILER(MSVC)
|
||||
_CCCL_END_NV_DIAG_SUPPRESS() // nonstandard cast to array type ignored
|
||||
#endif // _CCCL_COMPILER(MSVC)
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CONCEPTS_SWAPPABLE_H
|
||||
@@ -0,0 +1,101 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___CONCEPTS_TOTALLY_ORDERED_H
|
||||
#define _CUDA_STD___CONCEPTS_TOTALLY_ORDERED_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/boolean_testable.h>
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__concepts/equality_comparable.h>
|
||||
#include <cuda/std/__type_traits/common_reference.h>
|
||||
#include <cuda/std/__type_traits/make_const_lvalue_ref.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
#if _CCCL_HAS_CONCEPTS()
|
||||
|
||||
// [concept.totallyordered]
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
concept __partially_ordered_with = requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) {
|
||||
{ __t < __u } -> __boolean_testable;
|
||||
{ __t > __u } -> __boolean_testable;
|
||||
{ __t <= __u } -> __boolean_testable;
|
||||
{ __t >= __u } -> __boolean_testable;
|
||||
{ __u < __t } -> __boolean_testable;
|
||||
{ __u > __t } -> __boolean_testable;
|
||||
{ __u <= __t } -> __boolean_testable;
|
||||
{ __u >= __t } -> __boolean_testable;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
concept totally_ordered = equality_comparable<_Tp> && __partially_ordered_with<_Tp, _Tp>;
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
concept totally_ordered_with =
|
||||
totally_ordered<_Tp> && totally_ordered<_Up> && equality_comparable_with<_Tp, _Up>
|
||||
&& totally_ordered<common_reference_t<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>>>
|
||||
&& __partially_ordered_with<_Tp, _Up>;
|
||||
|
||||
#else // ^^^ _CCCL_HAS_CONCEPTS() ^^^ / vvv !_CCCL_HAS_CONCEPTS() vvv
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_CCCL_CONCEPT_FRAGMENT(
|
||||
__partially_ordered_with_,
|
||||
requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u)(
|
||||
_Satisfies(__boolean_testable)(__t < __u), //
|
||||
_Satisfies(__boolean_testable)(__t > __u), //
|
||||
_Satisfies(__boolean_testable)(__t <= __u), //
|
||||
_Satisfies(__boolean_testable)(__t >= __u), //
|
||||
_Satisfies(__boolean_testable)(__u < __t), //
|
||||
_Satisfies(__boolean_testable)(__u > __t), //
|
||||
_Satisfies(__boolean_testable)(__u <= __t), //
|
||||
_Satisfies(__boolean_testable)(__u >= __t)));
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_CCCL_CONCEPT __partially_ordered_with = _CCCL_FRAGMENT(__partially_ordered_with_, _Tp, _Up);
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT_FRAGMENT(__totally_ordered_,
|
||||
requires()(requires(equality_comparable<_Tp>), requires(__partially_ordered_with<_Tp, _Tp>)));
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT totally_ordered = _CCCL_FRAGMENT(__totally_ordered_, _Tp);
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_CCCL_CONCEPT_FRAGMENT(
|
||||
__totally_ordered_with_,
|
||||
requires()(requires(totally_ordered<_Tp>),
|
||||
requires(totally_ordered<_Up>),
|
||||
requires(equality_comparable_with<_Tp, _Up>),
|
||||
requires(totally_ordered<common_reference_t<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>>>),
|
||||
requires(__partially_ordered_with<_Tp, _Up>)));
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_CCCL_CONCEPT totally_ordered_with = _CCCL_FRAGMENT(__totally_ordered_with_, _Tp, _Up);
|
||||
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CONCEPTS_TOTALLY_ORDERED_H
|
||||
113
qwen3_6_scripts/cccl_preload/include/cuda/std/__cstddef/byte.h
Normal file
113
qwen3_6_scripts/cccl_preload/include/cuda/std/__cstddef/byte.h
Normal file
@@ -0,0 +1,113 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___CSTDDEF_BYTE_H
|
||||
#define _CUDA_STD___CSTDDEF_BYTE_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__type_traits/is_integral.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD_NOVERSION
|
||||
|
||||
enum class byte : unsigned char
|
||||
{
|
||||
};
|
||||
|
||||
_CCCL_API constexpr byte operator|(byte __lhs, byte __rhs) noexcept
|
||||
{
|
||||
return static_cast<byte>(
|
||||
static_cast<unsigned char>(static_cast<unsigned int>(__lhs) | static_cast<unsigned int>(__rhs)));
|
||||
}
|
||||
|
||||
_CCCL_API constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept
|
||||
{
|
||||
return __lhs = __lhs | __rhs;
|
||||
}
|
||||
|
||||
_CCCL_API constexpr byte operator&(byte __lhs, byte __rhs) noexcept
|
||||
{
|
||||
return static_cast<byte>(
|
||||
static_cast<unsigned char>(static_cast<unsigned int>(__lhs) & static_cast<unsigned int>(__rhs)));
|
||||
}
|
||||
|
||||
_CCCL_API constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept
|
||||
{
|
||||
return __lhs = __lhs & __rhs;
|
||||
}
|
||||
|
||||
_CCCL_API constexpr byte operator^(byte __lhs, byte __rhs) noexcept
|
||||
{
|
||||
return static_cast<byte>(
|
||||
static_cast<unsigned char>(static_cast<unsigned int>(__lhs) ^ static_cast<unsigned int>(__rhs)));
|
||||
}
|
||||
|
||||
_CCCL_API constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept
|
||||
{
|
||||
return __lhs = __lhs ^ __rhs;
|
||||
}
|
||||
|
||||
_CCCL_API constexpr byte operator~(byte __b) noexcept
|
||||
{
|
||||
return static_cast<byte>(static_cast<unsigned char>(~static_cast<unsigned int>(__b)));
|
||||
}
|
||||
|
||||
_CCCL_TEMPLATE(class _Integer)
|
||||
_CCCL_REQUIRES(is_integral_v<_Integer>)
|
||||
_CCCL_API constexpr byte& operator<<=(byte& __lhs, _Integer __shift) noexcept
|
||||
{
|
||||
return __lhs = __lhs << __shift;
|
||||
}
|
||||
|
||||
_CCCL_TEMPLATE(class _Integer)
|
||||
_CCCL_REQUIRES(is_integral_v<_Integer>)
|
||||
_CCCL_API constexpr byte operator<<(byte __lhs, _Integer __shift) noexcept
|
||||
{
|
||||
return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(__lhs) << __shift));
|
||||
}
|
||||
|
||||
_CCCL_TEMPLATE(class _Integer)
|
||||
_CCCL_REQUIRES(is_integral_v<_Integer>)
|
||||
_CCCL_API constexpr byte& operator>>=(byte& __lhs, _Integer __shift) noexcept
|
||||
{
|
||||
return __lhs = __lhs >> __shift;
|
||||
}
|
||||
|
||||
_CCCL_TEMPLATE(class _Integer)
|
||||
_CCCL_REQUIRES(is_integral_v<_Integer>)
|
||||
_CCCL_API constexpr byte operator>>(byte __lhs, _Integer __shift) noexcept
|
||||
{
|
||||
return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(__lhs) >> __shift));
|
||||
}
|
||||
|
||||
_CCCL_TEMPLATE(class _Integer)
|
||||
_CCCL_REQUIRES(is_integral_v<_Integer>)
|
||||
_CCCL_API constexpr _Integer to_integer(byte __b) noexcept
|
||||
{
|
||||
return static_cast<_Integer>(__b);
|
||||
}
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD_NOVERSION
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CSTDDEF_BYTE_H
|
||||
@@ -0,0 +1,52 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___CSTDDEF_TYPES_H
|
||||
#define _CUDA_STD___CSTDDEF_TYPES_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#if _CCCL_HOSTED()
|
||||
# include <cstddef>
|
||||
#else // ^^^ _CCCL_HOSTED() ^^^ / vvv _CCCL_FREESTANDING() vvv
|
||||
# if !defined(offsetof)
|
||||
# define offsetof(type, member) (::size_t) ((char*) &(((type*) 0)->member) - (char*) 0)
|
||||
# endif // !offsetof
|
||||
#endif // _CCCL_FREESTANDING()
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
#if _CCCL_FREESTANDING()
|
||||
using max_align_t = long double;
|
||||
#else // ^^^ _CCCL_FREESTANDING() ^^^ / vvv _CCCL_HOSTED() vvv
|
||||
// Re-use the compiler's <stddef.h> max_align_t where possible.
|
||||
using ::max_align_t;
|
||||
#endif // _CCCL_HOSTED()
|
||||
|
||||
using nullptr_t = decltype(nullptr);
|
||||
using ::ptrdiff_t;
|
||||
using ::size_t;
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CSTDDEF_TYPES_H
|
||||
@@ -0,0 +1,61 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___CSTRING_MEMCPY
|
||||
#define _CUDA_STD___CSTRING_MEMCPY
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/__memory/check_address.h>
|
||||
|
||||
#if _CCCL_HOSTED()
|
||||
# include <cstring>
|
||||
#endif // _CCCL_HOSTED()
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
using ::size_t;
|
||||
|
||||
// old compilers still trigger the name conflict
|
||||
// nvcc 12.0 and 12.1 trigger segmentation fault
|
||||
#if _CCCL_COMPILER(GCC, <=, 9) || _CCCL_CUDA_COMPILER(NVCC, <=, 12, 1)
|
||||
|
||||
using ::memcpy;
|
||||
|
||||
#else // ^^^ _CCCL_COMPILER(GCC, <=, 9) ^^^ / vvv _CCCL_COMPILER(GCC, >, 9) vvv
|
||||
|
||||
// The template parameter is used to avoid name ambiguity when external code calls 'memcpy' without namespace
|
||||
// qualification. Function templates have lower precedence than non-template functions for overload resolution.
|
||||
template <int = 0>
|
||||
_CCCL_API inline void* memcpy(void* __dest, const void* __src, size_t __count) noexcept
|
||||
{
|
||||
_CCCL_ASSERT(::cuda::__is_valid_address_range(__src, __count), "memcpy: source range is invalid");
|
||||
_CCCL_ASSERT(::cuda::__is_valid_address_range(__dest, __count), "memcpy: destination range is invalid");
|
||||
_CCCL_ASSERT(!::cuda::__are_ptrs_overlapping(__src, __dest, __count), "memcpy: source and destination overlap");
|
||||
return ::memcpy(__dest, __src, __count);
|
||||
}
|
||||
|
||||
#endif // ^^^ _CCCL_COMPILER(GCC, <=, 9) ^^^
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CSTRING_MEMCPY
|
||||
@@ -0,0 +1,126 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___EXCEPTION_EXCEPTION_MACROS_H
|
||||
#define _CUDA_STD___EXCEPTION_EXCEPTION_MACROS_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__exception/terminate.h>
|
||||
#include <cuda/std/__host_stdlib/cstdio>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
struct __cccl_catch_any_lvalue
|
||||
{
|
||||
template <class _Tp>
|
||||
_CCCL_API operator _Tp&() const noexcept;
|
||||
};
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
// The following macros are used to conditionally compile exception handling code. They
|
||||
// are used in the same way as `try` and `catch`, but they allow for different behavior
|
||||
// based on whether exceptions are enabled or not, and whether the code is being compiled
|
||||
// for device or not.
|
||||
//
|
||||
// Usage:
|
||||
// _CCCL_TRY
|
||||
// {
|
||||
// can_throw(); // Code that may throw an exception
|
||||
// }
|
||||
// _CCCL_CATCH (cuda_error& e) // Handle CUDA exceptions
|
||||
// {
|
||||
// printf("CUDA error: %s\n", e.what());
|
||||
// }
|
||||
// _CCCL_CATCH_ALL // Handle any other exceptions
|
||||
// {
|
||||
// printf("unknown error\n");
|
||||
// }
|
||||
//
|
||||
// Notes:
|
||||
// - the catch clause must always bind to a named variable
|
||||
|
||||
// Expand to keywords only for host code when exceptions are enabled. nvc++ in CUDA mode traps when an exception is
|
||||
// thrown in device code.
|
||||
#if _CCCL_HAS_EXCEPTIONS() && _CCCL_HOST_COMPILATION()
|
||||
# define _CCCL_TRY try
|
||||
# define _CCCL_CATCH catch
|
||||
# define _CCCL_CATCH_ALL catch (...)
|
||||
# define _CCCL_CATCH_FALLTHROUGH
|
||||
|
||||
// Even though nvc++ in CUDA mode replaces `throw` by `__trap()` call in device code, it instantiates the exception type
|
||||
// which can introduce some host only symbols to the nvvm ir (for example snprintf). So we need to wrap it by the
|
||||
// NV_IF_ELSE_TARGET macro.
|
||||
# define _CCCL_THROW(_TYPE, ...) \
|
||||
do \
|
||||
{ \
|
||||
NV_IF_ELSE_TARGET(NV_IS_HOST, (throw _TYPE(__VA_ARGS__);), (::cuda::std::terminate();)) \
|
||||
} while (0)
|
||||
# define _CCCL_RETHROW throw
|
||||
#else // ^^^ use exceptions ^^^ / vvv no exceptions vvv
|
||||
# define _CCCL_TRY \
|
||||
if constexpr (true) \
|
||||
{
|
||||
# define _CCCL_CATCH(...) \
|
||||
} \
|
||||
else if constexpr (false) \
|
||||
{ \
|
||||
for (__VA_ARGS__ = ::cuda::std::__cccl_catch_any_lvalue{}; false;)
|
||||
# define _CCCL_CATCH_ALL \
|
||||
} \
|
||||
else
|
||||
# define _CCCL_CATCH_FALLTHROUGH \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
}
|
||||
|
||||
# if _CCCL_HOSTJIT()
|
||||
# define _CCCL_THROW(_TYPE, ...) \
|
||||
do \
|
||||
{ \
|
||||
_CCCL_ASSERT(false, "An instance of class " #_TYPE " would be thrown."); \
|
||||
::cuda::std::terminate(); \
|
||||
} while (0)
|
||||
# else // ^^^ _CCCL_HOSTJIT() ^^^ / vvv !_CCCL_HOSTJIT() vvv
|
||||
# define _CCCL_THROW(_TYPE, ...) \
|
||||
do \
|
||||
{ \
|
||||
NV_IF_ELSE_TARGET(NV_IS_HOST, \
|
||||
({ \
|
||||
::fprintf(stderr, \
|
||||
"%s:%u: An instance of class %s would be thrown.\n what(): %s\nAborted\n", \
|
||||
__FILE__, \
|
||||
__LINE__, \
|
||||
#_TYPE, \
|
||||
(_TYPE(__VA_ARGS__)).what()); \
|
||||
::fflush(stderr); \
|
||||
}), \
|
||||
({ _CCCL_ASSERT(false, "An instance of class " #_TYPE " would be thrown."); })) \
|
||||
::cuda::std::terminate(); \
|
||||
} while (0)
|
||||
# endif // !_CCCL_HOSTJIT()
|
||||
# define _CCCL_RETHROW ::cuda::std::terminate()
|
||||
#endif // ^^^ no exceptions ^^^
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___EXCEPTION_EXCEPTION_MACROS_H
|
||||
@@ -0,0 +1,82 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___EXCEPTION_TERMINATE_H
|
||||
#define _CUDA_STD___EXCEPTION_TERMINATE_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#if _CCCL_TILE_COMPILATION()
|
||||
# include <cuda/std/cassert>
|
||||
#endif // !_CCCL_TILE_COMPILATION()
|
||||
|
||||
#if _CCCL_HOSTED()
|
||||
# include <stdlib.h>
|
||||
#endif // _CCCL_HOSTED()
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_DIAG_PUSH
|
||||
_CCCL_DIAG_SUPPRESS_MSVC(4702) // unreachable code
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD_NOVERSION // purposefully not using versioning namespace
|
||||
|
||||
[[noreturn]] _CCCL_API inline void __cccl_terminate() noexcept
|
||||
{
|
||||
#if _CCCL_TILE_COMPILATION()
|
||||
NV_IF_ELSE_TARGET(NV_IS_HOST, (::exit(-1);), (assert(false);))
|
||||
#else // ^^^ _CCCL_TILE_COMPILATION() ^^^ / vvv !_CCCL_TILE_COMPILATION()
|
||||
NV_IF_ELSE_TARGET(NV_IS_HOST, (::exit(-1);), (::__trap();))
|
||||
#endif // !_CCCL_TILE_COMPILATION()
|
||||
_CCCL_UNREACHABLE();
|
||||
}
|
||||
|
||||
#if 0 // Expose once atomic is universally available
|
||||
|
||||
using terminate_handler = void (*)();
|
||||
|
||||
# ifdef __CUDA_ARCH__
|
||||
__device__
|
||||
# endif // __CUDA_ARCH__
|
||||
static _CCCL_CONSTINIT ::cuda::std::atomic<terminate_handler>
|
||||
__cccl_terminate_handler{&__cccl_terminate};
|
||||
|
||||
_CCCL_API inline terminate_handler set_terminate(terminate_handler __func) noexcept
|
||||
{
|
||||
return __cccl_terminate_handler.exchange(__func);
|
||||
}
|
||||
_CCCL_API inline terminate_handler get_terminate() noexcept
|
||||
{
|
||||
return __cccl_terminate_handler.load(__func);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
[[noreturn]] _CCCL_API inline void terminate() noexcept
|
||||
{
|
||||
__cccl_terminate();
|
||||
}
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD_NOVERSION
|
||||
|
||||
_CCCL_DIAG_POP
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___EXCEPTION_TERMINATE_H
|
||||
@@ -0,0 +1,157 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___FLOATING_POINT_FORMAT_H
|
||||
#define _CUDA_STD___FLOATING_POINT_FORMAT_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__fwd/fp.h>
|
||||
#include <cuda/std/__type_traits/is_same.h>
|
||||
#include <cuda/std/cfloat>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
enum class __fp_format
|
||||
{
|
||||
__binary16, // IEEE 754 binary16
|
||||
__binary32, // IEEE 754 binary32
|
||||
__binary64, // IEEE 754 binary64
|
||||
__binary128, // IEEE 754 binary128
|
||||
__bfloat16, // Google's 16-bit brain float
|
||||
__fp80_x86, // x86 80-bit extended precision
|
||||
__fp8_nv_e4m3, // NVIDIA's __nv_fp8_e4m3
|
||||
__fp8_nv_e5m2, // NVIDIA's __nv_fp8_e5m2
|
||||
__fp8_nv_e8m0, // NVIDIA's __nv_fp8_e8m0
|
||||
__fp6_nv_e2m3, // NVIDIA's __nv_fp6_e2m3
|
||||
__fp6_nv_e3m2, // NVIDIA's __nv_fp6_e3m2
|
||||
__fp4_nv_e2m1, // NVIDIA's __nv_fp4_e2m1
|
||||
|
||||
__invalid,
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr __fp_format __fp_format_of_v_impl() noexcept
|
||||
{
|
||||
if constexpr (is_same_v<_Tp, float>)
|
||||
{
|
||||
return __fp_format::__binary32;
|
||||
}
|
||||
else if constexpr (is_same_v<_Tp, double>)
|
||||
{
|
||||
return __fp_format::__binary64;
|
||||
}
|
||||
#if _CCCL_HAS_LONG_DOUBLE()
|
||||
else if constexpr (is_same_v<_Tp, long double>)
|
||||
{
|
||||
# if LDBL_MIN_EXP == -1021 && LDBL_MAX_EXP == 1024 && LDBL_MANT_DIG == 53
|
||||
return __fp_format::__binary64;
|
||||
# elif LDBL_MIN_EXP == -16381 && LDBL_MAX_EXP == 16384 && LDBL_MANT_DIG == 64
|
||||
static_assert(sizeof(long double) == 16,
|
||||
"When the long double format is x86 80-bit extended floating point, CCCL requires the size of long "
|
||||
"double to be 16 bytes.");
|
||||
return __fp_format::__fp80_x86;
|
||||
# elif LDBL_MIN_EXP == -16381 && LDBL_MAX_EXP == 16384 && LDBL_MANT_DIG == 113
|
||||
return __fp_format::__binary128;
|
||||
# else
|
||||
# error "Unknown long double format. Define CCCL_DISABLE_LONG_DOUBLE to disable long double support in CCCL."
|
||||
# endif
|
||||
}
|
||||
#endif // _CCCL_HAS_LONG_DOUBLE()
|
||||
#if _CCCL_HAS_NVFP16()
|
||||
else if constexpr (is_same_v<_Tp, __half>)
|
||||
{
|
||||
return __fp_format::__binary16;
|
||||
}
|
||||
#endif // _CCCL_HAS_NVFP16()
|
||||
#if _CCCL_HAS_NVBF16()
|
||||
else if constexpr (is_same_v<_Tp, __nv_bfloat16>)
|
||||
{
|
||||
return __fp_format::__bfloat16;
|
||||
}
|
||||
#endif // _CCCL_HAS_NVBF16()
|
||||
#if _CCCL_HAS_NVFP8_E4M3()
|
||||
else if constexpr (is_same_v<_Tp, __nv_fp8_e4m3>)
|
||||
{
|
||||
return __fp_format::__fp8_nv_e4m3;
|
||||
}
|
||||
#endif // _CCCL_HAS_NVFP8_E4M3()
|
||||
#if _CCCL_HAS_NVFP8_E5M2()
|
||||
else if constexpr (is_same_v<_Tp, __nv_fp8_e5m2>)
|
||||
{
|
||||
return __fp_format::__fp8_nv_e5m2;
|
||||
}
|
||||
#endif // _CCCL_HAS_NVFP8_E5M2()
|
||||
#if _CCCL_HAS_NVFP8_E8M0()
|
||||
else if constexpr (is_same_v<_Tp, __nv_fp8_e8m0>)
|
||||
{
|
||||
return __fp_format::__fp8_nv_e8m0;
|
||||
}
|
||||
#endif // _CCCL_HAS_NVFP8_E8M0()
|
||||
#if _CCCL_HAS_NVFP6_E2M3()
|
||||
else if constexpr (is_same_v<_Tp, __nv_fp6_e2m3>)
|
||||
{
|
||||
return __fp_format::__fp6_nv_e2m3;
|
||||
}
|
||||
#endif // _CCCL_HAS_NVFP6_E2M3()
|
||||
#if _CCCL_HAS_NVFP6_E3M2()
|
||||
else if constexpr (is_same_v<_Tp, __nv_fp6_e3m2>)
|
||||
{
|
||||
return __fp_format::__fp6_nv_e3m2;
|
||||
}
|
||||
#endif // _CCCL_HAS_NVFP6_E3M2()
|
||||
#if _CCCL_HAS_NVFP4_E2M1()
|
||||
else if constexpr (is_same_v<_Tp, __nv_fp4_e2m1>)
|
||||
{
|
||||
return __fp_format::__fp4_nv_e2m1;
|
||||
}
|
||||
#endif // _CCCL_HAS_NVFP4_E2M1()
|
||||
#if _CCCL_HAS_FLOAT128()
|
||||
else if constexpr (is_same_v<_Tp, __float128>)
|
||||
{
|
||||
return __fp_format::__binary128;
|
||||
}
|
||||
#endif // _CCCL_HAS_FLOAT128()
|
||||
else
|
||||
{
|
||||
return __fp_format::__invalid;
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr __fp_format __fp_format_of_v = ::cuda::std::__fp_format_of_v_impl<_Tp>();
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr __fp_format __fp_format_of_v<const _Tp> = __fp_format_of_v<_Tp>;
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr __fp_format __fp_format_of_v<volatile _Tp> = __fp_format_of_v<_Tp>;
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr __fp_format __fp_format_of_v<const volatile _Tp> = __fp_format_of_v<_Tp>;
|
||||
|
||||
template <__fp_format _Fmt>
|
||||
inline constexpr __fp_format __fp_format_of_v<__cccl_fp<_Fmt>> = _Fmt;
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___FLOATING_POINT_FORMAT_H
|
||||
@@ -0,0 +1,229 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___FLOATING_POINT_PROPERTIES_H
|
||||
#define _CUDA_STD___FLOATING_POINT_PROPERTIES_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__floating_point/format.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
// __fp_is_signed_v
|
||||
|
||||
template <__fp_format _Fmt>
|
||||
inline constexpr bool __fp_is_signed_v = true;
|
||||
|
||||
template <>
|
||||
inline constexpr bool __fp_is_signed_v<__fp_format::__fp8_nv_e8m0> = false;
|
||||
|
||||
// __fp_exp_nbits_v
|
||||
|
||||
template <__fp_format _Fmt>
|
||||
inline constexpr int __fp_exp_nbits_v = 0;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_exp_nbits_v<__fp_format::__binary16> = 5;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_exp_nbits_v<__fp_format::__binary32> = 8;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_exp_nbits_v<__fp_format::__binary64> = 11;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_exp_nbits_v<__fp_format::__binary128> = 15;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_exp_nbits_v<__fp_format::__bfloat16> = 8;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_exp_nbits_v<__fp_format::__fp80_x86> = 15;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_exp_nbits_v<__fp_format::__fp8_nv_e4m3> = 4;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_exp_nbits_v<__fp_format::__fp8_nv_e5m2> = 5;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_exp_nbits_v<__fp_format::__fp8_nv_e8m0> = 8;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_exp_nbits_v<__fp_format::__fp6_nv_e2m3> = 2;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_exp_nbits_v<__fp_format::__fp6_nv_e3m2> = 3;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_exp_nbits_v<__fp_format::__fp4_nv_e2m1> = 2;
|
||||
|
||||
// __fp_exp_bias_v
|
||||
|
||||
template <__fp_format _Fmt>
|
||||
inline constexpr int __fp_exp_bias_v = (1 << (__fp_exp_nbits_v<_Fmt> - 1)) - 1;
|
||||
|
||||
// __fp_exp_min_v
|
||||
|
||||
template <__fp_format _Fmt>
|
||||
inline constexpr int __fp_exp_min_v = 1 - __fp_exp_bias_v<_Fmt>;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_exp_min_v<__fp_format::__fp8_nv_e8m0> = -127;
|
||||
|
||||
// __fp_exp_max_v
|
||||
|
||||
template <__fp_format _Fmt>
|
||||
inline constexpr int __fp_exp_max_v = (1 << __fp_exp_nbits_v<_Fmt>) -2 - __fp_exp_bias_v<_Fmt>;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_exp_max_v<__fp_format::__fp8_nv_e4m3> = 8;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_exp_max_v<__fp_format::__fp6_nv_e2m3> = 2;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_exp_max_v<__fp_format::__fp6_nv_e3m2> = 4;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_exp_max_v<__fp_format::__fp4_nv_e2m1> = 2;
|
||||
|
||||
// __fp_mant_nbits_v
|
||||
|
||||
template <__fp_format _Fmt>
|
||||
inline constexpr int __fp_mant_nbits_v = 0;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_mant_nbits_v<__fp_format::__binary16> = 10;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_mant_nbits_v<__fp_format::__binary32> = 23;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_mant_nbits_v<__fp_format::__binary64> = 52;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_mant_nbits_v<__fp_format::__binary128> = 112;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_mant_nbits_v<__fp_format::__bfloat16> = 7;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_mant_nbits_v<__fp_format::__fp80_x86> = 64;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_mant_nbits_v<__fp_format::__fp8_nv_e4m3> = 3;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_mant_nbits_v<__fp_format::__fp8_nv_e5m2> = 2;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_mant_nbits_v<__fp_format::__fp8_nv_e8m0> = 0;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_mant_nbits_v<__fp_format::__fp6_nv_e2m3> = 3;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_mant_nbits_v<__fp_format::__fp6_nv_e3m2> = 2;
|
||||
|
||||
template <>
|
||||
inline constexpr int __fp_mant_nbits_v<__fp_format::__fp4_nv_e2m1> = 1;
|
||||
|
||||
// __fp_has_implicit_bit_v
|
||||
|
||||
template <__fp_format _Fmt>
|
||||
inline constexpr bool __fp_has_implicit_bit_v = true;
|
||||
|
||||
template <>
|
||||
inline constexpr bool __fp_has_implicit_bit_v<__fp_format::__fp80_x86> = false;
|
||||
|
||||
// __fp_digits_v
|
||||
|
||||
template <__fp_format _Fmt>
|
||||
inline constexpr int __fp_digits_v = __fp_mant_nbits_v<_Fmt> + static_cast<int>(__fp_has_implicit_bit_v<_Fmt>);
|
||||
|
||||
// __fp_has_denorm_v
|
||||
|
||||
template <__fp_format _Fmt>
|
||||
inline constexpr bool __fp_has_denorm_v = true;
|
||||
|
||||
template <>
|
||||
inline constexpr bool __fp_has_denorm_v<__fp_format::__fp8_nv_e8m0> = false;
|
||||
|
||||
// __fp_has_inf_v
|
||||
|
||||
template <__fp_format _Fmt>
|
||||
inline constexpr bool __fp_has_inf_v = true;
|
||||
|
||||
template <>
|
||||
inline constexpr bool __fp_has_inf_v<__fp_format::__fp8_nv_e4m3> = false;
|
||||
|
||||
template <>
|
||||
inline constexpr bool __fp_has_inf_v<__fp_format::__fp8_nv_e8m0> = false;
|
||||
|
||||
template <>
|
||||
inline constexpr bool __fp_has_inf_v<__fp_format::__fp6_nv_e2m3> = false;
|
||||
|
||||
template <>
|
||||
inline constexpr bool __fp_has_inf_v<__fp_format::__fp6_nv_e3m2> = false;
|
||||
|
||||
template <>
|
||||
inline constexpr bool __fp_has_inf_v<__fp_format::__fp4_nv_e2m1> = false;
|
||||
|
||||
// __fp_has_nan_v
|
||||
|
||||
template <__fp_format _Fmt>
|
||||
inline constexpr bool __fp_has_nan_v = true;
|
||||
|
||||
template <>
|
||||
inline constexpr bool __fp_has_nan_v<__fp_format::__fp6_nv_e2m3> = false;
|
||||
|
||||
template <>
|
||||
inline constexpr bool __fp_has_nan_v<__fp_format::__fp6_nv_e3m2> = false;
|
||||
|
||||
template <>
|
||||
inline constexpr bool __fp_has_nan_v<__fp_format::__fp4_nv_e2m1> = false;
|
||||
|
||||
// __fp_has_nans_v
|
||||
|
||||
template <__fp_format _Fmt>
|
||||
inline constexpr bool __fp_has_nans_v = true;
|
||||
|
||||
template <>
|
||||
inline constexpr bool __fp_has_nans_v<__fp_format::__fp8_nv_e4m3> = false;
|
||||
|
||||
template <>
|
||||
inline constexpr bool __fp_has_nans_v<__fp_format::__fp8_nv_e8m0> = false;
|
||||
|
||||
template <>
|
||||
inline constexpr bool __fp_has_nans_v<__fp_format::__fp6_nv_e2m3> = false;
|
||||
|
||||
template <>
|
||||
inline constexpr bool __fp_has_nans_v<__fp_format::__fp6_nv_e3m2> = false;
|
||||
|
||||
template <>
|
||||
inline constexpr bool __fp_has_nans_v<__fp_format::__fp4_nv_e2m1> = false;
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___FLOATING_POINT_PROPERTIES_H
|
||||
@@ -0,0 +1,260 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___FLOATING_POINT_STORAGE_H
|
||||
#define _CUDA_STD___FLOATING_POINT_STORAGE_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__bit/bit_cast.h>
|
||||
#include <cuda/std/__floating_point/format.h>
|
||||
#include <cuda/std/__floating_point/traits.h>
|
||||
#include <cuda/std/__type_traits/always_false.h>
|
||||
#include <cuda/std/__type_traits/is_same.h>
|
||||
#include <cuda/std/cstdint>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
template <__fp_format _Fmt>
|
||||
[[nodiscard]] _CCCL_API constexpr auto __fp_storage_type_impl() noexcept
|
||||
{
|
||||
if constexpr (_Fmt == __fp_format::__fp8_nv_e4m3 || _Fmt == __fp_format::__fp8_nv_e5m2
|
||||
|| _Fmt == __fp_format::__fp8_nv_e8m0 || _Fmt == __fp_format::__fp6_nv_e2m3
|
||||
|| _Fmt == __fp_format::__fp6_nv_e3m2 || _Fmt == __fp_format::__fp4_nv_e2m1)
|
||||
{
|
||||
return uint8_t{};
|
||||
}
|
||||
else if constexpr (_Fmt == __fp_format::__binary16 || _Fmt == __fp_format::__bfloat16)
|
||||
{
|
||||
return uint16_t{};
|
||||
}
|
||||
else if constexpr (_Fmt == __fp_format::__binary32)
|
||||
{
|
||||
return uint32_t{};
|
||||
}
|
||||
else if constexpr (_Fmt == __fp_format::__binary64)
|
||||
{
|
||||
return uint64_t{};
|
||||
}
|
||||
#if _CCCL_HAS_INT128()
|
||||
else if constexpr (_Fmt == __fp_format::__fp80_x86 || _Fmt == __fp_format::__binary128)
|
||||
{
|
||||
return __uint128_t{};
|
||||
}
|
||||
#endif // _CCCL_HAS_INT128()
|
||||
else
|
||||
{
|
||||
static_assert(__always_false_v<decltype(_Fmt)>, "Unsupported floating point format");
|
||||
}
|
||||
}
|
||||
|
||||
template <__fp_format _Fmt>
|
||||
using __fp_storage_t = decltype(__fp_storage_type_impl<_Fmt>());
|
||||
|
||||
template <class _Tp>
|
||||
using __fp_storage_of_t = __fp_storage_t<__fp_format_of_v<_Tp>>;
|
||||
|
||||
#if !_CCCL_TILE_COMPILATION()
|
||||
template <class _Tp>
|
||||
struct __cccl_nvfp_manip_helper : _Tp
|
||||
{
|
||||
using _Tp::__x;
|
||||
};
|
||||
#endif // _CCCL_TILE_COMPILATION()
|
||||
|
||||
template <class _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr _Tp __fp_from_storage(__fp_storage_of_t<_Tp> __v) noexcept
|
||||
{
|
||||
if constexpr (__is_std_fp_v<_Tp> || __is_ext_compiler_fp_v<_Tp>)
|
||||
{
|
||||
return ::cuda::std::bit_cast<_Tp>(__v);
|
||||
}
|
||||
else if constexpr (__is_ext_cccl_fp_v<_Tp>)
|
||||
{
|
||||
_Tp __ret{};
|
||||
__ret.__storage_ = __v;
|
||||
return __ret;
|
||||
}
|
||||
#if _CCCL_HAS_NVFP16()
|
||||
else if constexpr (is_same_v<_Tp, __half>)
|
||||
{
|
||||
# if _CCCL_TILE_COMPILATION()
|
||||
return ::cuda::std::bit_cast<_Tp>(__v);
|
||||
# else // ^^^ _CCCL_TILE_COMPILATION() ^^^ / vvv !_CCCL_TILE_COMPILATION()
|
||||
__cccl_nvfp_manip_helper<_Tp> __helper{};
|
||||
__helper.__x = __v;
|
||||
return __helper;
|
||||
# endif // !_CCCL_TILE_COMPILATION()
|
||||
}
|
||||
#endif // _CCCL_HAS_NVFP16()
|
||||
#if _CCCL_HAS_NVBF16()
|
||||
else if constexpr (is_same_v<_Tp, __nv_bfloat16>)
|
||||
{
|
||||
# if _CCCL_TILE_COMPILATION()
|
||||
return ::cuda::std::bit_cast<_Tp>(__v);
|
||||
# else // ^^^ _CCCL_TILE_COMPILATION() ^^^ / vvv !_CCCL_TILE_COMPILATION()
|
||||
__cccl_nvfp_manip_helper<_Tp> __helper{};
|
||||
__helper.__x = __v;
|
||||
return __helper;
|
||||
# endif // !_CCCL_TILE_COMPILATION()
|
||||
}
|
||||
#endif // _CCCL_HAS_NVBF16()
|
||||
#if _CCCL_HAS_NVFP8_E4M3()
|
||||
else if constexpr (is_same_v<_Tp, __nv_fp8_e4m3>)
|
||||
{
|
||||
_Tp __ret{};
|
||||
__ret.__x = __v;
|
||||
return __ret;
|
||||
}
|
||||
#endif // _CCCL_HAS_NVFP8_E4M3()
|
||||
#if _CCCL_HAS_NVFP8_E5M2()
|
||||
else if constexpr (is_same_v<_Tp, __nv_fp8_e5m2>)
|
||||
{
|
||||
_Tp __ret{};
|
||||
__ret.__x = __v;
|
||||
return __ret;
|
||||
}
|
||||
#endif // _CCCL_HAS_NVFP8_E5M2()
|
||||
#if _CCCL_HAS_NVFP8_E8M0()
|
||||
else if constexpr (is_same_v<_Tp, __nv_fp8_e8m0>)
|
||||
{
|
||||
_Tp __ret{};
|
||||
__ret.__x = __v;
|
||||
return __ret;
|
||||
}
|
||||
#endif // _CCCL_HAS_NVFP8_E8M0()
|
||||
#if _CCCL_HAS_NVFP6_E2M3()
|
||||
else if constexpr (is_same_v<_Tp, __nv_fp6_e2m3>)
|
||||
{
|
||||
_CCCL_ASSERT((__v & 0xc0u) == 0u, "Invalid __nv_fp6_e2m3 storage value");
|
||||
_Tp __ret{};
|
||||
__ret.__x = __v;
|
||||
return __ret;
|
||||
}
|
||||
#endif // _CCCL_HAS_NVFP6_E2M3()
|
||||
#if _CCCL_HAS_NVFP6_E3M2()
|
||||
else if constexpr (is_same_v<_Tp, __nv_fp6_e3m2>)
|
||||
{
|
||||
_CCCL_ASSERT((__v & 0xc0u) == 0u, "Invalid __nv_fp6_e3m2 storage value");
|
||||
_Tp __ret{};
|
||||
__ret.__x = __v;
|
||||
return __ret;
|
||||
}
|
||||
#endif // _CCCL_HAS_NVFP6_E3M2()
|
||||
#if _CCCL_HAS_NVFP4_E2M1()
|
||||
else if constexpr (is_same_v<_Tp, __nv_fp4_e2m1>)
|
||||
{
|
||||
_CCCL_ASSERT((__v & 0xf0u) == 0u, "Invalid __nv_fp4_e2m1 storage value");
|
||||
_Tp __ret{};
|
||||
__ret.__x = __v;
|
||||
return __ret;
|
||||
}
|
||||
#endif // _CCCL_HAS_NVFP4_E2M1()
|
||||
else
|
||||
{
|
||||
static_assert(__always_false_v<_Tp>, "Unsupported floating point format");
|
||||
}
|
||||
}
|
||||
|
||||
_CCCL_TEMPLATE(class _Tp, class _Up)
|
||||
_CCCL_REQUIRES((!is_same_v<_Up, __fp_storage_of_t<_Tp>>) )
|
||||
_CCCL_API constexpr _Tp __fp_from_storage(const _Up& __v) noexcept = delete;
|
||||
|
||||
template <class _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr __fp_storage_of_t<_Tp> __fp_get_storage(_Tp __v) noexcept
|
||||
{
|
||||
if constexpr (__is_std_fp_v<_Tp> || __is_ext_compiler_fp_v<_Tp>)
|
||||
{
|
||||
return ::cuda::std::bit_cast<__fp_storage_of_t<_Tp>>(__v);
|
||||
}
|
||||
else if constexpr (__is_ext_cccl_fp_v<_Tp>)
|
||||
{
|
||||
return __v.__storage_;
|
||||
}
|
||||
#if _CCCL_HAS_NVFP16()
|
||||
else if constexpr (is_same_v<_Tp, __half>)
|
||||
{
|
||||
# if _CCCL_TILE_COMPILATION()
|
||||
return ::cuda::std::bit_cast<__fp_storage_of_t<_Tp>>(__v);
|
||||
# else // ^^^ _CCCL_TILE_COMPILATION() ^^^ / vvv !_CCCL_TILE_COMPILATION() vvv
|
||||
return __cccl_nvfp_manip_helper<_Tp>{__v}.__x;
|
||||
# endif // !_CCCL_TILE_COMPILATION()
|
||||
}
|
||||
#endif // _CCCL_HAS_NVFP16()
|
||||
#if _CCCL_HAS_NVBF16()
|
||||
else if constexpr (is_same_v<_Tp, __nv_bfloat16>)
|
||||
{
|
||||
# if _CCCL_TILE_COMPILATION()
|
||||
return ::cuda::std::bit_cast<__fp_storage_of_t<_Tp>>(__v);
|
||||
# else // ^^^ _CCCL_TILE_COMPILATION() ^^^ / vvv !_CCCL_TILE_COMPILATION() vvv
|
||||
return __cccl_nvfp_manip_helper<_Tp>{__v}.__x;
|
||||
# endif // !_CCCL_TILE_COMPILATION()
|
||||
}
|
||||
#endif // _CCCL_HAS_NVBF16()
|
||||
// Distinct extended floating-point types expose the same storage member.
|
||||
// NOLINTBEGIN(bugprone-branch-clone)
|
||||
#if _CCCL_HAS_NVFP8_E4M3()
|
||||
else if constexpr (is_same_v<_Tp, __nv_fp8_e4m3>)
|
||||
{
|
||||
return __v.__x;
|
||||
}
|
||||
#endif // _CCCL_HAS_NVFP8_E4M3()
|
||||
#if _CCCL_HAS_NVFP8_E5M2()
|
||||
else if constexpr (is_same_v<_Tp, __nv_fp8_e5m2>)
|
||||
{
|
||||
return __v.__x;
|
||||
}
|
||||
#endif // _CCCL_HAS_NVFP8_E5M2()
|
||||
#if _CCCL_HAS_NVFP8_E8M0()
|
||||
else if constexpr (is_same_v<_Tp, __nv_fp8_e8m0>)
|
||||
{
|
||||
return __v.__x;
|
||||
}
|
||||
#endif // _CCCL_HAS_NVFP8_E8M0()
|
||||
#if _CCCL_HAS_NVFP6_E2M3()
|
||||
else if constexpr (is_same_v<_Tp, __nv_fp6_e2m3>)
|
||||
{
|
||||
return __v.__x;
|
||||
}
|
||||
#endif // _CCCL_HAS_NVFP6_E2M3()
|
||||
#if _CCCL_HAS_NVFP6_E3M2()
|
||||
else if constexpr (is_same_v<_Tp, __nv_fp6_e3m2>)
|
||||
{
|
||||
return __v.__x;
|
||||
}
|
||||
#endif // _CCCL_HAS_NVFP6_E3M2()
|
||||
#if _CCCL_HAS_NVFP4_E2M1()
|
||||
else if constexpr (is_same_v<_Tp, __nv_fp4_e2m1>)
|
||||
{
|
||||
return __v.__x;
|
||||
}
|
||||
#endif // _CCCL_HAS_NVFP4_E2M1()
|
||||
// NOLINTEND(bugprone-branch-clone)
|
||||
else
|
||||
{
|
||||
static_assert(__always_false_v<_Tp>, "Unsupported floating point format");
|
||||
}
|
||||
}
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___FLOATING_POINT_STORAGE_H
|
||||
@@ -0,0 +1,171 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___FLOATING_POINT_TRAITS_H
|
||||
#define _CUDA_STD___FLOATING_POINT_TRAITS_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__floating_point/properties.h>
|
||||
#include <cuda/std/__fwd/fp.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
// __is_std_fp_v
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_std_fp_v = false;
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_std_fp_v<const _Tp> = __is_std_fp_v<_Tp>;
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_std_fp_v<volatile _Tp> = __is_std_fp_v<_Tp>;
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_std_fp_v<const volatile _Tp> = __is_std_fp_v<_Tp>;
|
||||
|
||||
template <>
|
||||
inline constexpr bool __is_std_fp_v<float> = true;
|
||||
|
||||
template <>
|
||||
inline constexpr bool __is_std_fp_v<double> = true;
|
||||
|
||||
template <>
|
||||
inline constexpr bool __is_std_fp_v<long double> = true;
|
||||
|
||||
// __is_ext_nv_fp_v
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_ext_nv_fp_v = false;
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_ext_nv_fp_v<const _Tp> = __is_ext_nv_fp_v<_Tp>;
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_ext_nv_fp_v<volatile _Tp> = __is_ext_nv_fp_v<_Tp>;
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_ext_nv_fp_v<const volatile _Tp> = __is_ext_nv_fp_v<_Tp>;
|
||||
|
||||
#if _CCCL_HAS_NVFP16()
|
||||
template <>
|
||||
inline constexpr bool __is_ext_nv_fp_v<__half> = true;
|
||||
#endif // _CCCL_HAS_NVFP16()
|
||||
|
||||
#if _CCCL_HAS_NVBF16()
|
||||
template <>
|
||||
inline constexpr bool __is_ext_nv_fp_v<__nv_bfloat16> = true;
|
||||
#endif // _CCCL_HAS_NVBF16()
|
||||
|
||||
#if _CCCL_HAS_NVFP8_E4M3()
|
||||
template <>
|
||||
inline constexpr bool __is_ext_nv_fp_v<__nv_fp8_e4m3> = true;
|
||||
#endif // _CCCL_HAS_NVFP8_E4M3()
|
||||
|
||||
#if _CCCL_HAS_NVFP8_E5M2()
|
||||
template <>
|
||||
inline constexpr bool __is_ext_nv_fp_v<__nv_fp8_e5m2> = true;
|
||||
#endif // _CCCL_HAS_NVFP8_E5M2()
|
||||
|
||||
#if _CCCL_HAS_NVFP8_E8M0()
|
||||
template <>
|
||||
inline constexpr bool __is_ext_nv_fp_v<__nv_fp8_e8m0> = true;
|
||||
#endif // _CCCL_HAS_NVFP8_E8M0()
|
||||
|
||||
#if _CCCL_HAS_NVFP6_E2M3()
|
||||
template <>
|
||||
inline constexpr bool __is_ext_nv_fp_v<__nv_fp6_e2m3> = true;
|
||||
#endif // _CCCL_HAS_NVFP6_E2M3()
|
||||
|
||||
#if _CCCL_HAS_NVFP6_E3M2()
|
||||
template <>
|
||||
inline constexpr bool __is_ext_nv_fp_v<__nv_fp6_e3m2> = true;
|
||||
#endif // _CCCL_HAS_NVFP6_E3M2()
|
||||
|
||||
#if _CCCL_HAS_NVFP4_E2M1()
|
||||
template <>
|
||||
inline constexpr bool __is_ext_nv_fp_v<__nv_fp4_e2m1> = true;
|
||||
#endif // _CCCL_HAS_NVFP4_E2M1()
|
||||
|
||||
// __is_ext_compiler_fp_v
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_ext_compiler_fp_v = false;
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_ext_compiler_fp_v<const _Tp> = __is_ext_compiler_fp_v<_Tp>;
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_ext_compiler_fp_v<volatile _Tp> = __is_ext_compiler_fp_v<_Tp>;
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_ext_compiler_fp_v<const volatile _Tp> = __is_ext_compiler_fp_v<_Tp>;
|
||||
|
||||
#if _CCCL_HAS_FLOAT128()
|
||||
template <>
|
||||
inline constexpr bool __is_ext_compiler_fp_v<__float128> = true;
|
||||
#endif // _CCCL_HAS_FLOAT128()
|
||||
|
||||
// __is_ext_cccl_fp_v
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_ext_cccl_fp_v = false;
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_ext_cccl_fp_v<const _Tp> = __is_ext_cccl_fp_v<_Tp>;
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_ext_cccl_fp_v<volatile _Tp> = __is_ext_cccl_fp_v<_Tp>;
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_ext_cccl_fp_v<const volatile _Tp> = __is_ext_cccl_fp_v<_Tp>;
|
||||
|
||||
template <__fp_format _Fmt>
|
||||
inline constexpr bool __is_ext_cccl_fp_v<__cccl_fp<_Fmt>> = true;
|
||||
|
||||
// __is_ext_fp_v
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_ext_fp_v = __is_ext_nv_fp_v<_Tp> || __is_ext_compiler_fp_v<_Tp> || __is_ext_cccl_fp_v<_Tp>;
|
||||
|
||||
// __is_fp_v (todo: use cuda::std::is_floating_point_v instead in the future)
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_fp_v = __is_std_fp_v<_Tp> || __is_ext_fp_v<_Tp>;
|
||||
|
||||
// __fp_is_subset_v
|
||||
|
||||
template <__fp_format _LhsFmt, __fp_format _RhsFmt>
|
||||
inline constexpr bool __fp_is_subset_v =
|
||||
(!__fp_is_signed_v<_LhsFmt> || __fp_is_signed_v<_RhsFmt>)
|
||||
&& __fp_exp_min_v<_LhsFmt> >= __fp_exp_min_v<_RhsFmt> && __fp_exp_max_v<_LhsFmt> <= __fp_exp_max_v<_RhsFmt>
|
||||
&& __fp_digits_v<_LhsFmt> <= __fp_digits_v<_RhsFmt> && (!__fp_has_denorm_v<_LhsFmt> || __fp_has_denorm_v<_RhsFmt>);
|
||||
|
||||
// __fp_is_subset_of_v
|
||||
|
||||
template <class _Lhs, class _Rhs>
|
||||
inline constexpr bool __fp_is_subset_of_v = __fp_is_subset_v<__fp_format_of_v<_Lhs>, __fp_format_of_v<_Rhs>>;
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___FLOATING_POINT_TRAITS_H
|
||||
@@ -0,0 +1,64 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___FUNCTIONAL_BINARY_FUNCTION_H
|
||||
#define _CUDA_STD___FUNCTIONAL_BINARY_FUNCTION_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
#if defined(_LIBCUDACXX_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
|
||||
|
||||
template <class _Arg1, class _Arg2, class _Result>
|
||||
struct _CCCL_TYPE_VISIBILITY_DEFAULT CCCL_DEPRECATED binary_function
|
||||
{
|
||||
using first_argument_type = _Arg1;
|
||||
using second_argument_type = _Arg2;
|
||||
using result_type = _Result;
|
||||
};
|
||||
|
||||
#endif // defined(_LIBCUDACXX_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
|
||||
|
||||
template <class _Arg1, class _Arg2, class _Result>
|
||||
struct __binary_function_keep_layout_base
|
||||
{
|
||||
#if _CCCL_STD_VER <= 2017 || defined(_LIBCUDACXX_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using first_argument_type CCCL_DEPRECATED = _Arg1;
|
||||
using second_argument_type CCCL_DEPRECATED = _Arg2;
|
||||
using result_type CCCL_DEPRECATED = _Result;
|
||||
#endif // _LIBCUDACXX_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS
|
||||
};
|
||||
|
||||
#if defined(_LIBCUDACXX_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
|
||||
_CCCL_SUPPRESS_DEPRECATED_PUSH
|
||||
_CCCL_SUPPRESS_DEPRECATED_NVRTC_DIAG
|
||||
template <class _Arg1, class _Arg2, class _Result>
|
||||
using __binary_function = binary_function<_Arg1, _Arg2, _Result>;
|
||||
_CCCL_SUPPRESS_DEPRECATED_POP
|
||||
#else
|
||||
template <class _Arg1, class _Arg2, class _Result>
|
||||
using __binary_function = __binary_function_keep_layout_base<_Arg1, _Arg2, _Result>;
|
||||
#endif // !_LIBCUDACXX_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___FUNCTIONAL_BINARY_FUNCTION_H
|
||||
@@ -0,0 +1,57 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023-24 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___FUNCTIONAL_IDENTITY_H
|
||||
#define _CUDA_STD___FUNCTIONAL_IDENTITY_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__functional/reference_wrapper.h>
|
||||
#include <cuda/std/__type_traits/integral_constant.h>
|
||||
#include <cuda/std/__utility/forward.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_identity_v = false;
|
||||
|
||||
struct identity
|
||||
{
|
||||
template <class _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr _Tp&& operator()(_Tp&& __t) const noexcept
|
||||
{
|
||||
return ::cuda::std::forward<_Tp>(__t);
|
||||
}
|
||||
|
||||
using is_transparent = void;
|
||||
};
|
||||
|
||||
template <>
|
||||
inline constexpr bool __is_identity_v<identity> = true;
|
||||
template <>
|
||||
inline constexpr bool __is_identity_v<reference_wrapper<identity>> = true;
|
||||
template <>
|
||||
inline constexpr bool __is_identity_v<reference_wrapper<const identity>> = true;
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___FUNCTIONAL_IDENTITY_H
|
||||
@@ -0,0 +1,299 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___FUNCTIONAL_INVOKE_H
|
||||
#define _CUDA_STD___FUNCTIONAL_INVOKE_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__fwd/reference_wrapper.h>
|
||||
#include <cuda/std/__type_traits/decay.h>
|
||||
#include <cuda/std/__type_traits/enable_if.h>
|
||||
#include <cuda/std/__type_traits/integral_constant.h>
|
||||
#include <cuda/std/__type_traits/is_base_of.h>
|
||||
#include <cuda/std/__type_traits/is_core_convertible.h>
|
||||
#include <cuda/std/__type_traits/is_member_function_pointer.h>
|
||||
#include <cuda/std/__type_traits/is_member_object_pointer.h>
|
||||
#include <cuda/std/__type_traits/is_same.h>
|
||||
#include <cuda/std/__type_traits/is_void.h>
|
||||
#include <cuda/std/__type_traits/nat.h>
|
||||
#include <cuda/std/__type_traits/remove_cvref.h>
|
||||
#include <cuda/std/__utility/declval.h>
|
||||
#include <cuda/std/__utility/forward.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
struct __any
|
||||
{
|
||||
template <class _T>
|
||||
_CCCL_API inline __any(_T);
|
||||
};
|
||||
|
||||
template <class _DecayedFp>
|
||||
struct __member_pointer_class_type
|
||||
{};
|
||||
|
||||
template <class _Ret, class _ClassType>
|
||||
struct __member_pointer_class_type<_Ret _ClassType::*>
|
||||
{
|
||||
using type = _ClassType;
|
||||
};
|
||||
|
||||
template <class _DecayedFp>
|
||||
using __member_pointer_class_type_t = typename __member_pointer_class_type<_DecayedFp>::type;
|
||||
|
||||
template <class _Fp,
|
||||
class _A0,
|
||||
class _DecayFp = decay_t<_Fp>,
|
||||
class _DecayA0 = decay_t<_A0>,
|
||||
class _ClassT = __member_pointer_class_type_t<_DecayFp>>
|
||||
using __enable_if_bullet1 = enable_if_t<is_member_function_pointer_v<_DecayFp> && is_base_of_v<_ClassT, _DecayA0>>;
|
||||
|
||||
template <class _Fp, class _A0, class _DecayFp = decay_t<_Fp>, class _DecayA0 = decay_t<_A0>>
|
||||
using __enable_if_bullet2 =
|
||||
enable_if_t<is_member_function_pointer_v<_DecayFp> && __is_cuda_std_reference_wrapper_v<_DecayA0>>;
|
||||
|
||||
template <class _Fp,
|
||||
class _A0,
|
||||
class _DecayFp = decay_t<_Fp>,
|
||||
class _DecayA0 = decay_t<_A0>,
|
||||
class _ClassT = __member_pointer_class_type_t<_DecayFp>>
|
||||
using __enable_if_bullet3 = enable_if_t<is_member_function_pointer_v<_DecayFp> && !is_base_of_v<_ClassT, _DecayA0>
|
||||
&& !__is_cuda_std_reference_wrapper_v<_DecayA0>>;
|
||||
|
||||
template <class _Fp,
|
||||
class _A0,
|
||||
class _DecayFp = decay_t<_Fp>,
|
||||
class _DecayA0 = decay_t<_A0>,
|
||||
class _ClassT = __member_pointer_class_type_t<_DecayFp>>
|
||||
using __enable_if_bullet4 = enable_if_t<is_member_object_pointer_v<_DecayFp> && is_base_of_v<_ClassT, _DecayA0>>;
|
||||
|
||||
template <class _Fp, class _A0, class _DecayFp = decay_t<_Fp>, class _DecayA0 = decay_t<_A0>>
|
||||
using __enable_if_bullet5 =
|
||||
enable_if_t<is_member_object_pointer_v<_DecayFp> && __is_cuda_std_reference_wrapper_v<_DecayA0>>;
|
||||
|
||||
template <class _Fp,
|
||||
class _A0,
|
||||
class _DecayFp = decay_t<_Fp>,
|
||||
class _DecayA0 = decay_t<_A0>,
|
||||
class _ClassT = __member_pointer_class_type_t<_DecayFp>>
|
||||
using __enable_if_bullet6 = enable_if_t<is_member_object_pointer_v<_DecayFp> && !is_base_of_v<_ClassT, _DecayA0>
|
||||
&& !__is_cuda_std_reference_wrapper_v<_DecayA0>>;
|
||||
|
||||
// __invoke forward declarations
|
||||
|
||||
// fall back - none of the bullets
|
||||
|
||||
template <class... _Args>
|
||||
_CCCL_API inline __nat __invoke(__any, _Args&&... __args);
|
||||
|
||||
// bullets 1, 2 and 3
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _Fp, class _A0, class... _Args, class = __enable_if_bullet1<_Fp, _A0>>
|
||||
_CCCL_API constexpr decltype((::cuda::std::declval<_A0>()
|
||||
.*::cuda::std::declval<_Fp>())(::cuda::std::declval<_Args>()...))
|
||||
__invoke(_Fp&& __f,
|
||||
_A0&& __a0,
|
||||
_Args&&... __args) noexcept(noexcept((static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...)))
|
||||
{
|
||||
return (static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...);
|
||||
}
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _Fp, class _A0, class... _Args, class = __enable_if_bullet2<_Fp, _A0>>
|
||||
_CCCL_API constexpr decltype((::cuda::std::declval<_A0>().get()
|
||||
.*::cuda::std::declval<_Fp>())(::cuda::std::declval<_Args>()...))
|
||||
__invoke(_Fp&& __f, _A0&& __a0, _Args&&... __args) noexcept(noexcept((__a0.get().*__f)(static_cast<_Args&&>(__args)...)))
|
||||
{
|
||||
return (__a0.get().*__f)(static_cast<_Args&&>(__args)...);
|
||||
}
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _Fp, class _A0, class... _Args, class = __enable_if_bullet3<_Fp, _A0>>
|
||||
_CCCL_API constexpr decltype(((*::cuda::std::declval<_A0>())
|
||||
.*::cuda::std::declval<_Fp>())(::cuda::std::declval<_Args>()...))
|
||||
__invoke(_Fp&& __f,
|
||||
_A0&& __a0,
|
||||
_Args&&... __args) noexcept(noexcept(((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...)))
|
||||
{
|
||||
return ((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...);
|
||||
}
|
||||
|
||||
// bullets 4, 5 and 6
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _Fp, class _A0, class = __enable_if_bullet4<_Fp, _A0>>
|
||||
_CCCL_API constexpr decltype(::cuda::std::declval<_A0>().*::cuda::std::declval<_Fp>())
|
||||
__invoke(_Fp&& __f, _A0&& __a0) noexcept(noexcept(static_cast<_A0&&>(__a0).*__f))
|
||||
{
|
||||
return static_cast<_A0&&>(__a0).*__f;
|
||||
}
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _Fp, class _A0, class = __enable_if_bullet5<_Fp, _A0>>
|
||||
_CCCL_API constexpr decltype(::cuda::std::declval<_A0>().get().*::cuda::std::declval<_Fp>())
|
||||
__invoke(_Fp&& __f, _A0&& __a0) noexcept(noexcept(__a0.get().*__f))
|
||||
{
|
||||
return __a0.get().*__f;
|
||||
}
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _Fp, class _A0, class = __enable_if_bullet6<_Fp, _A0>>
|
||||
_CCCL_API constexpr decltype((*::cuda::std::declval<_A0>()).*::cuda::std::declval<_Fp>())
|
||||
__invoke(_Fp&& __f, _A0&& __a0) noexcept(noexcept((*static_cast<_A0&&>(__a0)).*__f))
|
||||
{
|
||||
return (*static_cast<_A0&&>(__a0)).*__f;
|
||||
}
|
||||
|
||||
// bullet 7
|
||||
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <class _Fp, class... _Args>
|
||||
_CCCL_API constexpr decltype(::cuda::std::declval<_Fp>()(::cuda::std::declval<_Args>()...))
|
||||
__invoke(_Fp&& __f, _Args&&... __args) noexcept(noexcept(static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...)))
|
||||
{
|
||||
return static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...);
|
||||
}
|
||||
|
||||
// __is_invocable
|
||||
template <class _Fp, class... _Args>
|
||||
using __invoke_result_t =
|
||||
decltype(::cuda::std::__invoke(::cuda::std::declval<_Fp>(), ::cuda::std::declval<_Args>()...));
|
||||
|
||||
template <class _Fp, class... _Args>
|
||||
_CCCL_CONCEPT __is_invocable =
|
||||
_CCCL_REQUIRES_EXPR((_Fp, variadic _Args))(requires(!is_same_v<__nat, __invoke_result_t<_Fp, _Args...>>));
|
||||
|
||||
template <class _Ret, class _Fp, class... _Args>
|
||||
_CCCL_CONCEPT __is_invocable_r = _CCCL_REQUIRES_EXPR((_Ret, _Fp, variadic _Args))(
|
||||
requires(__is_invocable<_Fp, _Args...>),
|
||||
requires((is_void_v<_Ret> || __is_core_convertible<__invoke_result_t<_Fp, _Args...>, _Ret>::value)));
|
||||
|
||||
template <class _Fp, class... _Args>
|
||||
struct _CCCL_TYPE_VISIBILITY_DEFAULT invoke_result //
|
||||
: public enable_if<__is_invocable<_Fp, _Args...>, __invoke_result_t<_Fp, _Args...>>
|
||||
{
|
||||
#if _CCCL_CUDA_COMPILER(NVCC) && defined(__CUDACC_EXTENDED_LAMBDA__) && !_CCCL_DEVICE_COMPILATION()
|
||||
# if _CCCL_CUDACC_BELOW(12, 3)
|
||||
static_assert(!__nv_is_extended_device_lambda_closure_type(remove_cvref_t<_Fp>),
|
||||
"Attempt to use an extended __device__ lambda in a context "
|
||||
"that requires querying its return type in host code. Use a "
|
||||
"named function object, an extended __host__ __device__ lambda, or "
|
||||
"cuda::proclaim_return_type instead.");
|
||||
# else // ^^^ _CCCL_CUDACC_BELOW(12, 3) ^^^ / vvv _CCCL_CUDACC_AT_LEAST(12, 3) vvv
|
||||
static_assert(
|
||||
!__nv_is_extended_device_lambda_closure_type(remove_cvref_t<_Fp>)
|
||||
|| __nv_is_extended_host_device_lambda_closure_type(remove_cvref_t<_Fp>)
|
||||
|| __nv_is_extended_device_lambda_with_preserved_return_type(remove_cvref_t<_Fp>),
|
||||
"Attempt to use an extended __device__ lambda in a context "
|
||||
"that requires querying its return type in host code. Use a "
|
||||
"named function object, an extended __host__ __device__ lambda, "
|
||||
"cuda::proclaim_return_type, or an extended __device__ lambda "
|
||||
"with a trailing return type instead ([] __device__ (...) -> RETURN_TYPE {...}).");
|
||||
# endif // _CCCL_CUDACC_AT_LEAST(12, 3)
|
||||
#endif
|
||||
};
|
||||
|
||||
// is_invocable
|
||||
|
||||
template <class _Fn, class... _Args>
|
||||
struct _CCCL_TYPE_VISIBILITY_DEFAULT is_invocable : bool_constant<__is_invocable<_Fn, _Args...>>
|
||||
{};
|
||||
|
||||
template <class _Ret, class _Fn, class... _Args>
|
||||
struct _CCCL_TYPE_VISIBILITY_DEFAULT is_invocable_r : bool_constant<__is_invocable_r<_Ret, _Fn, _Args...>>
|
||||
{};
|
||||
|
||||
template <class _Fn, class... _Args>
|
||||
inline constexpr bool is_invocable_v = __is_invocable<_Fn, _Args...>;
|
||||
|
||||
template <class _Ret, class _Fn, class... _Args>
|
||||
inline constexpr bool is_invocable_r_v = __is_invocable_r<_Ret, _Fn, _Args...>;
|
||||
|
||||
// is_nothrow_invocable
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_API constexpr void __cccl_test_noexcept_conversion(_Tp) noexcept;
|
||||
|
||||
template <bool _IsInvocable, bool _IsCVVoid, class _Ret, class _Fp, class... _Args>
|
||||
inline constexpr bool __nothrow_invocable_r_imp = false;
|
||||
|
||||
template <class _Ret, class _Fp, class... _Args>
|
||||
inline constexpr bool __nothrow_invocable_r_imp<true, false, _Ret, _Fp, _Args...> =
|
||||
noexcept(::cuda::std::__cccl_test_noexcept_conversion<_Ret>(
|
||||
::cuda::std::__invoke(declval<_Fp>(), ::cuda::std::declval<_Args>()...)));
|
||||
|
||||
template <class _Ret, class _Fp, class... _Args>
|
||||
inline constexpr bool __nothrow_invocable_r_imp<true, true, _Ret, _Fp, _Args...> =
|
||||
noexcept(::cuda::std::__invoke(::cuda::std::declval<_Fp>(), ::cuda::std::declval<_Args>()...));
|
||||
|
||||
template <class _Fp, class... _Args>
|
||||
inline constexpr bool is_nothrow_invocable_v =
|
||||
__nothrow_invocable_r_imp<__is_invocable<_Fp, _Args...>, true, void, _Fp, _Args...>;
|
||||
|
||||
template <class _Ret, class _Fp, class... _Args>
|
||||
inline constexpr bool is_nothrow_invocable_r_v =
|
||||
__nothrow_invocable_r_imp<__is_invocable_r<_Ret, _Fp, _Args...>, is_void_v<_Ret>, _Ret, _Fp, _Args...>;
|
||||
|
||||
template <class _Fn, class... _Args>
|
||||
struct _CCCL_TYPE_VISIBILITY_DEFAULT is_nothrow_invocable : bool_constant<is_nothrow_invocable_v<_Fn, _Args...>>
|
||||
{};
|
||||
|
||||
template <class _Ret, class _Fn, class... _Args>
|
||||
struct _CCCL_TYPE_VISIBILITY_DEFAULT
|
||||
is_nothrow_invocable_r : bool_constant<is_nothrow_invocable_r_v<_Ret, _Fn, _Args...>>
|
||||
{};
|
||||
|
||||
// Not going directly through __invoke_result_t because we want the additional device lambda checks in invoke_result
|
||||
template <class _Fn, class... _Args>
|
||||
using invoke_result_t = typename invoke_result<_Fn, _Args...>::type;
|
||||
|
||||
template <class _Fn, class... _Args>
|
||||
_CCCL_API constexpr invoke_result_t<_Fn, _Args...>
|
||||
invoke(_Fn&& __f, _Args&&... __args) noexcept(is_nothrow_invocable_v<_Fn, _Args...>)
|
||||
{
|
||||
return ::cuda::std::__invoke(::cuda::std::forward<_Fn>(__f), ::cuda::std::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
_CCCL_TEMPLATE(class _Ret, class _Fn, class... _Args)
|
||||
_CCCL_REQUIRES(is_invocable_r_v<_Ret, _Fn, _Args...>)
|
||||
_CCCL_API constexpr _Ret invoke_r(_Fn&& __f, _Args&&... __args) noexcept(is_nothrow_invocable_r_v<_Ret, _Fn, _Args...>)
|
||||
{
|
||||
if constexpr (is_void_v<_Ret>)
|
||||
{
|
||||
::cuda::std::__invoke(::cuda::std::forward<_Fn>(__f), ::cuda::std::forward<_Args>(__args)...);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ::cuda::std::__invoke(::cuda::std::forward<_Fn>(__f), ::cuda::std::forward<_Args>(__args)...);
|
||||
}
|
||||
}
|
||||
|
||||
/// The type of intermediate accumulator (according to P2322R6)
|
||||
template <typename Invocable, typename InputT, typename InitT = InputT>
|
||||
using __accumulator_t = decay_t<invoke_result_t<Invocable, InitT, InputT>>;
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___FUNCTIONAL_INVOKE_H
|
||||
@@ -0,0 +1,116 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___FUNCTIONAL_REFERENCE_WRAPPER_H
|
||||
#define _CUDA_STD___FUNCTIONAL_REFERENCE_WRAPPER_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__functional/invoke.h>
|
||||
#include <cuda/std/__functional/weak_result_type.h>
|
||||
#include <cuda/std/__fwd/reference_wrapper.h>
|
||||
#include <cuda/std/__memory/addressof.h>
|
||||
#include <cuda/std/__type_traits/enable_if.h>
|
||||
#include <cuda/std/__type_traits/remove_cvref.h>
|
||||
#include <cuda/std/__utility/declval.h>
|
||||
#include <cuda/std/__utility/forward.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
template <class _Tp>
|
||||
class _CCCL_TYPE_VISIBILITY_DEFAULT reference_wrapper : public __weak_result_type<_Tp>
|
||||
{
|
||||
public:
|
||||
// types
|
||||
using type = _Tp;
|
||||
|
||||
private:
|
||||
type* __f_{};
|
||||
|
||||
static _CCCL_API void __fun(_Tp&) noexcept;
|
||||
static void __fun(_Tp&&) = delete; // NOLINT(modernize-use-equals-delete)
|
||||
|
||||
public:
|
||||
// NOLINTBEGIN(bugprone-forwarding-reference-overload)
|
||||
template <
|
||||
class _Up,
|
||||
class = enable_if_t<!__is_same_uncvref<_Up, reference_wrapper>::value, decltype(__fun(::cuda::std::declval<_Up>()))>>
|
||||
_CCCL_API constexpr reference_wrapper(_Up&& __u) noexcept(noexcept(__fun(::cuda::std::declval<_Up>())))
|
||||
{
|
||||
type& __f = static_cast<_Up&&>(__u);
|
||||
__f_ = ::cuda::std::addressof(__f);
|
||||
}
|
||||
// NOLINTEND(bugprone-forwarding-reference-overload)
|
||||
|
||||
// access
|
||||
_CCCL_API constexpr operator type&() const noexcept
|
||||
{
|
||||
return *__f_;
|
||||
}
|
||||
[[nodiscard]] _CCCL_API constexpr type& get() const noexcept
|
||||
{
|
||||
return *__f_;
|
||||
}
|
||||
|
||||
// invoke
|
||||
template <class... _ArgTypes>
|
||||
_CCCL_API constexpr invoke_result_t<type&, _ArgTypes...> operator()(_ArgTypes&&... __args) const
|
||||
noexcept(is_nothrow_invocable_v<_Tp&, _ArgTypes...>)
|
||||
{
|
||||
return ::cuda::std::invoke(get(), ::cuda::std::forward<_ArgTypes>(__args)...);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_DEDUCTION_GUIDE_ATTRIBUTES reference_wrapper(_Tp&) -> reference_wrapper<_Tp>;
|
||||
|
||||
template <class _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr reference_wrapper<_Tp> ref(_Tp& __t) noexcept
|
||||
{
|
||||
return reference_wrapper<_Tp>(__t);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr reference_wrapper<_Tp> ref(reference_wrapper<_Tp> __t) noexcept
|
||||
{
|
||||
return __t;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr reference_wrapper<const _Tp> cref(const _Tp& __t) noexcept
|
||||
{
|
||||
return reference_wrapper<const _Tp>(__t);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr reference_wrapper<const _Tp> cref(reference_wrapper<_Tp> __t) noexcept
|
||||
{
|
||||
return __t;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
void ref(const _Tp&&) = delete;
|
||||
template <class _Tp>
|
||||
void cref(const _Tp&&) = delete;
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___FUNCTIONAL_REFERENCE_WRAPPER_H
|
||||
@@ -0,0 +1,63 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___FUNCTIONAL_UNARY_FUNCTION_H
|
||||
#define _CUDA_STD___FUNCTIONAL_UNARY_FUNCTION_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
#if defined(_LIBCUDACXX_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
|
||||
|
||||
template <class _Arg, class _Result>
|
||||
struct _CCCL_TYPE_VISIBILITY_DEFAULT CCCL_DEPRECATED unary_function
|
||||
{
|
||||
using argument_type = _Arg;
|
||||
using result_type = _Result;
|
||||
};
|
||||
|
||||
#endif // _LIBCUDACXX_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
|
||||
|
||||
template <class _Arg, class _Result>
|
||||
struct __unary_function_keep_layout_base
|
||||
{
|
||||
#if _CCCL_STD_VER <= 2017 || defined(_LIBCUDACXX_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using argument_type CCCL_DEPRECATED = _Arg;
|
||||
using result_type CCCL_DEPRECATED = _Result;
|
||||
#endif
|
||||
};
|
||||
|
||||
#if defined(_LIBCUDACXX_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
|
||||
|
||||
_CCCL_SUPPRESS_DEPRECATED_PUSH
|
||||
_CCCL_SUPPRESS_DEPRECATED_NVRTC_DIAG
|
||||
template <class _Arg, class _Result>
|
||||
using __unary_function = unary_function<_Arg, _Result>;
|
||||
_CCCL_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
#else
|
||||
template <class _Arg, class _Result>
|
||||
using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;
|
||||
#endif // !_LIBCUDACXX_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___FUNCTIONAL_UNARY_FUNCTION_H
|
||||
@@ -0,0 +1,56 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___FUNCTIONAL_UNWRAP_REF_H
|
||||
#define _CUDA_STD___FUNCTIONAL_UNWRAP_REF_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__fwd/reference_wrapper.h>
|
||||
#include <cuda/std/__type_traits/decay.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
template <class _Tp>
|
||||
struct unwrap_reference
|
||||
{
|
||||
using type _CCCL_NODEBUG_ALIAS = _Tp;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct unwrap_reference<reference_wrapper<_Tp>>
|
||||
{
|
||||
using type _CCCL_NODEBUG_ALIAS = _Tp&;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
using unwrap_reference_t = typename unwrap_reference<_Tp>::type;
|
||||
|
||||
template <class _Tp>
|
||||
struct unwrap_ref_decay : unwrap_reference<decay_t<_Tp>>
|
||||
{};
|
||||
|
||||
template <class _Tp>
|
||||
using unwrap_ref_decay_t = typename unwrap_ref_decay<_Tp>::type;
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___FUNCTIONAL_UNWRAP_REF_H
|
||||
@@ -0,0 +1,262 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___FUNCTIONAL_WEAK_RESULT_TYPE_H
|
||||
#define _CUDA_STD___FUNCTIONAL_WEAK_RESULT_TYPE_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__functional/binary_function.h>
|
||||
#include <cuda/std/__functional/invoke.h>
|
||||
#include <cuda/std/__functional/unary_function.h>
|
||||
#include <cuda/std/__type_traits/integral_constant.h>
|
||||
#include <cuda/std/__type_traits/is_same.h>
|
||||
#include <cuda/std/__utility/declval.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_CONCEPT __has_member_result_type = _CCCL_REQUIRES_EXPR((_Tp))(typename(typename _Tp::result_type));
|
||||
|
||||
// __weak_result_type
|
||||
|
||||
template <class _Tp>
|
||||
struct __derives_from_unary_function
|
||||
{
|
||||
private:
|
||||
struct __two
|
||||
{
|
||||
char __lx;
|
||||
char __lxx;
|
||||
};
|
||||
static _CCCL_API inline __two __test(...);
|
||||
template <class _Ap, class _Rp>
|
||||
static _CCCL_API inline __unary_function<_Ap, _Rp> __test(const volatile __unary_function<_Ap, _Rp>*);
|
||||
|
||||
public:
|
||||
static const bool value = !is_same_v<decltype(__test((_Tp*) nullptr)), __two>;
|
||||
using type = decltype(__test((_Tp*) nullptr));
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __derives_from_binary_function
|
||||
{
|
||||
private:
|
||||
struct __two
|
||||
{
|
||||
char __lx;
|
||||
char __lxx;
|
||||
};
|
||||
static __two _CCCL_API inline __test(...);
|
||||
template <class _A1, class _A2, class _Rp>
|
||||
static _CCCL_API inline __binary_function<_A1, _A2, _Rp> __test(const volatile __binary_function<_A1, _A2, _Rp>*);
|
||||
|
||||
public:
|
||||
static const bool value = !is_same_v<decltype(__test((_Tp*) nullptr)), __two>;
|
||||
using type = decltype(__test((_Tp*) nullptr));
|
||||
};
|
||||
|
||||
template <class _Tp, bool = __derives_from_unary_function<_Tp>::value>
|
||||
struct __maybe_derive_from_unary_function // bool is true
|
||||
: public __derives_from_unary_function<_Tp>::type
|
||||
{};
|
||||
|
||||
template <class _Tp>
|
||||
struct __maybe_derive_from_unary_function<_Tp, false>
|
||||
{};
|
||||
|
||||
template <class _Tp, bool = __derives_from_binary_function<_Tp>::value>
|
||||
struct __maybe_derive_from_binary_function // bool is true
|
||||
: public __derives_from_binary_function<_Tp>::type
|
||||
{};
|
||||
|
||||
template <class _Tp>
|
||||
struct __maybe_derive_from_binary_function<_Tp, false>
|
||||
{};
|
||||
|
||||
template <class _Tp, bool = __has_member_result_type<_Tp>>
|
||||
struct __weak_result_type_imp // bool is true
|
||||
: public __maybe_derive_from_unary_function<_Tp>
|
||||
, public __maybe_derive_from_binary_function<_Tp>
|
||||
{
|
||||
#if _CCCL_STD_VER <= 2017 || defined(_LIBCUDACXX_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using result_type _CCCL_NODEBUG_ALIAS CCCL_DEPRECATED = typename _Tp::result_type;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __weak_result_type_imp<_Tp, false>
|
||||
: public __maybe_derive_from_unary_function<_Tp>
|
||||
, public __maybe_derive_from_binary_function<_Tp>
|
||||
{};
|
||||
|
||||
template <class _Tp>
|
||||
struct __weak_result_type : public __weak_result_type_imp<_Tp>
|
||||
{};
|
||||
|
||||
// 0 argument case
|
||||
|
||||
template <class _Rp>
|
||||
struct __weak_result_type<_Rp()>
|
||||
{
|
||||
#if _CCCL_STD_VER <= 2017 || defined(_LIBCUDACXX_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using result_type _CCCL_NODEBUG_ALIAS CCCL_DEPRECATED = _Rp;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Rp>
|
||||
struct __weak_result_type<_Rp (&)()>
|
||||
{
|
||||
#if _CCCL_STD_VER <= 2017 || defined(_LIBCUDACXX_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using result_type _CCCL_NODEBUG_ALIAS CCCL_DEPRECATED = _Rp;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Rp>
|
||||
struct __weak_result_type<_Rp (*)()>
|
||||
{
|
||||
#if _CCCL_STD_VER <= 2017 || defined(_LIBCUDACXX_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using result_type _CCCL_NODEBUG_ALIAS CCCL_DEPRECATED = _Rp;
|
||||
#endif
|
||||
};
|
||||
|
||||
// 1 argument case
|
||||
|
||||
template <class _Rp, class _A1>
|
||||
struct __weak_result_type<_Rp(_A1)> : public __unary_function<_A1, _Rp>
|
||||
{};
|
||||
|
||||
template <class _Rp, class _A1>
|
||||
struct __weak_result_type<_Rp (&)(_A1)> : public __unary_function<_A1, _Rp>
|
||||
{};
|
||||
|
||||
template <class _Rp, class _A1>
|
||||
struct __weak_result_type<_Rp (*)(_A1)> : public __unary_function<_A1, _Rp>
|
||||
{};
|
||||
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)()> : public __unary_function<_Cp*, _Rp>
|
||||
{};
|
||||
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)() const> : public __unary_function<const _Cp*, _Rp>
|
||||
{};
|
||||
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)() volatile> : public __unary_function<volatile _Cp*, _Rp>
|
||||
{};
|
||||
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)() const volatile> : public __unary_function<const volatile _Cp*, _Rp>
|
||||
{};
|
||||
|
||||
// 2 argument case
|
||||
|
||||
template <class _Rp, class _A1, class _A2>
|
||||
struct __weak_result_type<_Rp(_A1, _A2)> : public __binary_function<_A1, _A2, _Rp>
|
||||
{};
|
||||
|
||||
template <class _Rp, class _A1, class _A2>
|
||||
struct __weak_result_type<_Rp (*)(_A1, _A2)> : public __binary_function<_A1, _A2, _Rp>
|
||||
{};
|
||||
|
||||
template <class _Rp, class _A1, class _A2>
|
||||
struct __weak_result_type<_Rp (&)(_A1, _A2)> : public __binary_function<_A1, _A2, _Rp>
|
||||
{};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1)> : public __binary_function<_Cp*, _A1, _Rp>
|
||||
{};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) const> : public __binary_function<const _Cp*, _A1, _Rp>
|
||||
{};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile> : public __binary_function<volatile _Cp*, _A1, _Rp>
|
||||
{};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile> : public __binary_function<const volatile _Cp*, _A1, _Rp>
|
||||
{};
|
||||
|
||||
// 3 or more arguments
|
||||
|
||||
template <class _Rp, class _A1, class _A2, class _A3, class... _A4>
|
||||
struct __weak_result_type<_Rp(_A1, _A2, _A3, _A4...)>
|
||||
{
|
||||
#if _CCCL_STD_VER <= 2017 || defined(_LIBCUDACXX_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using result_type _CCCL_NODEBUG_ALIAS CCCL_DEPRECATED = _Rp;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Rp, class _A1, class _A2, class _A3, class... _A4>
|
||||
struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)>
|
||||
{
|
||||
#if _CCCL_STD_VER <= 2017 || defined(_LIBCUDACXX_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using result_type _CCCL_NODEBUG_ALIAS CCCL_DEPRECATED = _Rp;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Rp, class _A1, class _A2, class _A3, class... _A4>
|
||||
struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)>
|
||||
{
|
||||
#if _CCCL_STD_VER <= 2017 || defined(_LIBCUDACXX_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using result_type _CCCL_NODEBUG_ALIAS CCCL_DEPRECATED = _Rp;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class... _A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)>
|
||||
{
|
||||
#if _CCCL_STD_VER <= 2017 || defined(_LIBCUDACXX_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using result_type _CCCL_NODEBUG_ALIAS CCCL_DEPRECATED = _Rp;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class... _A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const>
|
||||
{
|
||||
#if _CCCL_STD_VER <= 2017 || defined(_LIBCUDACXX_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using result_type _CCCL_NODEBUG_ALIAS CCCL_DEPRECATED = _Rp;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class... _A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile>
|
||||
{
|
||||
#if _CCCL_STD_VER <= 2017 || defined(_LIBCUDACXX_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using result_type _CCCL_NODEBUG_ALIAS CCCL_DEPRECATED = _Rp;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class... _A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
|
||||
{
|
||||
#if _CCCL_STD_VER <= 2017 || defined(_LIBCUDACXX_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
|
||||
using result_type _CCCL_NODEBUG_ALIAS CCCL_DEPRECATED = _Rp;
|
||||
#endif
|
||||
};
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___FUNCTIONAL_WEAK_RESULT_TYPE_H
|
||||
68
qwen3_6_scripts/cccl_preload/include/cuda/std/__fwd/array.h
Normal file
68
qwen3_6_scripts/cccl_preload/include/cuda/std/__fwd/array.h
Normal file
@@ -0,0 +1,68 @@
|
||||
//===---------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___FWD_ARRAY_H
|
||||
#define _CUDA_STD___FWD_ARRAY_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/cstddef>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
// std:: forward declarations
|
||||
|
||||
#if _CCCL_HAS_HOST_STD_LIB()
|
||||
_CCCL_BEGIN_NAMESPACE_STD
|
||||
|
||||
# if _CCCL_HOST_STD_LIB(STL)
|
||||
template <class _Tp, size_t _Size>
|
||||
class array;
|
||||
# else // ^^^ _CCCL_HOST_STD_LIB(STL) ^^^ / vvv !_CCCL_HOST_STD_LIB(STL) vvv
|
||||
template <class _Tp, size_t _Size>
|
||||
struct array;
|
||||
# endif // !_CCCL_HOST_STD_LIB(STL)
|
||||
|
||||
_CCCL_END_NAMESPACE_STD
|
||||
#endif // _CCCL_HAS_HOST_STD_LIB()
|
||||
|
||||
// ::cuda::std:: forward declaration
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
struct _CCCL_TYPE_VISIBILITY_DEFAULT array;
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_cuda_std_array_v = false;
|
||||
|
||||
template <class _Tp, size_t _Sz>
|
||||
inline constexpr bool __is_cuda_std_array_v<array<_Tp, _Sz>> = true;
|
||||
|
||||
#if _CCCL_HAS_HOST_STD_LIB()
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_std_array_v = false;
|
||||
|
||||
template <class _Tp, size_t _Sz>
|
||||
inline constexpr bool __is_std_array_v<::std::array<_Tp, _Sz>> = true;
|
||||
#endif // _CCCL_HAS_HOST_STD_LIB()
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___FWD_ARRAY_H
|
||||
@@ -0,0 +1,75 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023-24 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___FWD_COMPLEX_H
|
||||
#define _CUDA_STD___FWD_COMPLEX_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
// std:: forward declarations
|
||||
|
||||
#if _CCCL_HAS_HOST_STD_LIB()
|
||||
_CCCL_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class>
|
||||
class complex;
|
||||
|
||||
_CCCL_END_NAMESPACE_STD
|
||||
#endif // _CCCL_HAS_HOST_STD_LIB()
|
||||
|
||||
// cuda::std:: forward declarations
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
template <class _Tp>
|
||||
class _CCCL_TYPE_VISIBILITY_DEFAULT complex;
|
||||
|
||||
// __is_std_complex_v
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_std_complex_v = false;
|
||||
#if _CCCL_HAS_HOST_STD_LIB()
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_std_complex_v<const _Tp> = __is_std_complex_v<_Tp>;
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_std_complex_v<volatile _Tp> = __is_std_complex_v<_Tp>;
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_std_complex_v<const volatile _Tp> = __is_std_complex_v<_Tp>;
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_std_complex_v<::std::complex<_Tp>> = true;
|
||||
#endif // _CCCL_HAS_HOST_STD_LIB()
|
||||
|
||||
// __is_cuda_std_complex_v
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_cuda_std_complex_v = false;
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_cuda_std_complex_v<const _Tp> = __is_cuda_std_complex_v<_Tp>;
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_cuda_std_complex_v<volatile _Tp> = __is_cuda_std_complex_v<_Tp>;
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_cuda_std_complex_v<const volatile _Tp> = __is_cuda_std_complex_v<_Tp>;
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_cuda_std_complex_v<complex<_Tp>> = true;
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___FWD_COMPLEX_H
|
||||
120
qwen3_6_scripts/cccl_preload/include/cuda/std/__fwd/format.h
Normal file
120
qwen3_6_scripts/cccl_preload/include/cuda/std/__fwd/format.h
Normal file
@@ -0,0 +1,120 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___FWD_FORMAT_H
|
||||
#define _CUDA_STD___FWD_FORMAT_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__fwd/iterator.h>
|
||||
#include <cuda/std/__type_traits/type_identity.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
#if __cpp_lib_format >= 201907L
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class, class>
|
||||
struct formatter;
|
||||
|
||||
_CCCL_END_NAMESPACE_STD
|
||||
|
||||
#endif // __cpp_lib_format >= 201907L
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
template <class _CharT>
|
||||
class _CCCL_TYPE_VISIBILITY_DEFAULT basic_format_parse_context;
|
||||
|
||||
using format_parse_context = basic_format_parse_context<char>;
|
||||
#if _CCCL_HAS_WCHAR_T()
|
||||
using wformat_parse_context = basic_format_parse_context<wchar_t>;
|
||||
#endif // _CCCL_HAS_WCHAR_T()
|
||||
|
||||
template <class _CharT>
|
||||
class _CCCL_TYPE_VISIBILITY_DEFAULT _CCCL_PREFERRED_NAME(format_parse_context)
|
||||
#if _CCCL_HAS_WCHAR_T()
|
||||
_CCCL_PREFERRED_NAME(wformat_parse_context)
|
||||
#endif // _CCCL_HAS_WCHAR_T()
|
||||
basic_format_parse_context;
|
||||
|
||||
template <class _CharT>
|
||||
class __fmt_output_buffer;
|
||||
|
||||
template <class _Context>
|
||||
class _CCCL_TYPE_VISIBILITY_DEFAULT basic_format_arg;
|
||||
|
||||
template <class _OutIt, class _CharT>
|
||||
class _CCCL_TYPE_VISIBILITY_DEFAULT basic_format_context;
|
||||
|
||||
using format_context = basic_format_context<__back_insert_iterator<__fmt_output_buffer<char>>, char>;
|
||||
#if _CCCL_HAS_WCHAR_T()
|
||||
using wformat_context = basic_format_context<__back_insert_iterator<__fmt_output_buffer<wchar_t>>, wchar_t>;
|
||||
#endif // _CCCL_HAS_WCHAR_T()
|
||||
|
||||
template <class _OutIt, class _CharT>
|
||||
class _CCCL_TYPE_VISIBILITY_DEFAULT _CCCL_PREFERRED_NAME(format_context)
|
||||
#if _CCCL_HAS_WCHAR_T()
|
||||
_CCCL_PREFERRED_NAME(wformat_context)
|
||||
#endif // _CCCL_HAS_WCHAR_T()
|
||||
basic_format_context;
|
||||
|
||||
template <class _Context>
|
||||
class _CCCL_TYPE_VISIBILITY_DEFAULT basic_format_args;
|
||||
|
||||
using format_args = basic_format_args<format_context>;
|
||||
#if _CCCL_HAS_WCHAR_T()
|
||||
using wformat_args = basic_format_args<wformat_context>;
|
||||
#endif // _CCCL_HAS_WCHAR_T()
|
||||
|
||||
template <class _Context>
|
||||
class _CCCL_TYPE_VISIBILITY_DEFAULT _CCCL_PREFERRED_NAME(format_args)
|
||||
#if _CCCL_HAS_WCHAR_T()
|
||||
_CCCL_PREFERRED_NAME(wformat_args)
|
||||
#endif // _CCCL_HAS_WCHAR_T()
|
||||
basic_format_args;
|
||||
|
||||
template <class _CharT, class... _Args>
|
||||
struct _CCCL_TYPE_VISIBILITY_DEFAULT basic_format_string;
|
||||
|
||||
template <class... _Args>
|
||||
using format_string = basic_format_string<char, type_identity_t<_Args>...>;
|
||||
|
||||
#if _CCCL_HAS_WCHAR_T()
|
||||
template <class... _Args>
|
||||
using wformat_string = basic_format_string<wchar_t, type_identity_t<_Args>...>;
|
||||
#endif // _CCCL_HAS_WCHAR_T()
|
||||
|
||||
template <class _OutIt>
|
||||
struct _CCCL_TYPE_VISIBILITY_DEFAULT format_to_n_result;
|
||||
|
||||
enum class range_format
|
||||
{
|
||||
disabled,
|
||||
map,
|
||||
set,
|
||||
sequence,
|
||||
string,
|
||||
debug_string,
|
||||
};
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___FWD_FORMAT_H
|
||||
37
qwen3_6_scripts/cccl_preload/include/cuda/std/__fwd/fp.h
Normal file
37
qwen3_6_scripts/cccl_preload/include/cuda/std/__fwd/fp.h
Normal file
@@ -0,0 +1,37 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___FWD_FP_H
|
||||
#define _CUDA_STD___FWD_FP_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
enum class __fp_format;
|
||||
|
||||
template <__fp_format _Fmt>
|
||||
class __cccl_fp;
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___FWD_FP_H
|
||||
132
qwen3_6_scripts/cccl_preload/include/cuda/std/__fwd/get.h
Normal file
132
qwen3_6_scripts/cccl_preload/include/cuda/std/__fwd/get.h
Normal file
@@ -0,0 +1,132 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023-24 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___FWD_GET_H
|
||||
#define _CUDA_STD___FWD_GET_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__concepts/copyable.h>
|
||||
#include <cuda/std/__fwd/array.h>
|
||||
#include <cuda/std/__fwd/complex.h>
|
||||
#include <cuda/std/__fwd/pair.h>
|
||||
#include <cuda/std/__fwd/subrange.h>
|
||||
#include <cuda/std/__fwd/tuple.h>
|
||||
#include <cuda/std/__tuple_dir/tuple_element.h>
|
||||
#include <cuda/std/__utility/forward.h>
|
||||
#include <cuda/std/cstddef>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
template <size_t _Ip, class... _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr tuple_element_t<_Ip, tuple<_Tp...>>& get(tuple<_Tp...>&) noexcept;
|
||||
|
||||
template <size_t _Ip, class... _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr const tuple_element_t<_Ip, tuple<_Tp...>>& get(const tuple<_Tp...>&) noexcept;
|
||||
|
||||
template <size_t _Ip, class... _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr tuple_element_t<_Ip, tuple<_Tp...>>&& get(tuple<_Tp...>&&) noexcept;
|
||||
|
||||
template <size_t _Ip, class... _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr const tuple_element_t<_Ip, tuple<_Tp...>>&& get(const tuple<_Tp...>&&) noexcept;
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
[[nodiscard]] _CCCL_API constexpr tuple_element_t<_Ip, pair<_T1, _T2>>& get(pair<_T1, _T2>&) noexcept;
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
[[nodiscard]] _CCCL_API constexpr const tuple_element_t<_Ip, pair<_T1, _T2>>& get(const pair<_T1, _T2>&) noexcept;
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
[[nodiscard]] _CCCL_API constexpr tuple_element_t<_Ip, pair<_T1, _T2>>&& get(pair<_T1, _T2>&&) noexcept;
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
[[nodiscard]] _CCCL_API constexpr const tuple_element_t<_Ip, pair<_T1, _T2>>&& get(const pair<_T1, _T2>&&) noexcept;
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
[[nodiscard]] _CCCL_API constexpr _Tp& get(array<_Tp, _Size>&) noexcept;
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
[[nodiscard]] _CCCL_API constexpr const _Tp& get(const array<_Tp, _Size>&) noexcept;
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
[[nodiscard]] _CCCL_API constexpr _Tp&& get(array<_Tp, _Size>&&) noexcept;
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
[[nodiscard]] _CCCL_API constexpr const _Tp&& get(const array<_Tp, _Size>&&) noexcept;
|
||||
|
||||
template <size_t _Ip, class _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr _Tp& get(complex<_Tp>&) noexcept;
|
||||
|
||||
template <size_t _Ip, class _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr _Tp&& get(complex<_Tp>&&) noexcept;
|
||||
|
||||
template <size_t _Ip, class _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr const _Tp& get(const complex<_Tp>&) noexcept;
|
||||
|
||||
template <size_t _Ip, class _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr const _Tp&& get(const complex<_Tp>&&) noexcept;
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD_RANGES
|
||||
|
||||
#if _CCCL_HAS_CONCEPTS()
|
||||
template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
|
||||
requires((_Index == 0) && copyable<_Iter>) || (_Index == 1)
|
||||
#else // ^^^ C++20 ^^^ / vvv C++17 vvv
|
||||
template <size_t _Index,
|
||||
class _Iter,
|
||||
class _Sent,
|
||||
subrange_kind _Kind,
|
||||
enable_if_t<((_Index == 0) && copyable<_Iter>) || (_Index == 1), int> = 0>
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^
|
||||
_CCCL_API constexpr auto get(const subrange<_Iter, _Sent, _Kind>& __subrange);
|
||||
|
||||
#if _CCCL_HAS_CONCEPTS()
|
||||
template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
|
||||
requires(_Index < 2)
|
||||
#else // ^^^ C++20 ^^^ / vvv C++17 vvv
|
||||
template <size_t _Index,
|
||||
class _Iter,
|
||||
class _Sent,
|
||||
subrange_kind _Kind,
|
||||
enable_if_t<_Index<2, int> = 0>
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^
|
||||
_CCCL_API constexpr auto get(subrange<_Iter, _Sent, _Kind>&& __subrange);
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD_RANGES
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
using ::cuda::std::ranges::get;
|
||||
|
||||
// Explicitly rely on ADL, mostly for constructors of host STL types, where we cannot squeze using ::cuda::std::get; in
|
||||
_CCCL_EXEC_CHECK_DISABLE
|
||||
template <size_t _Ip, class _TupleLike>
|
||||
[[nodiscard]] _CCCL_API constexpr decltype(auto) __adl_get(_TupleLike&& __t) noexcept
|
||||
{
|
||||
using ::cuda::std::get;
|
||||
return get<_Ip>(::cuda::std::forward<_TupleLike>(__t));
|
||||
}
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___FWD_GET_H
|
||||
@@ -0,0 +1,45 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___FWD_ITERATOR_H
|
||||
#define _CUDA_STD___FWD_ITERATOR_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
template <class _Container>
|
||||
class _CCCL_TYPE_VISIBILITY_DEFAULT __back_insert_iterator;
|
||||
|
||||
template <class, class = void>
|
||||
struct _CCCL_TYPE_VISIBILITY_DEFAULT iterator_traits;
|
||||
|
||||
_LIBCUDACXX_BEGIN_HIDDEN_FRIEND_NAMESPACE
|
||||
|
||||
template <class _Iter>
|
||||
class _CCCL_TYPE_VISIBILITY_DEFAULT reverse_iterator;
|
||||
|
||||
_LIBCUDACXX_END_HIDDEN_FRIEND_NAMESPACE(reverse_iterator)
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___FWD_ITERATOR_H
|
||||
53
qwen3_6_scripts/cccl_preload/include/cuda/std/__fwd/pair.h
Normal file
53
qwen3_6_scripts/cccl_preload/include/cuda/std/__fwd/pair.h
Normal file
@@ -0,0 +1,53 @@
|
||||
//===---------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___FWD_PAIR_H
|
||||
#define _CUDA_STD___FWD_PAIR_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
// std:: forward declarations
|
||||
|
||||
#if _CCCL_HAS_HOST_STD_LIB()
|
||||
_CCCL_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class, class>
|
||||
struct pair;
|
||||
|
||||
_CCCL_END_NAMESPACE_STD
|
||||
#endif // _CCCL_HAS_HOST_STD_LIB()
|
||||
|
||||
// cuda::std:: forward declarations
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
template <class, class>
|
||||
struct _CCCL_TYPE_VISIBILITY_DEFAULT pair;
|
||||
|
||||
template <class>
|
||||
inline constexpr bool __is_cuda_std_pair = false;
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
inline constexpr bool __is_cuda_std_pair<pair<_Tp, _Up>> = true;
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___FWD_PAIR_H
|
||||
@@ -0,0 +1,52 @@
|
||||
//===---------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___FWD_REFERENCE_WRAPPER_H
|
||||
#define _CUDA_STD___FWD_REFERENCE_WRAPPER_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
// std:: forward declarations
|
||||
|
||||
#if _CCCL_HAS_HOST_STD_LIB()
|
||||
_CCCL_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class>
|
||||
class reference_wrapper;
|
||||
|
||||
_CCCL_END_NAMESPACE_STD
|
||||
#endif // _CCCL_HAS_HOST_STD_LIB()
|
||||
|
||||
// cuda::std:: forward declarations
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
template <class _Tp>
|
||||
class _CCCL_TYPE_VISIBILITY_DEFAULT reference_wrapper;
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_cuda_std_reference_wrapper_v = false;
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_cuda_std_reference_wrapper_v<reference_wrapper<_Tp>> = true;
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___FWD_REFERENCE_WRAPPER_H
|
||||
45
qwen3_6_scripts/cccl_preload/include/cuda/std/__fwd/span.h
Normal file
45
qwen3_6_scripts/cccl_preload/include/cuda/std/__fwd/span.h
Normal file
@@ -0,0 +1,45 @@
|
||||
// -*- C++ -*-
|
||||
//===---------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___FWD_SPAN_H
|
||||
#define _CUDA_STD___FWD_SPAN_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/cstddef>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
inline constexpr size_t dynamic_extent = static_cast<size_t>(-1);
|
||||
|
||||
template <typename _Tp, size_t _Extent = dynamic_extent>
|
||||
class span;
|
||||
|
||||
template <class _Tp>
|
||||
inline constexpr bool __is_cuda_std_span_v = false;
|
||||
|
||||
template <class _Tp, size_t _Extent>
|
||||
inline constexpr bool __is_cuda_std_span_v<span<_Tp, _Extent>> = true;
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___FWD_SPAN_H
|
||||
@@ -0,0 +1,65 @@
|
||||
//===---------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___FWD_SUBRANGE_H
|
||||
#define _CUDA_STD___FWD_SUBRANGE_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__iterator/concepts.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD_RANGES
|
||||
|
||||
enum class _CCCL_TYPE_VISIBILITY_DEFAULT subrange_kind : bool
|
||||
{
|
||||
unsized,
|
||||
sized
|
||||
};
|
||||
|
||||
#if _CCCL_HAS_CONCEPTS()
|
||||
template <input_or_output_iterator _Iter,
|
||||
sentinel_for<_Iter> _Sent = _Iter,
|
||||
subrange_kind _Kind = sized_sentinel_for<_Sent, _Iter> ? subrange_kind::sized : subrange_kind::unsized>
|
||||
requires(_Kind == subrange_kind::sized || !sized_sentinel_for<_Sent, _Iter>)
|
||||
class _CCCL_TYPE_VISIBILITY_DEFAULT subrange;
|
||||
#else // ^^^ C++20 ^^^ / vvv C++17 vvv
|
||||
template <class _Iter,
|
||||
class _Sent = _Iter,
|
||||
subrange_kind _Kind = sized_sentinel_for<_Sent, _Iter> ? subrange_kind::sized : subrange_kind::unsized,
|
||||
enable_if_t<input_or_output_iterator<_Iter>, int> = 0,
|
||||
enable_if_t<sentinel_for<_Sent, _Iter>, int> = 0,
|
||||
enable_if_t<(_Kind == subrange_kind::sized || !sized_sentinel_for<_Sent, _Iter>), int> = 0>
|
||||
class _CCCL_TYPE_VISIBILITY_DEFAULT subrange;
|
||||
#endif // ^^^ !_CCCL_HAS_CONCEPTS() ^^^
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD_RANGES
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
template <class>
|
||||
inline constexpr bool __is_cuda_std_ranges_subrange_v = false;
|
||||
|
||||
template <class _Iter, class _Sent, ::cuda::std::ranges::subrange_kind _Kind>
|
||||
inline constexpr bool __is_cuda_std_ranges_subrange_v<::cuda::std::ranges::subrange<_Iter, _Sent, _Kind>> = true;
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___FWD_SUBRANGE_H
|
||||
52
qwen3_6_scripts/cccl_preload/include/cuda/std/__fwd/tuple.h
Normal file
52
qwen3_6_scripts/cccl_preload/include/cuda/std/__fwd/tuple.h
Normal file
@@ -0,0 +1,52 @@
|
||||
//===---------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___FWD_TUPLE_H
|
||||
#define _CUDA_STD___FWD_TUPLE_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
#if _CCCL_HAS_HOST_STD_LIB()
|
||||
_CCCL_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class...>
|
||||
class tuple;
|
||||
|
||||
_CCCL_END_NAMESPACE_STD
|
||||
#endif // _CCCL_HAS_HOST_STD_LIB()
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
template <class...>
|
||||
class _CCCL_TYPE_VISIBILITY_DEFAULT tuple;
|
||||
|
||||
template <class>
|
||||
inline constexpr bool __is_tuple_of_iterator_references_v = false;
|
||||
|
||||
template <class>
|
||||
inline constexpr bool __is_cuda_std_tuple = false;
|
||||
|
||||
template <class... _Types>
|
||||
inline constexpr bool __is_cuda_std_tuple<tuple<_Types...>> = true;
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___FWD_TUPLE_H
|
||||
@@ -0,0 +1,28 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___HOST_STDLIB_CSTDIO
|
||||
#define _CUDA_STD___HOST_STDLIB_CSTDIO
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#if _CCCL_HOSTED()
|
||||
# include <cstdio>
|
||||
#endif // _CCCL_HOSTED()
|
||||
|
||||
#endif // _CUDA_STD___HOST_STDLIB_CSTDIO
|
||||
@@ -0,0 +1,49 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___HOST_STDLIB_MATH_H
|
||||
#define _CUDA_STD___HOST_STDLIB_MATH_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#if _CCCL_HOSTED()
|
||||
# include <math.h>
|
||||
|
||||
// Standard C++ library comes with it's own <math.h> C++ compatible header. However, if the include paths are jumbled,
|
||||
// it might happen that the original C <math.h> is found first. This is a problem because C headers define many of the
|
||||
// math functions as macros which would change our definitions. So, we check whether any of the functions are defined
|
||||
// as a macro to distinguish the C++ copatibility header from the C header.
|
||||
# if defined(fabs) || defined(fmod) || defined(remainder) || defined(remquo) || defined(fma) || defined(fmax) \
|
||||
|| defined(fmin) || defined(fdim) || defined(exp) || defined(exp2) || defined(expm1) || defined(log) \
|
||||
|| defined(log10) || defined(log2) || defined(log1p) || defined(pow) || defined(sqrt) || defined(cbrt) \
|
||||
|| defined(hypot) || defined(sin) || defined(cos) || defined(tan) || defined(asin) || defined(acos) \
|
||||
|| defined(atan) || defined(atan2) || defined(sinh) || defined(cosh) || defined(tanh) || defined(asinh) \
|
||||
|| defined(acosh) || defined(atanh) || defined(erf) || defined(erfc) || defined(tgamma) || defined(lgamma) \
|
||||
|| defined(ceil) || defined(floor) || defined(trunc) || defined(round) || defined(lround) || defined(llround) \
|
||||
|| defined(nearbyint) || defined(rint) || defined(lrint) || defined(llrint) || defined(frexp) || defined(ldexp) \
|
||||
|| defined(scalbn) || defined(scalbln) || defined(ilogb) || defined(logb) || defined(nextafter) \
|
||||
|| defined(nexttoward) || defined(copysign) || defined(fpclassify) || defined(isfinite) || defined(isinf) \
|
||||
|| defined(isnan) || defined(isnormal) || defined(signbit) || defined(isgreater) || defined(isgreaterequal) \
|
||||
|| defined(isless) || defined(islessequal) || defined(islessgreater) || defined(isunordered)
|
||||
# error \
|
||||
"libcu++ requires the C++ compatibility <math.h> header, not the C <math.h> header. Please, check your include paths."
|
||||
# endif // math functions defined as macros
|
||||
|
||||
#endif // _CCCL_HOSTED()
|
||||
|
||||
#endif // _CUDA_STD___HOST_STDLIB_MATH_H
|
||||
@@ -0,0 +1,36 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___HOST_STDLIB_MEMORY
|
||||
#define _CUDA_STD___HOST_STDLIB_MEMORY
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
// When nvc++ uses CCCL components as part of its implementation of
|
||||
// Standard C++ algorithms, a cycle of included files may result when CCCL code
|
||||
// tries to use a standard algorithm. The THRUST_INCLUDING_ALGORITHMS_HEADER macro
|
||||
// is defined only when CCCL is including an algorithms-related header, giving
|
||||
// the compiler a chance to detect and break the cycle of includes.
|
||||
|
||||
#if _CCCL_HOSTED()
|
||||
# define THRUST_INCLUDING_ALGORITHMS_HEADER
|
||||
# include <memory>
|
||||
# undef THRUST_INCLUDING_ALGORITHMS_HEADER
|
||||
#endif // _CCCL_HOSTED()
|
||||
|
||||
#endif // _CUDA_STD___HOST_STDLIB_MEMORY
|
||||
@@ -0,0 +1,29 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___HOST_STDLIB_NEW
|
||||
#define _CUDA_STD___HOST_STDLIB_NEW
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
// HostJiT also needs <new>
|
||||
#if !_CCCL_COMPILER(NVRTC)
|
||||
# include <new>
|
||||
#endif // !_CCCL_COMPILER(NVRTC)
|
||||
|
||||
#endif // _CUDA_STD___HOST_STDLIB_NEW
|
||||
@@ -0,0 +1,28 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___HOST_STDLIB_STDEXCEPT
|
||||
#define _CUDA_STD___HOST_STDLIB_STDEXCEPT
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#if _CCCL_HOSTED()
|
||||
# include <stdexcept>
|
||||
#endif // _CCCL_HOSTED()
|
||||
|
||||
#endif // _CUDA_STD___HOST_STDLIB_STDEXCEPT
|
||||
@@ -0,0 +1,55 @@
|
||||
//===---------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___INTERNAL_ATOMIC_H
|
||||
#define _CUDA_STD___INTERNAL_ATOMIC_H
|
||||
|
||||
#include <cuda/__cccl_config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__internal/features.h>
|
||||
|
||||
#if _CCCL_CUDA_COMPILATION()
|
||||
# define _CCCL_ATOMIC_ALWAYS_LOCK_FREE(size, ptr) (size <= 8)
|
||||
#elif _CCCL_COMPILER(CLANG) || _CCCL_COMPILER(GCC)
|
||||
# define _CCCL_ATOMIC_ALWAYS_LOCK_FREE(...) __atomic_always_lock_free(__VA_ARGS__)
|
||||
#endif // _CCCL_CUDA_COMPILER
|
||||
|
||||
// Enable bypassing automatic storage checks in atomics when using CTK 12.2 and below and if NDEBUG is defined.
|
||||
// A compiler bug prevents the safe use of `__is_local` and PTX spacep until after 13.0.
|
||||
#ifndef _CCCL_ATOMIC_UNSAFE_AUTOMATIC_STORAGE
|
||||
# if _CCCL_CUDACC_BELOW(13, 1) && !defined(NDEBUG)
|
||||
# define _CCCL_ATOMIC_UNSAFE_AUTOMATIC_STORAGE
|
||||
# endif // _CCCL_CUDACC_BELOW(13, 1)
|
||||
#endif // _CCCL_ATOMIC_UNSAFE_AUTOMATIC_STORAGE
|
||||
|
||||
#define _CCCL_ATOMIC_FLAG_TYPE int
|
||||
|
||||
// Clang provides 128b atomics as a builtin
|
||||
#if defined(CCCL_ENABLE_EXPERIMENTAL_HOST_ATOMICS_128B)
|
||||
# define _CCCL_HOST_128_ATOMICS_ENABLED() 1
|
||||
# define _CCCL_HOST_128_ATOMICS_MAYBE() 0
|
||||
// GCC does not provide 128b atomics, but they may be available as a library, this requires opt-in usage.
|
||||
// See: https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html "-mcx16" for more
|
||||
#elif _CCCL_COMPILER(CLANG) || _CCCL_COMPILER(GCC)
|
||||
# define _CCCL_HOST_128_ATOMICS_ENABLED() 0
|
||||
# define _CCCL_HOST_128_ATOMICS_MAYBE() 1
|
||||
#else
|
||||
# define _CCCL_HOST_128_ATOMICS_ENABLED() 0
|
||||
# define _CCCL_HOST_128_ATOMICS_MAYBE() 0
|
||||
#endif
|
||||
|
||||
#endif // _CUDA_STD___INTERNAL_ATOMIC_H
|
||||
@@ -0,0 +1,44 @@
|
||||
//===---------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___INTERNAL_CPP_DIALECT_H
|
||||
#define _CUDA_STD___INTERNAL_CPP_DIALECT_H
|
||||
|
||||
#include <cuda/__cccl_config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
// Define LIBCUDACXX_COMPILER_DEPRECATION macro:
|
||||
#if _CCCL_COMPILER(MSVC) || _CCCL_COMPILER(NVRTC)
|
||||
# define LIBCUDACXX_COMP_DEPR_IMPL(msg) \
|
||||
_CCCL_PRAGMA(message(__FILE__ ":" _CCCL_TO_STRING(__LINE__) ": warning: " #msg))
|
||||
#else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC) vvv
|
||||
# define LIBCUDACXX_COMP_DEPR_IMPL(msg) _CCCL_PRAGMA(GCC warning #msg)
|
||||
#endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
// clang-format off
|
||||
#define LIBCUDACXX_DIALECT_DEPRECATION(REQ, CUR) \
|
||||
LIBCUDACXX_COMP_DEPR_IMPL( \
|
||||
libcu++ requires at least REQ. CUR is deprecated but still supported. CUR support will be removed in a \
|
||||
future release. Define CCCL_IGNORE_DEPRECATED_CPP_DIALECT to suppress this message.)
|
||||
// clang-format on
|
||||
|
||||
#ifndef CCCL_IGNORE_DEPRECATED_CPP_DIALECT
|
||||
# if _CCCL_STD_VER < 2017
|
||||
# error libcu++ requires at least C++ 17. Define CCCL_IGNORE_DEPRECATED_CPP_DIALECT to suppress this message.
|
||||
# endif // _CCCL_STD_VER < 2017
|
||||
#endif // CCCL_IGNORE_DEPRECATED_CPP_DIALECT
|
||||
|
||||
#endif // _CUDA_STD___INTERNAL_CPP_DIALECT_H
|
||||
@@ -0,0 +1,127 @@
|
||||
//===---------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___INTERNAL_FEATURES_H
|
||||
#define _CUDA_STD___INTERNAL_FEATURES_H
|
||||
|
||||
#include <cuda/__cccl_config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#define _LIBCUDACXX_HAS_CXX20_CHRONO_LITERALS() (!_CCCL_COMPILER(CLANG) || _CCCL_STD_VER >= 2020)
|
||||
#define _LIBCUDACXX_HAS_MONOTONIC_CLOCK() 0
|
||||
#define _LIBCUDACXX_HAS_SPACESHIP_OPERATOR() 0
|
||||
|
||||
#if _CCCL_CUDA_COMPILATION() || __cpp_aligned_new < 201606
|
||||
# define _LIBCUDACXX_HAS_ALIGNED_ALLOCATION() 0
|
||||
#else
|
||||
# define _LIBCUDACXX_HAS_ALIGNED_ALLOCATION() 1
|
||||
#endif // !_CCCL_CUDA_COMPILATION() && __cpp_aligned_new >= 201606
|
||||
|
||||
// We need `is_constant_evaluated` for clang and gcc. MSVC also needs extensive rework
|
||||
#if !defined(_CCCL_BUILTIN_IS_CONSTANT_EVALUATED)
|
||||
# define _LIBCUDACXX_HAS_CONSTEXPR_COMPLEX_OPERATIONS() 0
|
||||
#elif _CCCL_COMPILER(NVRTC)
|
||||
# define _LIBCUDACXX_HAS_CONSTEXPR_COMPLEX_OPERATIONS() 0
|
||||
#elif _CCCL_COMPILER(MSVC)
|
||||
# define _LIBCUDACXX_HAS_CONSTEXPR_COMPLEX_OPERATIONS() 0
|
||||
#elif _CCCL_CUDA_COMPILER(CLANG)
|
||||
# define _LIBCUDACXX_HAS_CONSTEXPR_COMPLEX_OPERATIONS() 0
|
||||
#else
|
||||
# define _LIBCUDACXX_HAS_CONSTEXPR_COMPLEX_OPERATIONS() 1
|
||||
#endif
|
||||
|
||||
#if _LIBCUDACXX_HAS_CONSTEXPR_COMPLEX_OPERATIONS()
|
||||
# define _CCCL_CONSTEXPR_COMPLEX constexpr
|
||||
#else
|
||||
# define _CCCL_CONSTEXPR_COMPLEX
|
||||
#endif // !_LIBCUDACXX_HAS_CONSTEXPR_COMPLEX_OPERATIONS()
|
||||
|
||||
#ifndef _LIBCUDACXX_HAS_NO_INCOMPLETE_RANGES
|
||||
# define _LIBCUDACXX_HAS_NO_INCOMPLETE_RANGES
|
||||
#endif // _LIBCUDACXX_HAS_NO_INCOMPLETE_RANGES
|
||||
|
||||
// libcu++ requires host device support for its tests. Until then restrict usage to at least 12.2
|
||||
#if _CCCL_HAS_NVFP16() && _CCCL_CTK_AT_LEAST(12, 2)
|
||||
# define _LIBCUDACXX_HAS_NVFP16() 1
|
||||
#else
|
||||
# define _LIBCUDACXX_HAS_NVFP16() 0
|
||||
#endif // _CCCL_HAS_NVFP16() && _CCCL_CTK_AT_LEAST(12, 2)
|
||||
|
||||
// libcu++ requires host device support for its tests. Until then restrict usage to at least 12.2
|
||||
#if _CCCL_HAS_NVBF16() && _CCCL_CTK_AT_LEAST(12, 2)
|
||||
# define _LIBCUDACXX_HAS_NVBF16() 1
|
||||
#else
|
||||
# define _LIBCUDACXX_HAS_NVBF16() 0
|
||||
#endif // _CCCL_HAS_NVBF16() && _CCCL_CTK_AT_LEAST(12, 2)
|
||||
|
||||
#if _CCCL_COMPILER(MSVC)
|
||||
# define _CCCL_ALIGNAS_TYPE(x) alignas(x)
|
||||
# define _CCCL_ALIGNAS(x) __declspec(align(x))
|
||||
#elif _CCCL_HAS_FEATURE(cxx_alignas)
|
||||
# define _CCCL_ALIGNAS_TYPE(x) alignas(x)
|
||||
# define _CCCL_ALIGNAS(x) alignas(x)
|
||||
#else
|
||||
# define _CCCL_ALIGNAS_TYPE(x) __attribute__((__aligned__(alignof(x))))
|
||||
# define _CCCL_ALIGNAS(x) __attribute__((__aligned__(x)))
|
||||
#endif // !_CCCL_COMPILER(MSVC) && !_CCCL_HAS_FEATURE(cxx_alignas)
|
||||
|
||||
// We can only expose constexpr allocations if the compiler supports it
|
||||
// For now disable constexpr allocation support until we can actually use
|
||||
#if 0 && __cpp_constexpr_dynamic_alloc >= 201907L && __cpp_lib_constexpr_dynamic_alloc >= 201907L \
|
||||
&& _CCCL_STD_VER >= 2020 && !_CCCL_COMPILER(NVRTC)
|
||||
# define _CCCL_HAS_CONSTEXPR_ALLOCATION
|
||||
# define _CCCL_CONSTEXPR_CXX20_ALLOCATION constexpr
|
||||
#else // ^^^ has constexpr allocations ^^^ / vvv no constexpr allocations vvv
|
||||
# define _CCCL_CONSTEXPR_CXX20_ALLOCATION
|
||||
#endif // ^^^ no constexpr allocations ^^^
|
||||
|
||||
// Enable removed C++17 features
|
||||
#if defined(_LIBCUDACXX_ENABLE_CXX17_REMOVED_FEATURES)
|
||||
# define _LIBCUDACXX_ENABLE_CXX17_REMOVED_BINDERS
|
||||
#endif // _LIBCUDACXX_ENABLE_CXX17_REMOVED_FEATURES
|
||||
|
||||
#ifndef _CCCL_DISABLE_ADDITIONAL_DIAGNOSTICS
|
||||
# define _CCCL_DIAGNOSE_WARNING(_COND, _MSG) _CCCL_DIAGNOSE_IF(_COND, _MSG, "warning")
|
||||
# define _CCCL_DIAGNOSE_ERROR(_COND, _MSG) _CCCL_DIAGNOSE_IF(_COND, _MSG, "error")
|
||||
#else
|
||||
# define _CCCL_DIAGNOSE_WARNING(_COND, _MSG)
|
||||
# define _CCCL_DIAGNOSE_ERROR(_COND, _MSG)
|
||||
#endif
|
||||
|
||||
#define _CCCL_HAS_SIMD_F32X2_INTRINSICS() \
|
||||
(_CCCL_CUDACC_AT_LEAST(12, 8) && _CCCL_HAS_CTK() && !_CCCL_CUDA_COMPILER(CLANG))
|
||||
#define _CCCL_HAS_SIMD_F32X2_PTX() (__cccl_ptx_isa >= 860ULL)
|
||||
#define _CCCL_HAS_SIMD_F32X2() \
|
||||
((_CCCL_HAS_SIMD_F32X2_INTRINSICS() || _CCCL_HAS_SIMD_F32X2_PTX()) && !_CCCL_TILE_COMPILATION())
|
||||
|
||||
// nvcc >= 12.8 already optimizes 16-bit X2 min/max operations to SIMD instructions
|
||||
#define _CCCL_HAS_SIMD_16BIT_MIN_MAX_COMPILER_OPTIMIZATION() _CCCL_CUDA_COMPILER(NVCC, >=, 12, 8)
|
||||
|
||||
#define _CCCL_HAS_SIMD_8BIT_INTRINSICS() 0 // TODO(fbusato): CTK 13.2 produces non-optimal code for 8-bit SIMD instrs.
|
||||
#define _CCCL_HAS_SIMD_8BIT_PTX() (__cccl_ptx_isa >= 920ULL)
|
||||
#define _CCCL_HAS_SIMD_8BIT() \
|
||||
((_CCCL_HAS_SIMD_8BIT_PTX() || _CCCL_HAS_SIMD_8BIT_INTRINSICS()) && !_CCCL_TILE_COMPILATION())
|
||||
|
||||
// Third party libraries
|
||||
|
||||
#if (__has_include(<dlpack/dlpack.h>) || __has_include(<dlpack.h>)) && \
|
||||
!_CCCL_COMPILER(NVRTC) && !defined(CCCL_DISABLE_DLPACK)
|
||||
# define _CCCL_HAS_DLPACK() 1
|
||||
#else // ^^^ has dlpack ^^^ / vvv no dlpack vvv
|
||||
# define _CCCL_HAS_DLPACK() 0
|
||||
#endif // ^^^ no dlpack ^^^
|
||||
|
||||
#endif // _CUDA_STD___INTERNAL_FEATURES_H
|
||||
@@ -0,0 +1,188 @@
|
||||
//===---------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___INTERNAL_NAMESPACES_H
|
||||
#define _CUDA_STD___INTERNAL_NAMESPACES_H
|
||||
|
||||
#include <cuda/__cccl_config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__internal/version.h>
|
||||
|
||||
// During the header testing, we want to check if the code is wrapped by the prologue/epilogue
|
||||
#if defined(_CCCL_HEADER_TEST)
|
||||
# define _CCCL_PROLOGUE_INCLUDE_CHECK() \
|
||||
static_assert(_CCCL_PROLOGUE_INCLUDED(), "missing #include <cuda/std/__cccl/prologue.h>");
|
||||
#else // ^^^ defined(_CCCL_HEADER_TEST) ^^^ / vvv !defined(_CCCL_HEADER_TEST) vvv
|
||||
# define _CCCL_PROLOGUE_INCLUDE_CHECK()
|
||||
#endif // ^^^ !defined(_CCCL_HEADER_TEST) ^^^
|
||||
|
||||
#ifndef _LIBCUDACXX_ABI_NAMESPACE
|
||||
# define _LIBCUDACXX_ABI_NAMESPACE _CCCL_PP_CAT(__, _LIBCUDACXX_CUDA_ABI_VERSION)
|
||||
#endif // _LIBCUDACXX_ABI_NAMESPACE
|
||||
|
||||
#define _CCCL_BEGIN_NAMESPACE_NOVERSION(_NS) \
|
||||
_CCCL_PROLOGUE_INCLUDE_CHECK() namespace _NS \
|
||||
{
|
||||
#define _CCCL_END_NAMESPACE_NOVERSION(_NS) \
|
||||
} \
|
||||
_CCCL_PROLOGUE_INCLUDE_CHECK()
|
||||
#define _CCCL_BEGIN_NAMESPACE(_NS) \
|
||||
_CCCL_BEGIN_NAMESPACE_NOVERSION(_NS) inline namespace _LIBCUDACXX_ABI_NAMESPACE \
|
||||
{
|
||||
#define _CCCL_END_NAMESPACE(_NS) \
|
||||
} \
|
||||
_CCCL_END_NAMESPACE_NOVERSION(_NS)
|
||||
|
||||
// Open a namespace for APIs that were version bumped in a minor release
|
||||
// Version bump namespace should be removed from the APIs at the next major release
|
||||
#define _CCCL_BEGIN_NAMESPACE_ABI_VER4_BUMP \
|
||||
static_assert(_LIBCUDACXX_CUDA_ABI_VERSION == 4, "Version bump should be removed"); \
|
||||
inline namespace __version_bump_ver4_ \
|
||||
{
|
||||
#define _CCCL_END_NAMESPACE_ABI_VER4_BUMP \
|
||||
static_assert(_LIBCUDACXX_CUDA_ABI_VERSION == 4, "Version bump should be removed"); \
|
||||
}
|
||||
|
||||
// Standard namespaces with or without versioning
|
||||
#define _CCCL_BEGIN_NAMESPACE_CUDA_STD_NOVERSION _CCCL_BEGIN_NAMESPACE_NOVERSION(cuda::std)
|
||||
#define _CCCL_END_NAMESPACE_CUDA_STD_NOVERSION _CCCL_END_NAMESPACE_NOVERSION(cuda::std)
|
||||
#define _CCCL_BEGIN_NAMESPACE_CUDA_STD _CCCL_BEGIN_NAMESPACE(cuda::std)
|
||||
#define _CCCL_END_NAMESPACE_CUDA_STD _CCCL_END_NAMESPACE(cuda::std)
|
||||
|
||||
// cuda specific namespaces
|
||||
#define _CCCL_BEGIN_NAMESPACE_CUDA _CCCL_BEGIN_NAMESPACE(cuda)
|
||||
#define _CCCL_END_NAMESPACE_CUDA _CCCL_END_NAMESPACE(cuda)
|
||||
#define _CCCL_BEGIN_NAMESPACE_CUDA_MR _CCCL_BEGIN_NAMESPACE(cuda::mr)
|
||||
#define _CCCL_END_NAMESPACE_CUDA_MR _CCCL_END_NAMESPACE(cuda::mr)
|
||||
#define _CCCL_BEGIN_NAMESPACE_CUDA_DEVICE _CCCL_BEGIN_NAMESPACE(cuda::device)
|
||||
#define _CCCL_END_NAMESPACE_CUDA_DEVICE _CCCL_END_NAMESPACE(cuda::device)
|
||||
#define _CCCL_BEGIN_NAMESPACE_CUDA_PTX _CCCL_BEGIN_NAMESPACE(cuda::ptx)
|
||||
#define _CCCL_END_NAMESPACE_CUDA_PTX _CCCL_END_NAMESPACE(cuda::ptx)
|
||||
#define _CCCL_BEGIN_NAMESPACE_CUDA_DEVICE_EXPERIMENTAL _CCCL_BEGIN_NAMESPACE(cuda::device::experimental)
|
||||
#define _CCCL_END_NAMESPACE_CUDA_DEVICE_EXPERIMENTAL _CCCL_END_NAMESPACE(cuda::device::experimental)
|
||||
#define _CCCL_BEGIN_NAMESPACE_CUDA_DRIVER _CCCL_BEGIN_NAMESPACE(cuda::__driver)
|
||||
#define _CCCL_END_NAMESPACE_CUDA_DRIVER _CCCL_END_NAMESPACE(cuda::__driver)
|
||||
|
||||
// Namespaces related to <simd>
|
||||
#define _CCCL_BEGIN_NAMESPACE_CUDA_STD_SIMD _CCCL_BEGIN_NAMESPACE(cuda::std::simd)
|
||||
#define _CCCL_END_NAMESPACE_CUDA_STD_SIMD _CCCL_END_NAMESPACE(cuda::std::simd)
|
||||
|
||||
// Namespaces related to <ranges>
|
||||
#define _CCCL_BEGIN_NAMESPACE_CUDA_STD_RANGES _CCCL_BEGIN_NAMESPACE(cuda::std::ranges)
|
||||
#define _CCCL_END_NAMESPACE_CUDA_STD_RANGES _CCCL_END_NAMESPACE(cuda::std::ranges)
|
||||
#define _CCCL_BEGIN_NAMESPACE_CUDA_STD_VIEWS _CCCL_BEGIN_NAMESPACE(cuda::std::ranges::views)
|
||||
#define _CCCL_END_NAMESPACE_CUDA_STD_VIEWS _CCCL_END_NAMESPACE(cuda::std::ranges::views)
|
||||
|
||||
#define _CCCL_BEGIN_NAMESPACE_CPO(_CPO) \
|
||||
namespace _CPO \
|
||||
{
|
||||
#define _CCCL_END_NAMESPACE_CPO }
|
||||
|
||||
// Namespaces related to chrono / filesystem
|
||||
#define _CCCL_BEGIN_NAMESPACE_FILESYSTEM \
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD_NOVERSION \
|
||||
inline namespace __fs \
|
||||
{ \
|
||||
namespace filesystem \
|
||||
{ \
|
||||
inline namespace _LIBCUDACXX_ABI_NAMESPACE \
|
||||
{
|
||||
#define _CCCL_END_NAMESPACE_FILESYSTEM \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
_CCCL_END_NAMESPACE_CUDA_STD_NOVERSION
|
||||
|
||||
// Shorthands for different qualifiers
|
||||
// Namespaces related to execution
|
||||
#define _CCCL_BEGIN_NAMESPACE_CUDA_STD_EXECUTION _CCCL_BEGIN_NAMESPACE(cuda::std::execution)
|
||||
#define _CCCL_END_NAMESPACE_CUDA_STD_EXECUTION _CCCL_END_NAMESPACE(cuda::std::execution)
|
||||
|
||||
#define _CCCL_BEGIN_NAMESPACE_CUDA_EXECUTION _CCCL_BEGIN_NAMESPACE(cuda::execution)
|
||||
#define _CCCL_END_NAMESPACE_CUDA_EXECUTION _CCCL_END_NAMESPACE(cuda::execution)
|
||||
|
||||
#define _CCCL_BEGIN_NAMESPACE_CUDA_ARGUMENT _CCCL_BEGIN_NAMESPACE(cuda::args)
|
||||
#define _CCCL_END_NAMESPACE_CUDA_ARGUMENT _CCCL_END_NAMESPACE(cuda::args)
|
||||
|
||||
// Namespace to avoid name collisions with CPOs on clang-16 (see
|
||||
// https://godbolt.org/z/9TadonrdM for example). MSVC's ancient parser also gets confused with
|
||||
// __cccl_true in the main iter_move template.
|
||||
#if _CCCL_COMPILER(CLANG, <=, 16) || _CCCL_COMPILER(MSVC)
|
||||
# define _LIBCUDACXX_BEGIN_HIDDEN_FRIEND_NAMESPACE \
|
||||
namespace __hidden \
|
||||
{
|
||||
# define _LIBCUDACXX_END_HIDDEN_FRIEND_NAMESPACE(_CLASS) \
|
||||
} \
|
||||
using __hidden::_CLASS;
|
||||
#else // ^^^ _CCCL_COMPILER(CLANG, <=, 16) ^^^ / vvv _CCCL_COMPILER(CLANG, >, 16) vvv
|
||||
# define _LIBCUDACXX_BEGIN_HIDDEN_FRIEND_NAMESPACE
|
||||
# define _LIBCUDACXX_END_HIDDEN_FRIEND_NAMESPACE(_CLASS)
|
||||
#endif // !_CCCL_COMPILER(CLANG, >, 16)
|
||||
|
||||
#if defined(CCCL_DISABLE_ARCH_DEPENDENT_NAMESPACE)
|
||||
# define _CCCL_BEGIN_NAMESPACE_ARCH_DEPENDENT
|
||||
# define _CCCL_END_NAMESPACE_ARCH_DEPENDENT
|
||||
#else // not defined(CCCL_DISABLE_ARCH_DEPENDENT_NAMESPACE)
|
||||
# if _CCCL_CUDA_COMPILER(NVHPC)
|
||||
# define _CCCL_BEGIN_NAMESPACE_ARCH_DEPENDENT \
|
||||
inline namespace _CCCL_PP_CAT(_CCCL_PP_SPLICE_WITH(_, _SM, NV_TARGET_SM_INTEGER_LIST), _NVHPC) \
|
||||
{
|
||||
# define _CCCL_END_NAMESPACE_ARCH_DEPENDENT }
|
||||
# else // ^^^ _CCCL_CUDA_COMPILER(NVHPC) ^^^ / vvv !_CCCL_CUDA_COMPILER(NVHPC) vvv
|
||||
# define _CCCL_BEGIN_NAMESPACE_ARCH_DEPENDENT \
|
||||
inline namespace _CCCL_PP_SPLICE_WITH(_, _SM, __CUDA_ARCH_LIST__) \
|
||||
{
|
||||
# define _CCCL_END_NAMESPACE_ARCH_DEPENDENT }
|
||||
# endif // ^^^ !_CCCL_CUDA_COMPILER(NVHPC) ^^^
|
||||
#endif // not defined(CCCL_DISABLE_ARCH_DEPENDENT_NAMESPACE)
|
||||
|
||||
// Host standard library namespaces
|
||||
#if _CCCL_HOST_STD_LIB(LIBSTDCXX)
|
||||
// We don't appy attributes on forward declarations, so we omit the _GLIBCXX_VISIBILITY(default)
|
||||
# if _GLIBCXX_INLINE_VERSION
|
||||
# define _CCCL_BEGIN_NAMESPACE_STD \
|
||||
_CCCL_PROLOGUE_INCLUDE_CHECK() namespace std \
|
||||
{ \
|
||||
inline _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
# define _CCCL_END_NAMESPACE_STD \
|
||||
_GLIBCXX_END_NAMESPACE_VERSION \
|
||||
} \
|
||||
_CCCL_PROLOGUE_INCLUDE_CHECK()
|
||||
# else // ^^^ _GLIBCXX_INLINE_VERSION ^^^ / vvv !_GLIBCXX_INLINE_VERSION vvv
|
||||
# define _CCCL_BEGIN_NAMESPACE_STD \
|
||||
_CCCL_PROLOGUE_INCLUDE_CHECK() namespace std \
|
||||
{
|
||||
# define _CCCL_END_NAMESPACE_STD \
|
||||
} \
|
||||
_CCCL_PROLOGUE_INCLUDE_CHECK()
|
||||
# endif // ^^^ !_GLIBCXX_INLINE_VERSION ^^^
|
||||
#elif _CCCL_HOST_STD_LIB(LIBCXX)
|
||||
# define _CCCL_BEGIN_NAMESPACE_STD _CCCL_PROLOGUE_INCLUDE_CHECK() _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
# define _CCCL_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD _CCCL_PROLOGUE_INCLUDE_CHECK()
|
||||
#elif _CCCL_HOST_STD_LIB(STL)
|
||||
# define _CCCL_BEGIN_NAMESPACE_STD _CCCL_PROLOGUE_INCLUDE_CHECK() _STD_BEGIN
|
||||
# define _CCCL_END_NAMESPACE_STD _STD_END _CCCL_PROLOGUE_INCLUDE_CHECK()
|
||||
#else
|
||||
# define _CCCL_BEGIN_NAMESPACE_STD \
|
||||
_CCCL_PROLOGUE_INCLUDE_CHECK() namespace std \
|
||||
{
|
||||
# define _CCCL_END_NAMESPACE_STD \
|
||||
} \
|
||||
_CCCL_PROLOGUE_INCLUDE_CHECK()
|
||||
#endif
|
||||
|
||||
#endif // _CUDA_STD___INTERNAL_NAMESPACES_H
|
||||
@@ -0,0 +1,34 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _CUDA_STD___INTERNAL_PSTL_CONFIG_H
|
||||
#define _CUDA_STD___INTERNAL_PSTL_CONFIG_H
|
||||
|
||||
#include <cuda/std/detail/__config>
|
||||
|
||||
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
|
||||
# pragma GCC system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
|
||||
# pragma clang system_header
|
||||
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
|
||||
# pragma system_header
|
||||
#endif // no system header
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
#define _CCCL_HAS_BACKEND_CUDA() _CCCL_CUDA_COMPILATION() && !_CCCL_COMPILER(NVRTC)
|
||||
#define _CCCL_HAS_BACKEND_OMP() 0
|
||||
#define _CCCL_HAS_BACKEND_TBB() 0
|
||||
|
||||
#define _CCCL_HAS_PSTL_BACKEND() (_CCCL_HAS_BACKEND_CUDA() || _CCCL_HAS_BACKEND_OMP() || _CCCL_HAS_BACKEND_TBB())
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___INTERNAL_PSTL_CONFIG_H
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user