diff --git a/.gitattributes b/.gitattributes index 560a7fbee6b9973a56fa10f009c5e9140d0a70f4..5958a22c6fef104f7e7a4c2149dc7d2dc6e1815c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1767,3 +1767,4 @@ videollama2/lib/python3.10/site-packages/scipy.libs/libgfortran-040039e1.so.5.0. videollama2/lib/python3.10/site-packages/scipy.libs/libscipy_openblas-c128ec02.so filter=lfs diff=lfs merge=lfs -text vllm/lib/python3.10/site-packages/cupy/_core/flags.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text vllm/lib/python3.10/site-packages/cupy/_core/_accelerator.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 filter=lfs diff=lfs merge=lfs -text diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/_fusion_kernel.cpython-310-x86_64-linux-gnu.so b/vllm/lib/python3.10/site-packages/cupy/_core/_fusion_kernel.cpython-310-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..cd12fb3d5d659b1909d236e3b7e0df0b5bb7d50a --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/_fusion_kernel.cpython-310-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c7bec145e412003f3263f0a3caad63465e6fe5a09c711447984bdbd949d3b61 +size 1189992 diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/__memory_resource/get_property.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/__memory_resource/get_property.h new file mode 100644 index 0000000000000000000000000000000000000000..43712ede2a547a5a680f2ea2a2a4d1a49bc0d1c4 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/__memory_resource/get_property.h @@ -0,0 +1,158 @@ +//===----------------------------------------------------------------------===// +// +// Part of libcu++, the C++ Standard Library for your entire system, +// under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#ifndef _CUDA__MEMORY_RESOURCE_GET_PROPERTY_H +#define _CUDA__MEMORY_RESOURCE_GET_PROPERTY_H + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#if !_CCCL_COMPILER(MSVC2017) && defined(LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE) + +# include +# include +# include +# include + +# if _CCCL_STD_VER >= 2014 + +_LIBCUDACXX_BEGIN_NAMESPACE_CUDA + +//! @brief The \c has_property concept verifies that a Resource satisfies a given Property +//! @rst +//! For \c has_property we require the following free function to be callable +//! +//! .. code cpp:: +//! +//! get_property(const Resource& res, Property prop); +//! +//! @endrst +template +_CCCL_CONCEPT has_property = _CCCL_REQUIRES_EXPR((_Resource, _Property), const _Resource& __res, _Property __prop)( + ((void) get_property(__res, __prop))); + +template +using __property_value_t = typename _Property::value_type; + +//! @brief The \c property_with_value concept verifies that a Property is stateful and signals this through the +//! `value_type` alias +//! @rst +//! .. code cpp:: +//! +//! struct stateless_property {}; +//! static_assert(!cuda::property_with_value); +//! +//! struct stateful_property { using value_type = int; }; +//! static_assert(!cuda::property_with_value); +//! +//! @endrst +template +_CCCL_CONCEPT property_with_value = _CCCL_REQUIRES_EXPR((_Property))(typename(__property_value_t<_Property>)); + +//! @brief The \c has_property_with concept verifies that a Resource satisfies a given stateful Property +//! @rst +//! For \c has_property_with we require the following free function to be callable and its return type to exactly match +//! the ``value_type`` of the Property +//! +//! .. code cpp:: +//! +//! struct stateless_property {}; +//! constexpr void get_property(const Resource& res, stateless_property) {} +//! +//! // The resource must be stateful +//! static_assert(!cuda::has_property_with); +//! +//! struct stateful_property { using value_type = int; }; +//! constexpr int get_property(const Resource& res, stateful_property) {} +//! +//! // The resource is stateful and has the correct return type +//! static_assert(cuda::has_property_with); +//! +//! // The resource is stateful but the return type is incorrect +//! static_assert(!cuda::has_property_with); +//! +//! constexpr double get_property(const OtherResource& res, stateful_property) {} +//! +//! // The resource is stateful but the value_type does not match the `get_property` return type +//! static_assert(!cuda::has_property_with); +//! +//! @endrst +template +_CCCL_CONCEPT_FRAGMENT( + __has_property_with_, + requires(const _Resource& __res)(requires(property_with_value<_Property>), + requires(_CUDA_VSTD::same_as<_Return, decltype(get_property(__res, _Property{}))>))); +template +_CCCL_CONCEPT has_property_with = _CCCL_FRAGMENT(__has_property_with_, _Resource, _Property, _Return); + +template +_CCCL_CONCEPT_FRAGMENT( + __has_upstream_resource_, + requires(const _Resource& __res)( + requires(_CUDA_VSTD::same_as<_CUDA_VSTD::__remove_const_ref_t, _Upstream>))); +template +_CCCL_CONCEPT __has_upstream_resource = _CCCL_FRAGMENT(__has_upstream_resource_, _Resource, _Upstream); + +_LIBCUDACXX_BEGIN_NAMESPACE_CPO(__forward_property) +template +struct __fn +{ + _CCCL_EXEC_CHECK_DISABLE + _CCCL_TEMPLATE(class _Property) + _CCCL_REQUIRES((!property_with_value<_Property>) _CCCL_AND has_property<_Upstream, _Property>) + _LIBCUDACXX_HIDE_FROM_ABI friend constexpr void get_property(const _Derived&, _Property) noexcept {} + + // The indirection is needed, otherwise the compiler might believe that _Derived is an incomplete type + _CCCL_EXEC_CHECK_DISABLE + _CCCL_TEMPLATE(class _Property, class _Derived2 = _Derived) + _CCCL_REQUIRES(property_with_value<_Property> _CCCL_AND has_property<_Upstream, _Property> _CCCL_AND + __has_upstream_resource<_Derived2, _Upstream>) + _LIBCUDACXX_HIDE_FROM_ABI friend constexpr __property_value_t<_Property> + get_property(const _Derived& __res, _Property __prop) + { + return get_property(__res.upstream_resource(), __prop); + } +}; +_LIBCUDACXX_END_NAMESPACE_CPO + +//! @brief The \c forward_property CRTP template allows Derived to forward all properties of Upstream +//! @rst +//! .. code cpp:: +//! +//! class UpstreamWithProperties; +//! +//! class DerivedClass : cuda::forward_properties { +//! // This method is needed to forward stateful properties +//! UpstreamWithProperties& upstream_resource() const { ... } +//! }; +//! +//! .. note:: +//! +//! In order to forward stateful properties, a type needs do implement an `upstream_resource()` method that returns +//! an instance of the upstream. +//! +//! @endrst +template +using forward_property = __forward_property::__fn<_Derived, _Upstream>; + +_LIBCUDACXX_END_NAMESPACE_CUDA + +# endif // _CCCL_STD_VER >= 2014 + +#endif // !_CCCL_COMPILER(MSVC2017) && LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + +#endif //_CUDA__MEMORY_RESOURCE_GET_PROPERTY_H diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/__memory_resource/properties.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/__memory_resource/properties.h new file mode 100644 index 0000000000000000000000000000000000000000..7fea82903676b61302d4a4b6362ddccf34c6504b --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/__memory_resource/properties.h @@ -0,0 +1,73 @@ +//===----------------------------------------------------------------------===// +// +// Part of libcu++, the C++ Standard Library for your entire system, +// under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#ifndef _CUDA__MEMORY_RESOURCE_PROPERTIES_H +#define _CUDA__MEMORY_RESOURCE_PROPERTIES_H + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#include +#include + +#if !_CCCL_COMPILER(MSVC2017) && defined(LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE) + +# if _CCCL_STD_VER >= 2014 + +_LIBCUDACXX_BEGIN_NAMESPACE_CUDA_MR + +//! @brief The default alignment by a cudaMalloc{...} call +_CCCL_INLINE_VAR constexpr size_t default_cuda_malloc_alignment = 256; + +//! @brief The default alignment by a cudaMallocHost{...} call +_CCCL_INLINE_VAR constexpr size_t default_cuda_malloc_host_alignment = alignof(_CUDA_VSTD::max_align_t); + +//! @brief The device_accessible property signals that the allocated memory is device accessible +struct device_accessible +{}; + +//! @brief The device_accessible property signals that the allocated memory is host accessible +struct host_accessible +{}; + +//! @brief determines whether a set of properties signals host accessible memory. +template +_CCCL_INLINE_VAR constexpr bool __is_host_accessible = + _CUDA_VSTD::__type_set_contains_v<_CUDA_VSTD::__make_type_set<_Properties...>, host_accessible>; + +//! @brief determines whether a set of properties signals device accessible memory. +template +_CCCL_INLINE_VAR constexpr bool __is_device_accessible = + _CUDA_VSTD::__type_set_contains_v<_CUDA_VSTD::__make_type_set<_Properties...>, device_accessible>; + +//! @brief determines whether a set of properties signals host device accessible memory. +template +_CCCL_INLINE_VAR constexpr bool __is_host_device_accessible = + _CUDA_VSTD::__type_set_contains_v<_CUDA_VSTD::__make_type_set<_Properties...>, host_accessible, device_accessible>; + +//! @brief verifies that a set of properties contains at least one execution space property +template +_CCCL_INLINE_VAR constexpr bool __contains_execution_space_property = + __is_host_accessible<_Properties...> || __is_device_accessible<_Properties...>; + +_LIBCUDACXX_END_NAMESPACE_CUDA_MR + +# endif // _CCCL_STD_VER >= 2014 + +#endif // !_CCCL_COMPILER(MSVC2017) && LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + +#endif //_CUDA__MEMORY_RESOURCE_PROPERTIES_H diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__exception/cuda_error.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__exception/cuda_error.h new file mode 100644 index 0000000000000000000000000000000000000000..fdc32cf0571597a60b47b9b2dd0653e2875c8b58 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__exception/cuda_error.h @@ -0,0 +1,81 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of libcu++, the C++ Standard Library for your entire system, +// under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX___EXCEPTION_CUDA_ERROR_H +#define _LIBCUDACXX___EXCEPTION_CUDA_ERROR_H + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#include + +#if !_CCCL_COMPILER(NVRTC) +# include +# include +#endif // !_CCCL_COMPILER(NVRTC) + +#include + +_LIBCUDACXX_BEGIN_NAMESPACE_CUDA + +/** + * @brief Exception thrown when a CUDA error is encountered. + */ +#ifndef _CCCL_NO_EXCEPTIONS +class cuda_error : public ::std::runtime_error +{ +private: + struct __msg_storage + { + char __buffer[256]; + }; + + static char* __format_cuda_error(const int __status, const char* __msg, char* __msg_buffer) noexcept + { + ::snprintf(__msg_buffer, 256, "cudaError %d: %s", __status, __msg); + return __msg_buffer; + } + +public: + cuda_error(const int __status, const char* __msg, __msg_storage __msg_buffer = {0}) noexcept + : ::std::runtime_error(__format_cuda_error(__status, __msg, __msg_buffer.__buffer)) + {} +}; + +_CCCL_NORETURN _LIBCUDACXX_HIDE_FROM_ABI void __throw_cuda_error(const int __status, const char* __msg) +{ + NV_IF_ELSE_TARGET(NV_IS_HOST, + (throw ::cuda::cuda_error(__status, __msg);), + ((void) __status; (void) __msg; _CUDA_VSTD_NOVERSION::terminate();)) +} +#else // ^^^ !_CCCL_NO_EXCEPTIONS ^^^ / vvv _CCCL_NO_EXCEPTIONS vvv +class cuda_error +{ +public: + _LIBCUDACXX_HIDE_FROM_ABI cuda_error(const int, const char*) noexcept {} +}; + +_CCCL_NORETURN _LIBCUDACXX_HIDE_FROM_ABI void __throw_cuda_error(const int, const char*) +{ + _CUDA_VSTD_NOVERSION::terminate(); +} +#endif // _CCCL_NO_EXCEPTIONS + +_LIBCUDACXX_END_NAMESPACE_CUDA + +#endif // _LIBCUDACXX___EXCEPTION_CUDA_ERROR_H diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__exception/terminate.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__exception/terminate.h new file mode 100644 index 0000000000000000000000000000000000000000..a65722bac64479d7d4438605b378a5e7844cc3fc --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__exception/terminate.h @@ -0,0 +1,69 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of libcu++, the C++ Standard Library for your entire system, +// under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX___EXCEPTION_TERMINATE_H +#define _LIBCUDACXX___EXCEPTION_TERMINATE_H + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#include // ::exit + +_CCCL_DIAG_PUSH +_CCCL_DIAG_SUPPRESS_MSVC(4702) // unreachable code + +_LIBCUDACXX_BEGIN_NAMESPACE_STD_NOVERSION // purposefully not using versioning namespace + +_CCCL_NORETURN _LIBCUDACXX_HIDE_FROM_ABI void __cccl_terminate() noexcept +{ + NV_IF_ELSE_TARGET(NV_IS_HOST, (::exit(-1);), (__trap();)) + _CCCL_UNREACHABLE(); +} + +#if 0 // Expose once atomic is universally available + +typedef void (*terminate_handler)(); + +# ifdef __CUDA_ARCH__ +__device__ +# endif // __CUDA_ARCH__ + static _LIBCUDACXX_SAFE_STATIC _CUDA_VSTD::atomic + __cccl_terminate_handler{&__cccl_terminate}; + +_LIBCUDACXX_HIDE_FROM_ABI terminate_handler set_terminate(terminate_handler __func) noexcept +{ + return __cccl_terminate_handler.exchange(__func); +} +_LIBCUDACXX_HIDE_FROM_ABI terminate_handler get_terminate() noexcept +{ + return __cccl_terminate_handler.load(__func); +} + +#endif + +_CCCL_NORETURN _LIBCUDACXX_HIDE_FROM_ABI void terminate() noexcept +{ + __cccl_terminate(); + _CCCL_UNREACHABLE(); +} + +_LIBCUDACXX_END_NAMESPACE_STD_NOVERSION + +_CCCL_DIAG_POP + +#endif // _LIBCUDACXX___EXCEPTION_TERMINATE_H diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/addressof.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/addressof.h new file mode 100644 index 0000000000000000000000000000000000000000..971f33605bc78845a9914adf3f87a16d00aadb2a --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/addressof.h @@ -0,0 +1,51 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX___MEMORY_ADDRESSOF_H +#define _LIBCUDACXX___MEMORY_ADDRESSOF_H + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +// addressof +// NVCXX has the builtin defined but did not mark it as supported +#if defined(_CCCL_BUILTIN_ADDRESSOF) + +template +_LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 _LIBCUDACXX_NO_CFI _Tp* addressof(_Tp& __x) noexcept +{ + return _CCCL_BUILTIN_ADDRESSOF(__x); +} + +#else + +template +_LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_NO_CFI _Tp* addressof(_Tp& __x) noexcept +{ + return reinterpret_cast<_Tp*>(const_cast(&reinterpret_cast(__x))); +} + +#endif // defined(_CCCL_BUILTIN_ADDRESSOF) + +template +_Tp* addressof(const _Tp&&) noexcept = delete; + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX___MEMORY_ADDRESSOF_H diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/align.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/align.h new file mode 100644 index 0000000000000000000000000000000000000000..605ea1cac787830ec45653a4f9bd0152c8016ea8 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/align.h @@ -0,0 +1,55 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of libcu++, the C++ Standard Library for your entire system, +// under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX___MEMORY_ALIGN_H +#define _LIBCUDACXX___MEMORY_ALIGN_H + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#include +#include + +_CCCL_DIAG_PUSH +_CCCL_DIAG_SUPPRESS_MSVC(4146) // unary minus operator applied to unsigned type, result still unsigned + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +_LIBCUDACXX_HIDE_FROM_ABI void* align(size_t __alignment, size_t __size, void*& __ptr, size_t& __space) +{ + if (__space < __size) + { + return nullptr; + } + + const auto __intptr = reinterpret_cast(__ptr); + const auto __aligned = (__intptr - 1u + __alignment) & -__alignment; + const auto __diff = __aligned - __intptr; + if (__diff > (__space - __size)) + { + return nullptr; + } + __space -= __diff; + return __ptr = reinterpret_cast(__aligned); +} + +_LIBCUDACXX_END_NAMESPACE_STD + +_CCCL_DIAG_POP + +#endif // _LIBCUDACXX___MEMORY_ALIGN_H diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocate_at_least.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocate_at_least.h new file mode 100644 index 0000000000000000000000000000000000000000..4b620c8e3901659bae99f450861533e50bdda186 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocate_at_least.h @@ -0,0 +1,77 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of libcu++, the C++ Standard Library for your entire system, +// under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX___MEMORY_ALLOCATE_AT_LEAST_H +#define _LIBCUDACXX___MEMORY_ALLOCATE_AT_LEAST_H + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#include +#include + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +#if _CCCL_STD_VER >= 2023 +template +struct allocation_result +{ + _Pointer ptr; + size_t count; +}; +_LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(allocation_result); + +template +_CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr allocation_result::pointer> +allocate_at_least(_Alloc& __alloc, size_t __n) +{ + if constexpr (requires { __alloc.allocate_at_least(__n); }) + { + return __alloc.allocate_at_least(__n); + } + else + { + return {__alloc.allocate(__n), __n}; + } +} + +template +_CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr auto __allocate_at_least(_Alloc& __alloc, size_t __n) +{ + return _CUDA_VSTD::allocate_at_least(__alloc, __n); +} +#else // ^^^ _CCCL_STD_VER >= 2023 ^^^ / vvv _CCCL_STD_VER < 2023 vvv +template +struct __allocation_result +{ + _Pointer ptr; + size_t count; +}; + +template +_CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr __allocation_result::pointer> +__allocate_at_least(_Alloc& __alloc, size_t __n) +{ + return {__alloc.allocate(__n), __n}; +} + +#endif // _CCCL_STD_VER >= 2023 + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX___MEMORY_ALLOCATE_AT_LEAST_H diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocation_guard.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocation_guard.h new file mode 100644 index 0000000000000000000000000000000000000000..2851536932535e3814f327d686a475c5ddeb981f --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocation_guard.h @@ -0,0 +1,96 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of libcu++, the C++ Standard Library for your entire system, +// under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX___MEMORY_ALLOCATION_GUARD_H +#define _LIBCUDACXX___MEMORY_ALLOCATION_GUARD_H + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#include +#include +#include + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +// Helper class to allocate memory using an Allocator in an exception safe +// manner. +// +// The intended usage of this class is as follows: +// +// 0 +// 1 __allocation_guard guard(alloc, 10); +// 2 do_some_initialization_that_may_throw(guard.__get()); +// 3 save_allocated_pointer_in_a_noexcept_operation(guard.__release_ptr()); +// 4 +// +// If line (2) throws an exception during initialization of the memory, the +// guard's destructor will be called, and the memory will be released using +// Allocator deallocation. Otherwise, we release the memory from the guard on +// line (3) in an operation that can't throw -- after that, the guard is not +// responsible for the memory anymore. +// +// This is similar to a unique_ptr, except it's easier to use with a +// custom allocator. + +_CCCL_NV_DIAG_SUPPRESS(2659) // constexpr non-static member function will not be implicitly 'const' in C++14 + +template +struct __allocation_guard +{ + using _Pointer = typename allocator_traits<_Alloc>::pointer; + using _Size = typename allocator_traits<_Alloc>::size_type; + + template // we perform the allocator conversion inside the constructor + _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 explicit __allocation_guard(_AllocT __alloc, _Size __n) + : __alloc_(_CUDA_VSTD::move(__alloc)) + , __n_(__n) + , __ptr_(allocator_traits<_Alloc>::allocate(__alloc_, __n_)) // initialization order is important + {} + + _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 ~__allocation_guard() noexcept + { + if (__ptr_ != nullptr) + { + allocator_traits<_Alloc>::deallocate(__alloc_, __ptr_, __n_); + } + } + + _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 _Pointer __release_ptr() noexcept + { // not called __release() because it's a keyword in objective-c++ + _Pointer __tmp = __ptr_; + __ptr_ = nullptr; + return __tmp; + } + + _LIBCUDACXX_HIDE_FROM_ABI constexpr _Pointer __get() const noexcept + { + return __ptr_; + } + +private: + _Alloc __alloc_; + _Size __n_; + _Pointer __ptr_; +}; + +_CCCL_NV_DIAG_DEFAULT(2659) + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX___MEMORY_ALLOCATION_GUARD_H diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocator.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocator.h new file mode 100644 index 0000000000000000000000000000000000000000..c771226e191dbb5cc4fc0aff4453a0b5839e7a05 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocator.h @@ -0,0 +1,318 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of libcu++, the C++ Standard Library for your entire system, +// under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX___MEMORY_ALLOCATOR_H +#define _LIBCUDACXX___MEMORY_ALLOCATOR_H + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(_CCCL_HAS_CONSTEXPR_ALLOCATION) && !_CCCL_COMPILER(NVRTC) +# include +#endif // _CCCL_HAS_CONSTEXPR_ALLOCATION && !_CCCL_COMPILER(NVRTC) + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +template +class allocator; + +#if _CCCL_STD_VER <= 2017 +// These specializations shouldn't be marked _LIBCUDACXX_DEPRECATED_IN_CXX17. +// Specializing allocator is deprecated, but not using it. +template <> +class _CCCL_TYPE_VISIBILITY_DEFAULT allocator +{ +public: + _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef void* pointer; + _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef const void* const_pointer; + _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef void value_type; + + template + struct _LIBCUDACXX_DEPRECATED_IN_CXX17 rebind + { + typedef allocator<_Up> other; + }; +}; + +template <> +class _CCCL_TYPE_VISIBILITY_DEFAULT allocator +{ +public: + _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef const void* pointer; + _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef const void* const_pointer; + _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef const void value_type; + + template + struct _LIBCUDACXX_DEPRECATED_IN_CXX17 rebind + { + typedef allocator<_Up> other; + }; +}; +#endif // _CCCL_STD_VER <= 2017 + +// This class provides a non-trivial default constructor to the class that derives from it +// if the condition is satisfied. +// +// The second template parameter exists to allow giving a unique type to __non_trivial_if, +// which makes it possible to avoid breaking the ABI when making this a base class of an +// existing class. Without that, imagine we have classes D1 and D2, both of which used to +// have no base classes, but which now derive from __non_trivial_if. The layout of a class +// that inherits from both D1 and D2 will change because the two __non_trivial_if base +// classes are not allowed to share the same address. +// +// By making those __non_trivial_if base classes unique, we work around this problem and +// it is safe to start deriving from __non_trivial_if in existing classes. +template +struct __non_trivial_if +{}; + +template +struct __non_trivial_if +{ + _LIBCUDACXX_HIDE_FROM_ABI constexpr __non_trivial_if() noexcept {} +}; + +// allocator +// +// Note: For ABI compatibility between C++20 and previous standards, we make +// allocator trivial in C++20. + +template +class _CCCL_TYPE_VISIBILITY_DEFAULT allocator : private __non_trivial_if> +{ + static_assert(!_CCCL_TRAIT(is_volatile, _Tp), "std::allocator does not support volatile types"); + +public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Tp value_type; + typedef true_type propagate_on_container_move_assignment; + typedef true_type is_always_equal; + + _CCCL_CONSTEXPR_CXX20 allocator() noexcept = default; + + template + _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 allocator(const allocator<_Up>&) noexcept + {} + + _CCCL_EXEC_CHECK_DISABLE + _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20_ALLOCATION _Tp* allocate(size_t __n) + { + if (__n > allocator_traits::max_size(*this)) + { + __throw_bad_array_new_length(); + } +#if defined(_CCCL_HAS_CONSTEXPR_ALLOCATION) + if (_CUDA_VSTD::is_constant_evaluated()) + { + return ::std::allocator<_Tp>{}.allocate(__n); + } +#endif // _CCCL_HAS_CONSTEXPR_ALLOCATION + { + return static_cast<_Tp*>(_CUDA_VSTD::__cccl_allocate(__n * sizeof(_Tp), _LIBCUDACXX_ALIGNOF(_Tp))); + } + } + +#if _CCCL_STD_VER >= 2023 + _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr allocation_result<_Tp*> allocate_at_least(size_t __n) + { + return {allocate(__n), __n}; + } +#endif // _CCCL_HAS_CONSTEXPR_ALLOCATION + + _CCCL_EXEC_CHECK_DISABLE + _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20_ALLOCATION void deallocate(_Tp* __p, size_t __n) noexcept + { +#if defined(_CCCL_HAS_CONSTEXPR_ALLOCATION) + if (_CUDA_VSTD::is_constant_evaluated()) + { + return ::std::allocator<_Tp>{}.deallocate(__p, __n); + } + else +#endif // _CCCL_STD_VER >= 2020 + { + _CUDA_VSTD::__cccl_deallocate((void*) __p, __n * sizeof(_Tp), _LIBCUDACXX_ALIGNOF(_Tp)); + } + } + + // C++20 Removed members +#if _CCCL_STD_VER <= 2017 + _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef _Tp* pointer; + _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer; + _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef _Tp& reference; + _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef const _Tp& const_reference; + + template + struct _LIBCUDACXX_DEPRECATED_IN_CXX17 rebind + { + typedef allocator<_Up> other; + }; + + _LIBCUDACXX_DEPRECATED_IN_CXX17 _LIBCUDACXX_HIDE_FROM_ABI pointer address(reference __x) const noexcept + { + return _CUDA_VSTD::addressof(__x); + } + _LIBCUDACXX_DEPRECATED_IN_CXX17 _LIBCUDACXX_HIDE_FROM_ABI const_pointer address(const_reference __x) const noexcept + { + return _CUDA_VSTD::addressof(__x); + } + + _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_DEPRECATED_IN_CXX17 _Tp* allocate(size_t __n, const void*) + { + return allocate(__n); + } + + _LIBCUDACXX_DEPRECATED_IN_CXX17 _LIBCUDACXX_HIDE_FROM_ABI size_type max_size() const noexcept + { + return size_type(~0) / sizeof(_Tp); + } + + template + _LIBCUDACXX_DEPRECATED_IN_CXX17 _LIBCUDACXX_HIDE_FROM_ABI void construct(_Up* __p, _Args&&... __args) + { + ::new ((void*) __p) _Up(_CUDA_VSTD::forward<_Args>(__args)...); + } + + _LIBCUDACXX_DEPRECATED_IN_CXX17 _LIBCUDACXX_HIDE_FROM_ABI void destroy(pointer __p) noexcept + { + __p->~_Tp(); + } +#endif // _CCCL_STD_VER <= 2017 +}; + +template +class _CCCL_TYPE_VISIBILITY_DEFAULT allocator + : private __non_trivial_if> +{ + static_assert(!_CCCL_TRAIT(is_volatile, _Tp), "std::allocator does not support volatile types"); + +public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef const _Tp value_type; + typedef true_type propagate_on_container_move_assignment; + typedef true_type is_always_equal; + + _CCCL_CONSTEXPR_CXX20 allocator() noexcept = default; + + template + _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 allocator(const allocator<_Up>&) noexcept + {} + + _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 const _Tp* allocate(size_t __n) + { + if (__n > allocator_traits::max_size(*this)) + { + __throw_bad_array_new_length(); + } + if (_CUDA_VSTD::is_constant_evaluated()) + { + return static_cast(::operator new(__n * sizeof(_Tp))); + } + else + { + return static_cast(_CUDA_VSTD::__cccl_allocate(__n * sizeof(_Tp), _LIBCUDACXX_ALIGNOF(_Tp))); + } + } + +#if _CCCL_STD_VER >= 2023 + _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr allocation_result allocate_at_least(size_t __n) + { + return {allocate(__n), __n}; + } +#endif // _CCCL_STD_VER >= 2023 + + _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 void deallocate(const _Tp* __p, size_t __n) noexcept + { + if (_CUDA_VSTD::is_constant_evaluated()) + { + ::operator delete(const_cast<_Tp*>(__p)); + } + else + { + _CUDA_VSTD::__cccl_deallocate((void*) const_cast<_Tp*>(__p), __n * sizeof(_Tp), _LIBCUDACXX_ALIGNOF(_Tp)); + } + } + + // C++20 Removed members +#if _CCCL_STD_VER <= 2017 + _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef const _Tp* pointer; + _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer; + _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef const _Tp& reference; + _LIBCUDACXX_DEPRECATED_IN_CXX17 typedef const _Tp& const_reference; + + template + struct _LIBCUDACXX_DEPRECATED_IN_CXX17 rebind + { + typedef allocator<_Up> other; + }; + + _LIBCUDACXX_DEPRECATED_IN_CXX17 _LIBCUDACXX_HIDE_FROM_ABI const_pointer address(const_reference __x) const noexcept + { + return _CUDA_VSTD::addressof(__x); + } + + _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_DEPRECATED_IN_CXX17 const _Tp* allocate(size_t __n, const void*) + { + return allocate(__n); + } + + _LIBCUDACXX_DEPRECATED_IN_CXX17 _LIBCUDACXX_HIDE_FROM_ABI size_type max_size() const noexcept + { + return size_type(~0) / sizeof(_Tp); + } + + template + _LIBCUDACXX_DEPRECATED_IN_CXX17 _LIBCUDACXX_HIDE_FROM_ABI void construct(_Up* __p, _Args&&... __args) + { + ::new ((void*) __p) _Up(_CUDA_VSTD::forward<_Args>(__args)...); + } + + _LIBCUDACXX_DEPRECATED_IN_CXX17 _LIBCUDACXX_HIDE_FROM_ABI void destroy(pointer __p) noexcept + { + __p->~_Tp(); + } +#endif // _CCCL_STD_VER <= 2017 +}; + +template +_LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 bool operator==(const allocator<_Tp>&, const allocator<_Up>&) noexcept +{ + return true; +} + +template +_LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX20 bool operator!=(const allocator<_Tp>&, const allocator<_Up>&) noexcept +{ + return false; +} + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX___MEMORY_ALLOCATOR_H diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocator_arg_t.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocator_arg_t.h new file mode 100644 index 0000000000000000000000000000000000000000..ae88ce576150aa97a91d9299a4601096ce92795c --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocator_arg_t.h @@ -0,0 +1,80 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of libcu++, the C++ Standard Library for your entire system, +// under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX___FUNCTIONAL_ALLOCATOR_ARG_T_H +#define _LIBCUDACXX___FUNCTIONAL_ALLOCATOR_ARG_T_H + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#include +#include +#include +#include +#include + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +struct _CCCL_TYPE_VISIBILITY_DEFAULT allocator_arg_t +{ + _CCCL_HIDE_FROM_ABI explicit allocator_arg_t() = default; +}; + +_CCCL_INLINE_VAR constexpr allocator_arg_t allocator_arg = allocator_arg_t(); + +// allocator construction + +template +struct __uses_alloc_ctor_imp +{ + typedef _CCCL_NODEBUG_ALIAS remove_cvref_t<_Alloc> _RawAlloc; + static const bool __ua = uses_allocator<_Tp, _RawAlloc>::value; + static const bool __ic = is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value; + static const int value = __ua ? 2 - __ic : 0; +}; + +template +struct __uses_alloc_ctor : integral_constant::value> +{}; + +template +_LIBCUDACXX_HIDE_FROM_ABI void +__user_alloc_construct_impl(integral_constant, _Tp* __storage, const _Allocator&, _Args&&... __args) +{ + new (__storage) _Tp(_CUDA_VSTD::forward<_Args>(__args)...); +} + +// FIXME: This should have a version which takes a non-const alloc. +template +_LIBCUDACXX_HIDE_FROM_ABI void +__user_alloc_construct_impl(integral_constant, _Tp* __storage, const _Allocator& __a, _Args&&... __args) +{ + new (__storage) _Tp(allocator_arg, __a, _CUDA_VSTD::forward<_Args>(__args)...); +} + +// FIXME: This should have a version which takes a non-const alloc. +template +_LIBCUDACXX_HIDE_FROM_ABI void +__user_alloc_construct_impl(integral_constant, _Tp* __storage, const _Allocator& __a, _Args&&... __args) +{ + new (__storage) _Tp(_CUDA_VSTD::forward<_Args>(__args)..., __a); +} + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX___FUNCTIONAL_ALLOCATOR_ARG_T_H diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocator_destructor.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocator_destructor.h new file mode 100644 index 0000000000000000000000000000000000000000..e6fc850a086acea88931df32cebe068a3e60c03f --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocator_destructor.h @@ -0,0 +1,55 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of libcu++, the C++ Standard Library for your entire system, +// under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX___MEMORY_ALLOCATOR_DESTRUCTOR_H +#define _LIBCUDACXX___MEMORY_ALLOCATOR_DESTRUCTOR_H + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#include + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +template +class __allocator_destructor +{ + typedef _CCCL_NODEBUG_ALIAS allocator_traits<_Alloc> __alloc_traits; + +public: + typedef _CCCL_NODEBUG_ALIAS typename __alloc_traits::pointer pointer; + typedef _CCCL_NODEBUG_ALIAS typename __alloc_traits::size_type size_type; + +private: + _Alloc& __alloc_; + size_type __s_; + +public: + _LIBCUDACXX_HIDE_FROM_ABI __allocator_destructor(_Alloc& __a, size_type __s) noexcept + : __alloc_(__a) + , __s_(__s) + {} + _LIBCUDACXX_HIDE_FROM_ABI void operator()(pointer __p) noexcept + { + __alloc_traits::deallocate(__alloc_, __p, __s_); + } +}; + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX___MEMORY_ALLOCATOR_DESTRUCTOR_H diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocator_traits.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocator_traits.h new file mode 100644 index 0000000000000000000000000000000000000000..8634ecb6adcd3b9703cfacd0915ce2faf736cfce --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__memory/allocator_traits.h @@ -0,0 +1,581 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of libcu++, the C++ Standard Library for your entire system, +// under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX___MEMORY_ALLOCATOR_TRAITS_H +#define _LIBCUDACXX___MEMORY_ALLOCATOR_TRAITS_H + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +_CCCL_PUSH_MACROS + +_CCCL_NV_DIAG_SUPPRESS(1215) + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +#if defined(_CCCL_NO_VARIABLE_TEMPLATES) +# define _LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(NAME, PROPERTY) \ + template \ + struct NAME : false_type \ + {}; \ + template \ + struct NAME<_Tp, void_t> : true_type \ + {} +#else // ^^^ _CCCL_NO_VARIABLE_TEMPLATES ^^^ / vvv !_CCCL_NO_VARIABLE_TEMPLATES vvv +# define _LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(NAME, PROPERTY) \ + template \ + _CCCL_INLINE_VAR constexpr bool NAME##_v = false; \ + template \ + _CCCL_INLINE_VAR constexpr bool NAME##_v<_Tp, void_t> = true; +#endif // !_CCCL_NO_VARIABLE_TEMPLATES + +// __pointer +_LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(__has_pointer, pointer); +template , + bool = _CCCL_TRAIT(__has_pointer, _RawAlloc)> +struct __pointer +{ + using type _CCCL_NODEBUG_ALIAS = typename _RawAlloc::pointer; +}; +template +struct __pointer<_Tp, _Alloc, _RawAlloc, false> +{ + using type _CCCL_NODEBUG_ALIAS = _Tp*; +}; + +// __const_pointer +_LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(__has_const_pointer, const_pointer); +template +struct __const_pointer +{ + using type _CCCL_NODEBUG_ALIAS = typename _Alloc::const_pointer; +}; +template +struct __const_pointer<_Tp, _Ptr, _Alloc, false> +{ + using type _CCCL_NODEBUG_ALIAS = typename pointer_traits<_Ptr>::template rebind; +}; + +// __void_pointer +_LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(__has_void_pointer, void_pointer); +template +struct __void_pointer +{ + using type _CCCL_NODEBUG_ALIAS = typename _Alloc::void_pointer; +}; +template +struct __void_pointer<_Ptr, _Alloc, false> +{ + using type _CCCL_NODEBUG_ALIAS = typename pointer_traits<_Ptr>::template rebind; +}; + +// __const_void_pointer +_LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(__has_const_void_pointer, const_void_pointer); +template +struct __const_void_pointer +{ + using type _CCCL_NODEBUG_ALIAS = typename _Alloc::const_void_pointer; +}; +template +struct __const_void_pointer<_Ptr, _Alloc, false> +{ + using type _CCCL_NODEBUG_ALIAS = typename pointer_traits<_Ptr>::template rebind; +}; + +// __size_type +_LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(__has_size_type, size_type); +template +struct __size_type : make_unsigned<_DiffType> +{}; +template +struct __size_type<_Alloc, _DiffType, true> +{ + using type _CCCL_NODEBUG_ALIAS = typename _Alloc::size_type; +}; + +// __alloc_traits_difference_type +_LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(__has_alloc_traits_difference_type, difference_type); +template +struct __alloc_traits_difference_type +{ + using type _CCCL_NODEBUG_ALIAS = typename pointer_traits<_Ptr>::difference_type; +}; +template +struct __alloc_traits_difference_type<_Alloc, _Ptr, true> +{ + using type _CCCL_NODEBUG_ALIAS = typename _Alloc::difference_type; +}; + +// __propagate_on_container_copy_assignment +_LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(__has_propagate_on_container_copy_assignment, + propagate_on_container_copy_assignment); +template +struct __propagate_on_container_copy_assignment : false_type +{}; +template +struct __propagate_on_container_copy_assignment<_Alloc, true> +{ + using type _CCCL_NODEBUG_ALIAS = typename _Alloc::propagate_on_container_copy_assignment; +}; + +// __propagate_on_container_move_assignment +_LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(__has_propagate_on_container_move_assignment, + propagate_on_container_move_assignment); +template +struct __propagate_on_container_move_assignment : false_type +{}; +template +struct __propagate_on_container_move_assignment<_Alloc, true> +{ + using type _CCCL_NODEBUG_ALIAS = typename _Alloc::propagate_on_container_move_assignment; +}; + +// __propagate_on_container_swap +_LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(__has_propagate_on_container_swap, propagate_on_container_swap); +template +struct __propagate_on_container_swap : false_type +{}; +template +struct __propagate_on_container_swap<_Alloc, true> +{ + using type _CCCL_NODEBUG_ALIAS = typename _Alloc::propagate_on_container_swap; +}; + +// __is_always_equal +_LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(__has_is_always_equal, is_always_equal); +template +struct __is_always_equal : is_empty<_Alloc> +{}; +template +struct __is_always_equal<_Alloc, true> +{ + using type _CCCL_NODEBUG_ALIAS = typename _Alloc::is_always_equal; +}; + +// __allocator_traits_rebind +_CCCL_SUPPRESS_DEPRECATED_PUSH +template +struct __has_rebind_other : false_type +{}; +template +struct __has_rebind_other<_Tp, _Up, void_t::other>> : true_type +{}; + +template ::value> +struct __allocator_traits_rebind +{ + static_assert(__has_rebind_other<_Tp, _Up>::value, "This allocator has to implement rebind"); + using type _CCCL_NODEBUG_ALIAS = typename _Tp::template rebind<_Up>::other; +}; +template