ZTWHHH commited on
Commit
0ed7984
·
verified ·
1 Parent(s): bab4271

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. vllm/lib/python3.10/site-packages/cupy/_core/_fusion_kernel.cpython-310-x86_64-linux-gnu.so +3 -0
  3. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/__memory_resource/get_property.h +158 -0
  4. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/__memory_resource/properties.h +73 -0
  5. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__exception/cuda_error.h +81 -0
  6. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__exception/terminate.h +69 -0
  7. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/addressof.h +51 -0
  8. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/align.h +55 -0
  9. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocate_at_least.h +77 -0
  10. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocation_guard.h +96 -0
  11. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocator.h +318 -0
  12. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocator_arg_t.h +80 -0
  13. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocator_destructor.h +55 -0
  14. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocator_traits.h +581 -0
  15. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/assume_aligned.h +53 -0
  16. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/builtin_new_allocator.h +83 -0
  17. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/compressed_pair.h +227 -0
  18. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/construct_at.h +268 -0
  19. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/destruct_n.h +87 -0
  20. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/pointer_traits.h +250 -0
  21. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/uninitialized_algorithms.h +672 -0
  22. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/unique_ptr.h +761 -0
  23. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/uses_allocator.h +70 -0
  24. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/voidify.h +37 -0
  25. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__string/string_view.h +317 -0
  26. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__thread/threading_support.h +109 -0
  27. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__thread/threading_support_cuda.h +48 -0
  28. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__thread/threading_support_external.h +41 -0
  29. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__thread/threading_support_pthread.h +184 -0
  30. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__thread/threading_support_win32.h +89 -0
  31. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/add_cv.h +36 -0
  32. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/add_lvalue_reference.h +58 -0
  33. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/add_pointer.h +61 -0
  34. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/aligned_union.h +58 -0
  35. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/can_extract_key.h +65 -0
  36. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/conditional.h +61 -0
  37. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/decay.h +79 -0
  38. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/fold.h +69 -0
  39. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/has_virtual_destructor.h +49 -0
  40. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/is_abstract.h +38 -0
  41. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/is_array.h +62 -0
  42. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/is_assignable.h +78 -0
  43. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/is_compound.h +54 -0
  44. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/is_const.h +56 -0
  45. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/is_convertible.h +214 -0
  46. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/is_copy_assignable.h +41 -0
  47. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/is_copy_constructible.h +41 -0
  48. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/is_empty.h +73 -0
  49. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/is_floating_point.h +52 -0
  50. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/is_function.h +61 -0
.gitattributes CHANGED
@@ -1767,3 +1767,4 @@ videollama2/lib/python3.10/site-packages/scipy.libs/libgfortran-040039e1.so.5.0.
1767
  videollama2/lib/python3.10/site-packages/scipy.libs/libscipy_openblas-c128ec02.so filter=lfs diff=lfs merge=lfs -text
1768
  vllm/lib/python3.10/site-packages/cupy/_core/flags.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
1769
  vllm/lib/python3.10/site-packages/cupy/_core/_accelerator.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
 
 
1767
  videollama2/lib/python3.10/site-packages/scipy.libs/libscipy_openblas-c128ec02.so filter=lfs diff=lfs merge=lfs -text
1768
  vllm/lib/python3.10/site-packages/cupy/_core/flags.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
1769
  vllm/lib/python3.10/site-packages/cupy/_core/_accelerator.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
1770
+ vllm/lib/python3.10/site-packages/cupy/_core/_fusion_kernel.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
vllm/lib/python3.10/site-packages/cupy/_core/_fusion_kernel.cpython-310-x86_64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8c7bec145e412003f3263f0a3caad63465e6fe5a09c711447984bdbd949d3b61
3
+ size 1189992
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/__memory_resource/get_property.h ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of libcu++, the C++ Standard Library for your entire system,
4
+ // under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ // SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
8
+ //
9
+ //===----------------------------------------------------------------------===//
10
+
11
+ #ifndef _CUDA__MEMORY_RESOURCE_GET_PROPERTY_H
12
+ #define _CUDA__MEMORY_RESOURCE_GET_PROPERTY_H
13
+
14
+ #include <cuda/std/detail/__config>
15
+
16
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
17
+ # pragma GCC system_header
18
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
19
+ # pragma clang system_header
20
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
21
+ # pragma system_header
22
+ #endif // no system header
23
+
24
+ #if !_CCCL_COMPILER(MSVC2017) && defined(LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE)
25
+
26
+ # include <cuda/std/__concepts/same_as.h>
27
+ # include <cuda/std/__type_traits/remove_const_ref.h>
28
+ # include <cuda/std/__type_traits/void_t.h>
29
+ # include <cuda/std/__utility/declval.h>
30
+
31
+ # if _CCCL_STD_VER >= 2014
32
+
33
+ _LIBCUDACXX_BEGIN_NAMESPACE_CUDA
34
+
35
+ //! @brief The \c has_property concept verifies that a Resource satisfies a given Property
36
+ //! @rst
37
+ //! For \c has_property we require the following free function to be callable
38
+ //!
39
+ //! .. code cpp::
40
+ //!
41
+ //! get_property(const Resource& res, Property prop);
42
+ //!
43
+ //! @endrst
44
+ template <class _Resource, class _Property>
45
+ _CCCL_CONCEPT has_property = _CCCL_REQUIRES_EXPR((_Resource, _Property), const _Resource& __res, _Property __prop)(
46
+ ((void) get_property(__res, __prop)));
47
+
48
+ template <class _Property>
49
+ using __property_value_t = typename _Property::value_type;
50
+
51
+ //! @brief The \c property_with_value concept verifies that a Property is stateful and signals this through the
52
+ //! `value_type` alias
53
+ //! @rst
54
+ //! .. code cpp::
55
+ //!
56
+ //! struct stateless_property {};
57
+ //! static_assert(!cuda::property_with_value<stateless_property>);
58
+ //!
59
+ //! struct stateful_property { using value_type = int; };
60
+ //! static_assert(!cuda::property_with_value<stateful_property>);
61
+ //!
62
+ //! @endrst
63
+ template <class _Property>
64
+ _CCCL_CONCEPT property_with_value = _CCCL_REQUIRES_EXPR((_Property))(typename(__property_value_t<_Property>));
65
+
66
+ //! @brief The \c has_property_with concept verifies that a Resource satisfies a given stateful Property
67
+ //! @rst
68
+ //! For \c has_property_with we require the following free function to be callable and its return type to exactly match
69
+ //! the ``value_type`` of the Property
70
+ //!
71
+ //! .. code cpp::
72
+ //!
73
+ //! struct stateless_property {};
74
+ //! constexpr void get_property(const Resource& res, stateless_property) {}
75
+ //!
76
+ //! // The resource must be stateful
77
+ //! static_assert(!cuda::has_property_with<Resource, stateless_property, int>);
78
+ //!
79
+ //! struct stateful_property { using value_type = int; };
80
+ //! constexpr int get_property(const Resource& res, stateful_property) {}
81
+ //!
82
+ //! // The resource is stateful and has the correct return type
83
+ //! static_assert(cuda::has_property_with<Resource, stateful_property, int>);
84
+ //!
85
+ //! // The resource is stateful but the return type is incorrect
86
+ //! static_assert(!cuda::has_property_with<Resource, stateful_property, double>);
87
+ //!
88
+ //! constexpr double get_property(const OtherResource& res, stateful_property) {}
89
+ //!
90
+ //! // The resource is stateful but the value_type does not match the `get_property` return type
91
+ //! static_assert(!cuda::has_property_with<OtherResource, stateful_property, double>);
92
+ //!
93
+ //! @endrst
94
+ template <class _Resource, class _Property, class _Return>
95
+ _CCCL_CONCEPT_FRAGMENT(
96
+ __has_property_with_,
97
+ requires(const _Resource& __res)(requires(property_with_value<_Property>),
98
+ requires(_CUDA_VSTD::same_as<_Return, decltype(get_property(__res, _Property{}))>)));
99
+ template <class _Resource, class _Property, class _Return>
100
+ _CCCL_CONCEPT has_property_with = _CCCL_FRAGMENT(__has_property_with_, _Resource, _Property, _Return);
101
+
102
+ template <class _Resource, class _Upstream>
103
+ _CCCL_CONCEPT_FRAGMENT(
104
+ __has_upstream_resource_,
105
+ requires(const _Resource& __res)(
106
+ requires(_CUDA_VSTD::same_as<_CUDA_VSTD::__remove_const_ref_t<decltype(__res.upstream_resource())>, _Upstream>)));
107
+ template <class _Resource, class _Upstream>
108
+ _CCCL_CONCEPT __has_upstream_resource = _CCCL_FRAGMENT(__has_upstream_resource_, _Resource, _Upstream);
109
+
110
+ _LIBCUDACXX_BEGIN_NAMESPACE_CPO(__forward_property)
111
+ template <class _Derived, class _Upstream>
112
+ struct __fn
113
+ {
114
+ _CCCL_EXEC_CHECK_DISABLE
115
+ _CCCL_TEMPLATE(class _Property)
116
+ _CCCL_REQUIRES((!property_with_value<_Property>) _CCCL_AND has_property<_Upstream, _Property>)
117
+ _LIBCUDACXX_HIDE_FROM_ABI friend constexpr void get_property(const _Derived&, _Property) noexcept {}
118
+
119
+ // The indirection is needed, otherwise the compiler might believe that _Derived is an incomplete type
120
+ _CCCL_EXEC_CHECK_DISABLE
121
+ _CCCL_TEMPLATE(class _Property, class _Derived2 = _Derived)
122
+ _CCCL_REQUIRES(property_with_value<_Property> _CCCL_AND has_property<_Upstream, _Property> _CCCL_AND
123
+ __has_upstream_resource<_Derived2, _Upstream>)
124
+ _LIBCUDACXX_HIDE_FROM_ABI friend constexpr __property_value_t<_Property>
125
+ get_property(const _Derived& __res, _Property __prop)
126
+ {
127
+ return get_property(__res.upstream_resource(), __prop);
128
+ }
129
+ };
130
+ _LIBCUDACXX_END_NAMESPACE_CPO
131
+
132
+ //! @brief The \c forward_property CRTP template allows Derived to forward all properties of Upstream
133
+ //! @rst
134
+ //! .. code cpp::
135
+ //!
136
+ //! class UpstreamWithProperties;
137
+ //!
138
+ //! class DerivedClass : cuda::forward_properties<DerivedClass, UpstreamWithProperties> {
139
+ //! // This method is needed to forward stateful properties
140
+ //! UpstreamWithProperties& upstream_resource() const { ... }
141
+ //! };
142
+ //!
143
+ //! .. note::
144
+ //!
145
+ //! In order to forward stateful properties, a type needs do implement an `upstream_resource()` method that returns
146
+ //! an instance of the upstream.
147
+ //!
148
+ //! @endrst
149
+ template <class _Derived, class _Upstream>
150
+ using forward_property = __forward_property::__fn<_Derived, _Upstream>;
151
+
152
+ _LIBCUDACXX_END_NAMESPACE_CUDA
153
+
154
+ # endif // _CCCL_STD_VER >= 2014
155
+
156
+ #endif // !_CCCL_COMPILER(MSVC2017) && LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE
157
+
158
+ #endif //_CUDA__MEMORY_RESOURCE_GET_PROPERTY_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/__memory_resource/properties.h ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of libcu++, the C++ Standard Library for your entire system,
4
+ // under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ // SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
8
+ //
9
+ //===----------------------------------------------------------------------===//
10
+
11
+ #ifndef _CUDA__MEMORY_RESOURCE_PROPERTIES_H
12
+ #define _CUDA__MEMORY_RESOURCE_PROPERTIES_H
13
+
14
+ #include <cuda/std/detail/__config>
15
+
16
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
17
+ # pragma GCC system_header
18
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
19
+ # pragma clang system_header
20
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
21
+ # pragma system_header
22
+ #endif // no system header
23
+
24
+ #include <cuda/std/__type_traits/type_set.h>
25
+ #include <cuda/std/cstddef>
26
+
27
+ #if !_CCCL_COMPILER(MSVC2017) && defined(LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE)
28
+
29
+ # if _CCCL_STD_VER >= 2014
30
+
31
+ _LIBCUDACXX_BEGIN_NAMESPACE_CUDA_MR
32
+
33
+ //! @brief The default alignment by a cudaMalloc{...} call
34
+ _CCCL_INLINE_VAR constexpr size_t default_cuda_malloc_alignment = 256;
35
+
36
+ //! @brief The default alignment by a cudaMallocHost{...} call
37
+ _CCCL_INLINE_VAR constexpr size_t default_cuda_malloc_host_alignment = alignof(_CUDA_VSTD::max_align_t);
38
+
39
+ //! @brief The device_accessible property signals that the allocated memory is device accessible
40
+ struct device_accessible
41
+ {};
42
+
43
+ //! @brief The device_accessible property signals that the allocated memory is host accessible
44
+ struct host_accessible
45
+ {};
46
+
47
+ //! @brief determines whether a set of properties signals host accessible memory.
48
+ template <class... _Properties>
49
+ _CCCL_INLINE_VAR constexpr bool __is_host_accessible =
50
+ _CUDA_VSTD::__type_set_contains_v<_CUDA_VSTD::__make_type_set<_Properties...>, host_accessible>;
51
+
52
+ //! @brief determines whether a set of properties signals device accessible memory.
53
+ template <class... _Properties>
54
+ _CCCL_INLINE_VAR constexpr bool __is_device_accessible =
55
+ _CUDA_VSTD::__type_set_contains_v<_CUDA_VSTD::__make_type_set<_Properties...>, device_accessible>;
56
+
57
+ //! @brief determines whether a set of properties signals host device accessible memory.
58
+ template <class... _Properties>
59
+ _CCCL_INLINE_VAR constexpr bool __is_host_device_accessible =
60
+ _CUDA_VSTD::__type_set_contains_v<_CUDA_VSTD::__make_type_set<_Properties...>, host_accessible, device_accessible>;
61
+
62
+ //! @brief verifies that a set of properties contains at least one execution space property
63
+ template <class... _Properties>
64
+ _CCCL_INLINE_VAR constexpr bool __contains_execution_space_property =
65
+ __is_host_accessible<_Properties...> || __is_device_accessible<_Properties...>;
66
+
67
+ _LIBCUDACXX_END_NAMESPACE_CUDA_MR
68
+
69
+ # endif // _CCCL_STD_VER >= 2014
70
+
71
+ #endif // !_CCCL_COMPILER(MSVC2017) && LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE
72
+
73
+ #endif //_CUDA__MEMORY_RESOURCE_PROPERTIES_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__exception/cuda_error.h ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of libcu++, the C++ Standard Library for your entire system,
5
+ // under the Apache License v2.0 with LLVM Exceptions.
6
+ // See https://llvm.org/LICENSE.txt for license information.
7
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
+ // SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
9
+ //
10
+ //===----------------------------------------------------------------------===//
11
+
12
+ #ifndef _LIBCUDACXX___EXCEPTION_CUDA_ERROR_H
13
+ #define _LIBCUDACXX___EXCEPTION_CUDA_ERROR_H
14
+
15
+ #include <cuda/std/detail/__config>
16
+
17
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
18
+ # pragma GCC system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
20
+ # pragma clang system_header
21
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
22
+ # pragma system_header
23
+ #endif // no system header
24
+
25
+ #include <cuda/std/__exception/terminate.h>
26
+
27
+ #if !_CCCL_COMPILER(NVRTC)
28
+ # include <cstdio>
29
+ # include <stdexcept>
30
+ #endif // !_CCCL_COMPILER(NVRTC)
31
+
32
+ #include <nv/target>
33
+
34
+ _LIBCUDACXX_BEGIN_NAMESPACE_CUDA
35
+
36
+ /**
37
+ * @brief Exception thrown when a CUDA error is encountered.
38
+ */
39
+ #ifndef _CCCL_NO_EXCEPTIONS
40
+ class cuda_error : public ::std::runtime_error
41
+ {
42
+ private:
43
+ struct __msg_storage
44
+ {
45
+ char __buffer[256];
46
+ };
47
+
48
+ static char* __format_cuda_error(const int __status, const char* __msg, char* __msg_buffer) noexcept
49
+ {
50
+ ::snprintf(__msg_buffer, 256, "cudaError %d: %s", __status, __msg);
51
+ return __msg_buffer;
52
+ }
53
+
54
+ public:
55
+ cuda_error(const int __status, const char* __msg, __msg_storage __msg_buffer = {0}) noexcept
56
+ : ::std::runtime_error(__format_cuda_error(__status, __msg, __msg_buffer.__buffer))
57
+ {}
58
+ };
59
+
60
+ _CCCL_NORETURN _LIBCUDACXX_HIDE_FROM_ABI void __throw_cuda_error(const int __status, const char* __msg)
61
+ {
62
+ NV_IF_ELSE_TARGET(NV_IS_HOST,
63
+ (throw ::cuda::cuda_error(__status, __msg);),
64
+ ((void) __status; (void) __msg; _CUDA_VSTD_NOVERSION::terminate();))
65
+ }
66
+ #else // ^^^ !_CCCL_NO_EXCEPTIONS ^^^ / vvv _CCCL_NO_EXCEPTIONS vvv
67
+ class cuda_error
68
+ {
69
+ public:
70
+ _LIBCUDACXX_HIDE_FROM_ABI cuda_error(const int, const char*) noexcept {}
71
+ };
72
+
73
+ _CCCL_NORETURN _LIBCUDACXX_HIDE_FROM_ABI void __throw_cuda_error(const int, const char*)
74
+ {
75
+ _CUDA_VSTD_NOVERSION::terminate();
76
+ }
77
+ #endif // _CCCL_NO_EXCEPTIONS
78
+
79
+ _LIBCUDACXX_END_NAMESPACE_CUDA
80
+
81
+ #endif // _LIBCUDACXX___EXCEPTION_CUDA_ERROR_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__exception/terminate.h ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of libcu++, the C++ Standard Library for your entire system,
5
+ // under the Apache License v2.0 with LLVM Exceptions.
6
+ // See https://llvm.org/LICENSE.txt for license information.
7
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
+ // SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
9
+ //
10
+ //===----------------------------------------------------------------------===//
11
+
12
+ #ifndef _LIBCUDACXX___EXCEPTION_TERMINATE_H
13
+ #define _LIBCUDACXX___EXCEPTION_TERMINATE_H
14
+
15
+ #include <cuda/std/detail/__config>
16
+
17
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
18
+ # pragma GCC system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
20
+ # pragma clang system_header
21
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
22
+ # pragma system_header
23
+ #endif // no system header
24
+
25
+ #include <cuda/std/cstdlib> // ::exit
26
+
27
+ _CCCL_DIAG_PUSH
28
+ _CCCL_DIAG_SUPPRESS_MSVC(4702) // unreachable code
29
+
30
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD_NOVERSION // purposefully not using versioning namespace
31
+
32
+ _CCCL_NORETURN _LIBCUDACXX_HIDE_FROM_ABI void __cccl_terminate() noexcept
33
+ {
34
+ NV_IF_ELSE_TARGET(NV_IS_HOST, (::exit(-1);), (__trap();))
35
+ _CCCL_UNREACHABLE();
36
+ }
37
+
38
+ #if 0 // Expose once atomic is universally available
39
+
40
+ typedef void (*terminate_handler)();
41
+
42
+ # ifdef __CUDA_ARCH__
43
+ __device__
44
+ # endif // __CUDA_ARCH__
45
+ static _LIBCUDACXX_SAFE_STATIC _CUDA_VSTD::atomic<terminate_handler>
46
+ __cccl_terminate_handler{&__cccl_terminate};
47
+
48
+ _LIBCUDACXX_HIDE_FROM_ABI terminate_handler set_terminate(terminate_handler __func) noexcept
49
+ {
50
+ return __cccl_terminate_handler.exchange(__func);
51
+ }
52
+ _LIBCUDACXX_HIDE_FROM_ABI terminate_handler get_terminate() noexcept
53
+ {
54
+ return __cccl_terminate_handler.load(__func);
55
+ }
56
+
57
+ #endif
58
+
59
+ _CCCL_NORETURN _LIBCUDACXX_HIDE_FROM_ABI void terminate() noexcept
60
+ {
61
+ __cccl_terminate();
62
+ _CCCL_UNREACHABLE();
63
+ }
64
+
65
+ _LIBCUDACXX_END_NAMESPACE_STD_NOVERSION
66
+
67
+ _CCCL_DIAG_POP
68
+
69
+ #endif // _LIBCUDACXX___EXCEPTION_TERMINATE_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/addressof.h ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
8
+ //
9
+ //===----------------------------------------------------------------------===//
10
+
11
+ #ifndef _LIBCUDACXX___MEMORY_ADDRESSOF_H
12
+ #define _LIBCUDACXX___MEMORY_ADDRESSOF_H
13
+
14
+ #include <cuda/std/detail/__config>
15
+
16
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
17
+ # pragma GCC system_header
18
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
19
+ # pragma clang system_header
20
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
21
+ # pragma system_header
22
+ #endif // no system header
23
+
24
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
25
+
26
+ // addressof
27
+ // NVCXX has the builtin defined but did not mark it as supported
28
+ #if defined(_CCCL_BUILTIN_ADDRESSOF)
29
+
30
+ template <class _Tp>
31
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 _LIBCUDACXX_NO_CFI _Tp* addressof(_Tp& __x) noexcept
32
+ {
33
+ return _CCCL_BUILTIN_ADDRESSOF(__x);
34
+ }
35
+
36
+ #else
37
+
38
+ template <class _Tp>
39
+ _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_NO_CFI _Tp* addressof(_Tp& __x) noexcept
40
+ {
41
+ return reinterpret_cast<_Tp*>(const_cast<char*>(&reinterpret_cast<const volatile char&>(__x)));
42
+ }
43
+
44
+ #endif // defined(_CCCL_BUILTIN_ADDRESSOF)
45
+
46
+ template <class _Tp>
47
+ _Tp* addressof(const _Tp&&) noexcept = delete;
48
+
49
+ _LIBCUDACXX_END_NAMESPACE_STD
50
+
51
+ #endif // _LIBCUDACXX___MEMORY_ADDRESSOF_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/align.h ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of libcu++, the C++ Standard Library for your entire system,
5
+ // under the Apache License v2.0 with LLVM Exceptions.
6
+ // See https://llvm.org/LICENSE.txt for license information.
7
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
+ // SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
9
+ //
10
+ //===----------------------------------------------------------------------===//
11
+
12
+ #ifndef _LIBCUDACXX___MEMORY_ALIGN_H
13
+ #define _LIBCUDACXX___MEMORY_ALIGN_H
14
+
15
+ #include <cuda/std/detail/__config>
16
+
17
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
18
+ # pragma GCC system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
20
+ # pragma clang system_header
21
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
22
+ # pragma system_header
23
+ #endif // no system header
24
+
25
+ #include <cuda/std/cstddef>
26
+ #include <cuda/std/cstdint>
27
+
28
+ _CCCL_DIAG_PUSH
29
+ _CCCL_DIAG_SUPPRESS_MSVC(4146) // unary minus operator applied to unsigned type, result still unsigned
30
+
31
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
32
+
33
+ _LIBCUDACXX_HIDE_FROM_ABI void* align(size_t __alignment, size_t __size, void*& __ptr, size_t& __space)
34
+ {
35
+ if (__space < __size)
36
+ {
37
+ return nullptr;
38
+ }
39
+
40
+ const auto __intptr = reinterpret_cast<uintptr_t>(__ptr);
41
+ const auto __aligned = (__intptr - 1u + __alignment) & -__alignment;
42
+ const auto __diff = __aligned - __intptr;
43
+ if (__diff > (__space - __size))
44
+ {
45
+ return nullptr;
46
+ }
47
+ __space -= __diff;
48
+ return __ptr = reinterpret_cast<void*>(__aligned);
49
+ }
50
+
51
+ _LIBCUDACXX_END_NAMESPACE_STD
52
+
53
+ _CCCL_DIAG_POP
54
+
55
+ #endif // _LIBCUDACXX___MEMORY_ALIGN_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocate_at_least.h ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of libcu++, the C++ Standard Library for your entire system,
5
+ // under the Apache License v2.0 with LLVM Exceptions.
6
+ // See https://llvm.org/LICENSE.txt for license information.
7
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
+ // SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
9
+ //
10
+ //===----------------------------------------------------------------------===//
11
+
12
+ #ifndef _LIBCUDACXX___MEMORY_ALLOCATE_AT_LEAST_H
13
+ #define _LIBCUDACXX___MEMORY_ALLOCATE_AT_LEAST_H
14
+
15
+ #include <cuda/std/detail/__config>
16
+
17
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
18
+ # pragma GCC system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
20
+ # pragma clang system_header
21
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
22
+ # pragma system_header
23
+ #endif // no system header
24
+
25
+ #include <cuda/std/__memory/allocator_traits.h>
26
+ #include <cuda/std/cstddef>
27
+
28
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
29
+
30
+ #if _CCCL_STD_VER >= 2023
31
+ template <class _Pointer>
32
+ struct allocation_result
33
+ {
34
+ _Pointer ptr;
35
+ size_t count;
36
+ };
37
+ _LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(allocation_result);
38
+
39
+ template <class _Alloc>
40
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr allocation_result<typename allocator_traits<_Alloc>::pointer>
41
+ allocate_at_least(_Alloc& __alloc, size_t __n)
42
+ {
43
+ if constexpr (requires { __alloc.allocate_at_least(__n); })
44
+ {
45
+ return __alloc.allocate_at_least(__n);
46
+ }
47
+ else
48
+ {
49
+ return {__alloc.allocate(__n), __n};
50
+ }
51
+ }
52
+
53
+ template <class _Alloc>
54
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr auto __allocate_at_least(_Alloc& __alloc, size_t __n)
55
+ {
56
+ return _CUDA_VSTD::allocate_at_least(__alloc, __n);
57
+ }
58
+ #else // ^^^ _CCCL_STD_VER >= 2023 ^^^ / vvv _CCCL_STD_VER < 2023 vvv
59
+ template <class _Pointer>
60
+ struct __allocation_result
61
+ {
62
+ _Pointer ptr;
63
+ size_t count;
64
+ };
65
+
66
+ template <class _Alloc>
67
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr __allocation_result<typename allocator_traits<_Alloc>::pointer>
68
+ __allocate_at_least(_Alloc& __alloc, size_t __n)
69
+ {
70
+ return {__alloc.allocate(__n), __n};
71
+ }
72
+
73
+ #endif // _CCCL_STD_VER >= 2023
74
+
75
+ _LIBCUDACXX_END_NAMESPACE_STD
76
+
77
+ #endif // _LIBCUDACXX___MEMORY_ALLOCATE_AT_LEAST_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocation_guard.h ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of libcu++, the C++ Standard Library for your entire system,
5
+ // under the Apache License v2.0 with LLVM Exceptions.
6
+ // See https://llvm.org/LICENSE.txt for license information.
7
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
9
+ //
10
+ //===----------------------------------------------------------------------===//
11
+
12
+ #ifndef _LIBCUDACXX___MEMORY_ALLOCATION_GUARD_H
13
+ #define _LIBCUDACXX___MEMORY_ALLOCATION_GUARD_H
14
+
15
+ #include <cuda/std/detail/__config>
16
+
17
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
18
+ # pragma GCC system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
20
+ # pragma clang system_header
21
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
22
+ # pragma system_header
23
+ #endif // no system header
24
+
25
+ #include <cuda/std/__memory/allocator_traits.h>
26
+ #include <cuda/std/__utility/move.h>
27
+ #include <cuda/std/cstddef>
28
+
29
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
30
+
31
+ // Helper class to allocate memory using an Allocator in an exception safe
32
+ // manner.
33
+ //
34
+ // The intended usage of this class is as follows:
35
+ //
36
+ // 0
37
+ // 1 __allocation_guard<SomeAllocator> guard(alloc, 10);
38
+ // 2 do_some_initialization_that_may_throw(guard.__get());
39
+ // 3 save_allocated_pointer_in_a_noexcept_operation(guard.__release_ptr());
40
+ // 4
41
+ //
42
+ // If line (2) throws an exception during initialization of the memory, the
43
+ // guard's destructor will be called, and the memory will be released using
44
+ // Allocator deallocation. Otherwise, we release the memory from the guard on
45
+ // line (3) in an operation that can't throw -- after that, the guard is not
46
+ // responsible for the memory anymore.
47
+ //
48
+ // This is similar to a unique_ptr, except it's easier to use with a
49
+ // custom allocator.
50
+
51
+ _CCCL_NV_DIAG_SUPPRESS(2659) // constexpr non-static member function will not be implicitly 'const' in C++14
52
+
53
+ template <class _Alloc>
54
+ struct __allocation_guard
55
+ {
56
+ using _Pointer = typename allocator_traits<_Alloc>::pointer;
57
+ using _Size = typename allocator_traits<_Alloc>::size_type;
58
+
59
+ template <class _AllocT> // we perform the allocator conversion inside the constructor
60
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 explicit __allocation_guard(_AllocT __alloc, _Size __n)
61
+ : __alloc_(_CUDA_VSTD::move(__alloc))
62
+ , __n_(__n)
63
+ , __ptr_(allocator_traits<_Alloc>::allocate(__alloc_, __n_)) // initialization order is important
64
+ {}
65
+
66
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 ~__allocation_guard() noexcept
67
+ {
68
+ if (__ptr_ != nullptr)
69
+ {
70
+ allocator_traits<_Alloc>::deallocate(__alloc_, __ptr_, __n_);
71
+ }
72
+ }
73
+
74
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 _Pointer __release_ptr() noexcept
75
+ { // not called __release() because it's a keyword in objective-c++
76
+ _Pointer __tmp = __ptr_;
77
+ __ptr_ = nullptr;
78
+ return __tmp;
79
+ }
80
+
81
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr _Pointer __get() const noexcept
82
+ {
83
+ return __ptr_;
84
+ }
85
+
86
+ private:
87
+ _Alloc __alloc_;
88
+ _Size __n_;
89
+ _Pointer __ptr_;
90
+ };
91
+
92
+ _CCCL_NV_DIAG_DEFAULT(2659)
93
+
94
+ _LIBCUDACXX_END_NAMESPACE_STD
95
+
96
+ #endif // _LIBCUDACXX___MEMORY_ALLOCATION_GUARD_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocator.h ADDED
@@ -0,0 +1,318 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of libcu++, the C++ Standard Library for your entire system,
5
+ // under the Apache License v2.0 with LLVM Exceptions.
6
+ // See https://llvm.org/LICENSE.txt for license information.
7
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
+ // SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
9
+ //
10
+ //===----------------------------------------------------------------------===//
11
+
12
+ #ifndef _LIBCUDACXX___MEMORY_ALLOCATOR_H
13
+ #define _LIBCUDACXX___MEMORY_ALLOCATOR_H
14
+
15
+ #include <cuda/std/detail/__config>
16
+
17
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
18
+ # pragma GCC system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
20
+ # pragma clang system_header
21
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
22
+ # pragma system_header
23
+ #endif // no system header
24
+
25
+ #include <cuda/std/__memory/addressof.h>
26
+ #include <cuda/std/__memory/allocate_at_least.h>
27
+ #include <cuda/std/__memory/allocator_traits.h>
28
+ #include <cuda/std/__new_>
29
+ #include <cuda/std/__type_traits/is_constant_evaluated.h>
30
+ #include <cuda/std/__type_traits/is_same.h>
31
+ #include <cuda/std/__type_traits/is_void.h>
32
+ #include <cuda/std/__type_traits/is_volatile.h>
33
+ #include <cuda/std/__utility/forward.h>
34
+ #include <cuda/std/cstddef>
35
+
36
+ #if defined(_CCCL_HAS_CONSTEXPR_ALLOCATION) && !_CCCL_COMPILER(NVRTC)
37
+ # include <memory>
38
+ #endif // _CCCL_HAS_CONSTEXPR_ALLOCATION && !_CCCL_COMPILER(NVRTC)
39
+
40
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
41
+
42
+ template <class _Tp>
43
+ class allocator;
44
+
45
+ #if _CCCL_STD_VER <= 2017
46
+ // These specializations shouldn't be marked _LIBCUDACXX_DEPRECATED_IN_CXX17.
47
+ // Specializing allocator<void> is deprecated, but not using it.
48
+ template <>
49
+ class _CCCL_TYPE_VISIBILITY_DEFAULT allocator<void>
50
+ {
51
+ public:
52
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef void* pointer;
53
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef const void* const_pointer;
54
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef void value_type;
55
+
56
+ template <class _Up>
57
+ struct _LIBCUDACXX_DEPRECATED_IN_CXX17 rebind
58
+ {
59
+ typedef allocator<_Up> other;
60
+ };
61
+ };
62
+
63
+ template <>
64
+ class _CCCL_TYPE_VISIBILITY_DEFAULT allocator<const void>
65
+ {
66
+ public:
67
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef const void* pointer;
68
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef const void* const_pointer;
69
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef const void value_type;
70
+
71
+ template <class _Up>
72
+ struct _LIBCUDACXX_DEPRECATED_IN_CXX17 rebind
73
+ {
74
+ typedef allocator<_Up> other;
75
+ };
76
+ };
77
+ #endif // _CCCL_STD_VER <= 2017
78
+
79
+ // This class provides a non-trivial default constructor to the class that derives from it
80
+ // if the condition is satisfied.
81
+ //
82
+ // The second template parameter exists to allow giving a unique type to __non_trivial_if,
83
+ // which makes it possible to avoid breaking the ABI when making this a base class of an
84
+ // existing class. Without that, imagine we have classes D1 and D2, both of which used to
85
+ // have no base classes, but which now derive from __non_trivial_if. The layout of a class
86
+ // that inherits from both D1 and D2 will change because the two __non_trivial_if base
87
+ // classes are not allowed to share the same address.
88
+ //
89
+ // By making those __non_trivial_if base classes unique, we work around this problem and
90
+ // it is safe to start deriving from __non_trivial_if in existing classes.
91
+ template <bool _Cond, class _Unique>
92
+ struct __non_trivial_if
93
+ {};
94
+
95
+ template <class _Unique>
96
+ struct __non_trivial_if<true, _Unique>
97
+ {
98
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr __non_trivial_if() noexcept {}
99
+ };
100
+
101
+ // allocator
102
+ //
103
+ // Note: For ABI compatibility between C++20 and previous standards, we make
104
+ // allocator<void> trivial in C++20.
105
+
106
+ template <class _Tp>
107
+ class _CCCL_TYPE_VISIBILITY_DEFAULT allocator : private __non_trivial_if<!_CCCL_TRAIT(is_void, _Tp), allocator<_Tp>>
108
+ {
109
+ static_assert(!_CCCL_TRAIT(is_volatile, _Tp), "std::allocator does not support volatile types");
110
+
111
+ public:
112
+ typedef size_t size_type;
113
+ typedef ptrdiff_t difference_type;
114
+ typedef _Tp value_type;
115
+ typedef true_type propagate_on_container_move_assignment;
116
+ typedef true_type is_always_equal;
117
+
118
+ _CCCL_CONSTEXPR_CXX20 allocator() noexcept = default;
119
+
120
+ template <class _Up>
121
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 allocator(const allocator<_Up>&) noexcept
122
+ {}
123
+
124
+ _CCCL_EXEC_CHECK_DISABLE
125
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20_ALLOCATION _Tp* allocate(size_t __n)
126
+ {
127
+ if (__n > allocator_traits<allocator>::max_size(*this))
128
+ {
129
+ __throw_bad_array_new_length();
130
+ }
131
+ #if defined(_CCCL_HAS_CONSTEXPR_ALLOCATION)
132
+ if (_CUDA_VSTD::is_constant_evaluated())
133
+ {
134
+ return ::std::allocator<_Tp>{}.allocate(__n);
135
+ }
136
+ #endif // _CCCL_HAS_CONSTEXPR_ALLOCATION
137
+ {
138
+ return static_cast<_Tp*>(_CUDA_VSTD::__cccl_allocate(__n * sizeof(_Tp), _LIBCUDACXX_ALIGNOF(_Tp)));
139
+ }
140
+ }
141
+
142
+ #if _CCCL_STD_VER >= 2023
143
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr allocation_result<_Tp*> allocate_at_least(size_t __n)
144
+ {
145
+ return {allocate(__n), __n};
146
+ }
147
+ #endif // _CCCL_HAS_CONSTEXPR_ALLOCATION
148
+
149
+ _CCCL_EXEC_CHECK_DISABLE
150
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20_ALLOCATION void deallocate(_Tp* __p, size_t __n) noexcept
151
+ {
152
+ #if defined(_CCCL_HAS_CONSTEXPR_ALLOCATION)
153
+ if (_CUDA_VSTD::is_constant_evaluated())
154
+ {
155
+ return ::std::allocator<_Tp>{}.deallocate(__p, __n);
156
+ }
157
+ else
158
+ #endif // _CCCL_STD_VER >= 2020
159
+ {
160
+ _CUDA_VSTD::__cccl_deallocate((void*) __p, __n * sizeof(_Tp), _LIBCUDACXX_ALIGNOF(_Tp));
161
+ }
162
+ }
163
+
164
+ // C++20 Removed members
165
+ #if _CCCL_STD_VER <= 2017
166
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef _Tp* pointer;
167
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer;
168
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef _Tp& reference;
169
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef const _Tp& const_reference;
170
+
171
+ template <class _Up>
172
+ struct _LIBCUDACXX_DEPRECATED_IN_CXX17 rebind
173
+ {
174
+ typedef allocator<_Up> other;
175
+ };
176
+
177
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 _LIBCUDACXX_HIDE_FROM_ABI pointer address(reference __x) const noexcept
178
+ {
179
+ return _CUDA_VSTD::addressof(__x);
180
+ }
181
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 _LIBCUDACXX_HIDE_FROM_ABI const_pointer address(const_reference __x) const noexcept
182
+ {
183
+ return _CUDA_VSTD::addressof(__x);
184
+ }
185
+
186
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_DEPRECATED_IN_CXX17 _Tp* allocate(size_t __n, const void*)
187
+ {
188
+ return allocate(__n);
189
+ }
190
+
191
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 _LIBCUDACXX_HIDE_FROM_ABI size_type max_size() const noexcept
192
+ {
193
+ return size_type(~0) / sizeof(_Tp);
194
+ }
195
+
196
+ template <class _Up, class... _Args>
197
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 _LIBCUDACXX_HIDE_FROM_ABI void construct(_Up* __p, _Args&&... __args)
198
+ {
199
+ ::new ((void*) __p) _Up(_CUDA_VSTD::forward<_Args>(__args)...);
200
+ }
201
+
202
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 _LIBCUDACXX_HIDE_FROM_ABI void destroy(pointer __p) noexcept
203
+ {
204
+ __p->~_Tp();
205
+ }
206
+ #endif // _CCCL_STD_VER <= 2017
207
+ };
208
+
209
+ template <class _Tp>
210
+ class _CCCL_TYPE_VISIBILITY_DEFAULT allocator<const _Tp>
211
+ : private __non_trivial_if<!_CCCL_TRAIT(is_void, _Tp), allocator<const _Tp>>
212
+ {
213
+ static_assert(!_CCCL_TRAIT(is_volatile, _Tp), "std::allocator does not support volatile types");
214
+
215
+ public:
216
+ typedef size_t size_type;
217
+ typedef ptrdiff_t difference_type;
218
+ typedef const _Tp value_type;
219
+ typedef true_type propagate_on_container_move_assignment;
220
+ typedef true_type is_always_equal;
221
+
222
+ _CCCL_CONSTEXPR_CXX20 allocator() noexcept = default;
223
+
224
+ template <class _Up>
225
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 allocator(const allocator<_Up>&) noexcept
226
+ {}
227
+
228
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 const _Tp* allocate(size_t __n)
229
+ {
230
+ if (__n > allocator_traits<allocator>::max_size(*this))
231
+ {
232
+ __throw_bad_array_new_length();
233
+ }
234
+ if (_CUDA_VSTD::is_constant_evaluated())
235
+ {
236
+ return static_cast<const _Tp*>(::operator new(__n * sizeof(_Tp)));
237
+ }
238
+ else
239
+ {
240
+ return static_cast<const _Tp*>(_CUDA_VSTD::__cccl_allocate(__n * sizeof(_Tp), _LIBCUDACXX_ALIGNOF(_Tp)));
241
+ }
242
+ }
243
+
244
+ #if _CCCL_STD_VER >= 2023
245
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr allocation_result<const _Tp*> allocate_at_least(size_t __n)
246
+ {
247
+ return {allocate(__n), __n};
248
+ }
249
+ #endif // _CCCL_STD_VER >= 2023
250
+
251
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 void deallocate(const _Tp* __p, size_t __n) noexcept
252
+ {
253
+ if (_CUDA_VSTD::is_constant_evaluated())
254
+ {
255
+ ::operator delete(const_cast<_Tp*>(__p));
256
+ }
257
+ else
258
+ {
259
+ _CUDA_VSTD::__cccl_deallocate((void*) const_cast<_Tp*>(__p), __n * sizeof(_Tp), _LIBCUDACXX_ALIGNOF(_Tp));
260
+ }
261
+ }
262
+
263
+ // C++20 Removed members
264
+ #if _CCCL_STD_VER <= 2017
265
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef const _Tp* pointer;
266
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer;
267
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef const _Tp& reference;
268
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef const _Tp& const_reference;
269
+
270
+ template <class _Up>
271
+ struct _LIBCUDACXX_DEPRECATED_IN_CXX17 rebind
272
+ {
273
+ typedef allocator<_Up> other;
274
+ };
275
+
276
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 _LIBCUDACXX_HIDE_FROM_ABI const_pointer address(const_reference __x) const noexcept
277
+ {
278
+ return _CUDA_VSTD::addressof(__x);
279
+ }
280
+
281
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_DEPRECATED_IN_CXX17 const _Tp* allocate(size_t __n, const void*)
282
+ {
283
+ return allocate(__n);
284
+ }
285
+
286
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 _LIBCUDACXX_HIDE_FROM_ABI size_type max_size() const noexcept
287
+ {
288
+ return size_type(~0) / sizeof(_Tp);
289
+ }
290
+
291
+ template <class _Up, class... _Args>
292
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 _LIBCUDACXX_HIDE_FROM_ABI void construct(_Up* __p, _Args&&... __args)
293
+ {
294
+ ::new ((void*) __p) _Up(_CUDA_VSTD::forward<_Args>(__args)...);
295
+ }
296
+
297
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 _LIBCUDACXX_HIDE_FROM_ABI void destroy(pointer __p) noexcept
298
+ {
299
+ __p->~_Tp();
300
+ }
301
+ #endif // _CCCL_STD_VER <= 2017
302
+ };
303
+
304
+ template <class _Tp, class _Up>
305
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 bool operator==(const allocator<_Tp>&, const allocator<_Up>&) noexcept
306
+ {
307
+ return true;
308
+ }
309
+
310
+ template <class _Tp, class _Up>
311
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 bool operator!=(const allocator<_Tp>&, const allocator<_Up>&) noexcept
312
+ {
313
+ return false;
314
+ }
315
+
316
+ _LIBCUDACXX_END_NAMESPACE_STD
317
+
318
+ #endif // _LIBCUDACXX___MEMORY_ALLOCATOR_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocator_arg_t.h ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of libcu++, the C++ Standard Library for your entire system,
5
+ // under the Apache License v2.0 with LLVM Exceptions.
6
+ // See https://llvm.org/LICENSE.txt for license information.
7
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
+ // SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
9
+ //
10
+ //===----------------------------------------------------------------------===//
11
+
12
+ #ifndef _LIBCUDACXX___FUNCTIONAL_ALLOCATOR_ARG_T_H
13
+ #define _LIBCUDACXX___FUNCTIONAL_ALLOCATOR_ARG_T_H
14
+
15
+ #include <cuda/std/detail/__config>
16
+
17
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
18
+ # pragma GCC system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
20
+ # pragma clang system_header
21
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
22
+ # pragma system_header
23
+ #endif // no system header
24
+
25
+ #include <cuda/std/__memory/uses_allocator.h>
26
+ #include <cuda/std/__type_traits/integral_constant.h>
27
+ #include <cuda/std/__type_traits/is_constructible.h>
28
+ #include <cuda/std/__type_traits/remove_cvref.h>
29
+ #include <cuda/std/__utility/forward.h>
30
+
31
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
32
+
33
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT allocator_arg_t
34
+ {
35
+ _CCCL_HIDE_FROM_ABI explicit allocator_arg_t() = default;
36
+ };
37
+
38
+ _CCCL_INLINE_VAR constexpr allocator_arg_t allocator_arg = allocator_arg_t();
39
+
40
+ // allocator construction
41
+
42
+ template <class _Tp, class _Alloc, class... _Args>
43
+ struct __uses_alloc_ctor_imp
44
+ {
45
+ typedef _CCCL_NODEBUG_ALIAS remove_cvref_t<_Alloc> _RawAlloc;
46
+ static const bool __ua = uses_allocator<_Tp, _RawAlloc>::value;
47
+ static const bool __ic = is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
48
+ static const int value = __ua ? 2 - __ic : 0;
49
+ };
50
+
51
+ template <class _Tp, class _Alloc, class... _Args>
52
+ struct __uses_alloc_ctor : integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value>
53
+ {};
54
+
55
+ template <class _Tp, class _Allocator, class... _Args>
56
+ _LIBCUDACXX_HIDE_FROM_ABI void
57
+ __user_alloc_construct_impl(integral_constant<int, 0>, _Tp* __storage, const _Allocator&, _Args&&... __args)
58
+ {
59
+ new (__storage) _Tp(_CUDA_VSTD::forward<_Args>(__args)...);
60
+ }
61
+
62
+ // FIXME: This should have a version which takes a non-const alloc.
63
+ template <class _Tp, class _Allocator, class... _Args>
64
+ _LIBCUDACXX_HIDE_FROM_ABI void
65
+ __user_alloc_construct_impl(integral_constant<int, 1>, _Tp* __storage, const _Allocator& __a, _Args&&... __args)
66
+ {
67
+ new (__storage) _Tp(allocator_arg, __a, _CUDA_VSTD::forward<_Args>(__args)...);
68
+ }
69
+
70
+ // FIXME: This should have a version which takes a non-const alloc.
71
+ template <class _Tp, class _Allocator, class... _Args>
72
+ _LIBCUDACXX_HIDE_FROM_ABI void
73
+ __user_alloc_construct_impl(integral_constant<int, 2>, _Tp* __storage, const _Allocator& __a, _Args&&... __args)
74
+ {
75
+ new (__storage) _Tp(_CUDA_VSTD::forward<_Args>(__args)..., __a);
76
+ }
77
+
78
+ _LIBCUDACXX_END_NAMESPACE_STD
79
+
80
+ #endif // _LIBCUDACXX___FUNCTIONAL_ALLOCATOR_ARG_T_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocator_destructor.h ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of libcu++, the C++ Standard Library for your entire system,
5
+ // under the Apache License v2.0 with LLVM Exceptions.
6
+ // See https://llvm.org/LICENSE.txt for license information.
7
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
+ // SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
9
+ //
10
+ //===----------------------------------------------------------------------===//
11
+
12
+ #ifndef _LIBCUDACXX___MEMORY_ALLOCATOR_DESTRUCTOR_H
13
+ #define _LIBCUDACXX___MEMORY_ALLOCATOR_DESTRUCTOR_H
14
+
15
+ #include <cuda/std/detail/__config>
16
+
17
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
18
+ # pragma GCC system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
20
+ # pragma clang system_header
21
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
22
+ # pragma system_header
23
+ #endif // no system header
24
+
25
+ #include <cuda/std/__memory/allocator_traits.h>
26
+
27
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
28
+
29
+ template <class _Alloc>
30
+ class __allocator_destructor
31
+ {
32
+ typedef _CCCL_NODEBUG_ALIAS allocator_traits<_Alloc> __alloc_traits;
33
+
34
+ public:
35
+ typedef _CCCL_NODEBUG_ALIAS typename __alloc_traits::pointer pointer;
36
+ typedef _CCCL_NODEBUG_ALIAS typename __alloc_traits::size_type size_type;
37
+
38
+ private:
39
+ _Alloc& __alloc_;
40
+ size_type __s_;
41
+
42
+ public:
43
+ _LIBCUDACXX_HIDE_FROM_ABI __allocator_destructor(_Alloc& __a, size_type __s) noexcept
44
+ : __alloc_(__a)
45
+ , __s_(__s)
46
+ {}
47
+ _LIBCUDACXX_HIDE_FROM_ABI void operator()(pointer __p) noexcept
48
+ {
49
+ __alloc_traits::deallocate(__alloc_, __p, __s_);
50
+ }
51
+ };
52
+
53
+ _LIBCUDACXX_END_NAMESPACE_STD
54
+
55
+ #endif // _LIBCUDACXX___MEMORY_ALLOCATOR_DESTRUCTOR_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocator_traits.h ADDED
@@ -0,0 +1,581 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of libcu++, the C++ Standard Library for your entire system,
5
+ // under the Apache License v2.0 with LLVM Exceptions.
6
+ // See https://llvm.org/LICENSE.txt for license information.
7
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
9
+ //
10
+ //===----------------------------------------------------------------------===//
11
+
12
+ #ifndef _LIBCUDACXX___MEMORY_ALLOCATOR_TRAITS_H
13
+ #define _LIBCUDACXX___MEMORY_ALLOCATOR_TRAITS_H
14
+
15
+ #include <cuda/std/detail/__config>
16
+
17
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
18
+ # pragma GCC system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
20
+ # pragma clang system_header
21
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
22
+ # pragma system_header
23
+ #endif // no system header
24
+
25
+ #include <cuda/std/__memory/construct_at.h>
26
+ #include <cuda/std/__memory/pointer_traits.h>
27
+ #include <cuda/std/__type_traits/enable_if.h>
28
+ #include <cuda/std/__type_traits/is_copy_constructible.h>
29
+ #include <cuda/std/__type_traits/is_empty.h>
30
+ #include <cuda/std/__type_traits/is_move_constructible.h>
31
+ #include <cuda/std/__type_traits/is_same.h>
32
+ #include <cuda/std/__type_traits/is_trivially_move_constructible.h>
33
+ #include <cuda/std/__type_traits/make_unsigned.h>
34
+ #include <cuda/std/__type_traits/remove_reference.h>
35
+ #include <cuda/std/__type_traits/void_t.h>
36
+ #include <cuda/std/__utility/declval.h>
37
+ #include <cuda/std/__utility/forward.h>
38
+ #include <cuda/std/detail/libcxx/include/cstring>
39
+ #include <cuda/std/limits>
40
+
41
+ _CCCL_PUSH_MACROS
42
+
43
+ _CCCL_NV_DIAG_SUPPRESS(1215)
44
+
45
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
46
+
47
+ #if defined(_CCCL_NO_VARIABLE_TEMPLATES)
48
+ # define _LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(NAME, PROPERTY) \
49
+ template <class _Tp, class = void> \
50
+ struct NAME : false_type \
51
+ {}; \
52
+ template <class _Tp> \
53
+ struct NAME<_Tp, void_t<typename _Tp::PROPERTY>> : true_type \
54
+ {}
55
+ #else // ^^^ _CCCL_NO_VARIABLE_TEMPLATES ^^^ / vvv !_CCCL_NO_VARIABLE_TEMPLATES vvv
56
+ # define _LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(NAME, PROPERTY) \
57
+ template <class _Tp, class = void> \
58
+ _CCCL_INLINE_VAR constexpr bool NAME##_v = false; \
59
+ template <class _Tp> \
60
+ _CCCL_INLINE_VAR constexpr bool NAME##_v<_Tp, void_t<typename _Tp::PROPERTY>> = true;
61
+ #endif // !_CCCL_NO_VARIABLE_TEMPLATES
62
+
63
+ // __pointer
64
+ _LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(__has_pointer, pointer);
65
+ template <class _Tp,
66
+ class _Alloc,
67
+ class _RawAlloc = remove_reference_t<_Alloc>,
68
+ bool = _CCCL_TRAIT(__has_pointer, _RawAlloc)>
69
+ struct __pointer
70
+ {
71
+ using type _CCCL_NODEBUG_ALIAS = typename _RawAlloc::pointer;
72
+ };
73
+ template <class _Tp, class _Alloc, class _RawAlloc>
74
+ struct __pointer<_Tp, _Alloc, _RawAlloc, false>
75
+ {
76
+ using type _CCCL_NODEBUG_ALIAS = _Tp*;
77
+ };
78
+
79
+ // __const_pointer
80
+ _LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(__has_const_pointer, const_pointer);
81
+ template <class _Tp, class _Ptr, class _Alloc, bool = _CCCL_TRAIT(__has_const_pointer, _Alloc)>
82
+ struct __const_pointer
83
+ {
84
+ using type _CCCL_NODEBUG_ALIAS = typename _Alloc::const_pointer;
85
+ };
86
+ template <class _Tp, class _Ptr, class _Alloc>
87
+ struct __const_pointer<_Tp, _Ptr, _Alloc, false>
88
+ {
89
+ using type _CCCL_NODEBUG_ALIAS = typename pointer_traits<_Ptr>::template rebind<const _Tp>;
90
+ };
91
+
92
+ // __void_pointer
93
+ _LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(__has_void_pointer, void_pointer);
94
+ template <class _Ptr, class _Alloc, bool = _CCCL_TRAIT(__has_void_pointer, _Alloc)>
95
+ struct __void_pointer
96
+ {
97
+ using type _CCCL_NODEBUG_ALIAS = typename _Alloc::void_pointer;
98
+ };
99
+ template <class _Ptr, class _Alloc>
100
+ struct __void_pointer<_Ptr, _Alloc, false>
101
+ {
102
+ using type _CCCL_NODEBUG_ALIAS = typename pointer_traits<_Ptr>::template rebind<void>;
103
+ };
104
+
105
+ // __const_void_pointer
106
+ _LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(__has_const_void_pointer, const_void_pointer);
107
+ template <class _Ptr, class _Alloc, bool = _CCCL_TRAIT(__has_const_void_pointer, _Alloc)>
108
+ struct __const_void_pointer
109
+ {
110
+ using type _CCCL_NODEBUG_ALIAS = typename _Alloc::const_void_pointer;
111
+ };
112
+ template <class _Ptr, class _Alloc>
113
+ struct __const_void_pointer<_Ptr, _Alloc, false>
114
+ {
115
+ using type _CCCL_NODEBUG_ALIAS = typename pointer_traits<_Ptr>::template rebind<const void>;
116
+ };
117
+
118
+ // __size_type
119
+ _LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(__has_size_type, size_type);
120
+ template <class _Alloc, class _DiffType, bool = _CCCL_TRAIT(__has_size_type, _Alloc)>
121
+ struct __size_type : make_unsigned<_DiffType>
122
+ {};
123
+ template <class _Alloc, class _DiffType>
124
+ struct __size_type<_Alloc, _DiffType, true>
125
+ {
126
+ using type _CCCL_NODEBUG_ALIAS = typename _Alloc::size_type;
127
+ };
128
+
129
+ // __alloc_traits_difference_type
130
+ _LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(__has_alloc_traits_difference_type, difference_type);
131
+ template <class _Alloc, class _Ptr, bool = _CCCL_TRAIT(__has_alloc_traits_difference_type, _Alloc)>
132
+ struct __alloc_traits_difference_type
133
+ {
134
+ using type _CCCL_NODEBUG_ALIAS = typename pointer_traits<_Ptr>::difference_type;
135
+ };
136
+ template <class _Alloc, class _Ptr>
137
+ struct __alloc_traits_difference_type<_Alloc, _Ptr, true>
138
+ {
139
+ using type _CCCL_NODEBUG_ALIAS = typename _Alloc::difference_type;
140
+ };
141
+
142
+ // __propagate_on_container_copy_assignment
143
+ _LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(__has_propagate_on_container_copy_assignment,
144
+ propagate_on_container_copy_assignment);
145
+ template <class _Alloc, bool = _CCCL_TRAIT(__has_propagate_on_container_copy_assignment, _Alloc)>
146
+ struct __propagate_on_container_copy_assignment : false_type
147
+ {};
148
+ template <class _Alloc>
149
+ struct __propagate_on_container_copy_assignment<_Alloc, true>
150
+ {
151
+ using type _CCCL_NODEBUG_ALIAS = typename _Alloc::propagate_on_container_copy_assignment;
152
+ };
153
+
154
+ // __propagate_on_container_move_assignment
155
+ _LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(__has_propagate_on_container_move_assignment,
156
+ propagate_on_container_move_assignment);
157
+ template <class _Alloc, bool = _CCCL_TRAIT(__has_propagate_on_container_move_assignment, _Alloc)>
158
+ struct __propagate_on_container_move_assignment : false_type
159
+ {};
160
+ template <class _Alloc>
161
+ struct __propagate_on_container_move_assignment<_Alloc, true>
162
+ {
163
+ using type _CCCL_NODEBUG_ALIAS = typename _Alloc::propagate_on_container_move_assignment;
164
+ };
165
+
166
+ // __propagate_on_container_swap
167
+ _LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(__has_propagate_on_container_swap, propagate_on_container_swap);
168
+ template <class _Alloc, bool = _CCCL_TRAIT(__has_propagate_on_container_swap, _Alloc)>
169
+ struct __propagate_on_container_swap : false_type
170
+ {};
171
+ template <class _Alloc>
172
+ struct __propagate_on_container_swap<_Alloc, true>
173
+ {
174
+ using type _CCCL_NODEBUG_ALIAS = typename _Alloc::propagate_on_container_swap;
175
+ };
176
+
177
+ // __is_always_equal
178
+ _LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(__has_is_always_equal, is_always_equal);
179
+ template <class _Alloc, bool = _CCCL_TRAIT(__has_is_always_equal, _Alloc)>
180
+ struct __is_always_equal : is_empty<_Alloc>
181
+ {};
182
+ template <class _Alloc>
183
+ struct __is_always_equal<_Alloc, true>
184
+ {
185
+ using type _CCCL_NODEBUG_ALIAS = typename _Alloc::is_always_equal;
186
+ };
187
+
188
+ // __allocator_traits_rebind
189
+ _CCCL_SUPPRESS_DEPRECATED_PUSH
190
+ template <class _Tp, class _Up, class = void>
191
+ struct __has_rebind_other : false_type
192
+ {};
193
+ template <class _Tp, class _Up>
194
+ struct __has_rebind_other<_Tp, _Up, void_t<typename _Tp::template rebind<_Up>::other>> : true_type
195
+ {};
196
+
197
+ template <class _Tp, class _Up, bool = __has_rebind_other<_Tp, _Up>::value>
198
+ struct __allocator_traits_rebind
199
+ {
200
+ static_assert(__has_rebind_other<_Tp, _Up>::value, "This allocator has to implement rebind");
201
+ using type _CCCL_NODEBUG_ALIAS = typename _Tp::template rebind<_Up>::other;
202
+ };
203
+ template <template <class, class...> class _Alloc, class _Tp, class... _Args, class _Up>
204
+ struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, true>
205
+ {
206
+ using type _CCCL_NODEBUG_ALIAS = typename _Alloc<_Tp, _Args...>::template rebind<_Up>::other;
207
+ };
208
+ template <template <class, class...> class _Alloc, class _Tp, class... _Args, class _Up>
209
+ struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, false>
210
+ {
211
+ using type _CCCL_NODEBUG_ALIAS = _Alloc<_Up, _Args...>;
212
+ };
213
+ _CCCL_SUPPRESS_DEPRECATED_POP
214
+
215
+ template <class _Alloc, class _Tp>
216
+ using __allocator_traits_rebind_t = typename __allocator_traits_rebind<_Alloc, _Tp>::type;
217
+
218
+ _CCCL_SUPPRESS_DEPRECATED_PUSH
219
+
220
+ // __has_allocate_hint
221
+ template <class _Alloc, class _SizeType, class _ConstVoidPtr, class = void>
222
+ struct __has_allocate_hint : false_type
223
+ {};
224
+
225
+ template <class _Alloc, class _SizeType, class _ConstVoidPtr>
226
+ struct __has_allocate_hint<_Alloc,
227
+ _SizeType,
228
+ _ConstVoidPtr,
229
+ decltype((void) _CUDA_VSTD::declval<_Alloc>().allocate(
230
+ _CUDA_VSTD::declval<_SizeType>(), _CUDA_VSTD::declval<_ConstVoidPtr>()))> : true_type
231
+ {};
232
+
233
+ // __has_construct
234
+ template <class, class _Alloc, class... _Args>
235
+ struct __has_construct_impl : false_type
236
+ {};
237
+
238
+ template <class _Alloc, class... _Args>
239
+ struct __has_construct_impl<decltype((void) _CUDA_VSTD::declval<_Alloc>().construct(_CUDA_VSTD::declval<_Args>()...)),
240
+ _Alloc,
241
+ _Args...> : true_type
242
+ {};
243
+
244
+ template <class _Alloc, class... _Args>
245
+ struct __has_construct : __has_construct_impl<void, _Alloc, _Args...>
246
+ {};
247
+
248
+ // __has_destroy
249
+ template <class _Alloc, class _Pointer, class = void>
250
+ struct __has_destroy : false_type
251
+ {};
252
+
253
+ template <class _Alloc, class _Pointer>
254
+ struct __has_destroy<_Alloc,
255
+ _Pointer,
256
+ decltype((void) _CUDA_VSTD::declval<_Alloc>().destroy(_CUDA_VSTD::declval<_Pointer>()))>
257
+ : true_type
258
+ {};
259
+
260
+ // __has_max_size
261
+ template <class _Alloc, class = void>
262
+ struct __has_max_size : false_type
263
+ {};
264
+
265
+ template <class _Alloc>
266
+ struct __has_max_size<_Alloc, decltype((void) _CUDA_VSTD::declval<_Alloc&>().max_size())> : true_type
267
+ {};
268
+
269
+ // __has_select_on_container_copy_construction
270
+ template <class _Alloc, class = void>
271
+ struct __has_select_on_container_copy_construction : false_type
272
+ {};
273
+
274
+ template <class _Alloc>
275
+ struct __has_select_on_container_copy_construction<
276
+ _Alloc,
277
+ decltype((void) _CUDA_VSTD::declval<_Alloc>().select_on_container_copy_construction())> : true_type
278
+ {};
279
+
280
+ template <class _Tp>
281
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr _Tp* __to_raw_pointer(_Tp* __p) noexcept
282
+ {
283
+ return __p;
284
+ }
285
+
286
+ #if _CCCL_STD_VER <= 2017
287
+ template <class _Pointer>
288
+ _LIBCUDACXX_HIDE_FROM_ABI typename pointer_traits<_Pointer>::element_type* __to_raw_pointer(_Pointer __p) noexcept
289
+ {
290
+ return _CUDA_VSTD::__to_raw_pointer(__p.operator->());
291
+ }
292
+ #else // ^^^ C++17 ^^^ / vvv C++20 vvv
293
+ template <class _Pointer>
294
+ _LIBCUDACXX_HIDE_FROM_ABI auto
295
+ __to_raw_pointer(const _Pointer& __p) noexcept -> decltype(pointer_traits<_Pointer>::to_address(__p))
296
+ {
297
+ return pointer_traits<_Pointer>::to_address(__p);
298
+ }
299
+
300
+ template <class _Pointer, class... _None>
301
+ _LIBCUDACXX_HIDE_FROM_ABI auto __to_raw_pointer(const _Pointer& __p, _None...) noexcept
302
+ {
303
+ return _CUDA_VSTD::__to_raw_pointer(__p.operator->());
304
+ }
305
+ #endif // _CCCL_STD_VER >= 2020
306
+
307
+ _CCCL_SUPPRESS_DEPRECATED_POP
308
+
309
+ // __is_default_allocator
310
+ template <class _Tp>
311
+ struct __is_default_allocator : false_type
312
+ {};
313
+
314
+ template <class>
315
+ class allocator;
316
+
317
+ template <class _Tp>
318
+ struct __is_default_allocator<allocator<_Tp>> : true_type
319
+ {};
320
+ // __is_cpp17_move_insertable
321
+ template <class _Alloc, class = void>
322
+ struct __is_cpp17_move_insertable : is_move_constructible<typename _Alloc::value_type>
323
+ {};
324
+
325
+ template <class _Alloc>
326
+ struct __is_cpp17_move_insertable<
327
+ _Alloc,
328
+ enable_if_t<!__is_default_allocator<_Alloc>::value
329
+ && __has_construct<_Alloc, typename _Alloc::value_type*, typename _Alloc::value_type&&>::value>>
330
+ : true_type
331
+ {};
332
+
333
+ // __is_cpp17_copy_insertable
334
+ template <class _Alloc, class = void>
335
+ struct __is_cpp17_copy_insertable
336
+ : integral_constant<bool,
337
+ is_copy_constructible<typename _Alloc::value_type>::value
338
+ && __is_cpp17_move_insertable<_Alloc>::value>
339
+ {};
340
+
341
+ template <class _Alloc>
342
+ struct __is_cpp17_copy_insertable<
343
+ _Alloc,
344
+ enable_if_t<!__is_default_allocator<_Alloc>::value
345
+ && __has_construct<_Alloc, typename _Alloc::value_type*, const typename _Alloc::value_type&>::value>>
346
+ : __is_cpp17_move_insertable<_Alloc>
347
+ {};
348
+
349
+ template <class _Alloc>
350
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT allocator_traits
351
+ {
352
+ using allocator_type = _Alloc;
353
+ using value_type = typename allocator_type::value_type;
354
+ using pointer = typename __pointer<value_type, allocator_type>::type;
355
+ using const_pointer = typename __const_pointer<value_type, pointer, allocator_type>::type;
356
+ using void_pointer = typename __void_pointer<pointer, allocator_type>::type;
357
+ using const_void_pointer = typename __const_void_pointer<pointer, allocator_type>::type;
358
+ using difference_type = typename __alloc_traits_difference_type<allocator_type, pointer>::type;
359
+ using size_type = typename __size_type<allocator_type, difference_type>::type;
360
+ using propagate_on_container_copy_assignment =
361
+ typename __propagate_on_container_copy_assignment<allocator_type>::type;
362
+ using propagate_on_container_move_assignment =
363
+ typename __propagate_on_container_move_assignment<allocator_type>::type;
364
+ using propagate_on_container_swap = typename __propagate_on_container_swap<allocator_type>::type;
365
+ using is_always_equal = typename __is_always_equal<allocator_type>::type;
366
+
367
+ template <class _Tp>
368
+ using rebind_alloc = __allocator_traits_rebind_t<allocator_type, _Tp>;
369
+ template <class _Tp>
370
+ using rebind_traits = allocator_traits<rebind_alloc<_Tp>>;
371
+
372
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 static pointer
373
+ allocate(allocator_type& __a, size_type __n)
374
+ {
375
+ return __a.allocate(__n);
376
+ }
377
+
378
+ template <class _Ap = _Alloc, enable_if_t<__has_allocate_hint<_Ap, size_type, const_void_pointer>::value, int> = 0>
379
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 static pointer
380
+ allocate(allocator_type& __a, size_type __n, const_void_pointer __hint)
381
+ {
382
+ _CCCL_SUPPRESS_DEPRECATED_PUSH
383
+ return __a.allocate(__n, __hint);
384
+ _CCCL_SUPPRESS_DEPRECATED_POP
385
+ }
386
+ template <class _Ap = _Alloc,
387
+ class = void,
388
+ enable_if_t<!__has_allocate_hint<_Ap, size_type, const_void_pointer>::value, int> = 0>
389
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 static pointer
390
+ allocate(allocator_type& __a, size_type __n, const_void_pointer)
391
+ {
392
+ return __a.allocate(__n);
393
+ }
394
+
395
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 static void
396
+ deallocate(allocator_type& __a, pointer __p, size_type __n) noexcept
397
+ {
398
+ __a.deallocate(__p, __n);
399
+ }
400
+
401
+ template <class _Tp, class... _Args, enable_if_t<__has_construct<allocator_type, _Tp*, _Args...>::value, int> = 0>
402
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 static void construct(allocator_type& __a, _Tp* __p, _Args&&... __args)
403
+ {
404
+ _CCCL_SUPPRESS_DEPRECATED_PUSH
405
+ __a.construct(__p, _CUDA_VSTD::forward<_Args>(__args)...);
406
+ _CCCL_SUPPRESS_DEPRECATED_POP
407
+ }
408
+ template <class _Tp,
409
+ class... _Args,
410
+ class = void,
411
+ enable_if_t<!__has_construct<allocator_type, _Tp*, _Args...>::value, int> = 0>
412
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 static void construct(allocator_type&, _Tp* __p, _Args&&... __args)
413
+ {
414
+ #if _CCCL_STD_VER >= 2020
415
+ _CUDA_VSTD::construct_at(__p, _CUDA_VSTD::forward<_Args>(__args)...);
416
+ #else
417
+ ::new ((void*) __p) _Tp(_CUDA_VSTD::forward<_Args>(__args)...);
418
+ #endif
419
+ }
420
+
421
+ template <class _Tp, enable_if_t<__has_destroy<allocator_type, _Tp*>::value, int> = 0>
422
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 static void destroy(allocator_type& __a, _Tp* __p) noexcept
423
+ {
424
+ _CCCL_SUPPRESS_DEPRECATED_PUSH
425
+ __a.destroy(__p);
426
+ _CCCL_SUPPRESS_DEPRECATED_POP
427
+ }
428
+ template <class _Tp, class = void, enable_if_t<!__has_destroy<allocator_type, _Tp*>::value, int> = 0>
429
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 static void destroy(allocator_type&, _Tp* __p) noexcept
430
+ {
431
+ #if _CCCL_STD_VER >= 2020
432
+ _CUDA_VSTD::destroy_at(__p);
433
+ #else
434
+ __p->~_Tp();
435
+ #endif
436
+ }
437
+
438
+ _CCCL_SUPPRESS_DEPRECATED_PUSH
439
+ template <class _Ap = _Alloc, enable_if_t<__has_max_size<const _Ap>::value, int> = 0>
440
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 static size_type max_size(const allocator_type& __a) noexcept
441
+ {
442
+ return __a.max_size();
443
+ }
444
+ _CCCL_SUPPRESS_DEPRECATED_POP
445
+ template <class _Ap = _Alloc, class = void, enable_if_t<!__has_max_size<const _Ap>::value, int> = 0>
446
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 static size_type max_size(const allocator_type&) noexcept
447
+ {
448
+ return numeric_limits<size_type>::max() / sizeof(value_type);
449
+ }
450
+
451
+ template <class _Ap = _Alloc, enable_if_t<__has_select_on_container_copy_construction<const _Ap>::value, int> = 0>
452
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 static allocator_type
453
+ select_on_container_copy_construction(const allocator_type& __a)
454
+ {
455
+ return __a.select_on_container_copy_construction();
456
+ }
457
+ template <class _Ap = _Alloc,
458
+ class = void,
459
+ enable_if_t<!__has_select_on_container_copy_construction<const _Ap>::value, int> = 0>
460
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 static allocator_type
461
+ select_on_container_copy_construction(const allocator_type& __a)
462
+ {
463
+ return __a;
464
+ }
465
+
466
+ template <class _Ptr>
467
+ _LIBCUDACXX_HIDE_FROM_ABI static void
468
+ __construct_forward_with_exception_guarantees(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __begin2)
469
+ {
470
+ static_assert(__is_cpp17_move_insertable<allocator_type>::value,
471
+ "The specified type does not meet the requirements of Cpp17MoveInsertible");
472
+ for (; __begin1 != __end1; ++__begin1, (void) ++__begin2)
473
+ {
474
+ construct(__a,
475
+ _CUDA_VSTD::__to_raw_pointer(__begin2),
476
+ #ifdef _CCCL_NO_EXCEPTIONS
477
+ _CUDA_VSTD::move(*__begin1)
478
+ #else // ^^^ _CCCL_NO_EXCEPTIONS ^^^ / vvv !_CCCL_NO_EXCEPTIONS vvv
479
+ _CUDA_VSTD::move_if_noexcept(*__begin1)
480
+ #endif // !_CCCL_NO_EXCEPTIONS
481
+ );
482
+ }
483
+ }
484
+
485
+ template <class _Tp>
486
+ _LIBCUDACXX_HIDE_FROM_ABI static enable_if_t<
487
+ (__is_default_allocator<allocator_type>::value || !__has_construct<allocator_type, _Tp*, _Tp>::value)
488
+ && is_trivially_move_constructible<_Tp>::value,
489
+ void>
490
+ __construct_forward_with_exception_guarantees(allocator_type&, _Tp* __begin1, _Tp* __end1, _Tp*& __begin2)
491
+ {
492
+ ptrdiff_t _Np = __end1 - __begin1;
493
+ if (_Np > 0)
494
+ {
495
+ _CUDA_VSTD::memcpy(__begin2, __begin1, _Np * sizeof(_Tp));
496
+ __begin2 += _Np;
497
+ }
498
+ }
499
+
500
+ template <class _Iter, class _Ptr>
501
+ _LIBCUDACXX_HIDE_FROM_ABI static void
502
+ __construct_range_forward(allocator_type& __a, _Iter __begin1, _Iter __end1, _Ptr& __begin2)
503
+ {
504
+ for (; __begin1 != __end1; ++__begin1, (void) ++__begin2)
505
+ {
506
+ construct(__a, _CUDA_VSTD::__to_raw_pointer(__begin2), *__begin1);
507
+ }
508
+ }
509
+
510
+ template <class _SourceTp,
511
+ class _DestTp,
512
+ class _RawSourceTp = remove_const_t<_SourceTp>,
513
+ class _RawDestTp = remove_const_t<_DestTp>>
514
+ _LIBCUDACXX_HIDE_FROM_ABI static enable_if_t<
515
+ is_trivially_move_constructible<_DestTp>::value && is_same<_RawSourceTp, _RawDestTp>::value
516
+ && (__is_default_allocator<allocator_type>::value || !__has_construct<allocator_type, _DestTp*, _SourceTp&>::value),
517
+ void>
518
+ __construct_range_forward(allocator_type&, _SourceTp* __begin1, _SourceTp* __end1, _DestTp*& __begin2)
519
+ {
520
+ ptrdiff_t _Np = __end1 - __begin1;
521
+ if (_Np > 0)
522
+ {
523
+ _CUDA_VSTD::memcpy(const_cast<_RawDestTp*>(__begin2), __begin1, _Np * sizeof(_DestTp));
524
+ __begin2 += _Np;
525
+ }
526
+ }
527
+
528
+ template <class _Ptr>
529
+ _LIBCUDACXX_HIDE_FROM_ABI static void
530
+ __construct_backward_with_exception_guarantees(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __end2)
531
+ {
532
+ static_assert(__is_cpp17_move_insertable<allocator_type>::value,
533
+ "The specified type does not meet the requirements of Cpp17MoveInsertable");
534
+ while (__end1 != __begin1)
535
+ {
536
+ construct(__a,
537
+ _CUDA_VSTD::__to_raw_pointer(__end2 - 1),
538
+ #ifdef _CCCL_NO_EXCEPTIONS
539
+ _CUDA_VSTD::move(*--__end1)
540
+ #else // ^^^ _CCCL_NO_EXCEPTIONS ^^^ / vvv !_CCCL_NO_EXCEPTIONS vvv
541
+ _CUDA_VSTD::move_if_noexcept(*--__end1)
542
+ #endif // !_CCCL_NO_EXCEPTIONS
543
+ );
544
+ --__end2;
545
+ }
546
+ }
547
+
548
+ template <class _Tp>
549
+ _LIBCUDACXX_HIDE_FROM_ABI static enable_if_t<
550
+ (__is_default_allocator<allocator_type>::value || !__has_construct<allocator_type, _Tp*, _Tp>::value)
551
+ && is_trivially_move_constructible<_Tp>::value,
552
+ void>
553
+ __construct_backward_with_exception_guarantees(allocator_type&, _Tp* __begin1, _Tp* __end1, _Tp*& __end2)
554
+ {
555
+ ptrdiff_t _Np = __end1 - __begin1;
556
+ __end2 -= _Np;
557
+ if (_Np > 0)
558
+ {
559
+ _CUDA_VSTD::memcpy(__end2, __begin1, _Np * sizeof(_Tp));
560
+ }
561
+ }
562
+ };
563
+
564
+ template <class _Traits, class _Tp>
565
+ using __rebind_alloc _CCCL_NODEBUG_ALIAS = typename _Traits::template rebind_alloc<_Tp>;
566
+
567
+ template <class _Traits, class _Tp>
568
+ struct __rebind_alloc_helper
569
+ {
570
+ typedef _CCCL_NODEBUG_ALIAS typename _Traits::template rebind_alloc<_Tp> type;
571
+ };
572
+
573
+ #undef _LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX
574
+
575
+ _LIBCUDACXX_END_NAMESPACE_STD
576
+
577
+ _CCCL_NV_DIAG_DEFAULT(1215)
578
+
579
+ _CCCL_POP_MACROS
580
+
581
+ #endif // _LIBCUDACXX___MEMORY_ALLOCATOR_TRAITS_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/assume_aligned.h ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of libcu++, the C++ Standard Library for your entire system,
5
+ // under the Apache License v2.0 with LLVM Exceptions.
6
+ // See https://llvm.org/LICENSE.txt for license information.
7
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
+ // SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
9
+ //
10
+ //===----------------------------------------------------------------------===//
11
+
12
+ #ifndef _LIBCUDACXX___MEMORY_ASSUME_ALIGNED_H
13
+ #define _LIBCUDACXX___MEMORY_ASSUME_ALIGNED_H
14
+
15
+ #include <cuda/std/detail/__config>
16
+
17
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
18
+ # pragma GCC system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
20
+ # pragma clang system_header
21
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
22
+ # pragma system_header
23
+ #endif // no system header
24
+
25
+ #include <cuda/std/__bit/has_single_bit.h>
26
+ #include <cuda/std/__type_traits/is_constant_evaluated.h>
27
+ #include <cuda/std/cstddef> // size_t
28
+ #include <cuda/std/cstdint> // uintptr_t
29
+
30
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
31
+
32
+ template <size_t _Align, class _Tp>
33
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 _Tp* assume_aligned(_Tp* __ptr) noexcept
34
+ {
35
+ static_assert(_CUDA_VSTD::has_single_bit(_Align), "std::assume_aligned requires the alignment to be a power of 2!");
36
+ #if defined(_CCCL_BUILTIN_IS_CONSTANT_EVALUATED) && defined(_CCCL_BUILTIN_ASSUME_ALIGNED)
37
+ if (!_CCCL_BUILTIN_IS_CONSTANT_EVALUATED())
38
+ {
39
+ # if !_CCCL_COMPILER(MSVC) // MSVC checks within the builtin
40
+ _CCCL_ASSERT(reinterpret_cast<uintptr_t>(__ptr) % _Align == 0, "Alignment assumption is violated");
41
+ # endif // !_CCCL_COMPILER(MSVC)
42
+ return static_cast<_Tp*>(_CCCL_BUILTIN_ASSUME_ALIGNED(__ptr, _Align));
43
+ }
44
+ else
45
+ #endif // _CCCL_BUILTIN_IS_CONSTANT_EVALUATED && _CCCL_BUILTIN_ASSUME_ALIGNED
46
+ {
47
+ return __ptr;
48
+ }
49
+ }
50
+
51
+ _LIBCUDACXX_END_NAMESPACE_STD
52
+
53
+ #endif // _LIBCUDACXX___MEMORY_ASSUME_ALIGNED_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/builtin_new_allocator.h ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of libcu++, the C++ Standard Library for your entire system,
5
+ // under the Apache License v2.0 with LLVM Exceptions.
6
+ // See https://llvm.org/LICENSE.txt for license information.
7
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
+ // SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
9
+ //
10
+ //===----------------------------------------------------------------------===//
11
+
12
+ #ifndef _LIBCUDACXX___MEMORY_BUILTIN_NEW_ALLOCATOR_H
13
+ #define _LIBCUDACXX___MEMORY_BUILTIN_NEW_ALLOCATOR_H
14
+
15
+ #include <cuda/std/detail/__config>
16
+
17
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
18
+ # pragma GCC system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
20
+ # pragma clang system_header
21
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
22
+ # pragma system_header
23
+ #endif // no system header
24
+
25
+ #include <cuda/std/__memory/unique_ptr.h>
26
+ #include <cuda/std/__new_>
27
+ #include <cuda/std/cstddef>
28
+
29
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
30
+
31
+ // __builtin_new_allocator -- A non-templated helper for allocating and
32
+ // deallocating memory using __builtin_operator_new and
33
+ // __builtin_operator_delete. It should be used in preference to
34
+ // `std::allocator<T>` to avoid additional instantiations.
35
+ struct __builtin_new_allocator
36
+ {
37
+ struct __builtin_new_deleter
38
+ {
39
+ typedef void* pointer_type;
40
+
41
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr explicit __builtin_new_deleter(size_t __size, size_t __align) noexcept
42
+ : __size_(__size)
43
+ , __align_(__align)
44
+ {}
45
+
46
+ _LIBCUDACXX_HIDE_FROM_ABI void operator()(void* __p) const noexcept
47
+ {
48
+ _CUDA_VSTD::__cccl_deallocate(__p, __size_, __align_);
49
+ }
50
+
51
+ private:
52
+ size_t __size_;
53
+ size_t __align_;
54
+ };
55
+
56
+ typedef unique_ptr<void, __builtin_new_deleter> __holder_t;
57
+
58
+ _LIBCUDACXX_HIDE_FROM_ABI static __holder_t __allocate_bytes(size_t __s, size_t __align)
59
+ {
60
+ return __holder_t(_CUDA_VSTD::__cccl_allocate(__s, __align), __builtin_new_deleter(__s, __align));
61
+ }
62
+
63
+ _LIBCUDACXX_HIDE_FROM_ABI static void __deallocate_bytes(void* __p, size_t __s, size_t __align) noexcept
64
+ {
65
+ _CUDA_VSTD::__cccl_deallocate(__p, __s, __align);
66
+ }
67
+
68
+ template <class _Tp>
69
+ _CCCL_NODEBUG_ALIAS _LIBCUDACXX_HIDE_FROM_ABI static __holder_t __allocate_type(size_t __n)
70
+ {
71
+ return __allocate_bytes(__n * sizeof(_Tp), _LIBCUDACXX_ALIGNOF(_Tp));
72
+ }
73
+
74
+ template <class _Tp>
75
+ _CCCL_NODEBUG_ALIAS _LIBCUDACXX_HIDE_FROM_ABI static void __deallocate_type(void* __p, size_t __n) noexcept
76
+ {
77
+ __deallocate_bytes(__p, __n * sizeof(_Tp), _LIBCUDACXX_ALIGNOF(_Tp));
78
+ }
79
+ };
80
+
81
+ _LIBCUDACXX_END_NAMESPACE_STD
82
+
83
+ #endif // _LIBCUDACXX___MEMORY_BUILTIN_NEW_ALLOCATOR_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/compressed_pair.h ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of libcu++, the C++ Standard Library for your entire system,
5
+ // under the Apache License v2.0 with LLVM Exceptions.
6
+ // See https://llvm.org/LICENSE.txt for license information.
7
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
+ // SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
9
+ //
10
+ //===----------------------------------------------------------------------===//
11
+
12
+ #ifndef _LIBCUDACXX___MEMORY_COMPRESSED_PAIR_H
13
+ #define _LIBCUDACXX___MEMORY_COMPRESSED_PAIR_H
14
+
15
+ #include <cuda/std/detail/__config>
16
+
17
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
18
+ # pragma GCC system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
20
+ # pragma clang system_header
21
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
22
+ # pragma system_header
23
+ #endif // no system header
24
+
25
+ #include <cuda/std/__fwd/get.h>
26
+ #include <cuda/std/__fwd/tuple.h>
27
+ #include <cuda/std/__tuple_dir/tuple_indices.h>
28
+ #include <cuda/std/__type_traits/decay.h>
29
+ #include <cuda/std/__type_traits/dependent_type.h>
30
+ #include <cuda/std/__type_traits/enable_if.h>
31
+ #include <cuda/std/__type_traits/is_default_constructible.h>
32
+ #include <cuda/std/__type_traits/is_empty.h>
33
+ #include <cuda/std/__type_traits/is_final.h>
34
+ #include <cuda/std/__type_traits/is_nothrow_constructible.h>
35
+ #include <cuda/std/__type_traits/is_nothrow_default_constructible.h>
36
+ #include <cuda/std/__type_traits/is_same.h>
37
+ #include <cuda/std/__type_traits/is_swappable.h>
38
+ #include <cuda/std/__utility/forward.h>
39
+ #include <cuda/std/__utility/move.h>
40
+ #include <cuda/std/__utility/piecewise_construct.h>
41
+ #include <cuda/std/cstddef>
42
+
43
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
44
+
45
+ // Tag used to default initialize one or both of the pair's elements.
46
+ struct __default_init_tag
47
+ {};
48
+ struct __value_init_tag
49
+ {};
50
+
51
+ template <class _Tp, int _Idx, bool _CanBeEmptyBase = _CCCL_TRAIT(is_empty, _Tp) && !_CCCL_TRAIT(is_final, _Tp)>
52
+ struct __compressed_pair_elem
53
+ {
54
+ using _ParamT = _Tp;
55
+ using reference = _Tp&;
56
+ using const_reference = const _Tp&;
57
+
58
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr explicit __compressed_pair_elem(__default_init_tag) noexcept(
59
+ _CCCL_TRAIT(is_nothrow_default_constructible, _Tp))
60
+ {}
61
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr explicit __compressed_pair_elem(__value_init_tag) noexcept(
62
+ _CCCL_TRAIT(is_nothrow_default_constructible, _Tp))
63
+ : __value_()
64
+ {}
65
+
66
+ template <class _Up, enable_if_t<!_CCCL_TRAIT(is_same, __compressed_pair_elem, decay_t<_Up>), int> = 0>
67
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr explicit __compressed_pair_elem(_Up&& __u) noexcept(
68
+ _CCCL_TRAIT(is_nothrow_constructible, _Tp, _Up))
69
+ : __value_(_CUDA_VSTD::forward<_Up>(__u))
70
+ {}
71
+
72
+ template <class... _Args, size_t... _Indices>
73
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX17 explicit __compressed_pair_elem(
74
+ piecewise_construct_t,
75
+ tuple<_Args...> __args,
76
+ __tuple_indices<_Indices...>) noexcept(_CCCL_TRAIT(is_nothrow_constructible, _Tp, _Args...))
77
+ : __value_(_CUDA_VSTD::forward<_Args>(_CUDA_VSTD::get<_Indices>(__args))...)
78
+ {}
79
+
80
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 reference __get() noexcept
81
+ {
82
+ return __value_;
83
+ }
84
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr const_reference __get() const noexcept
85
+ {
86
+ return __value_;
87
+ }
88
+
89
+ private:
90
+ _Tp __value_;
91
+ };
92
+
93
+ template <class _Tp, int _Idx>
94
+ struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp
95
+ {
96
+ using _ParamT = _Tp;
97
+ using reference = _Tp&;
98
+ using const_reference = const _Tp&;
99
+ using __value_type = _Tp;
100
+
101
+ _CCCL_HIDE_FROM_ABI explicit constexpr __compressed_pair_elem() = default;
102
+
103
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr explicit __compressed_pair_elem(__default_init_tag) noexcept(
104
+ _CCCL_TRAIT(is_nothrow_default_constructible, _Tp))
105
+ {}
106
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr explicit __compressed_pair_elem(__value_init_tag) noexcept(
107
+ _CCCL_TRAIT(is_nothrow_default_constructible, _Tp))
108
+ : __value_type()
109
+ {}
110
+
111
+ template <class _Up, enable_if_t<!_CCCL_TRAIT(is_same, __compressed_pair_elem, decay_t<_Up>), int> = 0>
112
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr explicit __compressed_pair_elem(_Up&& __u) noexcept(
113
+ _CCCL_TRAIT(is_nothrow_constructible, _Tp, _Up))
114
+ : __value_type(_CUDA_VSTD::forward<_Up>(__u))
115
+ {}
116
+
117
+ template <class... _Args, size_t... _Indices>
118
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX17 __compressed_pair_elem(
119
+ piecewise_construct_t,
120
+ tuple<_Args...> __args,
121
+ __tuple_indices<_Indices...>) noexcept(_CCCL_TRAIT(is_nothrow_constructible, _Tp, _Args...))
122
+ : __value_type(_CUDA_VSTD::forward<_Args>(_CUDA_VSTD::get<_Indices>(__args))...)
123
+ {}
124
+
125
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 reference __get() noexcept
126
+ {
127
+ return *this;
128
+ }
129
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr const_reference __get() const noexcept
130
+ {
131
+ return *this;
132
+ }
133
+ };
134
+
135
+ template <class _T1, class _T2>
136
+ class __compressed_pair
137
+ : private __compressed_pair_elem<_T1, 0>
138
+ , private __compressed_pair_elem<_T2, 1>
139
+ {
140
+ public:
141
+ // NOTE: This static assert should never fire because __compressed_pair
142
+ // is *almost never* used in a scenario where it's possible for T1 == T2.
143
+ // (The exception is std::function where it is possible that the function
144
+ // object and the allocator have the same type).
145
+ static_assert((!_CCCL_TRAIT(is_same, _T1, _T2)),
146
+ "__compressed_pair cannot be instantiated when T1 and T2 are the same type; "
147
+ "The current implementation is NOT ABI-compatible with the previous implementation for this "
148
+ "configuration");
149
+
150
+ using _Base1 _CCCL_NODEBUG_ALIAS = __compressed_pair_elem<_T1, 0>;
151
+ using _Base2 _CCCL_NODEBUG_ALIAS = __compressed_pair_elem<_T2, 1>;
152
+
153
+ template <bool _Dummy = true,
154
+ class = enable_if_t<__dependent_type<is_default_constructible<_T1>, _Dummy>::value
155
+ && __dependent_type<is_default_constructible<_T2>, _Dummy>::value>>
156
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr explicit __compressed_pair() noexcept(
157
+ _CCCL_TRAIT(is_nothrow_default_constructible, _T1) && _CCCL_TRAIT(is_nothrow_default_constructible, _T2))
158
+ : _Base1(__value_init_tag())
159
+ , _Base2(__value_init_tag())
160
+ {}
161
+
162
+ template <class _U1, class _U2>
163
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr explicit __compressed_pair(_U1&& __t1, _U2&& __t2) noexcept(
164
+ _CCCL_TRAIT(is_constructible, _T1, _U1) && _CCCL_TRAIT(is_constructible, _T2, _U2))
165
+ : _Base1(_CUDA_VSTD::forward<_U1>(__t1))
166
+ , _Base2(_CUDA_VSTD::forward<_U2>(__t2))
167
+ {}
168
+
169
+ template <class... _Args1, class... _Args2>
170
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX17 explicit __compressed_pair(
171
+ piecewise_construct_t __pc,
172
+ tuple<_Args1...> __first_args,
173
+ tuple<_Args2...> __second_args) noexcept(_CCCL_TRAIT(is_constructible, _T1, _Args1...)
174
+ && _CCCL_TRAIT(is_constructible, _T2, _Args2...))
175
+ : _Base1(__pc, _CUDA_VSTD::move(__first_args), typename __make_tuple_indices<sizeof...(_Args1)>::type())
176
+ , _Base2(__pc, _CUDA_VSTD::move(__second_args), typename __make_tuple_indices<sizeof...(_Args2)>::type())
177
+ {}
178
+
179
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 typename _Base1::reference first() noexcept
180
+ {
181
+ return static_cast<_Base1&>(*this).__get();
182
+ }
183
+
184
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr typename _Base1::const_reference first() const noexcept
185
+ {
186
+ return static_cast<_Base1 const&>(*this).__get();
187
+ }
188
+
189
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 typename _Base2::reference second() noexcept
190
+ {
191
+ return static_cast<_Base2&>(*this).__get();
192
+ }
193
+
194
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr typename _Base2::const_reference second() const noexcept
195
+ {
196
+ return static_cast<_Base2 const&>(*this).__get();
197
+ }
198
+
199
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr static _Base1* __get_first_base(__compressed_pair* __pair) noexcept
200
+ {
201
+ return static_cast<_Base1*>(__pair);
202
+ }
203
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr static _Base2* __get_second_base(__compressed_pair* __pair) noexcept
204
+ {
205
+ return static_cast<_Base2*>(__pair);
206
+ }
207
+
208
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 void
209
+ swap(__compressed_pair& __x) noexcept(__is_nothrow_swappable<_T1>::value && __is_nothrow_swappable<_T2>::value)
210
+ {
211
+ using _CUDA_VSTD::swap;
212
+ swap(first(), __x.first());
213
+ swap(second(), __x.second());
214
+ }
215
+ };
216
+
217
+ template <class _T1, class _T2>
218
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 void swap(
219
+ __compressed_pair<_T1, _T2>& __x,
220
+ __compressed_pair<_T1, _T2>& __y) noexcept(__is_nothrow_swappable<_T1>::value && __is_nothrow_swappable<_T2>::value)
221
+ {
222
+ __x.swap(__y);
223
+ }
224
+
225
+ _LIBCUDACXX_END_NAMESPACE_STD
226
+
227
+ #endif // _LIBCUDACXX___MEMORY_COMPRESSED_PAIR_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/construct_at.h ADDED
@@ -0,0 +1,268 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ // SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES
8
+ //
9
+ //===----------------------------------------------------------------------===//
10
+
11
+ #ifndef _LIBCUDACXX___MEMORY_CONSTRUCT_AT_H
12
+ #define _LIBCUDACXX___MEMORY_CONSTRUCT_AT_H
13
+
14
+ #include <cuda/std/detail/__config>
15
+
16
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
17
+ # pragma GCC system_header
18
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
19
+ # pragma clang system_header
20
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
21
+ # pragma system_header
22
+ #endif // no system header
23
+
24
+ #include <cuda/std/__concepts/concept_macros.h>
25
+ #include <cuda/std/__iterator/access.h>
26
+ #include <cuda/std/__memory/addressof.h>
27
+ #include <cuda/std/__memory/voidify.h>
28
+ #include <cuda/std/__type_traits/enable_if.h>
29
+ #include <cuda/std/__type_traits/integral_constant.h>
30
+ #include <cuda/std/__type_traits/is_arithmetic.h>
31
+ #include <cuda/std/__type_traits/is_array.h>
32
+ #include <cuda/std/__type_traits/is_constant_evaluated.h>
33
+ #include <cuda/std/__type_traits/is_trivially_constructible.h>
34
+ #include <cuda/std/__type_traits/is_trivially_destructible.h>
35
+ #include <cuda/std/__type_traits/is_trivially_move_assignable.h>
36
+ #include <cuda/std/__type_traits/void_t.h>
37
+ #include <cuda/std/__utility/declval.h>
38
+ #include <cuda/std/__utility/forward.h>
39
+ #include <cuda/std/__utility/move.h>
40
+
41
+ #if _CCCL_CUDA_COMPILER(CLANG)
42
+ # include <new>
43
+ #endif // _CCCL_CUDA_COMPILER(CLANG)
44
+
45
+ #if _CCCL_STD_VER >= 2020 // need to backfill ::std::construct_at
46
+ # if !_CCCL_COMPILER(NVRTC)
47
+ # include <memory>
48
+ # endif // _CCCL_COMPILER(NVRTC)
49
+
50
+ # ifndef __cpp_lib_constexpr_dynamic_alloc
51
+ namespace std
52
+ {
53
+ _CCCL_EXEC_CHECK_DISABLE
54
+ template <class _Tp,
55
+ class... _Args,
56
+ class = decltype(::new(_CUDA_VSTD::declval<void*>()) _Tp(_CUDA_VSTD::declval<_Args>()...))>
57
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr _Tp* construct_at(_Tp* __location, _Args&&... __args)
58
+ {
59
+ # if defined(_CCCL_BUILTIN_ADDRESSOF)
60
+ return ::new (_CUDA_VSTD::__voidify(*__location)) _Tp(_CUDA_VSTD::forward<_Args>(__args)...);
61
+ # else
62
+ return ::new (const_cast<void*>(static_cast<const volatile void*>(__location)))
63
+ _Tp(_CUDA_VSTD::forward<_Args>(__args)...);
64
+ # endif
65
+ }
66
+ } // namespace std
67
+ # endif // __cpp_lib_constexpr_dynamic_alloc
68
+ #endif // _CCCL_STD_VER >= 2020
69
+
70
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
71
+
72
+ // There is a performance issue with placement new, where EDG based compiler insert a nullptr check that is superfluous
73
+ // Because this is a noticeable performance regression, we specialize it for certain types
74
+ // This is possible because we are calling ::new ignoring any user defined overloads of operator placement new
75
+ namespace __detail
76
+ {
77
+ // We cannot allow narrowing conversions between arithmetic types as the assignment will give errors
78
+ template <class _To, class...>
79
+ struct __is_narrowing_impl : false_type
80
+ {};
81
+
82
+ template <class _To, class _From>
83
+ struct __is_narrowing_impl<_To, _From> : true_type
84
+ {};
85
+
86
+ // This is a bit hacky, but we rely on the fact that arithmetic types cannot have more than one argument to their
87
+ // constructor
88
+ template <class _To, class _From>
89
+ struct __is_narrowing_impl<_To, _From, void_t<decltype(_To{_CUDA_VSTD::declval<_From>()})>> : false_type
90
+ {};
91
+
92
+ template <class _Tp, class... _Args>
93
+ using __is_narrowing = _If<_CCCL_TRAIT(is_arithmetic, _Tp), __is_narrowing_impl<_Tp, _Args...>, false_type>;
94
+
95
+ // The destination type must be trivially constructible from the arguments and also trivially assignable, because we
96
+ // technically move assign in the optimization
97
+ template <class _Tp, class... _Args>
98
+ struct __can_optimize_construct_at
99
+ : integral_constant<bool,
100
+ _CCCL_TRAIT(is_trivially_constructible, _Tp, _Args...)
101
+ && _CCCL_TRAIT(is_trivially_move_assignable, _Tp) && !__is_narrowing<_Tp, _Args...>::value>
102
+ {};
103
+ } // namespace __detail
104
+
105
+ // construct_at
106
+ #if _CCCL_STD_VER >= 2020
107
+
108
+ _CCCL_EXEC_CHECK_DISABLE
109
+ template <class _Tp,
110
+ class... _Args,
111
+ class = decltype(::new(_CUDA_VSTD::declval<void*>()) _Tp(_CUDA_VSTD::declval<_Args>()...))>
112
+ _LIBCUDACXX_HIDE_FROM_ABI
113
+ _CCCL_CONSTEXPR_CXX20 enable_if_t<!__detail::__can_optimize_construct_at<_Tp, _Args...>::value, _Tp*>
114
+ construct_at(_Tp* __location, _Args&&... __args)
115
+ {
116
+ _CCCL_ASSERT(__location != nullptr, "null pointer given to construct_at");
117
+ // Need to go through `std::construct_at` as that is the explicitly blessed function
118
+ if (_CUDA_VSTD::is_constant_evaluated())
119
+ {
120
+ return ::std::construct_at(__location, _CUDA_VSTD::forward<_Args>(__args)...);
121
+ }
122
+ return ::new (_CUDA_VSTD::__voidify(*__location)) _Tp(_CUDA_VSTD::forward<_Args>(__args)...);
123
+ }
124
+
125
+ _CCCL_EXEC_CHECK_DISABLE
126
+ template <class _Tp,
127
+ class... _Args,
128
+ class = decltype(::new(_CUDA_VSTD::declval<void*>()) _Tp(_CUDA_VSTD::declval<_Args>()...))>
129
+ _LIBCUDACXX_HIDE_FROM_ABI
130
+ _CCCL_CONSTEXPR_CXX20 enable_if_t<__detail::__can_optimize_construct_at<_Tp, _Args...>::value, _Tp*>
131
+ construct_at(_Tp* __location, _Args&&... __args)
132
+ {
133
+ _CCCL_ASSERT(__location != nullptr, "null pointer given to construct_at");
134
+ // Need to go through `std::construct_at` as that is the explicitly blessed function
135
+ if (_CUDA_VSTD::is_constant_evaluated())
136
+ {
137
+ return ::std::construct_at(__location, _CUDA_VSTD::forward<_Args>(__args)...);
138
+ }
139
+ *__location = _Tp{_CUDA_VSTD::forward<_Args>(__args)...};
140
+ return __location;
141
+ }
142
+
143
+ #endif // _CCCL_STD_VER >= 2020
144
+
145
+ _CCCL_EXEC_CHECK_DISABLE
146
+ template <class _Tp, class... _Args>
147
+ _LIBCUDACXX_HIDE_FROM_ABI
148
+ _CCCL_CONSTEXPR_CXX20 enable_if_t<!__detail::__can_optimize_construct_at<_Tp, _Args...>::value, _Tp*>
149
+ __construct_at(_Tp* __location, _Args&&... __args)
150
+ {
151
+ _CCCL_ASSERT(__location != nullptr, "null pointer given to construct_at");
152
+ #if _CCCL_STD_VER >= 2020
153
+ // Need to go through `std::construct_at` as that is the explicitly blessed function
154
+ if (_CUDA_VSTD::is_constant_evaluated())
155
+ {
156
+ return ::std::construct_at(__location, _CUDA_VSTD::forward<_Args>(__args)...);
157
+ }
158
+ #endif // _CCCL_STD_VER >= 2020
159
+ return ::new (_CUDA_VSTD::__voidify(*__location)) _Tp(_CUDA_VSTD::forward<_Args>(__args)...);
160
+ }
161
+
162
+ _CCCL_EXEC_CHECK_DISABLE
163
+ template <class _Tp, class... _Args>
164
+ _LIBCUDACXX_HIDE_FROM_ABI
165
+ _CCCL_CONSTEXPR_CXX20 enable_if_t<__detail::__can_optimize_construct_at<_Tp, _Args...>::value, _Tp*>
166
+ __construct_at(_Tp* __location, _Args&&... __args)
167
+ {
168
+ _CCCL_ASSERT(__location != nullptr, "null pointer given to construct_at");
169
+ #if _CCCL_STD_VER >= 2020
170
+ // Need to go through `std::construct_at` as that is the explicitly blessed function
171
+ if (_CUDA_VSTD::is_constant_evaluated())
172
+ {
173
+ return ::std::construct_at(__location, _CUDA_VSTD::forward<_Args>(__args)...);
174
+ }
175
+ #endif // _CCCL_STD_VER >= 2020
176
+ *__location = _Tp{_CUDA_VSTD::forward<_Args>(__args)...};
177
+ return __location;
178
+ }
179
+
180
+ // destroy_at
181
+
182
+ // The internal functions are available regardless of the language version (with the exception of the `__destroy_at`
183
+ // taking an array).
184
+ template <class _ForwardIterator>
185
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 _ForwardIterator __destroy(_ForwardIterator, _ForwardIterator);
186
+
187
+ _CCCL_EXEC_CHECK_DISABLE
188
+ template <class _Tp,
189
+ enable_if_t<!_CCCL_TRAIT(is_array, _Tp), int> = 0,
190
+ enable_if_t<!_CCCL_TRAIT(is_trivially_destructible, _Tp), int> = 0>
191
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 void __destroy_at(_Tp* __loc)
192
+ {
193
+ _CCCL_ASSERT(__loc != nullptr, "null pointer given to destroy_at");
194
+ __loc->~_Tp();
195
+ }
196
+
197
+ _CCCL_EXEC_CHECK_DISABLE
198
+ template <class _Tp,
199
+ enable_if_t<!_CCCL_TRAIT(is_array, _Tp), int> = 0,
200
+ enable_if_t<_CCCL_TRAIT(is_trivially_destructible, _Tp), int> = 0>
201
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 void __destroy_at(_Tp* __loc)
202
+ {
203
+ _CCCL_ASSERT(__loc != nullptr, "null pointer given to destroy_at");
204
+ (void) __loc;
205
+ }
206
+
207
+ template <class _Tp, enable_if_t<_CCCL_TRAIT(is_array, _Tp), int> = 0>
208
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 void __destroy_at(_Tp* __loc)
209
+ {
210
+ _CCCL_ASSERT(__loc != nullptr, "null pointer given to destroy_at");
211
+ _CUDA_VSTD::__destroy(_CUDA_VSTD::begin(*__loc), _CUDA_VSTD::end(*__loc));
212
+ }
213
+
214
+ template <class _ForwardIterator>
215
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 _ForwardIterator
216
+ __destroy(_ForwardIterator __first, _ForwardIterator __last)
217
+ {
218
+ for (; __first != __last; ++__first)
219
+ {
220
+ _CUDA_VSTD::__destroy_at(_CUDA_VSTD::addressof(*__first));
221
+ }
222
+ return __first;
223
+ }
224
+
225
+ template <class _BidirectionalIterator>
226
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 _BidirectionalIterator
227
+ __reverse_destroy(_BidirectionalIterator __first, _BidirectionalIterator __last)
228
+ {
229
+ while (__last != __first)
230
+ {
231
+ --__last;
232
+ _CUDA_VSTD::__destroy_at(_CUDA_VSTD::addressof(*__last));
233
+ }
234
+ return __last;
235
+ }
236
+
237
+ template <class _Tp, enable_if_t<!_CCCL_TRAIT(is_array, _Tp), int> = 0>
238
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 void destroy_at(_Tp* __loc)
239
+ {
240
+ _CCCL_ASSERT(__loc != nullptr, "null pointer given to destroy_at");
241
+ __loc->~_Tp();
242
+ }
243
+
244
+ template <class _Tp, enable_if_t<_CCCL_TRAIT(is_array, _Tp), int> = 0>
245
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 void destroy_at(_Tp* __loc)
246
+ {
247
+ _CUDA_VSTD::__destroy_at(__loc);
248
+ }
249
+
250
+ template <class _ForwardIterator>
251
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 void destroy(_ForwardIterator __first, _ForwardIterator __last) noexcept
252
+ {
253
+ (void) _CUDA_VSTD::__destroy(_CUDA_VSTD::move(__first), _CUDA_VSTD::move(__last));
254
+ }
255
+
256
+ template <class _ForwardIterator, class _Size>
257
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 _ForwardIterator destroy_n(_ForwardIterator __first, _Size __n)
258
+ {
259
+ for (; __n > 0; (void) ++__first, --__n)
260
+ {
261
+ _CUDA_VSTD::__destroy_at(_CUDA_VSTD::addressof(*__first));
262
+ }
263
+ return __first;
264
+ }
265
+
266
+ _LIBCUDACXX_END_NAMESPACE_STD
267
+
268
+ #endif // _LIBCUDACXX___MEMORY_CONSTRUCT_AT_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/destruct_n.h ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of libcu++, the C++ Standard Library for your entire system,
5
+ // under the Apache License v2.0 with LLVM Exceptions.
6
+ // See https://llvm.org/LICENSE.txt for license information.
7
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
9
+ //
10
+ //===----------------------------------------------------------------------===//
11
+
12
+ #ifndef _LIBCUDACXX___MEMORY_DESTRUCT_N_H
13
+ #define _LIBCUDACXX___MEMORY_DESTRUCT_N_H
14
+
15
+ #include <cuda/std/detail/__config>
16
+
17
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
18
+ # pragma GCC system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
20
+ # pragma clang system_header
21
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
22
+ # pragma system_header
23
+ #endif // no system header
24
+
25
+ #include <cuda/std/__type_traits/integral_constant.h>
26
+ #include <cuda/std/__type_traits/is_trivially_destructible.h>
27
+ #include <cuda/std/cstddef>
28
+
29
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
30
+
31
+ struct __destruct_n
32
+ {
33
+ private:
34
+ size_t __size_;
35
+
36
+ template <class _Tp>
37
+ _LIBCUDACXX_HIDE_FROM_ABI void __process(_Tp* __p, false_type) noexcept
38
+ {
39
+ for (size_t __i = 0; __i < __size_; ++__i, ++__p)
40
+ {
41
+ __p->~_Tp();
42
+ }
43
+ }
44
+
45
+ template <class _Tp>
46
+ _LIBCUDACXX_HIDE_FROM_ABI void __process(_Tp*, true_type) noexcept
47
+ {}
48
+
49
+ _LIBCUDACXX_HIDE_FROM_ABI void __incr(false_type) noexcept
50
+ {
51
+ ++__size_;
52
+ }
53
+ _LIBCUDACXX_HIDE_FROM_ABI void __incr(true_type) noexcept {}
54
+
55
+ _LIBCUDACXX_HIDE_FROM_ABI void __set(size_t __s, false_type) noexcept
56
+ {
57
+ __size_ = __s;
58
+ }
59
+ _LIBCUDACXX_HIDE_FROM_ABI void __set(size_t, true_type) noexcept {}
60
+
61
+ public:
62
+ _LIBCUDACXX_HIDE_FROM_ABI explicit __destruct_n(size_t __s) noexcept
63
+ : __size_(__s)
64
+ {}
65
+
66
+ template <class _Tp>
67
+ _LIBCUDACXX_HIDE_FROM_ABI void __incr() noexcept
68
+ {
69
+ __incr(integral_constant<bool, is_trivially_destructible<_Tp>::value>());
70
+ }
71
+
72
+ template <class _Tp>
73
+ _LIBCUDACXX_HIDE_FROM_ABI void __set(size_t __s, _Tp*) noexcept
74
+ {
75
+ __set(__s, integral_constant<bool, is_trivially_destructible<_Tp>::value>());
76
+ }
77
+
78
+ template <class _Tp>
79
+ _LIBCUDACXX_HIDE_FROM_ABI void operator()(_Tp* __p) noexcept
80
+ {
81
+ __process(__p, integral_constant<bool, is_trivially_destructible<_Tp>::value>());
82
+ }
83
+ };
84
+
85
+ _LIBCUDACXX_END_NAMESPACE_STD
86
+
87
+ #endif // _LIBCUDACXX___MEMORY_DESTRUCT_N_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/pointer_traits.h ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___MEMORY_POINTER_TRAITS_H
11
+ #define _LIBCUDACXX___MEMORY_POINTER_TRAITS_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #include <cuda/std/__memory/addressof.h>
24
+ #include <cuda/std/__type_traits/conditional.h>
25
+ #include <cuda/std/__type_traits/conjunction.h>
26
+ #include <cuda/std/__type_traits/decay.h>
27
+ #include <cuda/std/__type_traits/enable_if.h>
28
+ #include <cuda/std/__type_traits/integral_constant.h>
29
+ #include <cuda/std/__type_traits/is_class.h>
30
+ #include <cuda/std/__type_traits/is_function.h>
31
+ #include <cuda/std/__type_traits/is_void.h>
32
+ #include <cuda/std/__type_traits/void_t.h>
33
+ #include <cuda/std/__utility/declval.h>
34
+ #include <cuda/std/cstddef>
35
+
36
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
37
+
38
+ template <class _Tp, class = void>
39
+ struct __has_element_type : false_type
40
+ {};
41
+
42
+ template <class _Tp>
43
+ struct __has_element_type<_Tp, void_t<typename _Tp::element_type>> : true_type
44
+ {};
45
+
46
+ template <class _Ptr, bool = __has_element_type<_Ptr>::value>
47
+ struct __pointer_traits_element_type;
48
+
49
+ template <class _Ptr>
50
+ struct __pointer_traits_element_type<_Ptr, true>
51
+ {
52
+ typedef _CCCL_NODEBUG_ALIAS typename _Ptr::element_type type;
53
+ };
54
+
55
+ template <template <class, class...> class _Sp, class _Tp, class... _Args>
56
+ struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, true>
57
+ {
58
+ typedef _CCCL_NODEBUG_ALIAS typename _Sp<_Tp, _Args...>::element_type type;
59
+ };
60
+
61
+ template <template <class, class...> class _Sp, class _Tp, class... _Args>
62
+ struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, false>
63
+ {
64
+ typedef _CCCL_NODEBUG_ALIAS _Tp type;
65
+ };
66
+
67
+ template <class _Tp, class = void>
68
+ struct __has_difference_type : false_type
69
+ {};
70
+
71
+ template <class _Tp>
72
+ struct __has_difference_type<_Tp, void_t<typename _Tp::difference_type>> : true_type
73
+ {};
74
+
75
+ template <class _Ptr, bool = __has_difference_type<_Ptr>::value>
76
+ struct __pointer_traits_difference_type
77
+ {
78
+ typedef _CCCL_NODEBUG_ALIAS ptrdiff_t type;
79
+ };
80
+
81
+ template <class _Ptr>
82
+ struct __pointer_traits_difference_type<_Ptr, true>
83
+ {
84
+ typedef _CCCL_NODEBUG_ALIAS typename _Ptr::difference_type type;
85
+ };
86
+
87
+ template <class _Tp, class _Up>
88
+ struct __has_rebind
89
+ {
90
+ private:
91
+ template <class _Xp>
92
+ _LIBCUDACXX_HIDE_FROM_ABI static false_type __test(...);
93
+ _CCCL_SUPPRESS_DEPRECATED_PUSH
94
+ template <class _Xp>
95
+ _LIBCUDACXX_HIDE_FROM_ABI static true_type __test(typename _Xp::template rebind<_Up>* = 0);
96
+ _CCCL_SUPPRESS_DEPRECATED_POP
97
+
98
+ public:
99
+ static const bool value = decltype(__test<_Tp>(0))::value;
100
+ };
101
+
102
+ template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
103
+ struct __pointer_traits_rebind
104
+ {
105
+ typedef _CCCL_NODEBUG_ALIAS typename _Tp::template rebind<_Up> type;
106
+ };
107
+
108
+ template <template <class, class...> class _Sp, class _Tp, class... _Args, class _Up>
109
+ struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, true>
110
+ {
111
+ typedef _CCCL_NODEBUG_ALIAS typename _Sp<_Tp, _Args...>::template rebind<_Up> type;
112
+ };
113
+
114
+ template <template <class, class...> class _Sp, class _Tp, class... _Args, class _Up>
115
+ struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, false>
116
+ {
117
+ typedef _Sp<_Up, _Args...> type;
118
+ };
119
+
120
+ template <class _Ptr>
121
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT pointer_traits
122
+ {
123
+ typedef _Ptr pointer;
124
+ typedef typename __pointer_traits_element_type<pointer>::type element_type;
125
+ typedef typename __pointer_traits_difference_type<pointer>::type difference_type;
126
+
127
+ template <class _Up>
128
+ using rebind = typename __pointer_traits_rebind<pointer, _Up>::type;
129
+
130
+ private:
131
+ struct __nat
132
+ {};
133
+
134
+ public:
135
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 static pointer
136
+ pointer_to(conditional_t<is_void<element_type>::value, __nat, element_type>& __r)
137
+ {
138
+ return pointer::pointer_to(__r);
139
+ }
140
+ };
141
+
142
+ template <class _Tp>
143
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT pointer_traits<_Tp*>
144
+ {
145
+ typedef _Tp* pointer;
146
+ typedef _Tp element_type;
147
+ typedef ptrdiff_t difference_type;
148
+
149
+ template <class _Up>
150
+ using rebind = _Up*;
151
+
152
+ private:
153
+ struct __nat
154
+ {};
155
+
156
+ public:
157
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 static pointer
158
+ pointer_to(conditional_t<is_void<element_type>::value, __nat, element_type>& __r) noexcept
159
+ {
160
+ return _CUDA_VSTD::addressof(__r);
161
+ }
162
+ };
163
+
164
+ template <class _From, class _To>
165
+ struct __rebind_pointer
166
+ {
167
+ typedef typename pointer_traits<_From>::template rebind<_To> type;
168
+ };
169
+
170
+ // to_address
171
+
172
+ template <class _Pointer, class = void>
173
+ struct __to_address_helper;
174
+
175
+ template <class _Tp>
176
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr _Tp* __to_address(_Tp* __p) noexcept
177
+ {
178
+ static_assert(!is_function<_Tp>::value, "_Tp is a function type");
179
+ return __p;
180
+ }
181
+
182
+ template <class _Pointer, class = void>
183
+ struct _HasToAddress : false_type
184
+ {};
185
+
186
+ template <class _Pointer>
187
+ struct _HasToAddress<_Pointer, decltype((void) pointer_traits<_Pointer>::to_address(declval<const _Pointer&>()))>
188
+ : true_type
189
+ {};
190
+
191
+ template <class _Pointer, class = void>
192
+ struct _HasArrow : false_type
193
+ {};
194
+
195
+ template <class _Pointer>
196
+ struct _HasArrow<_Pointer, decltype((void) declval<const _Pointer&>().operator->())> : true_type
197
+ {};
198
+
199
+ template <class _Pointer>
200
+ struct _IsFancyPointer
201
+ {
202
+ static const bool value = _HasArrow<_Pointer>::value || _HasToAddress<_Pointer>::value;
203
+ };
204
+
205
+ // enable_if is needed here to avoid instantiating checks for fancy pointers on raw pointers
206
+ template <class _Pointer, class = enable_if_t<_And<is_class<_Pointer>, _IsFancyPointer<_Pointer>>::value>>
207
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr decay_t<decltype(__to_address_helper<_Pointer>::__call(declval<const _Pointer&>()))>
208
+ __to_address(const _Pointer& __p) noexcept
209
+ {
210
+ return __to_address_helper<_Pointer>::__call(__p);
211
+ }
212
+
213
+ template <class _Pointer, class>
214
+ struct __to_address_helper
215
+ {
216
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr static decltype(_CUDA_VSTD::__to_address(declval<const _Pointer&>().operator->()))
217
+ __call(const _Pointer& __p) noexcept
218
+ {
219
+ return _CUDA_VSTD::__to_address(__p.operator->());
220
+ }
221
+ };
222
+
223
+ template <class _Pointer>
224
+ struct __to_address_helper<_Pointer, decltype((void) pointer_traits<_Pointer>::to_address(declval<const _Pointer&>()))>
225
+ {
226
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr static decltype(pointer_traits<_Pointer>::to_address(declval<const _Pointer&>()))
227
+ __call(const _Pointer& __p) noexcept
228
+ {
229
+ return pointer_traits<_Pointer>::to_address(__p);
230
+ }
231
+ };
232
+
233
+ #if _CCCL_STD_VER > 2011
234
+ template <class _Tp>
235
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr auto to_address(_Tp* __p) noexcept
236
+ {
237
+ return _CUDA_VSTD::__to_address(__p);
238
+ }
239
+
240
+ template <class _Pointer>
241
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr auto
242
+ to_address(const _Pointer& __p) noexcept -> decltype(_CUDA_VSTD::__to_address(__p))
243
+ {
244
+ return _CUDA_VSTD::__to_address(__p);
245
+ }
246
+ #endif
247
+
248
+ _LIBCUDACXX_END_NAMESPACE_STD
249
+
250
+ #endif // _LIBCUDACXX___MEMORY_POINTER_TRAITS_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/uninitialized_algorithms.h ADDED
@@ -0,0 +1,672 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of libcu++, the C++ Standard Library for your entire system,
5
+ // under the Apache License v2.0 with LLVM Exceptions.
6
+ // See https://llvm.org/LICENSE.txt for license information.
7
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
+ // SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
9
+ //
10
+ //===----------------------------------------------------------------------===//
11
+
12
+ #ifndef _LIBCUDACXX___MEMORY_UNINITIALIZED_ALGORITHMS_H
13
+ #define _LIBCUDACXX___MEMORY_UNINITIALIZED_ALGORITHMS_H
14
+
15
+ #include <cuda/std/detail/__config>
16
+
17
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
18
+ # pragma GCC system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
20
+ # pragma clang system_header
21
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
22
+ # pragma system_header
23
+ #endif // no system header
24
+
25
+ #include <cuda/std/__algorithm/copy.h>
26
+ #include <cuda/std/__algorithm/iterator_operations.h>
27
+ #include <cuda/std/__algorithm/move.h>
28
+ #include <cuda/std/__algorithm/unwrap_iter.h>
29
+ #include <cuda/std/__algorithm/unwrap_range.h>
30
+ #include <cuda/std/__memory/addressof.h>
31
+ #include <cuda/std/__memory/allocator_traits.h>
32
+ #include <cuda/std/__memory/construct_at.h>
33
+ #include <cuda/std/__memory/pointer_traits.h>
34
+ #include <cuda/std/__memory/voidify.h>
35
+ #include <cuda/std/__new_>
36
+ #include <cuda/std/__type_traits/extent.h>
37
+ #include <cuda/std/__type_traits/is_array.h>
38
+ #include <cuda/std/__type_traits/is_constant_evaluated.h>
39
+ #include <cuda/std/__type_traits/is_trivially_copy_assignable.h>
40
+ #include <cuda/std/__type_traits/is_trivially_copy_constructible.h>
41
+ #include <cuda/std/__type_traits/is_trivially_move_assignable.h>
42
+ #include <cuda/std/__type_traits/is_trivially_move_constructible.h>
43
+ #include <cuda/std/__type_traits/is_unbounded_array.h>
44
+ #include <cuda/std/__type_traits/negation.h>
45
+ #include <cuda/std/__type_traits/remove_const.h>
46
+ #include <cuda/std/__type_traits/remove_extent.h>
47
+ #include <cuda/std/__utility/exception_guard.h>
48
+ #include <cuda/std/__utility/move.h>
49
+ #include <cuda/std/__utility/pair.h>
50
+
51
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
52
+
53
+ struct __always_false
54
+ {
55
+ template <class... _Args>
56
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr bool operator()(_Args&&...) const noexcept
57
+ {
58
+ return false;
59
+ }
60
+ };
61
+
62
+ template <class _ForwardIterator>
63
+ struct __simple_rollback
64
+ {
65
+ _ForwardIterator& __first_;
66
+ _ForwardIterator& __current_;
67
+
68
+ _LIBCUDACXX_HIDE_FROM_ABI __simple_rollback(_ForwardIterator& __first, _ForwardIterator& __current)
69
+ : __first_(__first)
70
+ , __current_(__current)
71
+ {}
72
+
73
+ _LIBCUDACXX_HIDE_FROM_ABI void operator()() const noexcept
74
+ {
75
+ _CUDA_VSTD::__destroy(__first_, __current_);
76
+ }
77
+ };
78
+
79
+ // uninitialized_copy
80
+
81
+ template <class _ValueType, class _InputIterator, class _Sentinel1, class _ForwardIterator, class _EndPredicate>
82
+ _LIBCUDACXX_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitialized_copy(
83
+ _InputIterator __ifirst, _Sentinel1 __ilast, _ForwardIterator __ofirst, _EndPredicate __stop_copying)
84
+ {
85
+ _ForwardIterator __idx = __ofirst;
86
+ auto __guard = __make_exception_guard(__simple_rollback<_ForwardIterator>{__ofirst, __idx});
87
+ for (; __ifirst != __ilast && !__stop_copying(__idx); ++__ifirst, (void) ++__idx)
88
+ {
89
+ ::new (_CUDA_VSTD::__voidify(*__idx)) _ValueType(*__ifirst);
90
+ }
91
+ __guard.__complete();
92
+
93
+ return pair<_InputIterator, _ForwardIterator>(_CUDA_VSTD::move(__ifirst), _CUDA_VSTD::move(__idx));
94
+ }
95
+
96
+ template <class _InputIterator, class _ForwardIterator>
97
+ _LIBCUDACXX_HIDE_FROM_ABI _ForwardIterator
98
+ uninitialized_copy(_InputIterator __ifirst, _InputIterator __ilast, _ForwardIterator __ofirst)
99
+ {
100
+ typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
101
+ auto __result = _CUDA_VSTD::__uninitialized_copy<_ValueType>(
102
+ _CUDA_VSTD::move(__ifirst), _CUDA_VSTD::move(__ilast), _CUDA_VSTD::move(__ofirst), __always_false{});
103
+ return _CUDA_VSTD::move(__result.second);
104
+ }
105
+
106
+ // uninitialized_copy_n
107
+
108
+ template <class _ValueType, class _InputIterator, class _Size, class _ForwardIterator, class _EndPredicate>
109
+ _LIBCUDACXX_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator>
110
+ __uninitialized_copy_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst, _EndPredicate __stop_copying)
111
+ {
112
+ _ForwardIterator __idx = __ofirst;
113
+ auto __guard = __make_exception_guard(__simple_rollback<_ForwardIterator>{__ofirst, __idx});
114
+ for (; __n > 0 && !__stop_copying(__idx); ++__ifirst, (void) ++__idx, (void) --__n)
115
+ {
116
+ ::new (_CUDA_VSTD::__voidify(*__idx)) _ValueType(*__ifirst);
117
+ }
118
+ __guard.__complete();
119
+
120
+ return pair<_InputIterator, _ForwardIterator>(_CUDA_VSTD::move(__ifirst), _CUDA_VSTD::move(__idx));
121
+ }
122
+
123
+ template <class _InputIterator, class _Size, class _ForwardIterator>
124
+ _LIBCUDACXX_HIDE_FROM_ABI _ForwardIterator
125
+ uninitialized_copy_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst)
126
+ {
127
+ typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
128
+ auto __result = _CUDA_VSTD::__uninitialized_copy_n<_ValueType>(
129
+ _CUDA_VSTD::move(__ifirst), __n, _CUDA_VSTD::move(__ofirst), __always_false{});
130
+ return _CUDA_VSTD::move(__result.second);
131
+ }
132
+
133
+ // uninitialized_fill
134
+
135
+ template <class _ValueType, class _ForwardIterator, class _Sentinel, class _Tp>
136
+ _LIBCUDACXX_HIDE_FROM_ABI _ForwardIterator
137
+ __uninitialized_fill(_ForwardIterator __first, _Sentinel __last, const _Tp& __x)
138
+ {
139
+ _ForwardIterator __idx = __first;
140
+ auto __guard = __make_exception_guard(__simple_rollback<_ForwardIterator>{__first, __idx});
141
+ for (; __idx != __last; ++__idx)
142
+ {
143
+ ::new (_CUDA_VSTD::__voidify(*__idx)) _ValueType(__x);
144
+ }
145
+ __guard.__complete();
146
+
147
+ return __idx;
148
+ }
149
+
150
+ template <class _ForwardIterator, class _Tp>
151
+ _LIBCUDACXX_HIDE_FROM_ABI void uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __x)
152
+ {
153
+ typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
154
+ (void) _CUDA_VSTD::__uninitialized_fill<_ValueType>(__first, __last, __x);
155
+ }
156
+
157
+ // uninitialized_fill_n
158
+
159
+ template <class _ValueType, class _ForwardIterator, class _Size, class _Tp>
160
+ _LIBCUDACXX_HIDE_FROM_ABI _ForwardIterator __uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x)
161
+ {
162
+ _ForwardIterator __idx = __first;
163
+ auto __guard = __make_exception_guard(__simple_rollback<_ForwardIterator>{__first, __idx});
164
+ for (; __n > 0; ++__idx, (void) --__n)
165
+ {
166
+ ::new (_CUDA_VSTD::__voidify(*__idx)) _ValueType(__x);
167
+ }
168
+ __guard.__complete();
169
+
170
+ return __idx;
171
+ }
172
+
173
+ template <class _ForwardIterator, class _Size, class _Tp>
174
+ _LIBCUDACXX_HIDE_FROM_ABI _ForwardIterator uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x)
175
+ {
176
+ typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
177
+ return _CUDA_VSTD::__uninitialized_fill_n<_ValueType>(__first, __n, __x);
178
+ }
179
+
180
+ // uninitialized_default_construct
181
+
182
+ template <class _ValueType, class _ForwardIterator, class _Sentinel>
183
+ _LIBCUDACXX_HIDE_FROM_ABI _ForwardIterator __uninitialized_default_construct(_ForwardIterator __first, _Sentinel __last)
184
+ {
185
+ auto __idx = __first;
186
+ auto __guard = __make_exception_guard(__simple_rollback<_ForwardIterator>{__first, __idx});
187
+ for (; __idx != __last; ++__idx)
188
+ {
189
+ ::new (_CUDA_VSTD::__voidify(*__idx)) _ValueType;
190
+ }
191
+ __guard.__complete();
192
+
193
+ return __idx;
194
+ }
195
+
196
+ template <class _ForwardIterator>
197
+ _LIBCUDACXX_HIDE_FROM_ABI void uninitialized_default_construct(_ForwardIterator __first, _ForwardIterator __last)
198
+ {
199
+ using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
200
+ (void) _CUDA_VSTD::__uninitialized_default_construct<_ValueType>(_CUDA_VSTD::move(__first), _CUDA_VSTD::move(__last));
201
+ }
202
+
203
+ // uninitialized_default_construct_n
204
+
205
+ template <class _ValueType, class _ForwardIterator, class _Size>
206
+ _LIBCUDACXX_HIDE_FROM_ABI _ForwardIterator __uninitialized_default_construct_n(_ForwardIterator __first, _Size __n)
207
+ {
208
+ auto __idx = __first;
209
+ auto __guard = __make_exception_guard(__simple_rollback<_ForwardIterator>{__first, __idx});
210
+ for (; __n > 0; ++__idx, (void) --__n)
211
+ {
212
+ ::new (_CUDA_VSTD::__voidify(*__idx)) _ValueType;
213
+ }
214
+ __guard.__complete();
215
+
216
+ return __idx;
217
+ }
218
+
219
+ template <class _ForwardIterator, class _Size>
220
+ _LIBCUDACXX_HIDE_FROM_ABI _ForwardIterator uninitialized_default_construct_n(_ForwardIterator __first, _Size __n)
221
+ {
222
+ using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
223
+ return _CUDA_VSTD::__uninitialized_default_construct_n<_ValueType>(_CUDA_VSTD::move(__first), __n);
224
+ }
225
+
226
+ // uninitialized_value_construct
227
+
228
+ template <class _ValueType, class _ForwardIterator, class _Sentinel>
229
+ _LIBCUDACXX_HIDE_FROM_ABI _ForwardIterator __uninitialized_value_construct(_ForwardIterator __first, _Sentinel __last)
230
+ {
231
+ auto __idx = __first;
232
+ auto __guard = __make_exception_guard(__simple_rollback<_ForwardIterator>{__first, __idx});
233
+ for (; __idx != __last; ++__idx)
234
+ {
235
+ ::new (_CUDA_VSTD::__voidify(*__idx)) _ValueType();
236
+ }
237
+ __guard.__complete();
238
+
239
+ return __idx;
240
+ }
241
+
242
+ template <class _ForwardIterator>
243
+ _LIBCUDACXX_HIDE_FROM_ABI void uninitialized_value_construct(_ForwardIterator __first, _ForwardIterator __last)
244
+ {
245
+ using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
246
+ (void) _CUDA_VSTD::__uninitialized_value_construct<_ValueType>(_CUDA_VSTD::move(__first), _CUDA_VSTD::move(__last));
247
+ }
248
+
249
+ // uninitialized_value_construct_n
250
+
251
+ template <class _ValueType, class _ForwardIterator, class _Size>
252
+ _LIBCUDACXX_HIDE_FROM_ABI _ForwardIterator __uninitialized_value_construct_n(_ForwardIterator __first, _Size __n)
253
+ {
254
+ auto __idx = __first;
255
+ auto __guard = __make_exception_guard(__simple_rollback<_ForwardIterator>{__first, __idx});
256
+ for (; __n > 0; ++__idx, (void) --__n)
257
+ {
258
+ ::new (_CUDA_VSTD::__voidify(*__idx)) _ValueType();
259
+ }
260
+ __guard.__complete();
261
+
262
+ return __idx;
263
+ }
264
+
265
+ template <class _ForwardIterator, class _Size>
266
+ _LIBCUDACXX_HIDE_FROM_ABI _ForwardIterator uninitialized_value_construct_n(_ForwardIterator __first, _Size __n)
267
+ {
268
+ using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
269
+ return _CUDA_VSTD::__uninitialized_value_construct_n<_ValueType>(_CUDA_VSTD::move(__first), __n);
270
+ }
271
+
272
+ // uninitialized_move
273
+
274
+ template <class _ValueType,
275
+ class _IterOps,
276
+ class _InputIterator,
277
+ class _Sentinel1,
278
+ class _ForwardIterator,
279
+ class _EndPredicate>
280
+ _LIBCUDACXX_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitialized_move(
281
+ _InputIterator __ifirst, _Sentinel1 __ilast, _ForwardIterator __ofirst, _EndPredicate __stop_moving)
282
+ {
283
+ auto __idx = __ofirst;
284
+ auto __guard = __make_exception_guard(__simple_rollback<_ForwardIterator>{__ofirst, __idx});
285
+ for (; __ifirst != __ilast && !__stop_moving(__idx); ++__idx, (void) ++__ifirst)
286
+ {
287
+ ::new (_CUDA_VSTD::__voidify(*__idx)) _ValueType(_IterOps::__iter_move(__ifirst));
288
+ }
289
+ __guard.__complete();
290
+
291
+ return {_CUDA_VSTD::move(__ifirst), _CUDA_VSTD::move(__idx)};
292
+ }
293
+
294
+ template <class _InputIterator, class _ForwardIterator>
295
+ _LIBCUDACXX_HIDE_FROM_ABI _ForwardIterator
296
+ uninitialized_move(_InputIterator __ifirst, _InputIterator __ilast, _ForwardIterator __ofirst)
297
+ {
298
+ using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
299
+ auto __result = _CUDA_VSTD::__uninitialized_move<_ValueType, _IterOps<_ClassicAlgPolicy>>(
300
+ _CUDA_VSTD::move(__ifirst), _CUDA_VSTD::move(__ilast), _CUDA_VSTD::move(__ofirst), __always_false{});
301
+ return _CUDA_VSTD::move(__result.second);
302
+ }
303
+
304
+ // uninitialized_move_n
305
+
306
+ template <class _ValueType, class _IterOps, class _InputIterator, class _Size, class _ForwardIterator, class _EndPredicate>
307
+ _LIBCUDACXX_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator>
308
+ __uninitialized_move_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst, _EndPredicate __stop_moving)
309
+ {
310
+ auto __idx = __ofirst;
311
+ auto __guard = __make_exception_guard(__simple_rollback<_ForwardIterator>{__ofirst, __idx});
312
+ for (; __n > 0 && !__stop_moving(__idx); ++__idx, (void) ++__ifirst, --__n)
313
+ {
314
+ ::new (_CUDA_VSTD::__voidify(*__idx)) _ValueType(_IterOps::__iter_move(__ifirst));
315
+ }
316
+ __guard.__complete();
317
+
318
+ return {_CUDA_VSTD::move(__ifirst), _CUDA_VSTD::move(__idx)};
319
+ }
320
+
321
+ template <class _InputIterator, class _Size, class _ForwardIterator>
322
+ _LIBCUDACXX_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator>
323
+ uninitialized_move_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst)
324
+ {
325
+ using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
326
+ return _CUDA_VSTD::__uninitialized_move_n<_ValueType, _IterOps<_ClassicAlgPolicy>>(
327
+ _CUDA_VSTD::move(__ifirst), __n, _CUDA_VSTD::move(__ofirst), __always_false{});
328
+ }
329
+
330
+ // TODO: Rewrite this to iterate left to right and use reverse_iterators when calling
331
+ // Destroys every element in the range [first, last) FROM RIGHT TO LEFT using allocator
332
+ // destruction. If elements are themselves C-style arrays, they are recursively destroyed
333
+ // in the same manner.
334
+ //
335
+ // This function assumes that destructors do not throw, and that the allocator is bound to
336
+ // the correct type.
337
+ template <class _Alloc, class _BidirIter, enable_if_t<__is_cpp17_bidirectional_iterator<_BidirIter>::value, int> = 0>
338
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 void
339
+ __allocator_destroy_multidimensional(_Alloc& __alloc, _BidirIter __first, _BidirIter __last) noexcept
340
+ {
341
+ using _ValueType = typename iterator_traits<_BidirIter>::value_type;
342
+ static_assert(_CCCL_TRAIT(is_same, typename allocator_traits<_Alloc>::value_type, _ValueType),
343
+ "The allocator should already be rebound to the correct type");
344
+
345
+ if (__first == __last)
346
+ {
347
+ return;
348
+ }
349
+
350
+ _CCCL_IF_CONSTEXPR (_CCCL_TRAIT(is_array, _ValueType))
351
+ {
352
+ static_assert(!__cccl_is_unbounded_array<_ValueType>::value,
353
+ "arrays of unbounded arrays don't exist, but if they did we would mess up here");
354
+
355
+ using _Element = remove_extent_t<_ValueType>;
356
+ __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc);
357
+ do
358
+ {
359
+ --__last;
360
+ auto&& __array = *__last;
361
+ _CUDA_VSTD::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + _CCCL_TRAIT(extent, _ValueType));
362
+ } while (__last != __first);
363
+ }
364
+ else
365
+ {
366
+ do
367
+ {
368
+ --__last;
369
+ allocator_traits<_Alloc>::destroy(__alloc, _CUDA_VSTD::addressof(*__last));
370
+ } while (__last != __first);
371
+ }
372
+ }
373
+
374
+ // Constructs the object at the given location using the allocator's construct method.
375
+ //
376
+ // If the object being constructed is an array, each element of the array is allocator-constructed,
377
+ // recursively. If an exception is thrown during the construction of an array, the initialized
378
+ // elements are destroyed in reverse order of initialization using allocator destruction.
379
+ //
380
+ // This function assumes that the allocator is bound to the correct type.
381
+ template <class _Alloc, class _Tp>
382
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 void
383
+ __allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* __loc)
384
+ {
385
+ static_assert(_CCCL_TRAIT(is_same, typename allocator_traits<_Alloc>::value_type, _Tp),
386
+ "The allocator should already be rebound to the correct type");
387
+
388
+ _CCCL_IF_CONSTEXPR (_CCCL_TRAIT(is_array, _Tp))
389
+ {
390
+ using _Element = remove_extent_t<_Tp>;
391
+ __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc);
392
+ size_t __i = 0;
393
+ _Tp& __array = *__loc;
394
+
395
+ // If an exception is thrown, destroy what we have constructed so far in reverse order.
396
+ auto __guard = _CUDA_VSTD::__make_exception_guard([&]() {
397
+ _CUDA_VSTD::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i);
398
+ });
399
+
400
+ for (; __i != _CCCL_TRAIT(extent, _Tp); ++__i)
401
+ {
402
+ _CUDA_VSTD::__allocator_construct_at_multidimensional(__elem_alloc, _CUDA_VSTD::addressof(__array[__i]));
403
+ }
404
+ __guard.__complete();
405
+ }
406
+ else
407
+ {
408
+ allocator_traits<_Alloc>::construct(__alloc, __loc);
409
+ }
410
+ }
411
+
412
+ // Constructs the object at the given location using the allocator's construct method, passing along
413
+ // the provided argument.
414
+ //
415
+ // If the object being constructed is an array, the argument is also assumed to be an array. Each
416
+ // each element of the array being constructed is allocator-constructed from the corresponding
417
+ // element of the argument array. If an exception is thrown during the construction of an array,
418
+ // the initialized elements are destroyed in reverse order of initialization using allocator
419
+ // destruction.
420
+ //
421
+ // This function assumes that the allocator is bound to the correct type.
422
+ template <class _Alloc, class _Tp, class _Arg>
423
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 void
424
+ __allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* __loc, _Arg const& __arg)
425
+ {
426
+ static_assert(_CCCL_TRAIT(is_same, typename allocator_traits<_Alloc>::value_type, _Tp),
427
+ "The allocator should already be rebound to the correct type");
428
+
429
+ _CCCL_IF_CONSTEXPR (_CCCL_TRAIT(is_array, _Tp))
430
+ {
431
+ static_assert(_CCCL_TRAIT(is_array, _Arg),
432
+ "Provided non-array initialization argument to __allocator_construct_at_multidimensional when "
433
+ "trying to construct an array.");
434
+
435
+ using _Element = remove_extent_t<_Tp>;
436
+ __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc);
437
+ size_t __i = 0;
438
+ _Tp& __array = *__loc;
439
+
440
+ // If an exception is thrown, destroy what we have constructed so far in reverse order.
441
+ auto __guard = _CUDA_VSTD::__make_exception_guard([&]() {
442
+ _CUDA_VSTD::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i);
443
+ });
444
+ for (; __i != _CCCL_TRAIT(extent, _Tp); ++__i)
445
+ {
446
+ _CUDA_VSTD::__allocator_construct_at_multidimensional(
447
+ __elem_alloc, _CUDA_VSTD::addressof(__array[__i]), __arg[__i]);
448
+ }
449
+ __guard.__complete();
450
+ }
451
+ else
452
+ {
453
+ allocator_traits<_Alloc>::construct(__alloc, __loc, __arg);
454
+ }
455
+ }
456
+
457
+ // Given a range starting at it and containing n elements, initializes each element in the
458
+ // range from left to right using the construct method of the allocator (rebound to the
459
+ // correct type).
460
+ //
461
+ // If an exception is thrown, the initialized elements are destroyed in reverse order of
462
+ // initialization using allocator_traits destruction. If the elements in the range are C-style
463
+ // arrays, they are initialized element-wise using allocator construction, and recursively so.
464
+ template <class _Alloc, class _BidirIter, class _Tp, class _Size = typename iterator_traits<_BidirIter>::difference_type>
465
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 void
466
+ __uninitialized_allocator_fill_n_multidimensional(_Alloc& __alloc, _BidirIter __it, _Size __n, _Tp const& __value)
467
+ {
468
+ using _ValueType = typename iterator_traits<_BidirIter>::value_type;
469
+ __allocator_traits_rebind_t<_Alloc, _ValueType> __value_alloc(__alloc);
470
+ _BidirIter __begin = __it;
471
+
472
+ // If an exception is thrown, destroy what we have constructed so far in reverse order.
473
+ auto __guard = _CUDA_VSTD::__make_exception_guard([&]() {
474
+ _CUDA_VSTD::__allocator_destroy_multidimensional(__value_alloc, __begin, __it);
475
+ });
476
+ for (; __n != 0; --__n, ++__it)
477
+ {
478
+ _CUDA_VSTD::__allocator_construct_at_multidimensional(__value_alloc, _CUDA_VSTD::addressof(*__it), __value);
479
+ }
480
+ __guard.__complete();
481
+ }
482
+
483
+ // Same as __uninitialized_allocator_fill_n_multidimensional, but doesn't pass any initialization argument
484
+ // to the allocator's construct method, which results in value initialization.
485
+ template <class _Alloc, class _BidirIter, class _Size = typename iterator_traits<_BidirIter>::difference_type>
486
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 void
487
+ __uninitialized_allocator_value_construct_n_multidimensional(_Alloc& __alloc, _BidirIter __it, _Size __n)
488
+ {
489
+ using _ValueType = typename iterator_traits<_BidirIter>::value_type;
490
+ __allocator_traits_rebind_t<_Alloc, _ValueType> __value_alloc(__alloc);
491
+ _BidirIter __begin = __it;
492
+
493
+ // If an exception is thrown, destroy what we have constructed so far in reverse order.
494
+ auto __guard = _CUDA_VSTD::__make_exception_guard([&]() {
495
+ _CUDA_VSTD::__allocator_destroy_multidimensional(__value_alloc, __begin, __it);
496
+ });
497
+ for (; __n != 0; --__n, ++__it)
498
+ {
499
+ _CUDA_VSTD::__allocator_construct_at_multidimensional(__value_alloc, _CUDA_VSTD::addressof(*__it));
500
+ }
501
+ __guard.__complete();
502
+ }
503
+
504
+ // Destroy all elements in [__first, __last) from left to right using allocator destruction.
505
+ template <class _Alloc, class _Iter, class _Sent>
506
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 void __allocator_destroy(_Alloc& __alloc, _Iter __first, _Sent __last)
507
+ {
508
+ for (; __first != __last; ++__first)
509
+ {
510
+ allocator_traits<_Alloc>::destroy(__alloc, _CUDA_VSTD::__to_address(__first));
511
+ }
512
+ }
513
+
514
+ template <class _Alloc, class _Iter>
515
+ class _AllocatorDestroyRangeReverse
516
+ {
517
+ public:
518
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14
519
+ _AllocatorDestroyRangeReverse(_Alloc& __alloc, _Iter& __first, _Iter& __last)
520
+ : __alloc_(__alloc)
521
+ , __first_(__first)
522
+ , __last_(__last)
523
+ {}
524
+
525
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 void operator()() const
526
+ {
527
+ _CUDA_VSTD::__allocator_destroy(
528
+ __alloc_, _CUDA_VSTD::reverse_iterator<_Iter>(__last_), _CUDA_VSTD::reverse_iterator<_Iter>(__first_));
529
+ }
530
+
531
+ private:
532
+ _Alloc& __alloc_;
533
+ _Iter& __first_;
534
+ _Iter& __last_;
535
+ };
536
+
537
+ // Copy-construct [__first1, __last1) in [__first2, __first2 + N), where N is distance(__first1, __last1).
538
+ //
539
+ // The caller has to ensure that __first2 can hold at least N uninitialized elements. If an exception is thrown the
540
+ // already copied elements are destroyed in reverse order of their construction.
541
+ template <class _Alloc, class _Iter1, class _Sent1, class _Iter2>
542
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 _Iter2
543
+ __uninitialized_allocator_copy_impl(_Alloc& __alloc, _Iter1 __first1, _Sent1 __last1, _Iter2 __first2)
544
+ {
545
+ auto __destruct_first = __first2;
546
+ auto __guard = _CUDA_VSTD::__make_exception_guard(
547
+ _AllocatorDestroyRangeReverse<_Alloc, _Iter2>(__alloc, __destruct_first, __first2));
548
+ while (__first1 != __last1)
549
+ {
550
+ allocator_traits<_Alloc>::construct(__alloc, _CUDA_VSTD::__to_address(__first2), *__first1);
551
+ ++__first1;
552
+ ++__first2;
553
+ }
554
+ __guard.__complete();
555
+ return __first2;
556
+ }
557
+
558
+ template <class _Alloc, class _Type>
559
+ struct __allocator_has_trivial_copy_construct : _Not<__has_construct<_Alloc, _Type*, const _Type&>>
560
+ {};
561
+
562
+ template <class _Type>
563
+ struct __allocator_has_trivial_copy_construct<allocator<_Type>, _Type> : true_type
564
+ {};
565
+
566
+ template <
567
+ class _Alloc,
568
+ class _In,
569
+ class _RawTypeIn = remove_const_t<_In>,
570
+ class _Out,
571
+ enable_if_t<
572
+ // using _RawTypeIn because of the allocator<T const> extension
573
+ _CCCL_TRAIT(is_trivially_copy_constructible, _RawTypeIn) && _CCCL_TRAIT(is_trivially_copy_assignable, _RawTypeIn)
574
+ && _CCCL_TRAIT(is_same, remove_const_t<_In>, remove_const_t<_Out>)
575
+ && __allocator_has_trivial_copy_construct<_Alloc, _RawTypeIn>::value>* = nullptr>
576
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 _Out*
577
+ __uninitialized_allocator_copy_impl(_Alloc&, _In* __first1, _In* __last1, _Out* __first2)
578
+ {
579
+ if (_CUDA_VSTD::is_constant_evaluated())
580
+ {
581
+ while (__first1 != __last1)
582
+ {
583
+ _CUDA_VSTD::__construct_at(_CUDA_VSTD::__to_address(__first2), *__first1);
584
+ ++__first1;
585
+ ++__first2;
586
+ }
587
+ return __first2;
588
+ }
589
+ else
590
+ {
591
+ return _CUDA_VSTD::copy(__first1, __last1, __first2);
592
+ }
593
+ }
594
+
595
+ template <class _Alloc, class _Iter1, class _Sent1, class _Iter2>
596
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 _Iter2
597
+ __uninitialized_allocator_copy(_Alloc& __alloc, _Iter1 __first1, _Sent1 __last1, _Iter2 __first2)
598
+ {
599
+ auto __unwrapped_range = _CUDA_VSTD::__unwrap_range(__first1, __last1);
600
+ auto __result = _CUDA_VSTD::__uninitialized_allocator_copy_impl(
601
+ __alloc, __unwrapped_range.first, __unwrapped_range.second, _CUDA_VSTD::__unwrap_iter(__first2));
602
+ return _CUDA_VSTD::__rewrap_iter(__first2, __result);
603
+ }
604
+
605
+ // Move-construct the elements [__first1, __last1) into [__first2, __first2 + N)
606
+ // if the move constructor is noexcept, where N is distance(__first1, __last1).
607
+ //
608
+ // Otherwise try to copy all elements. If an exception is thrown the already copied
609
+ // elements are destroyed in reverse order of their construction.
610
+ template <class _Alloc, class _Iter1, class _Sent1, class _Iter2>
611
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 _Iter2
612
+ __uninitialized_allocator_move_if_noexcept(_Alloc& __alloc, _Iter1 __first1, _Sent1 __last1, _Iter2 __first2)
613
+ {
614
+ static_assert(__is_cpp17_move_insertable<_Alloc>::value,
615
+ "The specified type does not meet the requirements of Cpp17MoveInsertable");
616
+ auto __destruct_first = __first2;
617
+ auto __guard = _CUDA_VSTD::__make_exception_guard(
618
+ _AllocatorDestroyRangeReverse<_Alloc, _Iter2>(__alloc, __destruct_first, __first2));
619
+ while (__first1 != __last1)
620
+ {
621
+ #ifndef _CCCL_NO_EXCEPTIONS
622
+ allocator_traits<_Alloc>::construct(
623
+ __alloc, _CUDA_VSTD::__to_address(__first2), _CUDA_VSTD::move_if_noexcept(*__first1));
624
+ #else // ^^^ !_CCCL_NO_EXCEPTIONS ^^^ / vvv _CCCL_NO_EXCEPTIONS vvv
625
+ allocator_traits<_Alloc>::construct(__alloc, _CUDA_VSTD::__to_address(__first2), _CUDA_VSTD::move(*__first1));
626
+ #endif // _CCCL_NO_EXCEPTIONS
627
+ ++__first1;
628
+ ++__first2;
629
+ }
630
+ __guard.__complete();
631
+ return __first2;
632
+ }
633
+
634
+ template <class _Alloc, class _Type>
635
+ struct __allocator_has_trivial_move_construct : _Not<__has_construct<_Alloc, _Type*, _Type&&>>
636
+ {};
637
+
638
+ template <class _Type>
639
+ struct __allocator_has_trivial_move_construct<allocator<_Type>, _Type> : true_type
640
+ {};
641
+
642
+ #if !_CCCL_COMPILER(GCC)
643
+ template <class _Alloc,
644
+ class _Iter1,
645
+ class _Iter2,
646
+ class _Type = typename iterator_traits<_Iter1>::value_type,
647
+ class = enable_if_t<_CCCL_TRAIT(is_trivially_move_constructible, _Type)
648
+ && _CCCL_TRAIT(is_trivially_move_assignable, _Type)
649
+ && __allocator_has_trivial_move_construct<_Alloc, _Type>::value>>
650
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 _Iter2
651
+ __uninitialized_allocator_move_if_noexcept(_Alloc&, _Iter1 __first1, _Iter1 __last1, _Iter2 __first2)
652
+ {
653
+ if (_CUDA_VSTD::is_constant_evaluated())
654
+ {
655
+ while (__first1 != __last1)
656
+ {
657
+ _CUDA_VSTD::__construct_at(_CUDA_VSTD::__to_address(__first2), _CUDA_VSTD::move(*__first1));
658
+ ++__first1;
659
+ ++__first2;
660
+ }
661
+ return __first2;
662
+ }
663
+ else
664
+ {
665
+ return _CUDA_VSTD::move(__first1, __last1, __first2);
666
+ }
667
+ }
668
+ #endif // !_CCCL_COMPILER(GCC)
669
+
670
+ _LIBCUDACXX_END_NAMESPACE_STD
671
+
672
+ #endif // _LIBCUDACXX___MEMORY_UNINITIALIZED_ALGORITHMS_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/unique_ptr.h ADDED
@@ -0,0 +1,761 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of libcu++, the C++ Standard Library for your entire system,
5
+ // under the Apache License v2.0 with LLVM Exceptions.
6
+ // See https://llvm.org/LICENSE.txt for license information.
7
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
+ // SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
9
+ //
10
+ //===----------------------------------------------------------------------===//
11
+
12
+ #ifndef _LIBCUDACXX___MEMORY_UNIQUE_PTR_H
13
+ #define _LIBCUDACXX___MEMORY_UNIQUE_PTR_H
14
+
15
+ #include <cuda/std/detail/__config>
16
+
17
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
18
+ # pragma GCC system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
20
+ # pragma clang system_header
21
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
22
+ # pragma system_header
23
+ #endif // no system header
24
+
25
+ #include <cuda/std/cstddef>
26
+ #ifndef _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR
27
+ # include <cuda/std/__compare/compare_three_way.h>
28
+ # include <cuda/std/__compare/compare_three_way_result.h>
29
+ # include <cuda/std/__compare/three_way_comparable.h>
30
+ #endif // _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR
31
+ #include <cuda/std/__functional/hash.h>
32
+ #include <cuda/std/__functional/operations.h>
33
+ #include <cuda/std/__memory/allocator_traits.h> // __pointer
34
+ #include <cuda/std/__memory/compressed_pair.h>
35
+ #include <cuda/std/__type_traits/add_lvalue_reference.h>
36
+ #include <cuda/std/__type_traits/common_type.h>
37
+ #include <cuda/std/__type_traits/dependent_type.h>
38
+ #include <cuda/std/__type_traits/integral_constant.h>
39
+ #include <cuda/std/__type_traits/is_array.h>
40
+ #include <cuda/std/__type_traits/is_assignable.h>
41
+ #include <cuda/std/__type_traits/is_constructible.h>
42
+ #include <cuda/std/__type_traits/is_convertible.h>
43
+ #include <cuda/std/__type_traits/is_default_constructible.h>
44
+ #include <cuda/std/__type_traits/is_function.h>
45
+ #include <cuda/std/__type_traits/is_pointer.h>
46
+ #include <cuda/std/__type_traits/is_reference.h>
47
+ #include <cuda/std/__type_traits/is_same.h>
48
+ #include <cuda/std/__type_traits/is_swappable.h>
49
+ #include <cuda/std/__type_traits/is_void.h>
50
+ #include <cuda/std/__type_traits/remove_extent.h>
51
+ #include <cuda/std/__type_traits/type_identity.h>
52
+ #include <cuda/std/__utility/forward.h>
53
+ #include <cuda/std/__utility/move.h>
54
+
55
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
56
+
57
+ template <class _Tp>
58
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT default_delete
59
+ {
60
+ static_assert(!_CCCL_TRAIT(is_function, _Tp), "default_delete cannot be instantiated for function types");
61
+
62
+ _CCCL_HIDE_FROM_ABI constexpr default_delete() noexcept = default;
63
+
64
+ template <class _Up>
65
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20
66
+ default_delete(const default_delete<_Up>&, enable_if_t<_CCCL_TRAIT(is_convertible, _Up*, _Tp*), int> = 0) noexcept
67
+ {}
68
+
69
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 void operator()(_Tp* __ptr) const noexcept
70
+ {
71
+ static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type");
72
+ static_assert(!is_void<_Tp>::value, "cannot delete an incomplete type");
73
+ delete __ptr;
74
+ }
75
+ };
76
+
77
+ template <class _Tp>
78
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT default_delete<_Tp[]>
79
+ {
80
+ _CCCL_HIDE_FROM_ABI constexpr default_delete() noexcept = default;
81
+
82
+ template <class _Up>
83
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 default_delete(
84
+ const default_delete<_Up[]>&, enable_if_t<_CCCL_TRAIT(is_convertible, _Up (*)[], _Tp (*)[]), int> = 0) noexcept
85
+ {}
86
+
87
+ template <class _Up>
88
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 enable_if_t<_CCCL_TRAIT(is_convertible, _Up (*)[], _Tp (*)[]), void>
89
+ operator()(_Up* __ptr) const noexcept
90
+ {
91
+ static_assert(sizeof(_Up) >= 0, "cannot delete an incomplete type");
92
+ delete[] __ptr;
93
+ }
94
+ };
95
+
96
+ template <class _Deleter>
97
+ struct __unique_ptr_deleter_sfinae
98
+ {
99
+ static_assert(!_CCCL_TRAIT(is_reference, _Deleter), "incorrect specialization");
100
+ typedef const _Deleter& __lval_ref_type;
101
+ typedef _Deleter&& __good_rval_ref_type;
102
+ typedef true_type __enable_rval_overload;
103
+ };
104
+
105
+ template <class _Deleter>
106
+ struct __unique_ptr_deleter_sfinae<_Deleter const&>
107
+ {
108
+ typedef const _Deleter& __lval_ref_type;
109
+ typedef const _Deleter&& __bad_rval_ref_type;
110
+ typedef false_type __enable_rval_overload;
111
+ };
112
+
113
+ template <class _Deleter>
114
+ struct __unique_ptr_deleter_sfinae<_Deleter&>
115
+ {
116
+ typedef _Deleter& __lval_ref_type;
117
+ typedef _Deleter&& __bad_rval_ref_type;
118
+ typedef false_type __enable_rval_overload;
119
+ };
120
+
121
+ #if defined(_LIBCUDACXX_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI)
122
+ # define _LIBCUDACXX_UNIQUE_PTR_TRIVIAL_ABI __attribute__((__trivial_abi__))
123
+ #else
124
+ # define _LIBCUDACXX_UNIQUE_PTR_TRIVIAL_ABI
125
+ #endif
126
+
127
+ template <class _Tp, class _Dp = default_delete<_Tp>>
128
+ class _LIBCUDACXX_UNIQUE_PTR_TRIVIAL_ABI _CCCL_TYPE_VISIBILITY_DEFAULT unique_ptr
129
+ {
130
+ public:
131
+ typedef _Tp element_type;
132
+ typedef _Dp deleter_type;
133
+ typedef _CCCL_NODEBUG_ALIAS typename __pointer<_Tp, deleter_type>::type pointer;
134
+
135
+ static_assert(!_CCCL_TRAIT(is_rvalue_reference, deleter_type),
136
+ "the specified deleter type cannot be an rvalue reference");
137
+
138
+ private:
139
+ __compressed_pair<pointer, deleter_type> __ptr_;
140
+
141
+ struct __nat
142
+ {
143
+ int __for_bool_;
144
+ };
145
+
146
+ typedef _CCCL_NODEBUG_ALIAS __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE;
147
+
148
+ template <bool _Dummy>
149
+ using _LValRefType _CCCL_NODEBUG_ALIAS = typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;
150
+
151
+ template <bool _Dummy>
152
+ using _GoodRValRefType _CCCL_NODEBUG_ALIAS = typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;
153
+
154
+ template <bool _Dummy>
155
+ using _BadRValRefType _CCCL_NODEBUG_ALIAS = typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;
156
+
157
+ template <bool _Dummy, class _Deleter = typename __dependent_type<type_identity<deleter_type>, _Dummy>::type>
158
+ using _EnableIfDeleterDefaultConstructible _CCCL_NODEBUG_ALIAS =
159
+ typename enable_if<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value>::type;
160
+
161
+ template <class _ArgType>
162
+ using _EnableIfDeleterConstructible _CCCL_NODEBUG_ALIAS =
163
+ typename enable_if<is_constructible<deleter_type, _ArgType>::value>::type;
164
+
165
+ template <class _UPtr, class _Up>
166
+ using _EnableIfMoveConvertible _CCCL_NODEBUG_ALIAS =
167
+ typename enable_if<is_convertible<typename _UPtr::pointer, pointer>::value && !is_array<_Up>::value>::type;
168
+
169
+ template <class _UDel>
170
+ using _EnableIfDeleterConvertible _CCCL_NODEBUG_ALIAS =
171
+ typename enable_if<(is_reference<_Dp>::value && is_same<_Dp, _UDel>::value)
172
+ || (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value)>::type;
173
+
174
+ template <class _UDel>
175
+ using _EnableIfDeleterAssignable = typename enable_if<is_assignable<_Dp&, _UDel&&>::value>::type;
176
+
177
+ public:
178
+ template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy>>
179
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr unique_ptr() noexcept
180
+ : __ptr_(__value_init_tag(), __value_init_tag())
181
+ {}
182
+
183
+ template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy>>
184
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr unique_ptr(nullptr_t) noexcept
185
+ : __ptr_(__value_init_tag(), __value_init_tag())
186
+ {}
187
+
188
+ template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy>>
189
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 explicit unique_ptr(pointer __p) noexcept
190
+ : __ptr_(__p, __value_init_tag())
191
+ {}
192
+
193
+ template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy>>>
194
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 unique_ptr(pointer __p, _LValRefType<_Dummy> __d) noexcept
195
+ : __ptr_(__p, __d)
196
+ {}
197
+
198
+ template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy>>>
199
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) noexcept
200
+ : __ptr_(__p, _CUDA_VSTD::move(__d))
201
+ {
202
+ static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference");
203
+ }
204
+
205
+ template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy>>>
206
+ _LIBCUDACXX_HIDE_FROM_ABI unique_ptr(pointer __p, _BadRValRefType<_Dummy> __d) = delete;
207
+
208
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 unique_ptr(unique_ptr&& __u) noexcept
209
+ : __ptr_(__u.release(), _CUDA_VSTD::forward<deleter_type>(__u.get_deleter()))
210
+ {}
211
+
212
+ template <class _Up,
213
+ class _Ep,
214
+ class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>,
215
+ class = _EnableIfDeleterConvertible<_Ep>>
216
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept
217
+ : __ptr_(__u.release(), _CUDA_VSTD::forward<_Ep>(__u.get_deleter()))
218
+ {}
219
+
220
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 unique_ptr& operator=(unique_ptr&& __u) noexcept
221
+ {
222
+ reset(__u.release());
223
+ __ptr_.second() = _CUDA_VSTD::forward<deleter_type>(__u.get_deleter());
224
+ return *this;
225
+ }
226
+
227
+ template <class _Up,
228
+ class _Ep,
229
+ class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>,
230
+ class = _EnableIfDeleterAssignable<_Ep>>
231
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 unique_ptr& operator=(unique_ptr<_Up, _Ep>&& __u) noexcept
232
+ {
233
+ reset(__u.release());
234
+ __ptr_.second() = _CUDA_VSTD::forward<_Ep>(__u.get_deleter());
235
+ return *this;
236
+ }
237
+
238
+ unique_ptr(unique_ptr const&) = delete;
239
+ unique_ptr& operator=(unique_ptr const&) = delete;
240
+
241
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 ~unique_ptr()
242
+ {
243
+ reset();
244
+ }
245
+
246
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 unique_ptr& operator=(nullptr_t) noexcept
247
+ {
248
+ reset();
249
+ return *this;
250
+ }
251
+
252
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 add_lvalue_reference_t<_Tp> operator*() const
253
+ {
254
+ return *__ptr_.first();
255
+ }
256
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 pointer operator->() const noexcept
257
+ {
258
+ return __ptr_.first();
259
+ }
260
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 pointer get() const noexcept
261
+ {
262
+ return __ptr_.first();
263
+ }
264
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 deleter_type& get_deleter() noexcept
265
+ {
266
+ return __ptr_.second();
267
+ }
268
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 const deleter_type& get_deleter() const noexcept
269
+ {
270
+ return __ptr_.second();
271
+ }
272
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 explicit operator bool() const noexcept
273
+ {
274
+ return __ptr_.first() != nullptr;
275
+ }
276
+
277
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 pointer release() noexcept
278
+ {
279
+ pointer __t = __ptr_.first();
280
+ __ptr_.first() = pointer();
281
+ return __t;
282
+ }
283
+
284
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 void reset(pointer __p = pointer()) noexcept
285
+ {
286
+ pointer __tmp = __ptr_.first();
287
+ __ptr_.first() = __p;
288
+ if (__tmp)
289
+ {
290
+ __ptr_.second()(__tmp);
291
+ }
292
+ }
293
+
294
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 void swap(unique_ptr& __u) noexcept
295
+ {
296
+ __ptr_.swap(__u.__ptr_);
297
+ }
298
+ };
299
+
300
+ template <class _Tp, class _Dp>
301
+ class _LIBCUDACXX_UNIQUE_PTR_TRIVIAL_ABI _CCCL_TYPE_VISIBILITY_DEFAULT unique_ptr<_Tp[], _Dp>
302
+ {
303
+ public:
304
+ typedef _Tp element_type;
305
+ typedef _Dp deleter_type;
306
+ typedef typename __pointer<_Tp, deleter_type>::type pointer;
307
+
308
+ private:
309
+ __compressed_pair<pointer, deleter_type> __ptr_;
310
+
311
+ template <class _From>
312
+ struct _CheckArrayPointerConversion : is_same<_From, pointer>
313
+ {};
314
+
315
+ template <class _FromElem>
316
+ struct _CheckArrayPointerConversion<_FromElem*>
317
+ : integral_constant<
318
+ bool,
319
+ is_same<_FromElem*, pointer>::value
320
+ || (is_same<pointer, element_type*>::value && is_convertible<_FromElem (*)[], element_type (*)[]>::value)>
321
+ {};
322
+
323
+ typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE;
324
+
325
+ template <bool _Dummy>
326
+ using _LValRefType _CCCL_NODEBUG_ALIAS = typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;
327
+
328
+ template <bool _Dummy>
329
+ using _GoodRValRefType _CCCL_NODEBUG_ALIAS = typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;
330
+
331
+ template <bool _Dummy>
332
+ using _BadRValRefType _CCCL_NODEBUG_ALIAS = typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;
333
+
334
+ template <bool _Dummy, class _Deleter = typename __dependent_type<type_identity<deleter_type>, _Dummy>::type>
335
+ using _EnableIfDeleterDefaultConstructible _CCCL_NODEBUG_ALIAS =
336
+ typename enable_if<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value>::type;
337
+
338
+ template <class _ArgType>
339
+ using _EnableIfDeleterConstructible _CCCL_NODEBUG_ALIAS =
340
+ typename enable_if<is_constructible<deleter_type, _ArgType>::value>::type;
341
+
342
+ template <class _Pp>
343
+ using _EnableIfPointerConvertible _CCCL_NODEBUG_ALIAS =
344
+ typename enable_if<_CheckArrayPointerConversion<_Pp>::value>::type;
345
+
346
+ template <class _UPtr, class _Up, class _ElemT = typename _UPtr::element_type>
347
+ using _EnableIfMoveConvertible _CCCL_NODEBUG_ALIAS = typename enable_if<
348
+ is_array<_Up>::value && is_same<pointer, element_type*>::value && is_same<typename _UPtr::pointer, _ElemT*>::value
349
+ && is_convertible<_ElemT (*)[], element_type (*)[]>::value>::type;
350
+
351
+ template <class _UDel>
352
+ using _EnableIfDeleterConvertible _CCCL_NODEBUG_ALIAS =
353
+ typename enable_if<(is_reference<_Dp>::value && is_same<_Dp, _UDel>::value)
354
+ || (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value)>::type;
355
+
356
+ template <class _UDel>
357
+ using _EnableIfDeleterAssignable _CCCL_NODEBUG_ALIAS = typename enable_if<is_assignable<_Dp&, _UDel&&>::value>::type;
358
+
359
+ public:
360
+ template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy>>
361
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr unique_ptr() noexcept
362
+ : __ptr_(__value_init_tag(), __value_init_tag())
363
+ {}
364
+
365
+ template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy>>
366
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr unique_ptr(nullptr_t) noexcept
367
+ : __ptr_(__value_init_tag(), __value_init_tag())
368
+ {}
369
+
370
+ template <class _Pp,
371
+ bool _Dummy = true,
372
+ class = _EnableIfDeleterDefaultConstructible<_Dummy>,
373
+ class = _EnableIfPointerConvertible<_Pp>>
374
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 explicit unique_ptr(_Pp __p) noexcept
375
+ : __ptr_(__p, __value_init_tag())
376
+ {}
377
+
378
+ template <class _Pp,
379
+ bool _Dummy = true,
380
+ class = _EnableIfDeleterConstructible<_LValRefType<_Dummy>>,
381
+ class = _EnableIfPointerConvertible<_Pp>>
382
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 unique_ptr(_Pp __p, _LValRefType<_Dummy> __d) noexcept
383
+ : __ptr_(__p, __d)
384
+ {}
385
+
386
+ template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy>>>
387
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 unique_ptr(nullptr_t, _LValRefType<_Dummy> __d) noexcept
388
+ : __ptr_(nullptr, __d)
389
+ {}
390
+
391
+ template <class _Pp,
392
+ bool _Dummy = true,
393
+ class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy>>,
394
+ class = _EnableIfPointerConvertible<_Pp>>
395
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 unique_ptr(_Pp __p, _GoodRValRefType<_Dummy> __d) noexcept
396
+ : __ptr_(__p, _CUDA_VSTD::move(__d))
397
+ {
398
+ static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference");
399
+ }
400
+
401
+ template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy>>>
402
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 unique_ptr(nullptr_t, _GoodRValRefType<_Dummy> __d) noexcept
403
+ : __ptr_(nullptr, _CUDA_VSTD::move(__d))
404
+ {
405
+ static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference");
406
+ }
407
+
408
+ template <class _Pp,
409
+ bool _Dummy = true,
410
+ class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy>>,
411
+ class = _EnableIfPointerConvertible<_Pp>>
412
+ _LIBCUDACXX_HIDE_FROM_ABI unique_ptr(_Pp __p, _BadRValRefType<_Dummy> __d) = delete;
413
+
414
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 unique_ptr(unique_ptr&& __u) noexcept
415
+ : __ptr_(__u.release(), _CUDA_VSTD::forward<deleter_type>(__u.get_deleter()))
416
+ {}
417
+
418
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 unique_ptr& operator=(unique_ptr&& __u) noexcept
419
+ {
420
+ reset(__u.release());
421
+ __ptr_.second() = _CUDA_VSTD::forward<deleter_type>(__u.get_deleter());
422
+ return *this;
423
+ }
424
+
425
+ template <class _Up,
426
+ class _Ep,
427
+ class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>,
428
+ class = _EnableIfDeleterConvertible<_Ep>>
429
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept
430
+ : __ptr_(__u.release(), _CUDA_VSTD::forward<_Ep>(__u.get_deleter()))
431
+ {}
432
+
433
+ template <class _Up,
434
+ class _Ep,
435
+ class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>,
436
+ class = _EnableIfDeleterAssignable<_Ep>>
437
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 unique_ptr& operator=(unique_ptr<_Up, _Ep>&& __u) noexcept
438
+ {
439
+ reset(__u.release());
440
+ __ptr_.second() = _CUDA_VSTD::forward<_Ep>(__u.get_deleter());
441
+ return *this;
442
+ }
443
+
444
+ public:
445
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 ~unique_ptr()
446
+ {
447
+ reset();
448
+ }
449
+
450
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 unique_ptr& operator=(nullptr_t) noexcept
451
+ {
452
+ reset();
453
+ return *this;
454
+ }
455
+
456
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 add_lvalue_reference_t<_Tp> operator[](size_t __i) const
457
+ {
458
+ return __ptr_.first()[__i];
459
+ }
460
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 pointer get() const noexcept
461
+ {
462
+ return __ptr_.first();
463
+ }
464
+
465
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 deleter_type& get_deleter() noexcept
466
+ {
467
+ return __ptr_.second();
468
+ }
469
+
470
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 const deleter_type& get_deleter() const noexcept
471
+ {
472
+ return __ptr_.second();
473
+ }
474
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 explicit operator bool() const noexcept
475
+ {
476
+ return __ptr_.first() != nullptr;
477
+ }
478
+
479
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 pointer release() noexcept
480
+ {
481
+ pointer __t = __ptr_.first();
482
+ __ptr_.first() = pointer();
483
+ return __t;
484
+ }
485
+
486
+ template <class _Pp, enable_if_t<_CheckArrayPointerConversion<_Pp>::value, int> = 0>
487
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 void reset(_Pp __p) noexcept
488
+ {
489
+ pointer __tmp = __ptr_.first();
490
+ __ptr_.first() = __p;
491
+ if (__tmp)
492
+ {
493
+ __ptr_.second()(__tmp);
494
+ }
495
+ }
496
+
497
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 void reset(nullptr_t = nullptr) noexcept
498
+ {
499
+ pointer __tmp = __ptr_.first();
500
+ __ptr_.first() = nullptr;
501
+ if (__tmp)
502
+ {
503
+ __ptr_.second()(__tmp);
504
+ }
505
+ }
506
+
507
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 void swap(unique_ptr& __u) noexcept
508
+ {
509
+ __ptr_.swap(__u.__ptr_);
510
+ }
511
+ };
512
+
513
+ template <class _Tp, class _Dp>
514
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 enable_if_t<__is_swappable<_Dp>::value, void>
515
+ swap(unique_ptr<_Tp, _Dp>& __x, unique_ptr<_Tp, _Dp>& __y) noexcept
516
+ {
517
+ __x.swap(__y);
518
+ }
519
+
520
+ template <class _T1, class _D1, class _T2, class _D2>
521
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 bool
522
+ operator==(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y)
523
+ {
524
+ return __x.get() == __y.get();
525
+ }
526
+
527
+ #if _CCCL_STD_VER <= 2017
528
+ template <class _T1, class _D1, class _T2, class _D2>
529
+ _LIBCUDACXX_HIDE_FROM_ABI
530
+
531
+ bool
532
+ operator!=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y)
533
+ {
534
+ return !(__x == __y);
535
+ }
536
+ #endif
537
+
538
+ template <class _T1, class _D1, class _T2, class _D2>
539
+ _LIBCUDACXX_HIDE_FROM_ABI
540
+
541
+ bool
542
+ operator<(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y)
543
+ {
544
+ typedef typename unique_ptr<_T1, _D1>::pointer _P1;
545
+ typedef typename unique_ptr<_T2, _D2>::pointer _P2;
546
+ typedef typename common_type<_P1, _P2>::type _Vp;
547
+ return less<_Vp>()(__x.get(), __y.get());
548
+ }
549
+
550
+ template <class _T1, class _D1, class _T2, class _D2>
551
+ _LIBCUDACXX_HIDE_FROM_ABI
552
+
553
+ bool
554
+ operator>(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y)
555
+ {
556
+ return __y < __x;
557
+ }
558
+
559
+ template <class _T1, class _D1, class _T2, class _D2>
560
+ _LIBCUDACXX_HIDE_FROM_ABI
561
+
562
+ bool
563
+ operator<=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y)
564
+ {
565
+ return !(__y < __x);
566
+ }
567
+
568
+ template <class _T1, class _D1, class _T2, class _D2>
569
+ _LIBCUDACXX_HIDE_FROM_ABI
570
+
571
+ bool
572
+ operator>=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y)
573
+ {
574
+ return !(__x < __y);
575
+ }
576
+
577
+ #ifndef _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR
578
+ # if _CCCL_STD_VER >= 2020
579
+ template <class _T1, class _D1, class _T2, class _D2>
580
+ requires three_way_comparable_with<typename unique_ptr<_T1, _D1>::pointer, typename unique_ptr<_T2, _D2>::pointer>
581
+ _LIBCUDACXX_HIDE_FROM_ABI
582
+ compare_three_way_result_t<typename unique_ptr<_T1, _D1>::pointer, typename unique_ptr<_T2, _D2>::pointer>
583
+ operator<=>(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y)
584
+ {
585
+ return compare_three_way()(__x.get(), __y.get());
586
+ }
587
+ # endif // _CCCL_STD_VER >= 2020
588
+ #endif // _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR
589
+
590
+ template <class _T1, class _D1>
591
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 bool operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t) noexcept
592
+ {
593
+ return !__x;
594
+ }
595
+
596
+ #if _CCCL_STD_VER <= 2017
597
+ template <class _T1, class _D1>
598
+ _LIBCUDACXX_HIDE_FROM_ABI
599
+
600
+ bool
601
+ operator==(nullptr_t, const unique_ptr<_T1, _D1>& __x) noexcept
602
+ {
603
+ return !__x;
604
+ }
605
+
606
+ template <class _T1, class _D1>
607
+ _LIBCUDACXX_HIDE_FROM_ABI
608
+
609
+ bool
610
+ operator!=(const unique_ptr<_T1, _D1>& __x, nullptr_t) noexcept
611
+ {
612
+ return static_cast<bool>(__x);
613
+ }
614
+
615
+ template <class _T1, class _D1>
616
+ _LIBCUDACXX_HIDE_FROM_ABI
617
+
618
+ bool
619
+ operator!=(nullptr_t, const unique_ptr<_T1, _D1>& __x) noexcept
620
+ {
621
+ return static_cast<bool>(__x);
622
+ }
623
+ #endif // _CCCL_STD_VER <= 2017
624
+
625
+ template <class _T1, class _D1>
626
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 bool operator<(const unique_ptr<_T1, _D1>& __x, nullptr_t)
627
+ {
628
+ typedef typename unique_ptr<_T1, _D1>::pointer _P1;
629
+ return less<_P1>()(__x.get(), nullptr);
630
+ }
631
+
632
+ template <class _T1, class _D1>
633
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 bool operator<(nullptr_t, const unique_ptr<_T1, _D1>& __x)
634
+ {
635
+ typedef typename unique_ptr<_T1, _D1>::pointer _P1;
636
+ return less<_P1>()(nullptr, __x.get());
637
+ }
638
+
639
+ template <class _T1, class _D1>
640
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 bool operator>(const unique_ptr<_T1, _D1>& __x, nullptr_t)
641
+ {
642
+ return nullptr < __x;
643
+ }
644
+
645
+ template <class _T1, class _D1>
646
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 bool operator>(nullptr_t, const unique_ptr<_T1, _D1>& __x)
647
+ {
648
+ return __x < nullptr;
649
+ }
650
+
651
+ template <class _T1, class _D1>
652
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 bool operator<=(const unique_ptr<_T1, _D1>& __x, nullptr_t)
653
+ {
654
+ return !(nullptr < __x);
655
+ }
656
+
657
+ template <class _T1, class _D1>
658
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 bool operator<=(nullptr_t, const unique_ptr<_T1, _D1>& __x)
659
+ {
660
+ return !(__x < nullptr);
661
+ }
662
+
663
+ template <class _T1, class _D1>
664
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 bool operator>=(const unique_ptr<_T1, _D1>& __x, nullptr_t)
665
+ {
666
+ return !(__x < nullptr);
667
+ }
668
+
669
+ template <class _T1, class _D1>
670
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 bool operator>=(nullptr_t, const unique_ptr<_T1, _D1>& __x)
671
+ {
672
+ return !(nullptr < __x);
673
+ }
674
+
675
+ #ifndef _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR
676
+ # if _CCCL_STD_VER >= 2020
677
+ template <class _T1, class _D1>
678
+ requires three_way_comparable<typename unique_ptr<_T1, _D1>::pointer>
679
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 compare_three_way_result_t<typename unique_ptr<_T1, _D1>::pointer>
680
+ operator<=>(const unique_ptr<_T1, _D1>& __x, nullptr_t)
681
+ {
682
+ return compare_three_way()(__x.get(), static_cast<typename unique_ptr<_T1, _D1>::pointer>(nullptr));
683
+ }
684
+ # endif // _CCCL_STD_VER >= 2020
685
+ #endif // _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR
686
+
687
+ template <class _Tp>
688
+ struct __unique_if
689
+ {
690
+ typedef unique_ptr<_Tp> __unique_single;
691
+ };
692
+
693
+ template <class _Tp>
694
+ struct __unique_if<_Tp[]>
695
+ {
696
+ typedef unique_ptr<_Tp[]> __unique_array_unknown_bound;
697
+ };
698
+
699
+ template <class _Tp, size_t _Np>
700
+ struct __unique_if<_Tp[_Np]>
701
+ {
702
+ typedef void __unique_array_known_bound;
703
+ };
704
+
705
+ template <class _Tp, class... _Args>
706
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 typename __unique_if<_Tp>::__unique_single make_unique(_Args&&... __args)
707
+ {
708
+ return unique_ptr<_Tp>(new _Tp(_CUDA_VSTD::forward<_Args>(__args)...));
709
+ }
710
+
711
+ template <class _Tp>
712
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 typename __unique_if<_Tp>::__unique_array_unknown_bound
713
+ make_unique(size_t __n)
714
+ {
715
+ typedef remove_extent_t<_Tp> _Up;
716
+ return unique_ptr<_Tp>(new _Up[__n]());
717
+ }
718
+
719
+ template <class _Tp, class... _Args>
720
+ _LIBCUDACXX_HIDE_FROM_ABI typename __unique_if<_Tp>::__unique_array_known_bound make_unique(_Args&&...) = delete;
721
+
722
+ template <class _Tp>
723
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 typename __unique_if<_Tp>::__unique_single make_unique_for_overwrite()
724
+ {
725
+ return unique_ptr<_Tp>(new _Tp);
726
+ }
727
+
728
+ template <class _Tp>
729
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 typename __unique_if<_Tp>::__unique_array_unknown_bound
730
+ make_unique_for_overwrite(size_t __n)
731
+ {
732
+ return unique_ptr<_Tp>(new remove_extent_t<_Tp>[__n]);
733
+ }
734
+
735
+ template <class _Tp, class... _Args>
736
+ _LIBCUDACXX_HIDE_FROM_ABI typename __unique_if<_Tp>::__unique_array_known_bound
737
+ make_unique_for_overwrite(_Args&&...) = delete;
738
+
739
+ template <class _Tp>
740
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT hash;
741
+
742
+ #ifndef __cuda_std__
743
+ template <class _Tp, class _Dp>
744
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT hash<unique_ptr<_Tp, _Dp>>
745
+ {
746
+ # if _CCCL_STD_VER <= 2017 || defined(_LIBCUDACXX_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
747
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef unique_ptr<_Tp, _Dp> argument_type;
748
+ _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef size_t result_type;
749
+ # endif
750
+
751
+ _LIBCUDACXX_HIDE_FROM_ABI size_t operator()(const unique_ptr<_Tp, _Dp>& __ptr) const
752
+ {
753
+ typedef typename unique_ptr<_Tp, _Dp>::pointer pointer;
754
+ return hash<pointer>()(__ptr.get());
755
+ }
756
+ };
757
+ #endif // __cuda_std__
758
+
759
+ _LIBCUDACXX_END_NAMESPACE_STD
760
+
761
+ #endif // _LIBCUDACXX___MEMORY_UNIQUE_PTR_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/uses_allocator.h ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of libcu++, the C++ Standard Library for your entire system,
5
+ // under the Apache License v2.0 with LLVM Exceptions.
6
+ // See https://llvm.org/LICENSE.txt for license information.
7
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
+ // SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
9
+ //
10
+ //===----------------------------------------------------------------------===//
11
+
12
+ #ifndef _LIBCUDACXX___MEMORY_USES_ALLOCATOR_H
13
+ #define _LIBCUDACXX___MEMORY_USES_ALLOCATOR_H
14
+
15
+ #include <cuda/std/detail/__config>
16
+
17
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
18
+ # pragma GCC system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
20
+ # pragma clang system_header
21
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
22
+ # pragma system_header
23
+ #endif // no system header
24
+
25
+ #include <cuda/std/__type_traits/is_convertible.h>
26
+ #include <cuda/std/__type_traits/void_t.h>
27
+ #include <cuda/std/cstddef>
28
+
29
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
30
+
31
+ #if defined(_CCCL_NO_VARIABLE_TEMPLATES)
32
+ template <class _Tp, class = void>
33
+ struct __has_allocator_type : false_type
34
+ {};
35
+ template <class _Tp>
36
+ struct __has_allocator_type<_Tp, void_t<typename _Tp::allocator_type>> : true_type
37
+ {};
38
+
39
+ template <class _Tp, class _Alloc, bool = _CCCL_TRAIT(__has_allocator_type, _Tp)>
40
+ struct __uses_allocator : false_type
41
+ {};
42
+ template <class _Tp, class _Alloc>
43
+ struct __uses_allocator<_Tp, _Alloc, true> : is_convertible<_Alloc, typename _Tp::allocator_type>
44
+ {};
45
+ #else // ^^^ _CCCL_NO_VARIABLE_TEMPLATES ^^^ / vvv !_CCCL_NO_VARIABLE_TEMPLATES vvv
46
+ template <class _Tp, class = void>
47
+ _CCCL_INLINE_VAR constexpr bool __has_allocator_type_v = false;
48
+ template <class _Tp>
49
+ _CCCL_INLINE_VAR constexpr bool __has_allocator_type_v<_Tp, void_t<typename _Tp::allocator_type>> = true;
50
+
51
+ template <class _Tp, class _Alloc, bool = _CCCL_TRAIT(__has_allocator_type, _Tp)>
52
+ _CCCL_INLINE_VAR constexpr bool __uses_allocator_v = false;
53
+ template <class _Tp, class _Alloc>
54
+ _CCCL_INLINE_VAR constexpr bool __uses_allocator_v<_Tp, _Alloc, true> =
55
+ is_convertible_v<_Alloc, typename _Tp::allocator_type>;
56
+ #endif // !_CCCL_NO_VARIABLE_TEMPLATES
57
+
58
+ template <class _Tp, class _Alloc>
59
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT uses_allocator
60
+ : public integral_constant<bool, _CCCL_TRAIT(__uses_allocator, _Tp, _Alloc)>
61
+ {};
62
+
63
+ #if _CCCL_STD_VER >= 2014
64
+ template <class _Tp, class _Alloc>
65
+ _CCCL_INLINE_VAR constexpr bool uses_allocator_v = _CCCL_TRAIT(__uses_allocator, _Tp, _Alloc);
66
+ #endif // _CCCL_STD_VER >= 2014
67
+
68
+ _LIBCUDACXX_END_NAMESPACE_STD
69
+
70
+ #endif // _LIBCUDACXX___MEMORY_USES_ALLOCATOR_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/voidify.h ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES
8
+ //
9
+ //===----------------------------------------------------------------------===//
10
+
11
+ #ifndef _LIBCUDACXX___MEMORY_VOIDIFY_H
12
+ #define _LIBCUDACXX___MEMORY_VOIDIFY_H
13
+
14
+ #include <cuda/std/detail/__config>
15
+
16
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
17
+ # pragma GCC system_header
18
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
19
+ # pragma clang system_header
20
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
21
+ # pragma system_header
22
+ #endif // no system header
23
+
24
+ #include <cuda/std/__memory/addressof.h>
25
+
26
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
27
+
28
+ template <typename _Tp>
29
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 void* __voidify(_Tp& __from)
30
+ {
31
+ // Cast away cv-qualifiers to allow modifying elements of a range through const iterators.
32
+ return const_cast<void*>(static_cast<const volatile void*>(_CUDA_VSTD::addressof(__from)));
33
+ }
34
+
35
+ _LIBCUDACXX_END_NAMESPACE_STD
36
+
37
+ #endif // _LIBCUDACXX___MEMORY_VOIDIFY_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__string/string_view.h ADDED
@@ -0,0 +1,317 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___STRING_STRING_VIEW_H
11
+ #define _LIBCUDACXX___STRING_STRING_VIEW_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #ifndef _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR
24
+ # include <cuda/std/compare>
25
+ #endif
26
+ #include <cuda/std/__type_traits/is_constant_evaluated.h>
27
+ #include <cuda/std/cstddef>
28
+ #include <cuda/std/detail/libcxx/include/__string>
29
+ #include <cuda/std/detail/libcxx/include/stdexcept>
30
+
31
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
32
+
33
+ struct __string_view
34
+ {
35
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr __string_view(char const* __str, size_t __len) noexcept
36
+ : __str_(__str)
37
+ , __len_(__len)
38
+ {}
39
+
40
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr explicit __string_view(char const* __str) noexcept
41
+ : __str_(__str)
42
+ , __len_(__strlen_(__str))
43
+ {}
44
+
45
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr size_t size() const noexcept
46
+ {
47
+ return __len_;
48
+ }
49
+
50
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr char const* data() const noexcept
51
+ {
52
+ return __str_;
53
+ }
54
+
55
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr char const* begin() const noexcept
56
+ {
57
+ return __str_;
58
+ }
59
+
60
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr char const* end() const noexcept
61
+ {
62
+ return __str_ + __len_;
63
+ }
64
+
65
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr char const& operator[](ptrdiff_t __n) const noexcept
66
+ {
67
+ return __str_[__n];
68
+ }
69
+
70
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr __string_view substr(ptrdiff_t __start, ptrdiff_t __stop) const
71
+ {
72
+ return __string_view(__str_ + __check_offset(__start, __len_), __check_offset(__stop - __start, __len_));
73
+ }
74
+
75
+ // C++11 constexpr string comparison
76
+ #if _CCCL_STD_VER < 2014 || __cpp_constexpr < 201304L
77
+
78
+ private:
79
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI static constexpr int
80
+ __compare_(char const* __s1, size_t __len1, char const* __s2, size_t __len2, size_t __n) noexcept
81
+ {
82
+ return __n ? (*__s1 - *__s2 ? *__s1 - *__s2 : __compare_(__s1 + 1, __len1, __s2 + 1, __len2, __n - 1))
83
+ : int(__len1) - int(__len2);
84
+ }
85
+
86
+ template <bool _Forward>
87
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI static constexpr ptrdiff_t __try_find(
88
+ size_t __i,
89
+ const char* __needle,
90
+ size_t __needle_size,
91
+ char const* __haystack_begin,
92
+ char const* __haystack_end,
93
+ char const* __it) noexcept
94
+ {
95
+ return __i == __needle_size //
96
+ ? (_Forward ? __it - __haystack_begin : __it - __haystack_end - 1)
97
+ : __needle[__i] != (_Forward ? __it : __it - 1)[__i]
98
+ ? -1
99
+ : __try_find<_Forward>(__i + 1, __needle, __needle_size, __haystack_begin, __haystack_end, __it);
100
+ }
101
+
102
+ template <bool _Forward>
103
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI static constexpr ptrdiff_t __find(
104
+ ptrdiff_t __found,
105
+ const char* __needle,
106
+ size_t __needle_size,
107
+ char const* __haystack_begin,
108
+ char const* __haystack_end,
109
+ char const* __it) noexcept
110
+ {
111
+ return __found != -1 //
112
+ ? __found
113
+ : __it == __haystack_end
114
+ ? -1
115
+ : __find<_Forward>(
116
+ __try_find<_Forward>(0, __needle, __needle_size, __haystack_begin, __haystack_end, __it),
117
+ __needle,
118
+ __needle_size,
119
+ __haystack_begin,
120
+ __haystack_end,
121
+ (_Forward ? __it + 1 : __it - 1));
122
+ }
123
+
124
+ public:
125
+ template <size_t _Np>
126
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr ptrdiff_t find(const char (&__other)[_Np]) const noexcept
127
+ {
128
+ return (_Np - 1) > __len_
129
+ ? -1
130
+ : __find<true>(-1, __other, _Np - 1, __str_, __str_ + __len_ - (_Np - 1) + 1, __str_);
131
+ }
132
+
133
+ template <size_t _Np>
134
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr ptrdiff_t find_end(const char (&__other)[_Np]) const noexcept
135
+ {
136
+ return (_Np - 1) > __len_
137
+ ? -1
138
+ : __find<false>(
139
+ -1, __other, _Np - 1, __str_ + __len_ - (_Np - 1) + 1, __str_, __str_ + __len_ - (_Np - 1) + 1);
140
+ }
141
+
142
+ #else // ^^^ C++11 ^^^ / vvv C++14 and beyond vvv
143
+
144
+ private:
145
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI static constexpr int
146
+ __compare_(char const* __s1, size_t __len1, char const* __s2, size_t __len2, size_t __n) noexcept
147
+ {
148
+ if (__n)
149
+ {
150
+ for (;; ++__s1, ++__s2)
151
+ {
152
+ if (*__s1 < *__s2)
153
+ {
154
+ return -1;
155
+ }
156
+ if (*__s2 < *__s1)
157
+ {
158
+ return 1;
159
+ }
160
+ if (0 == --__n)
161
+ {
162
+ break;
163
+ }
164
+ }
165
+ }
166
+ return int(__len1) - int(__len2);
167
+ }
168
+
169
+ template <bool _Forward>
170
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI static constexpr ptrdiff_t
171
+ __find(const char* __needle, size_t __needle_size, const char* __haystack_begin, const char* __haystack_end) noexcept
172
+ {
173
+ char const* __it = __haystack_begin;
174
+ for (; __it != __haystack_end; (_Forward ? ++__it : --__it))
175
+ {
176
+ size_t __i = 0;
177
+ for (; __i != __needle_size; ++__i)
178
+ {
179
+ if ((_Forward ? __it : __it - 1)[__i] != __needle[__i])
180
+ {
181
+ break;
182
+ }
183
+ }
184
+ if (__i == __needle_size)
185
+ {
186
+ return _Forward ? __it - __haystack_begin : __it - __haystack_end - 1;
187
+ }
188
+ }
189
+ return -1;
190
+ }
191
+
192
+ public:
193
+ template <size_t _Np>
194
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr ptrdiff_t find(const char (&__other)[_Np]) const noexcept
195
+ {
196
+ return ((_Np - 1) > __len_) ? -1 : __find<true>(__other, _Np - 1, __str_, __str_ + __len_ - (_Np - 1) + 1);
197
+ }
198
+
199
+ template <size_t _Np>
200
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr ptrdiff_t find_end(const char (&__other)[_Np]) const noexcept
201
+ {
202
+ return ((_Np - 1) > __len_) ? -1 : __find<false>(__other, _Np - 1, __str_ + __len_ - (_Np - 1) + 1, __str_);
203
+ }
204
+
205
+ #endif // ^^^ C++14 and beyond ^^^
206
+
207
+ private:
208
+ // This overload is selected when we're not in a constant evaluated context.
209
+ // Compare the two strings' addresses as a shortcut, and fall back to a string
210
+ // comparison it they are not equal.
211
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI int __compare(__string_view const& __other, false_type) const noexcept
212
+ {
213
+ return __str_ == __other.__str_
214
+ ? int(__len_) - int(__other.__len_)
215
+ : __compare_(__str_, __len_, __other.__str_, __other.__len_, (__min_) (__len_, __other.__len_));
216
+ }
217
+
218
+ // This overload is selected when we're in a constant evaluated context. We
219
+ // cannot compare the two strings' addresses so fall back to a string
220
+ // comparison.
221
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr int
222
+ __compare(__string_view const& __other, true_type) const noexcept
223
+ {
224
+ return __compare_(__str_, __len_, __other.__str_, __other.__len_, (__min_) (__len_, __other.__len_));
225
+ }
226
+
227
+ public:
228
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr int compare(__string_view const& __other) const noexcept
229
+ {
230
+ // If we're in a constant evaluated context, we cannot compare the __str_
231
+ // members for equality.
232
+ return __compare(__other, bool_constant<__cccl_default_is_constant_evaluated()>());
233
+ }
234
+
235
+ _CCCL_NODISCARD_FRIEND _LIBCUDACXX_HIDE_FROM_ABI constexpr bool
236
+ operator==(__string_view const& __lhs, __string_view const& __rhs) noexcept
237
+ {
238
+ return __lhs.__len_ == __rhs.__len_ && __lhs.compare(__rhs) == 0;
239
+ }
240
+
241
+ #ifndef _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR
242
+
243
+ _CCCL_NODISCARD_FRIEND _LIBCUDACXX_HIDE_FROM_ABI constexpr auto
244
+ operator<=>(__string_view const& __lhs, __string_view const& __rhs) noexcept
245
+ {
246
+ return __lhs.compare(__rhs) <=> 0;
247
+ }
248
+
249
+ #else // ^^^ !_LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR ^^^ / vvv _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR
250
+
251
+ _CCCL_NODISCARD_FRIEND _LIBCUDACXX_HIDE_FROM_ABI constexpr bool
252
+ operator!=(__string_view const& __lhs, __string_view const& __rhs) noexcept
253
+ {
254
+ return !(__lhs == __rhs);
255
+ }
256
+
257
+ _CCCL_NODISCARD_FRIEND _LIBCUDACXX_HIDE_FROM_ABI constexpr bool
258
+ operator<(__string_view const& __lhs, __string_view const& __rhs) noexcept
259
+ {
260
+ return __lhs.compare(__rhs) < 0;
261
+ }
262
+
263
+ _CCCL_NODISCARD_FRIEND _LIBCUDACXX_HIDE_FROM_ABI constexpr bool
264
+ operator<=(__string_view const& __lhs, __string_view const& __rhs) noexcept
265
+ {
266
+ return __lhs.compare(__rhs) <= 0;
267
+ }
268
+
269
+ _CCCL_NODISCARD_FRIEND _LIBCUDACXX_HIDE_FROM_ABI constexpr bool
270
+ operator>(__string_view const& __lhs, __string_view const& __rhs) noexcept
271
+ {
272
+ return __lhs.compare(__rhs) > 0;
273
+ }
274
+
275
+ _CCCL_NODISCARD_FRIEND _LIBCUDACXX_HIDE_FROM_ABI constexpr bool
276
+ operator>=(__string_view const& __lhs, __string_view const& __rhs) noexcept
277
+ {
278
+ return __lhs.compare(__rhs) >= 0;
279
+ }
280
+
281
+ #endif // _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR
282
+
283
+ private:
284
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI static constexpr size_t __min_(size_t __x, size_t __y) noexcept
285
+ {
286
+ return __x < __y ? __x : __y;
287
+ }
288
+
289
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI static constexpr size_t
290
+ __strlen_0x_(char const* __str, size_t __len) noexcept
291
+ {
292
+ return *__str ? __strlen_0x_(__str + 1, __len + 1) : __len;
293
+ }
294
+
295
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI static constexpr size_t __strlen_(char const* __str) noexcept
296
+ {
297
+ #if _CCCL_STD_VER >= 2014
298
+ return _CUDA_VSTD::char_traits<char>::length(__str);
299
+ #else
300
+ return __strlen_0x_(__str, 0);
301
+ #endif
302
+ }
303
+
304
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI static constexpr size_t __check_offset(ptrdiff_t __diff, size_t __len)
305
+ {
306
+ return __diff < 0 || static_cast<size_t>(__diff) > __len
307
+ ? (_CUDA_VSTD::__throw_out_of_range("__string_view index out of range"), size_t(0))
308
+ : static_cast<size_t>(__diff);
309
+ }
310
+
311
+ char const* __str_;
312
+ size_t __len_;
313
+ };
314
+
315
+ _LIBCUDACXX_END_NAMESPACE_STD
316
+
317
+ #endif // _LIBCUDACXX___STRING_STRING_VIEW_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__thread/threading_support.h ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___THREAD_THREADING_SUPPORT_H
11
+ #define _LIBCUDACXX___THREAD_THREADING_SUPPORT_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #if !defined(_LIBCUDACXX_HAS_NO_THREADS)
24
+
25
+ # include <cuda/std/chrono>
26
+
27
+ # if defined(_LIBCUDACXX_HAS_THREAD_API_EXTERNAL)
28
+ # include <cuda/std/__thread/threading_support_external.h>
29
+ # endif // _LIBCUDACXX_HAS_THREAD_API_EXTERNAL
30
+
31
+ # if defined(_LIBCUDACXX_HAS_THREAD_API_CUDA)
32
+ # include <cuda/std/__thread/threading_support_cuda.h>
33
+ # elif defined(_LIBCUDACXX_HAS_THREAD_API_PTHREAD)
34
+ # include <cuda/std/__thread/threading_support_pthread.h>
35
+ # elif defined(_LIBCUDACXX_HAS_THREAD_API_WIN32)
36
+ # include <cuda/std/__thread/threading_support_win32.h>
37
+ # else // ^^^ _LIBCUDACXX_HAS_THREAD_API_WIN32 ^^^ / vvv Unknown Thread API vvv
38
+ # error "Unknown Thread API"
39
+ # endif // Unknown Thread API
40
+
41
+ _CCCL_PUSH_MACROS
42
+
43
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
44
+
45
+ # define _LIBCUDACXX_POLLING_COUNT 16
46
+
47
+ # if defined(__aarch64__)
48
+ # define __LIBCUDACXX_ASM_THREAD_YIELD (asm volatile("yield" :::);)
49
+ # elif defined(__x86_64__)
50
+ # define __LIBCUDACXX_ASM_THREAD_YIELD (asm volatile("pause" :::);)
51
+ # else // ^^^ __x86_64__ ^^^ / vvv !__x86_64__ vvv
52
+ # define __LIBCUDACXX_ASM_THREAD_YIELD (;)
53
+ # endif // !__x86_64__
54
+
55
+ _LIBCUDACXX_HIDE_FROM_ABI void __cccl_thread_yield_processor()
56
+ {
57
+ NV_IF_TARGET(NV_IS_HOST, __LIBCUDACXX_ASM_THREAD_YIELD)
58
+ }
59
+
60
+ template <class _Fn>
61
+ _LIBCUDACXX_HIDE_FROM_ABI bool __cccl_thread_poll_with_backoff(
62
+ _Fn&& __f, _CUDA_VSTD::chrono::nanoseconds __max = _CUDA_VSTD::chrono::nanoseconds::zero())
63
+ {
64
+ _CUDA_VSTD::chrono::high_resolution_clock::time_point const __start =
65
+ _CUDA_VSTD::chrono::high_resolution_clock::now();
66
+ for (int __count = 0;;)
67
+ {
68
+ if (__f())
69
+ {
70
+ return true;
71
+ }
72
+ if (__count < _LIBCUDACXX_POLLING_COUNT)
73
+ {
74
+ if (__count > (_LIBCUDACXX_POLLING_COUNT >> 1))
75
+ {
76
+ _CUDA_VSTD::__cccl_thread_yield_processor();
77
+ }
78
+ __count += 1;
79
+ continue;
80
+ }
81
+ _CUDA_VSTD::chrono::high_resolution_clock::duration const __elapsed =
82
+ _CUDA_VSTD::chrono::high_resolution_clock::now() - __start;
83
+ if (__max != _CUDA_VSTD::chrono::nanoseconds::zero() && __max < __elapsed)
84
+ {
85
+ return false;
86
+ }
87
+ _CUDA_VSTD::chrono::nanoseconds const __step = __elapsed / 4;
88
+ if (__step >= _CUDA_VSTD::chrono::milliseconds(1))
89
+ {
90
+ _CUDA_VSTD::__cccl_thread_sleep_for(_CUDA_VSTD::chrono::milliseconds(1));
91
+ }
92
+ else if (__step >= _CUDA_VSTD::chrono::microseconds(10))
93
+ {
94
+ _CUDA_VSTD::__cccl_thread_sleep_for(__step);
95
+ }
96
+ else
97
+ {
98
+ _CUDA_VSTD::__cccl_thread_yield();
99
+ }
100
+ }
101
+ }
102
+
103
+ _LIBCUDACXX_END_NAMESPACE_STD
104
+
105
+ _CCCL_POP_MACROS
106
+
107
+ #endif // !_LIBCUDACXX_HAS_NO_THREADS
108
+
109
+ #endif // _LIBCUDACXX___THREAD_THREADING_SUPPORT_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__thread/threading_support_cuda.h ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___THREAD_THREADING_SUPPORT_CUDA_H
11
+ #define _LIBCUDACXX___THREAD_THREADING_SUPPORT_CUDA_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #if !defined(_LIBCUDACXX_HAS_NO_THREADS) && defined(_LIBCUDACXX_HAS_THREAD_API_CUDA)
24
+
25
+ # include <cuda/std/chrono>
26
+ # include <cuda/std/climits>
27
+
28
+ _CCCL_PUSH_MACROS
29
+
30
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
31
+
32
+ _LIBCUDACXX_HIDE_FROM_ABI void __cccl_thread_yield() {}
33
+
34
+ _LIBCUDACXX_HIDE_FROM_ABI void __cccl_thread_sleep_for(_CUDA_VSTD::chrono::nanoseconds __ns)
35
+ {
36
+ NV_IF_TARGET(NV_IS_DEVICE,
37
+ (auto const __step = __ns.count(); assert(__step < numeric_limits<unsigned>::max());
38
+ asm volatile("nanosleep.u32 %0;" ::"r"((unsigned) __step)
39
+ :);))
40
+ }
41
+
42
+ _LIBCUDACXX_END_NAMESPACE_STD
43
+
44
+ _CCCL_POP_MACROS
45
+
46
+ #endif // !_LIBCUDACXX_HAS_NO_THREADS && _LIBCUDACXX_HAS_THREAD_API_CUDA
47
+
48
+ #endif // _LIBCUDACXX___THREAD_THREADING_SUPPORT_CUDA_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__thread/threading_support_external.h ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___THREAD_THREADING_SUPPORT_EXTERNAL_H
11
+ #define _LIBCUDACXX___THREAD_THREADING_SUPPORT_EXTERNAL_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #if !defined(_LIBCUDACXX_HAS_NO_THREADS) && defined(_LIBCUDACXX_HAS_THREAD_API_EXTERNAL)
24
+
25
+ # include <cuda/std/chrono>
26
+
27
+ _CCCL_PUSH_MACROS
28
+
29
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
30
+
31
+ _LIBCUDACXX_HIDE_FROM_ABI void __cccl_thread_yield();
32
+
33
+ _LIBCUDACXX_HIDE_FROM_ABI void __cccl_thread_sleep_for(_CUDA_VSTD::chrono::nanoseconds __ns);
34
+
35
+ _LIBCUDACXX_END_NAMESPACE_STD
36
+
37
+ _CCCL_POP_MACROS
38
+
39
+ #endif // !_LIBCUDACXX_HAS_NO_THREADS && _LIBCUDACXX_HAS_THREAD_API_EXTERNAL
40
+
41
+ #endif // _LIBCUDACXX___THREAD_THREADING_SUPPORT_EXTERNAL_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__thread/threading_support_pthread.h ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___THREAD_THREADING_SUPPORT_PTHREAD_H
11
+ #define _LIBCUDACXX___THREAD_THREADING_SUPPORT_PTHREAD_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #if !defined(_LIBCUDACXX_HAS_NO_THREADS) && defined(_LIBCUDACXX_HAS_THREAD_API_PTHREAD)
24
+
25
+ # include <cuda/std/chrono>
26
+ # include <cuda/std/climits>
27
+
28
+ # include <errno.h>
29
+ # include <pthread.h>
30
+ # include <sched.h>
31
+ # include <semaphore.h>
32
+ # if defined(__APPLE__)
33
+ # include <dispatch/dispatch.h>
34
+ # endif // __APPLE__
35
+ # if defined(__linux__)
36
+ # include <linux/futex.h>
37
+ # include <sys/syscall.h>
38
+ # include <unistd.h>
39
+ # endif // __linux__
40
+
41
+ _CCCL_PUSH_MACROS
42
+
43
+ typedef ::timespec __cccl_timespec_t;
44
+
45
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
46
+
47
+ // Mutex
48
+ typedef pthread_mutex_t __cccl_mutex_t;
49
+ # define _LIBCUDACXX_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
50
+
51
+ typedef pthread_mutex_t __cccl_recursive_mutex_t;
52
+
53
+ // Condition Variable
54
+ typedef pthread_cond_t __cccl_condvar_t;
55
+ # define _LIBCUDACXX_CONDVAR_INITIALIZER PTHREAD_COND_INITIALIZER
56
+
57
+ // Semaphore
58
+ # if defined(__APPLE__)
59
+ typedef dispatch_semaphore_t __cccl_semaphore_t;
60
+ # define _LIBCUDACXX_SEMAPHORE_MAX numeric_limits<long>::max()
61
+ # else // ^^^ __APPLE__ ^^^ / vvv !__APPLE__ vvv
62
+ typedef sem_t __cccl_semaphore_t;
63
+ # define _LIBCUDACXX_SEMAPHORE_MAX SEM_VALUE_MAX
64
+ # endif // !__APPLE__
65
+
66
+ // Execute once
67
+ typedef pthread_once_t __cccl_exec_once_flag;
68
+ # define _LIBCUDACXX_EXEC_ONCE_INITIALIZER PTHREAD_ONCE_INIT
69
+
70
+ // Thread id
71
+ typedef pthread_t __cccl_thread_id;
72
+
73
+ // Thread
74
+ # define _LIBCUDACXX_NULL_THREAD 0U
75
+
76
+ typedef pthread_t __cccl_thread_t;
77
+
78
+ // Thread Local Storage
79
+ typedef pthread_key_t __cccl_tls_key;
80
+
81
+ # define _LIBCUDACXX_TLS_DESTRUCTOR_CC
82
+
83
+ _LIBCUDACXX_HIDE_FROM_ABI __cccl_timespec_t __cccl_to_timespec(const _CUDA_VSTD::chrono::nanoseconds& __ns)
84
+ {
85
+ using namespace chrono;
86
+ seconds __s = duration_cast<seconds>(__ns);
87
+ __cccl_timespec_t __ts;
88
+ typedef decltype(__ts.tv_sec) ts_sec;
89
+ constexpr ts_sec __ts_sec_max = numeric_limits<ts_sec>::max();
90
+
91
+ if (__s.count() < __ts_sec_max)
92
+ {
93
+ __ts.tv_sec = static_cast<ts_sec>(__s.count());
94
+ __ts.tv_nsec = static_cast<decltype(__ts.tv_nsec)>((__ns - __s).count());
95
+ }
96
+ else
97
+ {
98
+ __ts.tv_sec = __ts_sec_max;
99
+ __ts.tv_nsec = 999999999; // (10^9 - 1)
100
+ }
101
+ return __ts;
102
+ }
103
+
104
+ // Semaphore
105
+ # if defined(__APPLE__)
106
+
107
+ _LIBCUDACXX_HIDE_FROM_ABI bool __cccl_semaphore_init(__cccl_semaphore_t* __sem, int __init)
108
+ {
109
+ return (*__sem = dispatch_semaphore_create(__init)) != nullptr;
110
+ }
111
+
112
+ _LIBCUDACXX_HIDE_FROM_ABI bool __cccl_semaphore_destroy(__cccl_semaphore_t* __sem)
113
+ {
114
+ dispatch_release(*__sem);
115
+ return true;
116
+ }
117
+
118
+ _LIBCUDACXX_HIDE_FROM_ABI bool __cccl_semaphore_post(__cccl_semaphore_t* __sem)
119
+ {
120
+ dispatch_semaphore_signal(*__sem);
121
+ return true;
122
+ }
123
+
124
+ _LIBCUDACXX_HIDE_FROM_ABI bool __cccl_semaphore_wait(__cccl_semaphore_t* __sem)
125
+ {
126
+ return dispatch_semaphore_wait(*__sem, DISPATCH_TIME_FOREVER) == 0;
127
+ }
128
+
129
+ _LIBCUDACXX_HIDE_FROM_ABI bool
130
+ __cccl_semaphore_wait_timed(__cccl_semaphore_t* __sem, _CUDA_VSTD::chrono::nanoseconds const& __ns)
131
+ {
132
+ return dispatch_semaphore_wait(*__sem, dispatch_time(DISPATCH_TIME_NOW, __ns.count())) == 0;
133
+ }
134
+
135
+ # else // ^^^ __APPLE__ ^^^ / vvv !__APPLE__ vvv
136
+
137
+ _LIBCUDACXX_HIDE_FROM_ABI bool __cccl_semaphore_init(__cccl_semaphore_t* __sem, int __init)
138
+ {
139
+ return sem_init(__sem, 0, __init) == 0;
140
+ }
141
+
142
+ _LIBCUDACXX_HIDE_FROM_ABI bool __cccl_semaphore_destroy(__cccl_semaphore_t* __sem)
143
+ {
144
+ return sem_destroy(__sem) == 0;
145
+ }
146
+
147
+ _LIBCUDACXX_HIDE_FROM_ABI bool __cccl_semaphore_post(__cccl_semaphore_t* __sem)
148
+ {
149
+ return sem_post(__sem) == 0;
150
+ }
151
+
152
+ _LIBCUDACXX_HIDE_FROM_ABI bool __cccl_semaphore_wait(__cccl_semaphore_t* __sem)
153
+ {
154
+ return sem_wait(__sem) == 0;
155
+ }
156
+
157
+ _LIBCUDACXX_HIDE_FROM_ABI bool
158
+ __cccl_semaphore_wait_timed(__cccl_semaphore_t* __sem, _CUDA_VSTD::chrono::nanoseconds const& __ns)
159
+ {
160
+ __cccl_timespec_t __ts = __cccl_to_timespec(__ns);
161
+ return sem_timedwait(__sem, &__ts) == 0;
162
+ }
163
+
164
+ # endif // !__APPLE__
165
+
166
+ _LIBCUDACXX_HIDE_FROM_ABI void __cccl_thread_yield()
167
+ {
168
+ sched_yield();
169
+ }
170
+
171
+ _LIBCUDACXX_HIDE_FROM_ABI void __cccl_thread_sleep_for(_CUDA_VSTD::chrono::nanoseconds __ns)
172
+ {
173
+ __cccl_timespec_t __ts = __cccl_to_timespec(__ns);
174
+ while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR)
175
+ ;
176
+ }
177
+
178
+ _LIBCUDACXX_END_NAMESPACE_STD
179
+
180
+ _CCCL_POP_MACROS
181
+
182
+ #endif // !_LIBCUDACXX_HAS_NO_THREADS
183
+
184
+ #endif // _LIBCUDACXX___THREAD_THREADING_SUPPORT_PTHREAD_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__thread/threading_support_win32.h ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___THREAD_THREADING_SUPPORT_WIN32_H
11
+ #define _LIBCUDACXX___THREAD_THREADING_SUPPORT_WIN32_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #if !defined(_LIBCUDACXX_HAS_NO_THREADS) && defined(_LIBCUDACXX_HAS_THREAD_API_WIN32)
24
+
25
+ # include <cuda/std/chrono>
26
+
27
+ # include <process.h>
28
+ # include <windows.h>
29
+
30
+ _CCCL_PUSH_MACROS
31
+
32
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
33
+
34
+ // Mutex
35
+ typedef void* __cccl_mutex_t;
36
+ # define _LIBCUDACXX_MUTEX_INITIALIZER 0
37
+
38
+ # if defined(_M_IX86) || defined(__i386__) || defined(_M_ARM) || defined(__arm__)
39
+ typedef void* __cccl_recursive_mutex_t[6];
40
+ # elif defined(_M_AMD64) || defined(__x86_64__) || defined(_M_ARM64) || defined(__aarch64__)
41
+ typedef void* __cccl_recursive_mutex_t[5];
42
+ # else
43
+ # error Unsupported architecture
44
+ # endif
45
+
46
+ // Condition Variable
47
+ typedef void* __cccl_condvar_t;
48
+ # define _LIBCUDACXX_CONDVAR_INITIALIZER 0
49
+
50
+ // Semaphore
51
+ typedef void* __cccl_semaphore_t;
52
+
53
+ // Execute Once
54
+ typedef void* __cccl_exec_once_flag;
55
+ # define _LIBCUDACXX_EXEC_ONCE_INITIALIZER 0
56
+
57
+ // Thread ID
58
+ typedef long __cccl_thread_id;
59
+
60
+ // Thread
61
+ # define _LIBCUDACXX_NULL_THREAD 0U
62
+
63
+ typedef void* __cccl_thread_t;
64
+
65
+ // Thread Local Storage
66
+ typedef long __cccl_tls_key;
67
+
68
+ # define _LIBCUDACXX_TLS_DESTRUCTOR_CC __stdcall
69
+
70
+ _LIBCUDACXX_HIDE_FROM_ABI void __cccl_thread_yield()
71
+ {
72
+ SwitchToThread();
73
+ }
74
+
75
+ _LIBCUDACXX_HIDE_FROM_ABI void __cccl_thread_sleep_for(chrono::nanoseconds __ns)
76
+ {
77
+ using namespace chrono;
78
+ // round-up to the nearest millisecond
79
+ milliseconds __ms = duration_cast<milliseconds>(__ns + chrono::nanoseconds(999999));
80
+ Sleep(static_cast<DWORD>(__ms.count()));
81
+ }
82
+
83
+ _LIBCUDACXX_END_NAMESPACE_STD
84
+
85
+ _CCCL_POP_MACROS
86
+
87
+ #endif // !_LIBCUDACXX_HAS_NO_THREADS && _LIBCUDACXX_HAS_THREAD_API_WIN32
88
+
89
+ #endif // _LIBCUDACXX___THREAD_THREADING_SUPPORT_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/add_cv.h ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___TYPE_TRAITS_ADD_CV_H
11
+ #define _LIBCUDACXX___TYPE_TRAITS_ADD_CV_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
24
+
25
+ template <class _Tp>
26
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT add_cv
27
+ {
28
+ typedef _CCCL_NODEBUG_ALIAS const volatile _Tp type;
29
+ };
30
+
31
+ template <class _Tp>
32
+ using add_cv_t _CCCL_NODEBUG_ALIAS = typename add_cv<_Tp>::type;
33
+
34
+ _LIBCUDACXX_END_NAMESPACE_STD
35
+
36
+ #endif // _LIBCUDACXX___TYPE_TRAITS_ADD_CV_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/add_lvalue_reference.h ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___TYPE_TRAITS_ADD_LVALUE_REFERENCE_H
11
+ #define _LIBCUDACXX___TYPE_TRAITS_ADD_LVALUE_REFERENCE_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #include <cuda/std/__type_traits/is_referenceable.h>
24
+
25
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
26
+
27
+ #if defined(_CCCL_BUILTIN_ADD_LVALUE_REFERENCE) && !defined(_LIBCUDACXX_USE_ADD_LVALUE_REFERENCE_FALLBACK)
28
+
29
+ template <class _Tp>
30
+ using add_lvalue_reference_t _CCCL_NODEBUG_ALIAS = _CCCL_BUILTIN_ADD_LVALUE_REFERENCE(_Tp);
31
+
32
+ #else // ^^^ _CCCL_BUILTIN_ADD_LVALUE_REFERENCE ^^^ / vvv !_CCCL_BUILTIN_ADD_LVALUE_REFERENCE vvv
33
+
34
+ template <class _Tp, bool = __cccl_is_referenceable<_Tp>::value>
35
+ struct __add_lvalue_reference_impl
36
+ {
37
+ typedef _CCCL_NODEBUG_ALIAS _Tp type;
38
+ };
39
+ template <class _Tp>
40
+ struct __add_lvalue_reference_impl<_Tp, true>
41
+ {
42
+ typedef _CCCL_NODEBUG_ALIAS _Tp& type;
43
+ };
44
+
45
+ template <class _Tp>
46
+ using add_lvalue_reference_t _CCCL_NODEBUG_ALIAS = typename __add_lvalue_reference_impl<_Tp>::type;
47
+
48
+ #endif // !_CCCL_BUILTIN_ADD_LVALUE_REFERENCE
49
+
50
+ template <class _Tp>
51
+ struct add_lvalue_reference
52
+ {
53
+ using type _CCCL_NODEBUG_ALIAS = add_lvalue_reference_t<_Tp>;
54
+ };
55
+
56
+ _LIBCUDACXX_END_NAMESPACE_STD
57
+
58
+ #endif // _LIBCUDACXX___TYPE_TRAITS_ADD_LVALUE_REFERENCE_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/add_pointer.h ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___TYPE_TRAITS_ADD_POINTER_H
11
+ #define _LIBCUDACXX___TYPE_TRAITS_ADD_POINTER_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #include <cuda/std/__type_traits/is_referenceable.h>
24
+ #include <cuda/std/__type_traits/is_same.h>
25
+ #include <cuda/std/__type_traits/is_void.h>
26
+ #include <cuda/std/__type_traits/remove_cv.h>
27
+ #include <cuda/std/__type_traits/remove_reference.h>
28
+
29
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
30
+
31
+ #if defined(_CCCL_BUILTIN_ADD_POINTER) && !defined(_LIBCUDACXX_USE_ADD_POINTER_FALLBACK)
32
+
33
+ template <class _Tp>
34
+ using add_pointer_t _CCCL_NODEBUG_ALIAS = _CCCL_BUILTIN_ADD_POINTER(_Tp);
35
+
36
+ #else // ^^^ _CCCL_BUILTIN_ADD_POINTER ^^^ / vvv !_CCCL_BUILTIN_ADD_POINTER vvv
37
+ template <class _Tp, bool = __cccl_is_referenceable<_Tp>::value || is_void<_Tp>::value>
38
+ struct __add_pointer_impl
39
+ {
40
+ typedef _CCCL_NODEBUG_ALIAS remove_reference_t<_Tp>* type;
41
+ };
42
+ template <class _Tp>
43
+ struct __add_pointer_impl<_Tp, false>
44
+ {
45
+ typedef _CCCL_NODEBUG_ALIAS _Tp type;
46
+ };
47
+
48
+ template <class _Tp>
49
+ using add_pointer_t _CCCL_NODEBUG_ALIAS = typename __add_pointer_impl<_Tp>::type;
50
+
51
+ #endif // !_CCCL_BUILTIN_ADD_POINTER
52
+
53
+ template <class _Tp>
54
+ struct add_pointer
55
+ {
56
+ using type _CCCL_NODEBUG_ALIAS = add_pointer_t<_Tp>;
57
+ };
58
+
59
+ _LIBCUDACXX_END_NAMESPACE_STD
60
+
61
+ #endif // _LIBCUDACXX___TYPE_TRAITS_ADD_POINTER_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/aligned_union.h ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___TYPE_TRAITS_ALIGNED_UNION_H
11
+ #define _LIBCUDACXX___TYPE_TRAITS_ALIGNED_UNION_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #include <cuda/std/__type_traits/aligned_storage.h>
24
+ #include <cuda/std/__type_traits/integral_constant.h>
25
+ #include <cuda/std/cstddef>
26
+
27
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
28
+
29
+ template <size_t _I0, size_t... _In>
30
+ struct __static_max;
31
+
32
+ template <size_t _I0>
33
+ struct __static_max<_I0>
34
+ {
35
+ static const size_t value = _I0;
36
+ };
37
+
38
+ template <size_t _I0, size_t _I1, size_t... _In>
39
+ struct __static_max<_I0, _I1, _In...>
40
+ {
41
+ static const size_t value = _I0 >= _I1 ? __static_max<_I0, _In...>::value : __static_max<_I1, _In...>::value;
42
+ };
43
+
44
+ template <size_t _Len, class _Type0, class... _Types>
45
+ struct aligned_union
46
+ {
47
+ static const size_t alignment_value =
48
+ __static_max<_LIBCUDACXX_PREFERRED_ALIGNOF(_Type0), _LIBCUDACXX_PREFERRED_ALIGNOF(_Types)...>::value;
49
+ static const size_t __len = __static_max<_Len, sizeof(_Type0), sizeof(_Types)...>::value;
50
+ typedef typename aligned_storage<__len, alignment_value>::type type;
51
+ };
52
+
53
+ template <size_t _Len, class... _Types>
54
+ using aligned_union_t _CCCL_NODEBUG_ALIAS = typename aligned_union<_Len, _Types...>::type;
55
+
56
+ _LIBCUDACXX_END_NAMESPACE_STD
57
+
58
+ #endif // _LIBCUDACXX___TYPE_TRAITS_ALIGNED_UNION_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/can_extract_key.h ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___TYPE_TRAITS_CAN_EXTRACT_KEY_H
11
+ #define _LIBCUDACXX___TYPE_TRAITS_CAN_EXTRACT_KEY_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #include <cuda/std/__fwd/pair.h>
24
+ #include <cuda/std/__type_traits/conditional.h>
25
+ #include <cuda/std/__type_traits/integral_constant.h>
26
+ #include <cuda/std/__type_traits/is_same.h>
27
+ #include <cuda/std/__type_traits/remove_const.h>
28
+ #include <cuda/std/__type_traits/remove_const_ref.h>
29
+
30
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
31
+
32
+ // These traits are used in __tree and __hash_table
33
+ struct __extract_key_fail_tag
34
+ {};
35
+ struct __extract_key_self_tag
36
+ {};
37
+ struct __extract_key_first_tag
38
+ {};
39
+
40
+ template <class _ValTy, class _Key, class _RawValTy = __remove_const_ref_t<_ValTy>>
41
+ struct __can_extract_key
42
+ : conditional_t<_IsSame<_RawValTy, _Key>::value, __extract_key_self_tag, __extract_key_fail_tag>
43
+ {};
44
+
45
+ template <class _Pair, class _Key, class _First, class _Second>
46
+ struct __can_extract_key<_Pair, _Key, pair<_First, _Second>>
47
+ : conditional_t<_IsSame<remove_const_t<_First>, _Key>::value, __extract_key_first_tag, __extract_key_fail_tag>
48
+ {};
49
+
50
+ // __can_extract_map_key uses true_type/false_type instead of the tags.
51
+ // It returns true if _Key != _ContainerValueTy (the container is a map not a set)
52
+ // and _ValTy == _Key.
53
+ template <class _ValTy, class _Key, class _ContainerValueTy, class _RawValTy = __remove_const_ref_t<_ValTy>>
54
+ struct __can_extract_map_key : integral_constant<bool, _IsSame<_RawValTy, _Key>::value>
55
+ {};
56
+
57
+ // This specialization returns __extract_key_fail_tag for non-map containers
58
+ // because _Key == _ContainerValueTy
59
+ template <class _ValTy, class _Key, class _RawValTy>
60
+ struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy> : false_type
61
+ {};
62
+
63
+ _LIBCUDACXX_END_NAMESPACE_STD
64
+
65
+ #endif // _LIBCUDACXX___TYPE_TRAITS_CAN_EXTRACT_KEY_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/conditional.h ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___TYPE_TRAITS_CONDITIONAL_H
11
+ #define _LIBCUDACXX___TYPE_TRAITS_CONDITIONAL_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
24
+
25
+ template <bool>
26
+ struct _IfImpl;
27
+
28
+ template <>
29
+ struct _IfImpl<true>
30
+ {
31
+ template <class _IfRes, class _ElseRes>
32
+ using _Select _CCCL_NODEBUG_ALIAS = _IfRes;
33
+ };
34
+
35
+ template <>
36
+ struct _IfImpl<false>
37
+ {
38
+ template <class _IfRes, class _ElseRes>
39
+ using _Select _CCCL_NODEBUG_ALIAS = _ElseRes;
40
+ };
41
+
42
+ template <bool _Cond, class _IfRes, class _ElseRes>
43
+ using _If _CCCL_NODEBUG_ALIAS = typename _IfImpl<_Cond>::template _Select<_IfRes, _ElseRes>;
44
+
45
+ template <bool _Bp, class _If, class _Then>
46
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT conditional
47
+ {
48
+ typedef _If type;
49
+ };
50
+ template <class _If, class _Then>
51
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT conditional<false, _If, _Then>
52
+ {
53
+ typedef _Then type;
54
+ };
55
+
56
+ template <bool _Bp, class _If, class _Then>
57
+ using conditional_t _CCCL_NODEBUG_ALIAS = typename conditional<_Bp, _If, _Then>::type;
58
+
59
+ _LIBCUDACXX_END_NAMESPACE_STD
60
+
61
+ #endif // _LIBCUDACXX___TYPE_TRAITS_CONDITIONAL_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/decay.h ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___TYPE_TRAITS_DECAY_H
11
+ #define _LIBCUDACXX___TYPE_TRAITS_DECAY_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #include <cuda/std/__type_traits/add_pointer.h>
24
+ #include <cuda/std/__type_traits/conditional.h>
25
+ #include <cuda/std/__type_traits/is_array.h>
26
+ #include <cuda/std/__type_traits/is_function.h>
27
+ #include <cuda/std/__type_traits/is_referenceable.h>
28
+ #include <cuda/std/__type_traits/remove_cv.h>
29
+ #include <cuda/std/__type_traits/remove_extent.h>
30
+ #include <cuda/std/__type_traits/remove_reference.h>
31
+
32
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
33
+
34
+ #if defined(_CCCL_BUILTIN_DECAY) && !defined(_LIBCUDACXX_USE_DECAY_FALLBACK)
35
+ template <class _Tp>
36
+ struct decay
37
+ {
38
+ using type _CCCL_NODEBUG_ALIAS = _CCCL_BUILTIN_DECAY(_Tp);
39
+ };
40
+
41
+ template <class _Tp>
42
+ using decay_t _CCCL_NODEBUG_ALIAS = _CCCL_BUILTIN_DECAY(_Tp);
43
+
44
+ #else // ^^^ _CCCL_BUILTIN_DECAY ^^^ / vvv !_CCCL_BUILTIN_DECAY vvv
45
+
46
+ template <class _Up, bool>
47
+ struct __decay_impl
48
+ {
49
+ typedef _CCCL_NODEBUG_ALIAS remove_cv_t<_Up> type;
50
+ };
51
+
52
+ template <class _Up>
53
+ struct __decay_impl<_Up, true>
54
+ {
55
+ public:
56
+ typedef _CCCL_NODEBUG_ALIAS conditional_t<is_array<_Up>::value,
57
+ remove_extent_t<_Up>*,
58
+ conditional_t<is_function<_Up>::value, add_pointer_t<_Up>, remove_cv_t<_Up>>>
59
+ type;
60
+ };
61
+
62
+ template <class _Tp>
63
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT decay
64
+ {
65
+ private:
66
+ typedef _CCCL_NODEBUG_ALIAS remove_reference_t<_Tp> _Up;
67
+
68
+ public:
69
+ typedef _CCCL_NODEBUG_ALIAS typename __decay_impl<_Up, __cccl_is_referenceable<_Up>::value>::type type;
70
+ };
71
+
72
+ template <class _Tp>
73
+ using decay_t _CCCL_NODEBUG_ALIAS = typename decay<_Tp>::type;
74
+
75
+ #endif // !_CCCL_BUILTIN_DECAY
76
+
77
+ _LIBCUDACXX_END_NAMESPACE_STD
78
+
79
+ #endif // _LIBCUDACXX___TYPE_TRAITS_DECAY_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/fold.h ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ // SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___TYPE_TRAITS_FOLD_H
11
+ #define _LIBCUDACXX___TYPE_TRAITS_FOLD_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #include <cuda/std/__type_traits/integral_constant.h>
24
+ #include <cuda/std/__type_traits/is_same.h>
25
+ #include <cuda/std/__type_traits/negation.h>
26
+
27
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
28
+
29
+ #if !defined(_CCCL_NO_FOLD_EXPRESSIONS)
30
+
31
+ // Use fold expressions when possible to implement __fold_and[_v] and
32
+ // __fold_or[_v].
33
+ template <bool... _Preds>
34
+ _CCCL_INLINE_VAR constexpr bool __fold_and_v = (_Preds && ...);
35
+
36
+ template <bool... _Preds>
37
+ _CCCL_INLINE_VAR constexpr bool __fold_or_v = (_Preds || ...);
38
+
39
+ template <bool... _Preds>
40
+ using __fold_and = bool_constant<bool((_Preds && ...))>; // cast to bool to avoid error from gcc < 8
41
+
42
+ template <bool... _Preds>
43
+ using __fold_or = bool_constant<bool((_Preds || ...))>; // cast to bool to avoid error from gcc < 8
44
+
45
+ #else // ^^^ !_CCCL_NO_FOLD_EXPRESSIONS / _CCCL_NO_FOLD_EXPRESSIONS vvv
46
+
47
+ // Otherwise, we can use a helper class to implement __fold_and and __fold_or.
48
+ template <bool... _Preds>
49
+ struct __fold_helper;
50
+
51
+ template <bool... _Preds>
52
+ using __fold_and = _IsSame<__fold_helper<true, _Preds...>, __fold_helper<_Preds..., true>>;
53
+
54
+ template <bool... _Preds>
55
+ using __fold_or = _Not<_IsSame<__fold_helper<false, _Preds...>, __fold_helper<_Preds..., false>>>;
56
+
57
+ # if !defined(_CCCL_NO_VARIABLE_TEMPLATES)
58
+ template <bool... _Preds>
59
+ _CCCL_INLINE_VAR constexpr bool __fold_and_v = __fold_and<_Preds...>::value;
60
+
61
+ template <bool... _Preds>
62
+ _CCCL_INLINE_VAR constexpr bool __fold_or_v = __fold_or<_Preds...>::value;
63
+ # endif // !_CCCL_NO_VARIABLE_TEMPLATES
64
+
65
+ #endif // _CCCL_NO_FOLD_EXPRESSIONS
66
+
67
+ _LIBCUDACXX_END_NAMESPACE_STD
68
+
69
+ #endif // _LIBCUDACXX___TYPE_TRAITS_FOLD_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/has_virtual_destructor.h ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___TYPE_TRAITS_HAS_VIRTUAL_DESTRUCTOR_H
11
+ #define _LIBCUDACXX___TYPE_TRAITS_HAS_VIRTUAL_DESTRUCTOR_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #include <cuda/std/__type_traits/integral_constant.h>
24
+
25
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
26
+
27
+ #if defined(_CCCL_BUILTIN_HAS_VIRTUAL_DESTRUCTOR) && !defined(_LIBCUDACXX_USE_HAS_VIRTUAL_DESTRUCTOR_FALLBACK)
28
+
29
+ template <class _Tp>
30
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT has_virtual_destructor
31
+ : public integral_constant<bool, _CCCL_BUILTIN_HAS_VIRTUAL_DESTRUCTOR(_Tp)>
32
+ {};
33
+
34
+ #else
35
+
36
+ template <class _Tp>
37
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT has_virtual_destructor : public false_type
38
+ {};
39
+
40
+ #endif // defined(_CCCL_BUILTIN_HAS_VIRTUAL_DESTRUCTOR) && !defined(_LIBCUDACXX_USE_HAS_VIRTUAL_DESTRUCTOR_FALLBACK)
41
+
42
+ #if !defined(_CCCL_NO_VARIABLE_TEMPLATES)
43
+ template <class _Tp>
44
+ _CCCL_INLINE_VAR constexpr bool has_virtual_destructor_v = has_virtual_destructor<_Tp>::value;
45
+ #endif // !_CCCL_NO_VARIABLE_TEMPLATES
46
+
47
+ _LIBCUDACXX_END_NAMESPACE_STD
48
+
49
+ #endif // _LIBCUDACXX___TYPE_TRAITS_HAS_VIRTUAL_DESTRUCTOR_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/is_abstract.h ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___TYPE_TRAITS_IS_ABSTRACT_H
11
+ #define _LIBCUDACXX___TYPE_TRAITS_IS_ABSTRACT_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #include <cuda/std/__type_traits/integral_constant.h>
24
+
25
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
26
+
27
+ template <class _Tp>
28
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT is_abstract : public integral_constant<bool, __is_abstract(_Tp)>
29
+ {};
30
+
31
+ #if !defined(_CCCL_NO_VARIABLE_TEMPLATES)
32
+ template <class _Tp>
33
+ _CCCL_INLINE_VAR constexpr bool is_abstract_v = __is_abstract(_Tp);
34
+ #endif // !_CCCL_NO_VARIABLE_TEMPLATES
35
+
36
+ _LIBCUDACXX_END_NAMESPACE_STD
37
+
38
+ #endif // _LIBCUDACXX___TYPE_TRAITS_IS_ABSTRACT_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/is_array.h ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___TYPE_TRAITS_IS_ARRAY_H
11
+ #define _LIBCUDACXX___TYPE_TRAITS_IS_ARRAY_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #include <cuda/std/__type_traits/integral_constant.h>
24
+ #include <cuda/std/cstddef>
25
+
26
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
27
+
28
+ // TODO: Clang incorrectly reports that __is_array is true for T[0].
29
+ // Re-enable the branch once https://llvm.org/PR54705 is fixed.
30
+ #if defined(_CCCL_BUILTIN_IS_ARRAY) && !defined(_LIBCUDACXX_USE_IS_ARRAY_FALLBACK)
31
+
32
+ template <class _Tp>
33
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT is_array : public integral_constant<bool, _CCCL_BUILTIN_IS_ARRAY(_Tp)>
34
+ {};
35
+
36
+ # if !defined(_CCCL_NO_VARIABLE_TEMPLATES)
37
+ template <class _Tp>
38
+ _CCCL_INLINE_VAR constexpr bool is_array_v = _CCCL_BUILTIN_IS_ARRAY(_Tp);
39
+ # endif // !_CCCL_NO_VARIABLE_TEMPLATES
40
+
41
+ #else
42
+
43
+ template <class _Tp>
44
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT is_array : public false_type
45
+ {};
46
+ template <class _Tp>
47
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT is_array<_Tp[]> : public true_type
48
+ {};
49
+ template <class _Tp, size_t _Np>
50
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT is_array<_Tp[_Np]> : public true_type
51
+ {};
52
+
53
+ # if !defined(_CCCL_NO_VARIABLE_TEMPLATES)
54
+ template <class _Tp>
55
+ _CCCL_INLINE_VAR constexpr bool is_array_v = is_array<_Tp>::value;
56
+ # endif // !_CCCL_NO_VARIABLE_TEMPLATES
57
+
58
+ #endif // defined(_CCCL_BUILTIN_IS_ARRAY) && !defined(_LIBCUDACXX_USE_IS_ARRAY_FALLBACK)
59
+
60
+ _LIBCUDACXX_END_NAMESPACE_STD
61
+
62
+ #endif // _LIBCUDACXX___TYPE_TRAITS_IS_ARRAY_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/is_assignable.h ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___TYPE_TRAITS_IS_ASSIGNABLE_H
11
+ #define _LIBCUDACXX___TYPE_TRAITS_IS_ASSIGNABLE_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #include <cuda/std/__type_traits/integral_constant.h>
24
+ #include <cuda/std/__type_traits/is_void.h>
25
+ #include <cuda/std/__utility/declval.h>
26
+
27
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
28
+
29
+ template <typename, typename _Tp>
30
+ struct __select_2nd
31
+ {
32
+ typedef _CCCL_NODEBUG_ALIAS _Tp type;
33
+ };
34
+
35
+ #if defined(_CCCL_BUILTIN_IS_ASSIGNABLE) && !defined(_LIBCUDACXX_USE_IS_ASSIGNABLE_FALLBACK)
36
+
37
+ template <class _T1, class _T2>
38
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT is_assignable
39
+ : public integral_constant<bool, _CCCL_BUILTIN_IS_ASSIGNABLE(_T1, _T2)>
40
+ {};
41
+
42
+ # if !defined(_CCCL_NO_VARIABLE_TEMPLATES)
43
+ template <class _T1, class _T2>
44
+ _CCCL_INLINE_VAR constexpr bool is_assignable_v = _CCCL_BUILTIN_IS_ASSIGNABLE(_T1, _T2);
45
+ # endif // !_CCCL_NO_VARIABLE_TEMPLATES
46
+
47
+ #else
48
+
49
+ template <class _Tp, class _Arg>
50
+ _LIBCUDACXX_HIDE_FROM_ABI
51
+ typename __select_2nd<decltype((_CUDA_VSTD::declval<_Tp>() = _CUDA_VSTD::declval<_Arg>())), true_type>::type
52
+ __is_assignable_test(int);
53
+
54
+ template <class, class>
55
+ _LIBCUDACXX_HIDE_FROM_ABI false_type __is_assignable_test(...);
56
+
57
+ template <class _Tp, class _Arg, bool = is_void<_Tp>::value || is_void<_Arg>::value>
58
+ struct __is_assignable_imp : public decltype((_CUDA_VSTD::__is_assignable_test<_Tp, _Arg>(0)))
59
+ {};
60
+
61
+ template <class _Tp, class _Arg>
62
+ struct __is_assignable_imp<_Tp, _Arg, true> : public false_type
63
+ {};
64
+
65
+ template <class _Tp, class _Arg>
66
+ struct is_assignable : public __is_assignable_imp<_Tp, _Arg>
67
+ {};
68
+
69
+ # if !defined(_CCCL_NO_VARIABLE_TEMPLATES)
70
+ template <class _Tp, class _Arg>
71
+ _CCCL_INLINE_VAR constexpr bool is_assignable_v = is_assignable<_Tp, _Arg>::value;
72
+ # endif // !_CCCL_NO_VARIABLE_TEMPLATES
73
+
74
+ #endif // defined(_CCCL_BUILTIN_IS_ASSIGNABLE) && !defined(_LIBCUDACXX_USE_IS_ASSIGNABLE_FALLBACK)
75
+
76
+ _LIBCUDACXX_END_NAMESPACE_STD
77
+
78
+ #endif // _LIBCUDACXX___TYPE_TRAITS_IS_ASSIGNABLE_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/is_compound.h ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___TYPE_TRAITS_IS_COMPOUND_H
11
+ #define _LIBCUDACXX___TYPE_TRAITS_IS_COMPOUND_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #include <cuda/std/__type_traits/integral_constant.h>
24
+ #include <cuda/std/__type_traits/is_fundamental.h>
25
+
26
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
27
+
28
+ #if defined(_CCCL_BUILTIN_IS_COMPOUND) && !defined(_LIBCUDACXX_USE_IS_COMPOUND_FALLBACK)
29
+
30
+ template <class _Tp>
31
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT is_compound : public integral_constant<bool, _CCCL_BUILTIN_IS_COMPOUND(_Tp)>
32
+ {};
33
+
34
+ # if !defined(_CCCL_NO_VARIABLE_TEMPLATES)
35
+ template <class _Tp>
36
+ _CCCL_INLINE_VAR constexpr bool is_compound_v = _CCCL_BUILTIN_IS_COMPOUND(_Tp);
37
+ # endif // !_CCCL_NO_VARIABLE_TEMPLATES
38
+
39
+ #else // ^^^ _CCCL_BUILTIN_IS_COMPOUND ^^^ / vvv !_CCCL_BUILTIN_IS_COMPOUND vvv
40
+
41
+ template <class _Tp>
42
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT is_compound : public integral_constant<bool, !is_fundamental<_Tp>::value>
43
+ {};
44
+
45
+ # if !defined(_CCCL_NO_VARIABLE_TEMPLATES)
46
+ template <class _Tp>
47
+ _CCCL_INLINE_VAR constexpr bool is_compound_v = is_compound<_Tp>::value;
48
+ # endif // !_CCCL_NO_VARIABLE_TEMPLATES
49
+
50
+ #endif // !_CCCL_BUILTIN_IS_COMPOUND
51
+
52
+ _LIBCUDACXX_END_NAMESPACE_STD
53
+
54
+ #endif // _LIBCUDACXX___TYPE_TRAITS_IS_COMPOUND_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/is_const.h ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___TYPE_TRAITS_IS_CONST_H
11
+ #define _LIBCUDACXX___TYPE_TRAITS_IS_CONST_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #include <cuda/std/__type_traits/integral_constant.h>
24
+
25
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
26
+
27
+ #if defined(_CCCL_BUILTIN_IS_CONST) && !defined(_LIBCUDACXX_USE_IS_CONST_FALLBACK)
28
+
29
+ template <class _Tp>
30
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT is_const : public integral_constant<bool, _CCCL_BUILTIN_IS_CONST(_Tp)>
31
+ {};
32
+
33
+ # if !defined(_CCCL_NO_VARIABLE_TEMPLATES)
34
+ template <class _Tp>
35
+ _CCCL_INLINE_VAR constexpr bool is_const_v = _CCCL_BUILTIN_IS_CONST(_Tp);
36
+ # endif // !_CCCL_NO_VARIABLE_TEMPLATES
37
+
38
+ #else // ^^^ _CCCL_BUILTIN_IS_CONST ^^^ / vvv !_CCCL_BUILTIN_IS_CONST vvv
39
+
40
+ template <class _Tp>
41
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT is_const : public false_type
42
+ {};
43
+ template <class _Tp>
44
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT is_const<_Tp const> : public true_type
45
+ {};
46
+
47
+ # if !defined(_CCCL_NO_VARIABLE_TEMPLATES)
48
+ template <class _Tp>
49
+ _CCCL_INLINE_VAR constexpr bool is_const_v = is_const<_Tp>::value;
50
+ # endif // !_CCCL_NO_VARIABLE_TEMPLATES
51
+
52
+ #endif // !_CCCL_BUILTIN_IS_CONST
53
+
54
+ _LIBCUDACXX_END_NAMESPACE_STD
55
+
56
+ #endif // _LIBCUDACXX___TYPE_TRAITS_IS_CONST_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/is_convertible.h ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
7
+ // SPDX-FileCopyrightText: Copyright (c) Microsoft Corporation.
8
+ //
9
+ //===----------------------------------------------------------------------===//
10
+
11
+ #ifndef _LIBCUDACXX___TYPE_TRAITS_IS_CONVERTIBLE_H
12
+ #define _LIBCUDACXX___TYPE_TRAITS_IS_CONVERTIBLE_H
13
+
14
+ #include <cuda/std/detail/__config>
15
+
16
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
17
+ # pragma GCC system_header
18
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
19
+ # pragma clang system_header
20
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
21
+ # pragma system_header
22
+ #endif // no system header
23
+
24
+ #include <cuda/std/__type_traits/integral_constant.h>
25
+ #include <cuda/std/__type_traits/is_array.h>
26
+ #include <cuda/std/__type_traits/is_function.h>
27
+ #include <cuda/std/__type_traits/is_void.h>
28
+ #include <cuda/std/__type_traits/remove_reference.h>
29
+ #include <cuda/std/__utility/declval.h>
30
+ #include <cuda/std/cstddef>
31
+
32
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
33
+
34
+ #if defined(_CCCL_BUILTIN_IS_CONVERTIBLE_TO) && !defined(_LIBCUDACXX_USE_IS_CONVERTIBLE_FALLBACK)
35
+
36
+ template <class _T1, class _T2>
37
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT is_convertible
38
+ : public integral_constant<bool, _CCCL_BUILTIN_IS_CONVERTIBLE_TO(_T1, _T2)>
39
+ {};
40
+
41
+ # if !defined(_CCCL_NO_VARIABLE_TEMPLATES)
42
+ template <class _T1, class _T2>
43
+ _CCCL_INLINE_VAR constexpr bool is_convertible_v = _CCCL_BUILTIN_IS_CONVERTIBLE_TO(_T1, _T2);
44
+ # endif // !_CCCL_NO_VARIABLE_TEMPLATES
45
+
46
+ # if _CCCL_COMPILER(MSVC) // Workaround for DevCom-1627396
47
+ template <class _Ty>
48
+ struct is_convertible<_Ty&, volatile _Ty&> : true_type
49
+ {};
50
+
51
+ template <class _Ty>
52
+ struct is_convertible<volatile _Ty&, volatile _Ty&> : true_type
53
+ {};
54
+
55
+ template <class _Ty>
56
+ struct is_convertible<_Ty&, const volatile _Ty&> : true_type
57
+ {};
58
+
59
+ template <class _Ty>
60
+ struct is_convertible<volatile _Ty&, const volatile _Ty&> : true_type
61
+ {};
62
+
63
+ template <class _Ty>
64
+ _CCCL_INLINE_VAR constexpr bool is_convertible_v<_Ty&, volatile _Ty&> = true;
65
+
66
+ template <class _Ty>
67
+ _CCCL_INLINE_VAR constexpr bool is_convertible_v<volatile _Ty&, volatile _Ty&> = true;
68
+
69
+ template <class _Ty>
70
+ _CCCL_INLINE_VAR constexpr bool is_convertible_v<_Ty&, const volatile _Ty&> = true;
71
+
72
+ template <class _Ty>
73
+ _CCCL_INLINE_VAR constexpr bool is_convertible_v<volatile _Ty&, const volatile _Ty&> = true;
74
+ # endif // _CCCL_COMPILER(MSVC)
75
+
76
+ #else // ^^^ _CCCL_BUILTIN_IS_CONVERTIBLE_TO ^^^ / vvv !_CCCL_BUILTIN_IS_CONVERTIBLE_TO vvv
77
+
78
+ namespace __is_convertible_imp
79
+ {
80
+
81
+ _CCCL_DIAG_PUSH
82
+ _CCCL_DIAG_SUPPRESS_NVHPC(volatile_func_param_deprecated)
83
+ _CCCL_NV_DIAG_SUPPRESS(volatile_func_param_deprecated)
84
+
85
+ template <class _Tp>
86
+ _LIBCUDACXX_HIDE_FROM_ABI void __test_convert(_Tp);
87
+
88
+ _CCCL_NV_DIAG_DEFAULT(volatile_func_param_deprecated)
89
+ _CCCL_DIAG_POP
90
+
91
+ template <class _From, class _To, class = void>
92
+ struct __is_convertible_test : public false_type
93
+ {};
94
+
95
+ template <class _From, class _To>
96
+ struct __is_convertible_test<
97
+ _From,
98
+ _To,
99
+ decltype(_CUDA_VSTD::__is_convertible_imp::__test_convert<_To>(_CUDA_VSTD::declval<_From>()))> : public true_type
100
+ {};
101
+
102
+ template <class _Tp,
103
+ bool _IsArray = is_array<_Tp>::value,
104
+ bool _IsFunction = is_function<_Tp>::value,
105
+ bool _IsVoid = is_void<_Tp>::value>
106
+ struct __is_array_function_or_void
107
+ {
108
+ enum
109
+ {
110
+ value = 0
111
+ };
112
+ };
113
+ template <class _Tp>
114
+ struct __is_array_function_or_void<_Tp, true, false, false>
115
+ {
116
+ enum
117
+ {
118
+ value = 1
119
+ };
120
+ };
121
+ template <class _Tp>
122
+ struct __is_array_function_or_void<_Tp, false, true, false>
123
+ {
124
+ enum
125
+ {
126
+ value = 2
127
+ };
128
+ };
129
+ template <class _Tp>
130
+ struct __is_array_function_or_void<_Tp, false, false, true>
131
+ {
132
+ enum
133
+ {
134
+ value = 3
135
+ };
136
+ };
137
+ } // namespace __is_convertible_imp
138
+
139
+ template <class _Tp, unsigned = __is_convertible_imp::__is_array_function_or_void<remove_reference_t<_Tp>>::value>
140
+ struct __is_convertible_check
141
+ {
142
+ static const size_t __v = 0;
143
+ };
144
+
145
+ template <class _Tp>
146
+ struct __is_convertible_check<_Tp, 0>
147
+ {
148
+ static const size_t __v = sizeof(_Tp);
149
+ };
150
+
151
+ template <class _T1,
152
+ class _T2,
153
+ unsigned _T1_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T1>::value,
154
+ unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value>
155
+ struct __is_convertible_fallback
156
+ : public integral_constant<bool, __is_convertible_imp::__is_convertible_test<_T1, _T2>::value>
157
+ {};
158
+
159
+ template <class _T1, class _T2>
160
+ struct __is_convertible_fallback<_T1, _T2, 0, 1> : public false_type
161
+ {};
162
+ template <class _T1, class _T2>
163
+ struct __is_convertible_fallback<_T1, _T2, 1, 1> : public false_type
164
+ {};
165
+ template <class _T1, class _T2>
166
+ struct __is_convertible_fallback<_T1, _T2, 2, 1> : public false_type
167
+ {};
168
+ template <class _T1, class _T2>
169
+ struct __is_convertible_fallback<_T1, _T2, 3, 1> : public false_type
170
+ {};
171
+
172
+ template <class _T1, class _T2>
173
+ struct __is_convertible_fallback<_T1, _T2, 0, 2> : public false_type
174
+ {};
175
+ template <class _T1, class _T2>
176
+ struct __is_convertible_fallback<_T1, _T2, 1, 2> : public false_type
177
+ {};
178
+ template <class _T1, class _T2>
179
+ struct __is_convertible_fallback<_T1, _T2, 2, 2> : public false_type
180
+ {};
181
+ template <class _T1, class _T2>
182
+ struct __is_convertible_fallback<_T1, _T2, 3, 2> : public false_type
183
+ {};
184
+
185
+ template <class _T1, class _T2>
186
+ struct __is_convertible_fallback<_T1, _T2, 0, 3> : public false_type
187
+ {};
188
+ template <class _T1, class _T2>
189
+ struct __is_convertible_fallback<_T1, _T2, 1, 3> : public false_type
190
+ {};
191
+ template <class _T1, class _T2>
192
+ struct __is_convertible_fallback<_T1, _T2, 2, 3> : public false_type
193
+ {};
194
+ template <class _T1, class _T2>
195
+ struct __is_convertible_fallback<_T1, _T2, 3, 3> : public true_type
196
+ {};
197
+
198
+ template <class _T1, class _T2>
199
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT is_convertible : public __is_convertible_fallback<_T1, _T2>
200
+ {
201
+ static const size_t __complete_check1 = __is_convertible_check<_T1>::__v;
202
+ static const size_t __complete_check2 = __is_convertible_check<_T2>::__v;
203
+ };
204
+
205
+ # if !defined(_CCCL_NO_VARIABLE_TEMPLATES)
206
+ template <class _From, class _To>
207
+ _CCCL_INLINE_VAR constexpr bool is_convertible_v = is_convertible<_From, _To>::value;
208
+ # endif // !_CCCL_NO_VARIABLE_TEMPLATES
209
+
210
+ #endif // !_CCCL_BUILTIN_IS_CONVERTIBLE_TO
211
+
212
+ _LIBCUDACXX_END_NAMESPACE_STD
213
+
214
+ #endif // _LIBCUDACXX___TYPE_TRAITS_IS_CONVERTIBLE_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/is_copy_assignable.h ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___TYPE_TRAITS_IS_COPY_ASSIGNABLE_H
11
+ #define _LIBCUDACXX___TYPE_TRAITS_IS_COPY_ASSIGNABLE_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #include <cuda/std/__type_traits/add_const.h>
24
+ #include <cuda/std/__type_traits/add_lvalue_reference.h>
25
+ #include <cuda/std/__type_traits/is_assignable.h>
26
+
27
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
28
+
29
+ template <class _Tp>
30
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT is_copy_assignable
31
+ : public is_assignable<add_lvalue_reference_t<_Tp>, add_lvalue_reference_t<typename add_const<_Tp>::type>>
32
+ {};
33
+
34
+ #if !defined(_CCCL_NO_VARIABLE_TEMPLATES)
35
+ template <class _Tp>
36
+ _CCCL_INLINE_VAR constexpr bool is_copy_assignable_v = is_copy_assignable<_Tp>::value;
37
+ #endif // !_CCCL_NO_VARIABLE_TEMPLATES
38
+
39
+ _LIBCUDACXX_END_NAMESPACE_STD
40
+
41
+ #endif // _LIBCUDACXX___TYPE_TRAITS_IS_COPY_ASSIGNABLE_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/is_copy_constructible.h ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___TYPE_TRAITS_IS_COPY_CONSTRUCTIBLE_H
11
+ #define _LIBCUDACXX___TYPE_TRAITS_IS_COPY_CONSTRUCTIBLE_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #include <cuda/std/__type_traits/add_const.h>
24
+ #include <cuda/std/__type_traits/add_lvalue_reference.h>
25
+ #include <cuda/std/__type_traits/is_constructible.h>
26
+
27
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
28
+
29
+ template <class _Tp>
30
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT is_copy_constructible
31
+ : public is_constructible<_Tp, add_lvalue_reference_t<typename add_const<_Tp>::type>>
32
+ {};
33
+
34
+ #if !defined(_CCCL_NO_VARIABLE_TEMPLATES)
35
+ template <class _Tp>
36
+ _CCCL_INLINE_VAR constexpr bool is_copy_constructible_v = is_copy_constructible<_Tp>::value;
37
+ #endif // !_CCCL_NO_VARIABLE_TEMPLATES
38
+
39
+ _LIBCUDACXX_END_NAMESPACE_STD
40
+
41
+ #endif // _LIBCUDACXX___TYPE_TRAITS_IS_COPY_CONSTRUCTIBLE_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/is_empty.h ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___TYPE_TRAITS_IS_EMPTY_H
11
+ #define _LIBCUDACXX___TYPE_TRAITS_IS_EMPTY_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #include <cuda/std/__type_traits/integral_constant.h>
24
+ #include <cuda/std/__type_traits/is_class.h>
25
+
26
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
27
+
28
+ #if defined(_CCCL_BUILTIN_IS_EMPTY) && !defined(_LIBCUDACXX_USE_IS_EMPTY_FALLBACK)
29
+
30
+ template <class _Tp>
31
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT is_empty : public integral_constant<bool, _CCCL_BUILTIN_IS_EMPTY(_Tp)>
32
+ {};
33
+
34
+ # if !defined(_CCCL_NO_VARIABLE_TEMPLATES)
35
+ template <class _Tp>
36
+ _CCCL_INLINE_VAR constexpr bool is_empty_v = _CCCL_BUILTIN_IS_EMPTY(_Tp);
37
+ # endif // !_CCCL_NO_VARIABLE_TEMPLATES
38
+
39
+ #else
40
+
41
+ template <class _Tp>
42
+ struct __is_empty1 : public _Tp
43
+ {
44
+ double __lx;
45
+ };
46
+
47
+ struct __is_empty2
48
+ {
49
+ double __lx;
50
+ };
51
+
52
+ template <class _Tp, bool = _CCCL_TRAIT(is_class, _Tp)>
53
+ struct __cccl_empty : public integral_constant<bool, sizeof(__is_empty1<_Tp>) == sizeof(__is_empty2)>
54
+ {};
55
+
56
+ template <class _Tp>
57
+ struct __cccl_empty<_Tp, false> : public false_type
58
+ {};
59
+
60
+ template <class _Tp>
61
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT is_empty : public __cccl_empty<_Tp>
62
+ {};
63
+
64
+ # if !defined(_CCCL_NO_VARIABLE_TEMPLATES)
65
+ template <class _Tp>
66
+ _CCCL_INLINE_VAR constexpr bool is_empty_v = is_empty<_Tp>::value;
67
+ # endif // !_CCCL_NO_VARIABLE_TEMPLATES
68
+
69
+ #endif // defined(_CCCL_BUILTIN_IS_EMPTY) && !defined(_LIBCUDACXX_USE_IS_EMPTY_FALLBACK)
70
+
71
+ _LIBCUDACXX_END_NAMESPACE_STD
72
+
73
+ #endif // _LIBCUDACXX___TYPE_TRAITS_IS_EMPTY_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/is_floating_point.h ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___TYPE_TRAITS_IS_FLOATING_POINT_H
11
+ #define _LIBCUDACXX___TYPE_TRAITS_IS_FLOATING_POINT_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #include <cuda/std/__type_traits/integral_constant.h>
24
+ #include <cuda/std/__type_traits/remove_cv.h>
25
+
26
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
27
+
28
+ template <class _Tp>
29
+ struct __cccl_is_floating_point : public false_type
30
+ {};
31
+ template <>
32
+ struct __cccl_is_floating_point<float> : public true_type
33
+ {};
34
+ template <>
35
+ struct __cccl_is_floating_point<double> : public true_type
36
+ {};
37
+ template <>
38
+ struct __cccl_is_floating_point<long double> : public true_type
39
+ {};
40
+
41
+ template <class _Tp>
42
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT is_floating_point : public __cccl_is_floating_point<remove_cv_t<_Tp>>
43
+ {};
44
+
45
+ #if !defined(_CCCL_NO_VARIABLE_TEMPLATES)
46
+ template <class _Tp>
47
+ _CCCL_INLINE_VAR constexpr bool is_floating_point_v = is_floating_point<_Tp>::value;
48
+ #endif // !_CCCL_NO_VARIABLE_TEMPLATES
49
+
50
+ _LIBCUDACXX_END_NAMESPACE_STD
51
+
52
+ #endif // _LIBCUDACXX___TYPE_TRAITS_IS_FLOATING_POINT_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__type_traits/is_function.h ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___TYPE_TRAITS_IS_FUNCTIONAL_H
11
+ #define _LIBCUDACXX___TYPE_TRAITS_IS_FUNCTIONAL_H
12
+
13
+ #include <cuda/std/detail/__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #include <cuda/std/__type_traits/integral_constant.h>
24
+ #include <cuda/std/__type_traits/is_const.h>
25
+ #include <cuda/std/__type_traits/is_reference.h>
26
+
27
+ _CCCL_DIAG_PUSH
28
+ _CCCL_DIAG_SUPPRESS_MSVC(4180) // qualifier applied to function type has no meaning; ignored
29
+
30
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
31
+
32
+ #if defined(_CCCL_BUILTIN_IS_FUNCTION) && !defined(_LIBCUDACXX_USE_IS_FUNCTION_FALLBACK)
33
+
34
+ template <class _Tp>
35
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT is_function : integral_constant<bool, _CCCL_BUILTIN_IS_FUNCTION(_Tp)>
36
+ {};
37
+
38
+ # if !defined(_CCCL_NO_VARIABLE_TEMPLATES)
39
+ template <class _Tp>
40
+ _CCCL_INLINE_VAR constexpr bool is_function_v = _CCCL_BUILTIN_IS_FUNCTION(_Tp);
41
+ # endif // !_CCCL_NO_VARIABLE_TEMPLATES
42
+
43
+ #else
44
+
45
+ template <class _Tp>
46
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT is_function
47
+ : public integral_constant<bool, !(is_reference<_Tp>::value || is_const<const _Tp>::value)>
48
+ {};
49
+
50
+ # if !defined(_CCCL_NO_VARIABLE_TEMPLATES)
51
+ template <class _Tp>
52
+ _CCCL_INLINE_VAR constexpr bool is_function_v = is_function<_Tp>::value;
53
+ # endif // !_CCCL_NO_VARIABLE_TEMPLATES
54
+
55
+ #endif // defined(_CCCL_BUILTIN_IS_FUNCTION) && !defined(_LIBCUDACXX_USE_IS_FUNCTION_FALLBACK)
56
+
57
+ _LIBCUDACXX_END_NAMESPACE_STD
58
+
59
+ _CCCL_DIAG_POP
60
+
61
+ #endif // _LIBCUDACXX___TYPE_TRAITS_IS_FUNCTIONAL_H