ZTWHHH commited on
Commit
47f975b
·
verified ·
1 Parent(s): 070d591

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 +3 -0
  2. videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/channel/basic/factory.h +23 -0
  3. videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/channel/cma/factory.h +23 -0
  4. videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/channel/error.h +40 -0
  5. videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/channel/xth/factory.h +23 -0
  6. videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/common/cpu_buffer.h +23 -0
  7. videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/common/cuda_buffer.h +24 -0
  8. videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/common/device.h +64 -0
  9. videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/common/error.h +127 -0
  10. videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/common/optional.h +1020 -0
  11. videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/config.h +14 -0
  12. videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/core/message.h +104 -0
  13. videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/core/pipe.h +98 -0
  14. videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/transport/uv/factory.h +23 -0
  15. videollama2/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/datasets/base.h +103 -0
  16. videollama2/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/datasets/shared.h +83 -0
  17. videollama2/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/datasets/stateful.h +70 -0
  18. videollama2/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/samplers/base.h +47 -0
  19. videollama2/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/samplers/distributed.h +139 -0
  20. videollama2/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/samplers/sequential.h +50 -0
  21. videollama2/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/samplers/serialize.h +28 -0
  22. videollama2/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/samplers/stream.h +63 -0
  23. videollama2/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/transforms/base.h +53 -0
  24. videollama2/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/transforms/tensor.h +77 -0
  25. vllm/lib/python3.10/site-packages/cupy/_core/_kernel.cpython-310-x86_64-linux-gnu.so +3 -0
  26. vllm/lib/python3.10/site-packages/cupy/_core/_routines_math.cpython-310-x86_64-linux-gnu.so +3 -0
  27. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__barrier/barrier.h +234 -0
  28. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__barrier/empty_completion.h +33 -0
  29. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__barrier/poll_tester.h +80 -0
  30. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__cuda/api_wrapper.h +55 -0
  31. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__cuda/chrono.h +66 -0
  32. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__cuda/cstdint_prelude.h +90 -0
  33. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__cuda/ensure_current_device.h +64 -0
  34. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__internal/cpp_dialect.h +46 -0
  35. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__internal/features.h +110 -0
  36. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__internal/namespaces.h +85 -0
  37. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__iterator/incrementable_traits.h +157 -0
  38. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__iterator/istream_iterator.h +140 -0
  39. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__iterator/iter_move.h +157 -0
  40. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__iterator/iterator.h +40 -0
  41. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__iterator/mergeable.h +68 -0
  42. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__iterator/move_sentinel.h +73 -0
  43. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__iterator/next.h +95 -0
  44. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__iterator/permutable.h +50 -0
  45. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__iterator/sortable.h +51 -0
  46. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__tuple_dir/ignore.h +47 -0
  47. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__tuple_dir/make_tuple_types.h +94 -0
  48. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__tuple_dir/sfinae_helpers.h +232 -0
  49. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__tuple_dir/structured_bindings.h +215 -0
  50. vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__tuple_dir/tuple_element.h +71 -0
.gitattributes CHANGED
@@ -1733,3 +1733,6 @@ vllm/lib/python3.10/site-packages/cupy/_core/internal.cpython-310-x86_64-linux-g
1733
  vllm/lib/python3.10/site-packages/cupy/_core/_fusion_variable.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
1734
  vllm/lib/python3.10/site-packages/cupy/_core/_routines_linalg.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
1735
  vllm/lib/python3.10/site-packages/cupy/_core/raw.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
 
 
 
 
1733
  vllm/lib/python3.10/site-packages/cupy/_core/_fusion_variable.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
1734
  vllm/lib/python3.10/site-packages/cupy/_core/_routines_linalg.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
1735
  vllm/lib/python3.10/site-packages/cupy/_core/raw.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
1736
+ vllm/lib/python3.10/site-packages/cupy/cuda/memory.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
1737
+ vllm/lib/python3.10/site-packages/cupy/_core/_kernel.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
1738
+ vllm/lib/python3.10/site-packages/cupy/_core/_routines_math.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/channel/basic/factory.h ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ #pragma once
10
+
11
+ #include <memory>
12
+
13
+ #include <tensorpipe/channel/context.h>
14
+
15
+ namespace tensorpipe {
16
+ namespace channel {
17
+ namespace basic {
18
+
19
+ std::shared_ptr<Context> create();
20
+
21
+ } // namespace basic
22
+ } // namespace channel
23
+ } // namespace tensorpipe
videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/channel/cma/factory.h ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ #pragma once
10
+
11
+ #include <memory>
12
+
13
+ #include <tensorpipe/channel/context.h>
14
+
15
+ namespace tensorpipe {
16
+ namespace channel {
17
+ namespace cma {
18
+
19
+ std::shared_ptr<Context> create();
20
+
21
+ } // namespace cma
22
+ } // namespace channel
23
+ } // namespace tensorpipe
videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/channel/error.h ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ #pragma once
10
+
11
+ #include <string>
12
+
13
+ #include <tensorpipe/common/error.h>
14
+
15
+ namespace tensorpipe {
16
+ namespace channel {
17
+
18
+ class ContextClosedError final : public BaseError {
19
+ public:
20
+ ContextClosedError() {}
21
+
22
+ std::string what() const override;
23
+ };
24
+
25
+ class ChannelClosedError final : public BaseError {
26
+ public:
27
+ ChannelClosedError() {}
28
+
29
+ std::string what() const override;
30
+ };
31
+
32
+ class ContextNotViableError final : public BaseError {
33
+ public:
34
+ ContextNotViableError() {}
35
+
36
+ std::string what() const override;
37
+ };
38
+
39
+ } // namespace channel
40
+ } // namespace tensorpipe
videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/channel/xth/factory.h ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ #pragma once
10
+
11
+ #include <memory>
12
+
13
+ #include <tensorpipe/channel/context.h>
14
+
15
+ namespace tensorpipe {
16
+ namespace channel {
17
+ namespace xth {
18
+
19
+ std::shared_ptr<Context> create();
20
+
21
+ } // namespace xth
22
+ } // namespace channel
23
+ } // namespace tensorpipe
videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/common/cpu_buffer.h ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ #pragma once
10
+
11
+ #include <tensorpipe/common/device.h>
12
+
13
+ namespace tensorpipe {
14
+
15
+ struct CpuBuffer {
16
+ void* ptr{nullptr};
17
+
18
+ Device getDevice() const {
19
+ return Device{kCpuDeviceType, 0};
20
+ }
21
+ };
22
+
23
+ } // namespace tensorpipe
videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/common/cuda_buffer.h ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ #pragma once
10
+
11
+ #include <cuda_runtime.h>
12
+
13
+ #include <tensorpipe/common/device.h>
14
+
15
+ namespace tensorpipe {
16
+
17
+ struct CudaBuffer {
18
+ void* ptr{nullptr};
19
+ cudaStream_t stream{cudaStreamDefault};
20
+
21
+ Device getDevice() const;
22
+ };
23
+
24
+ } // namespace tensorpipe
videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/common/device.h ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ #pragma once
10
+
11
+ #include <sstream>
12
+ #include <stdexcept>
13
+ #include <string>
14
+
15
+ namespace tensorpipe {
16
+
17
+ const std::string kCpuDeviceType{"cpu"};
18
+ const std::string kCudaDeviceType{"cuda"};
19
+
20
+ struct Device {
21
+ std::string type;
22
+ int index;
23
+
24
+ // This pointless constructor is needed to work around a bug in GCC 5.5 (and
25
+ // possibly other versions). It appears to be needed in the nop types that
26
+ // are used inside nop::Optional.
27
+ Device() {}
28
+
29
+ Device(std::string type, int index) : type(std::move(type)), index(index) {}
30
+
31
+ std::string toString() const {
32
+ std::stringstream ss;
33
+ ss << type << ":" << index;
34
+ return ss.str();
35
+ }
36
+
37
+ bool operator==(const Device& other) const {
38
+ return type == other.type && index == other.index;
39
+ }
40
+ };
41
+
42
+ } // namespace tensorpipe
43
+
44
+ namespace std {
45
+
46
+ template <>
47
+ struct hash<::tensorpipe::Device> {
48
+ size_t operator()(const ::tensorpipe::Device& device) const noexcept {
49
+ return std::hash<std::string>{}(device.toString());
50
+ }
51
+ };
52
+
53
+ template <>
54
+ struct hash<std::pair<::tensorpipe::Device, ::tensorpipe::Device>> {
55
+ size_t operator()(const std::pair<::tensorpipe::Device, ::tensorpipe::Device>&
56
+ p) const noexcept {
57
+ size_t h1 = std::hash<::tensorpipe::Device>{}(p.first);
58
+ size_t h2 = std::hash<::tensorpipe::Device>{}(p.second);
59
+ // Shifting one hash to avoid collisions between (a, b) and (b, a).
60
+ return h1 ^ (h2 << 1);
61
+ }
62
+ };
63
+
64
+ } // namespace std
videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/common/error.h ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ #pragma once
10
+
11
+ #include <memory>
12
+ #include <string>
13
+
14
+ namespace tensorpipe {
15
+
16
+ // Base class for actual errors.
17
+ class BaseError {
18
+ public:
19
+ virtual ~BaseError() = default;
20
+
21
+ // Returns an explanatory string.
22
+ // Like `std::exception` but returns a `std::string`.
23
+ virtual std::string what() const = 0;
24
+ };
25
+
26
+ // Wrapper class for errors.
27
+ //
28
+ // Background: we wish to not use exceptions yet need an error
29
+ // representation that can propagate across function and thread
30
+ // boundaries. This representation must be copyable (so we can store
31
+ // and return it at a later point in time) and retain downstream type
32
+ // information. This implies a heap allocation because it's the
33
+ // easiest way to deal with variable size objects (barring a union of
34
+ // all downstream error classes and a lot of custom code). Instead of
35
+ // passing a shared_ptr around directly, we use this wrapper class to
36
+ // keep implementation details hidden from calling code.
37
+ //
38
+ class Error final {
39
+ public:
40
+ // Constant instance that indicates success.
41
+ static const Error kSuccess;
42
+
43
+ // Default constructor for error that is not an error.
44
+ Error() {}
45
+
46
+ Error(std::shared_ptr<BaseError> error, std::string file, int line)
47
+ : error_(std::move(error)), file_(std::move(file)), line_(line) {}
48
+
49
+ virtual ~Error() = default;
50
+
51
+ // Converting to boolean means checking if there is an error. This
52
+ // means we don't need to use an `std::optional` and allows for a
53
+ // snippet like the following:
54
+ //
55
+ // if (error) {
56
+ // // Deal with it.
57
+ // }
58
+ //
59
+ operator bool() const {
60
+ return static_cast<bool>(error_);
61
+ }
62
+
63
+ template <typename T>
64
+ std::shared_ptr<T> castToType() const {
65
+ return std::dynamic_pointer_cast<T>(error_);
66
+ }
67
+
68
+ template <typename T>
69
+ bool isOfType() const {
70
+ return castToType<T>() != nullptr;
71
+ }
72
+
73
+ // Like `std::exception` but returns a `std::string`.
74
+ std::string what() const;
75
+
76
+ private:
77
+ std::shared_ptr<BaseError> error_;
78
+ std::string file_;
79
+ int line_;
80
+ };
81
+
82
+ class SystemError final : public BaseError {
83
+ public:
84
+ explicit SystemError(const char* syscall, int error)
85
+ : syscall_(syscall), error_(error) {}
86
+
87
+ std::string what() const override;
88
+
89
+ int errorCode() const;
90
+
91
+ private:
92
+ const char* syscall_;
93
+ const int error_;
94
+ };
95
+
96
+ class ShortReadError final : public BaseError {
97
+ public:
98
+ ShortReadError(ssize_t expected, ssize_t actual)
99
+ : expected_(expected), actual_(actual) {}
100
+
101
+ std::string what() const override;
102
+
103
+ private:
104
+ const ssize_t expected_;
105
+ const ssize_t actual_;
106
+ };
107
+
108
+ class ShortWriteError final : public BaseError {
109
+ public:
110
+ ShortWriteError(ssize_t expected, ssize_t actual)
111
+ : expected_(expected), actual_(actual) {}
112
+
113
+ std::string what() const override;
114
+
115
+ private:
116
+ const ssize_t expected_;
117
+ const ssize_t actual_;
118
+ };
119
+
120
+ class EOFError final : public BaseError {
121
+ public:
122
+ EOFError() {}
123
+
124
+ std::string what() const override;
125
+ };
126
+
127
+ } // namespace tensorpipe
videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/common/optional.h ADDED
@@ -0,0 +1,1020 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (C) 2011 - 2012 Andrzej Krzemienski.
2
+ //
3
+ // Use, modification, and distribution is subject to the Boost Software
4
+ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5
+ // http://www.boost.org/LICENSE_1_0.txt)
6
+ //
7
+ // The idea and interface is based on Boost.Optional library
8
+ // authored by Fernando Luis Cacciola Carballal
9
+
10
+ #pragma once
11
+
12
+ #include <cassert>
13
+ #include <functional>
14
+ #include <initializer_list>
15
+ #include <stdexcept>
16
+ #include <string>
17
+ #include <type_traits>
18
+ #include <utility>
19
+
20
+ #define TR2_OPTIONAL_REQUIRES(...) \
21
+ typename std::enable_if<__VA_ARGS__::value, bool>::type = false
22
+
23
+ #if defined __GNUC__ // NOTE: GNUC is also defined for Clang
24
+ #if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)
25
+ #define TR2_OPTIONAL_GCC_4_8_AND_HIGHER___
26
+ #elif (__GNUC__ > 4)
27
+ #define TR2_OPTIONAL_GCC_4_8_AND_HIGHER___
28
+ #endif
29
+ #
30
+ #if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)
31
+ #define TR2_OPTIONAL_GCC_4_7_AND_HIGHER___
32
+ #elif (__GNUC__ > 4)
33
+ #define TR2_OPTIONAL_GCC_4_7_AND_HIGHER___
34
+ #endif
35
+ #
36
+ #if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) && (__GNUC_PATCHLEVEL__ >= 1)
37
+ #define TR2_OPTIONAL_GCC_4_8_1_AND_HIGHER___
38
+ #elif (__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)
39
+ #define TR2_OPTIONAL_GCC_4_8_1_AND_HIGHER___
40
+ #elif (__GNUC__ > 4)
41
+ #define TR2_OPTIONAL_GCC_4_8_1_AND_HIGHER___
42
+ #endif
43
+ #endif
44
+ #
45
+ #if defined __clang_major__
46
+ #if (__clang_major__ == 3 && __clang_minor__ >= 5)
47
+ #define TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_
48
+ #elif (__clang_major__ > 3)
49
+ #define TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_
50
+ #endif
51
+ #if defined TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_
52
+ #define TR2_OPTIONAL_CLANG_3_4_2_AND_HIGHER_
53
+ #elif ( \
54
+ __clang_major__ == 3 && __clang_minor__ == 4 && __clang_patchlevel__ >= 2)
55
+ #define TR2_OPTIONAL_CLANG_3_4_2_AND_HIGHER_
56
+ #endif
57
+ #endif
58
+ #
59
+ #if defined _MSC_VER
60
+ #if (_MSC_VER >= 1900)
61
+ #define TR2_OPTIONAL_MSVC_2015_AND_HIGHER___
62
+ #endif
63
+ #endif
64
+
65
+ #if defined __clang__
66
+ #if (__clang_major__ > 2) || (__clang_major__ == 2) && (__clang_minor__ >= 9)
67
+ #define OPTIONAL_HAS_THIS_RVALUE_REFS 1
68
+ #else
69
+ #define OPTIONAL_HAS_THIS_RVALUE_REFS 0
70
+ #endif
71
+ #elif defined TR2_OPTIONAL_GCC_4_8_1_AND_HIGHER___
72
+ #define OPTIONAL_HAS_THIS_RVALUE_REFS 1
73
+ #elif defined TR2_OPTIONAL_MSVC_2015_AND_HIGHER___
74
+ #define OPTIONAL_HAS_THIS_RVALUE_REFS 1
75
+ #else
76
+ #define OPTIONAL_HAS_THIS_RVALUE_REFS 0
77
+ #endif
78
+
79
+ #if defined TR2_OPTIONAL_GCC_4_8_1_AND_HIGHER___
80
+ #define OPTIONAL_HAS_CONSTEXPR_INIT_LIST 1
81
+ #define OPTIONAL_CONSTEXPR_INIT_LIST constexpr
82
+ #else
83
+ #define OPTIONAL_HAS_CONSTEXPR_INIT_LIST 0
84
+ #define OPTIONAL_CONSTEXPR_INIT_LIST
85
+ #endif
86
+
87
+ #if defined TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_ && (defined __cplusplus) && \
88
+ (__cplusplus != 201103L)
89
+ #define OPTIONAL_HAS_MOVE_ACCESSORS 1
90
+ #else
91
+ #define OPTIONAL_HAS_MOVE_ACCESSORS 0
92
+ #endif
93
+
94
+ #// In C++11 constexpr implies const, so we need to make non-const members also non-constexpr
95
+ #if (defined __cplusplus) && (__cplusplus == 201103L)
96
+ #define OPTIONAL_MUTABLE_CONSTEXPR
97
+ #else
98
+ #define OPTIONAL_MUTABLE_CONSTEXPR constexpr
99
+ #endif
100
+
101
+ namespace tensorpipe {
102
+
103
+ // 20.5.4, optional for object types
104
+ template <class T>
105
+ class optional;
106
+
107
+ // 20.5.5, optional for lvalue reference types
108
+ template <class T>
109
+ class optional<T&>;
110
+
111
+ // workaround: std utility functions aren't constexpr yet
112
+ template <class T>
113
+ inline constexpr T&& constexpr_forward(
114
+ typename std::remove_reference<T>::type& t) noexcept {
115
+ return static_cast<T&&>(t);
116
+ }
117
+
118
+ template <class T>
119
+ inline constexpr T&& constexpr_forward(
120
+ typename std::remove_reference<T>::type&& t) noexcept {
121
+ static_assert(!std::is_lvalue_reference<T>::value, "!!");
122
+ return static_cast<T&&>(t);
123
+ }
124
+
125
+ template <class T>
126
+ inline constexpr typename std::remove_reference<T>::type&& constexpr_move(
127
+ T&& t) noexcept {
128
+ return static_cast<typename std::remove_reference<T>::type&&>(t);
129
+ }
130
+
131
+ #if defined NDEBUG
132
+ #define TR2_OPTIONAL_ASSERTED_EXPRESSION(CHECK, EXPR) (EXPR)
133
+ #else
134
+ #define TR2_OPTIONAL_ASSERTED_EXPRESSION(CHECK, EXPR) \
135
+ ((CHECK) ? (EXPR) : ([] { assert(!#CHECK); }(), (EXPR)))
136
+ #endif
137
+
138
+ namespace detail_ {
139
+
140
+ // static_addressof: a constexpr version of addressof
141
+ template <typename T>
142
+ struct has_overloaded_addressof {
143
+ template <class X>
144
+ constexpr static bool has_overload(...) {
145
+ return false;
146
+ }
147
+
148
+ template <class X, size_t S = sizeof(std::declval<X&>().operator&())>
149
+ constexpr static bool has_overload(bool) {
150
+ return true;
151
+ }
152
+
153
+ constexpr static bool value = has_overload<T>(true);
154
+ };
155
+
156
+ template <typename T, TR2_OPTIONAL_REQUIRES(!has_overloaded_addressof<T>)>
157
+ constexpr T* static_addressof(T& ref) {
158
+ return &ref;
159
+ }
160
+
161
+ template <typename T, TR2_OPTIONAL_REQUIRES(has_overloaded_addressof<T>)>
162
+ T* static_addressof(T& ref) {
163
+ return std::addressof(ref);
164
+ }
165
+
166
+ // the call to convert<A>(b) has return type A and converts b to type A iff b
167
+ // decltype(b) is implicitly convertible to A
168
+ template <class U>
169
+ constexpr U convert(U v) {
170
+ return v;
171
+ }
172
+
173
+ } // namespace detail_
174
+
175
+ constexpr struct trivial_init_t {
176
+ } trivial_init{};
177
+
178
+ // 20.5.6, In-place construction
179
+ constexpr struct in_place_t {
180
+ } in_place{};
181
+
182
+ // 20.5.7, Disengaged state indicator
183
+ struct nullopt_t {
184
+ struct init {};
185
+ constexpr explicit nullopt_t(init) {}
186
+ };
187
+ constexpr nullopt_t nullopt{nullopt_t::init()};
188
+
189
+ // 20.5.8, class bad_optional_access
190
+ class bad_optional_access : public std::logic_error {
191
+ public:
192
+ explicit bad_optional_access(const std::string& what_arg)
193
+ : logic_error{what_arg} {}
194
+ explicit bad_optional_access(const char* what_arg) : logic_error{what_arg} {}
195
+ };
196
+
197
+ template <class T>
198
+ union storage_t {
199
+ unsigned char dummy_;
200
+ T value_;
201
+
202
+ constexpr storage_t(trivial_init_t) noexcept : dummy_(){};
203
+
204
+ template <class... Args>
205
+ constexpr storage_t(Args&&... args)
206
+ : value_(constexpr_forward<Args>(args)...) {}
207
+
208
+ ~storage_t() {}
209
+ };
210
+
211
+ template <class T>
212
+ union constexpr_storage_t {
213
+ unsigned char dummy_;
214
+ T value_;
215
+
216
+ constexpr constexpr_storage_t(trivial_init_t) noexcept : dummy_(){};
217
+
218
+ template <class... Args>
219
+ constexpr constexpr_storage_t(Args&&... args)
220
+ : value_(constexpr_forward<Args>(args)...) {}
221
+
222
+ ~constexpr_storage_t() = default;
223
+ };
224
+
225
+ template <class T>
226
+ struct optional_base {
227
+ bool init_;
228
+ storage_t<T> storage_;
229
+
230
+ constexpr optional_base() noexcept : init_(false), storage_(trivial_init){};
231
+
232
+ explicit constexpr optional_base(const T& v) : init_(true), storage_(v) {}
233
+
234
+ explicit constexpr optional_base(T&& v)
235
+ : init_(true), storage_(constexpr_move(v)) {}
236
+
237
+ template <class... Args>
238
+ explicit optional_base(in_place_t, Args&&... args)
239
+ : init_(true), storage_(constexpr_forward<Args>(args)...) {}
240
+
241
+ template <
242
+ class U,
243
+ class... Args,
244
+ TR2_OPTIONAL_REQUIRES(std::is_constructible<T, std::initializer_list<U>>)>
245
+ explicit optional_base(
246
+ in_place_t,
247
+ std::initializer_list<U> il,
248
+ Args&&... args)
249
+ : init_(true), storage_(il, std::forward<Args>(args)...) {}
250
+
251
+ ~optional_base() {
252
+ if (init_)
253
+ storage_.value_.T::~T();
254
+ }
255
+ };
256
+
257
+ template <class T>
258
+ struct constexpr_optional_base {
259
+ bool init_;
260
+ constexpr_storage_t<T> storage_;
261
+
262
+ constexpr constexpr_optional_base() noexcept
263
+ : init_(false), storage_(trivial_init){};
264
+
265
+ explicit constexpr constexpr_optional_base(const T& v)
266
+ : init_(true), storage_(v) {}
267
+
268
+ explicit constexpr constexpr_optional_base(T&& v)
269
+ : init_(true), storage_(constexpr_move(v)) {}
270
+
271
+ template <class... Args>
272
+ explicit constexpr constexpr_optional_base(in_place_t, Args&&... args)
273
+ : init_(true), storage_(constexpr_forward<Args>(args)...) {}
274
+
275
+ template <
276
+ class U,
277
+ class... Args,
278
+ TR2_OPTIONAL_REQUIRES(std::is_constructible<T, std::initializer_list<U>>)>
279
+ OPTIONAL_CONSTEXPR_INIT_LIST explicit constexpr_optional_base(
280
+ in_place_t,
281
+ std::initializer_list<U> il,
282
+ Args&&... args)
283
+ : init_(true), storage_(il, std::forward<Args>(args)...) {}
284
+
285
+ ~constexpr_optional_base() = default;
286
+ };
287
+
288
+ template <class T>
289
+ using OptionalBase = typename std::conditional<
290
+ std::is_trivially_destructible<T>::value, // if possible
291
+ constexpr_optional_base<typename std::remove_const<
292
+ T>::type>, // use base with trivial destructor
293
+ optional_base<typename std::remove_const<T>::type>>::type;
294
+
295
+ template <class T>
296
+ class optional : private OptionalBase<T> {
297
+ static_assert(
298
+ !std::is_same<typename std::decay<T>::type, nullopt_t>::value,
299
+ "bad T");
300
+ static_assert(
301
+ !std::is_same<typename std::decay<T>::type, in_place_t>::value,
302
+ "bad T");
303
+
304
+ constexpr bool initialized() const noexcept {
305
+ return OptionalBase<T>::init_;
306
+ }
307
+ typename std::remove_const<T>::type* dataptr() {
308
+ return std::addressof(OptionalBase<T>::storage_.value_);
309
+ }
310
+ constexpr const T* dataptr() const {
311
+ return detail_::static_addressof(OptionalBase<T>::storage_.value_);
312
+ }
313
+
314
+ #if OPTIONAL_HAS_THIS_RVALUE_REFS == 1
315
+ constexpr const T& contained_val() const& {
316
+ return OptionalBase<T>::storage_.value_;
317
+ }
318
+ #if OPTIONAL_HAS_MOVE_ACCESSORS == 1
319
+ OPTIONAL_MUTABLE_CONSTEXPR T&& contained_val() && {
320
+ return std::move(OptionalBase<T>::storage_.value_);
321
+ }
322
+ OPTIONAL_MUTABLE_CONSTEXPR T& contained_val() & {
323
+ return OptionalBase<T>::storage_.value_;
324
+ }
325
+ #else
326
+ T& contained_val() & {
327
+ return OptionalBase<T>::storage_.value_;
328
+ }
329
+ T&& contained_val() && {
330
+ return std::move(OptionalBase<T>::storage_.value_);
331
+ }
332
+ #endif
333
+ #else
334
+ constexpr const T& contained_val() const {
335
+ return OptionalBase<T>::storage_.value_;
336
+ }
337
+ T& contained_val() {
338
+ return OptionalBase<T>::storage_.value_;
339
+ }
340
+ #endif
341
+
342
+ void clear() noexcept {
343
+ if (initialized())
344
+ dataptr()->T::~T();
345
+ OptionalBase<T>::init_ = false;
346
+ }
347
+
348
+ template <class... Args>
349
+ void initialize(Args&&... args) noexcept(
350
+ noexcept(T(std::forward<Args>(args)...))) {
351
+ assert(!OptionalBase<T>::init_);
352
+ ::new (static_cast<void*>(dataptr())) T(std::forward<Args>(args)...);
353
+ OptionalBase<T>::init_ = true;
354
+ }
355
+
356
+ template <class U, class... Args>
357
+ void initialize(std::initializer_list<U> il, Args&&... args) noexcept(
358
+ noexcept(T(il, std::forward<Args>(args)...))) {
359
+ assert(!OptionalBase<T>::init_);
360
+ ::new (static_cast<void*>(dataptr())) T(il, std::forward<Args>(args)...);
361
+ OptionalBase<T>::init_ = true;
362
+ }
363
+
364
+ public:
365
+ typedef T value_type;
366
+
367
+ // 20.5.5.1, constructors
368
+ constexpr optional() noexcept : OptionalBase<T>(){};
369
+ constexpr optional(nullopt_t) noexcept : OptionalBase<T>(){};
370
+
371
+ optional(const optional& rhs) : OptionalBase<T>() {
372
+ if (rhs.initialized()) {
373
+ ::new (static_cast<void*>(dataptr())) T(*rhs);
374
+ OptionalBase<T>::init_ = true;
375
+ }
376
+ }
377
+
378
+ optional(optional&& rhs) noexcept(
379
+ std::is_nothrow_move_constructible<T>::value)
380
+ : OptionalBase<T>() {
381
+ if (rhs.initialized()) {
382
+ ::new (static_cast<void*>(dataptr())) T(std::move(*rhs));
383
+ OptionalBase<T>::init_ = true;
384
+ }
385
+ }
386
+
387
+ constexpr optional(const T& v) : OptionalBase<T>(v) {}
388
+
389
+ constexpr optional(T&& v) : OptionalBase<T>(constexpr_move(v)) {}
390
+
391
+ template <class... Args>
392
+ explicit constexpr optional(in_place_t, Args&&... args)
393
+ : OptionalBase<T>(in_place_t{}, constexpr_forward<Args>(args)...) {}
394
+
395
+ template <
396
+ class U,
397
+ class... Args,
398
+ TR2_OPTIONAL_REQUIRES(std::is_constructible<T, std::initializer_list<U>>)>
399
+ OPTIONAL_CONSTEXPR_INIT_LIST explicit optional(
400
+ in_place_t,
401
+ std::initializer_list<U> il,
402
+ Args&&... args)
403
+ : OptionalBase<T>(in_place_t{}, il, constexpr_forward<Args>(args)...) {}
404
+
405
+ // 20.5.4.2, Destructor
406
+ ~optional() = default;
407
+
408
+ // 20.5.4.3, assignment
409
+ optional& operator=(nullopt_t) noexcept {
410
+ clear();
411
+ return *this;
412
+ }
413
+
414
+ optional& operator=(const optional& rhs) {
415
+ if (initialized() == true && rhs.initialized() == false)
416
+ clear();
417
+ else if (initialized() == false && rhs.initialized() == true)
418
+ initialize(*rhs);
419
+ else if (initialized() == true && rhs.initialized() == true)
420
+ contained_val() = *rhs;
421
+ return *this;
422
+ }
423
+
424
+ optional& operator=(optional&& rhs) noexcept(
425
+ std::is_nothrow_move_assignable<T>::value&&
426
+ std::is_nothrow_move_constructible<T>::value) {
427
+ if (initialized() == true && rhs.initialized() == false)
428
+ clear();
429
+ else if (initialized() == false && rhs.initialized() == true)
430
+ initialize(std::move(*rhs));
431
+ else if (initialized() == true && rhs.initialized() == true)
432
+ contained_val() = std::move(*rhs);
433
+ return *this;
434
+ }
435
+
436
+ template <class U>
437
+ auto operator=(U&& v) -> typename std::enable_if<
438
+ std::is_same<typename std::decay<U>::type, T>::value,
439
+ optional&>::type {
440
+ if (initialized()) {
441
+ contained_val() = std::forward<U>(v);
442
+ } else {
443
+ initialize(std::forward<U>(v));
444
+ }
445
+ return *this;
446
+ }
447
+
448
+ template <class... Args>
449
+ void emplace(Args&&... args) {
450
+ clear();
451
+ initialize(std::forward<Args>(args)...);
452
+ }
453
+
454
+ template <class U, class... Args>
455
+ void emplace(std::initializer_list<U> il, Args&&... args) {
456
+ clear();
457
+ initialize<U, Args...>(il, std::forward<Args>(args)...);
458
+ }
459
+
460
+ // 20.5.4.4, Swap
461
+ void swap(optional<T>& rhs) noexcept(
462
+ std::is_nothrow_move_constructible<T>::value&& noexcept(
463
+ std::swap(std::declval<T&>(), std::declval<T&>()))) {
464
+ if (initialized() == true && rhs.initialized() == false) {
465
+ rhs.initialize(std::move(**this));
466
+ clear();
467
+ } else if (initialized() == false && rhs.initialized() == true) {
468
+ initialize(std::move(*rhs));
469
+ rhs.clear();
470
+ } else if (initialized() == true && rhs.initialized() == true) {
471
+ using std::swap;
472
+ swap(**this, *rhs);
473
+ }
474
+ }
475
+
476
+ // 20.5.4.5, Observers
477
+
478
+ explicit constexpr operator bool() const noexcept {
479
+ return initialized();
480
+ }
481
+ constexpr bool has_value() const noexcept {
482
+ return initialized();
483
+ }
484
+
485
+ constexpr T const* operator->() const {
486
+ return TR2_OPTIONAL_ASSERTED_EXPRESSION(initialized(), dataptr());
487
+ }
488
+
489
+ #if OPTIONAL_HAS_MOVE_ACCESSORS == 1
490
+
491
+ OPTIONAL_MUTABLE_CONSTEXPR T* operator->() {
492
+ assert(initialized());
493
+ return dataptr();
494
+ }
495
+
496
+ constexpr T const& operator*() const& {
497
+ return TR2_OPTIONAL_ASSERTED_EXPRESSION(initialized(), contained_val());
498
+ }
499
+
500
+ OPTIONAL_MUTABLE_CONSTEXPR T& operator*() & {
501
+ assert(initialized());
502
+ return contained_val();
503
+ }
504
+
505
+ OPTIONAL_MUTABLE_CONSTEXPR T&& operator*() && {
506
+ assert(initialized());
507
+ return constexpr_move(contained_val());
508
+ }
509
+
510
+ constexpr T const& value() const& {
511
+ return initialized()
512
+ ? contained_val()
513
+ : (throw bad_optional_access("bad optional access"), contained_val());
514
+ }
515
+
516
+ OPTIONAL_MUTABLE_CONSTEXPR T& value() & {
517
+ return initialized()
518
+ ? contained_val()
519
+ : (throw bad_optional_access("bad optional access"), contained_val());
520
+ }
521
+
522
+ OPTIONAL_MUTABLE_CONSTEXPR T&& value() && {
523
+ if (!initialized())
524
+ throw bad_optional_access("bad optional access");
525
+ return std::move(contained_val());
526
+ }
527
+
528
+ #else
529
+
530
+ T* operator->() {
531
+ assert(initialized());
532
+ return dataptr();
533
+ }
534
+
535
+ constexpr T const& operator*() const {
536
+ return TR2_OPTIONAL_ASSERTED_EXPRESSION(initialized(), contained_val());
537
+ }
538
+
539
+ T& operator*() {
540
+ assert(initialized());
541
+ return contained_val();
542
+ }
543
+
544
+ constexpr T const& value() const {
545
+ return initialized()
546
+ ? contained_val()
547
+ : (throw bad_optional_access("bad optional access"), contained_val());
548
+ }
549
+
550
+ T& value() {
551
+ return initialized()
552
+ ? contained_val()
553
+ : (throw bad_optional_access("bad optional access"), contained_val());
554
+ }
555
+
556
+ #endif
557
+
558
+ #if OPTIONAL_HAS_THIS_RVALUE_REFS == 1
559
+
560
+ template <class V>
561
+ constexpr T value_or(V&& v) const& {
562
+ return *this ? **this : detail_::convert<T>(constexpr_forward<V>(v));
563
+ }
564
+
565
+ #if OPTIONAL_HAS_MOVE_ACCESSORS == 1
566
+
567
+ template <class V>
568
+ OPTIONAL_MUTABLE_CONSTEXPR T value_or(V&& v) && {
569
+ return *this
570
+ ? constexpr_move(const_cast<optional<T>&>(*this).contained_val())
571
+ : detail_::convert<T>(constexpr_forward<V>(v));
572
+ }
573
+
574
+ #else
575
+
576
+ template <class V>
577
+ T value_or(V&& v) && {
578
+ return *this
579
+ ? constexpr_move(const_cast<optional<T>&>(*this).contained_val())
580
+ : detail_::convert<T>(constexpr_forward<V>(v));
581
+ }
582
+
583
+ #endif
584
+
585
+ #else
586
+
587
+ template <class V>
588
+ constexpr T value_or(V&& v) const {
589
+ return *this ? **this : detail_::convert<T>(constexpr_forward<V>(v));
590
+ }
591
+
592
+ #endif
593
+
594
+ // 20.6.3.6, modifiers
595
+ void reset() noexcept {
596
+ clear();
597
+ }
598
+ };
599
+
600
+ template <class T>
601
+ class optional<T&> {
602
+ static_assert(!std::is_same<T, nullopt_t>::value, "bad T");
603
+ static_assert(!std::is_same<T, in_place_t>::value, "bad T");
604
+ T* ref;
605
+
606
+ public:
607
+ // 20.5.5.1, construction/destruction
608
+ constexpr optional() noexcept : ref(nullptr) {}
609
+
610
+ constexpr optional(nullopt_t) noexcept : ref(nullptr) {}
611
+
612
+ constexpr optional(T& v) noexcept : ref(detail_::static_addressof(v)) {}
613
+
614
+ optional(T&&) = delete;
615
+
616
+ constexpr optional(const optional& rhs) noexcept : ref(rhs.ref) {}
617
+
618
+ explicit constexpr optional(in_place_t, T& v) noexcept
619
+ : ref(detail_::static_addressof(v)) {}
620
+
621
+ explicit optional(in_place_t, T&&) = delete;
622
+
623
+ ~optional() = default;
624
+
625
+ // 20.5.5.2, mutation
626
+ optional& operator=(nullopt_t) noexcept {
627
+ ref = nullptr;
628
+ return *this;
629
+ }
630
+
631
+ // optional& operator=(const optional& rhs) noexcept {
632
+ // ref = rhs.ref;
633
+ // return *this;
634
+ // }
635
+
636
+ // optional& operator=(optional&& rhs) noexcept {
637
+ // ref = rhs.ref;
638
+ // return *this;
639
+ // }
640
+
641
+ template <typename U>
642
+ auto operator=(U&& rhs) noexcept -> typename std::enable_if<
643
+ std::is_same<typename std::decay<U>::type, optional<T&>>::value,
644
+ optional&>::type {
645
+ ref = rhs.ref;
646
+ return *this;
647
+ }
648
+
649
+ template <typename U>
650
+ auto operator=(U&& rhs) noexcept -> typename std::enable_if<
651
+ !std::is_same<typename std::decay<U>::type, optional<T&>>::value,
652
+ optional&>::type = delete;
653
+
654
+ void emplace(T& v) noexcept {
655
+ ref = detail_::static_addressof(v);
656
+ }
657
+
658
+ void emplace(T&&) = delete;
659
+
660
+ void swap(optional<T&>& rhs) noexcept {
661
+ std::swap(ref, rhs.ref);
662
+ }
663
+
664
+ // 20.5.5.3, observers
665
+ constexpr T* operator->() const {
666
+ return TR2_OPTIONAL_ASSERTED_EXPRESSION(ref, ref);
667
+ }
668
+
669
+ constexpr T& operator*() const {
670
+ return TR2_OPTIONAL_ASSERTED_EXPRESSION(ref, *ref);
671
+ }
672
+
673
+ constexpr T& value() const {
674
+ return ref ? *ref
675
+ : (throw bad_optional_access("bad optional access"), *ref);
676
+ }
677
+
678
+ explicit constexpr operator bool() const noexcept {
679
+ return ref != nullptr;
680
+ }
681
+
682
+ constexpr bool has_value() const noexcept {
683
+ return ref != nullptr;
684
+ }
685
+
686
+ template <class V>
687
+ constexpr typename std::decay<T>::type value_or(V&& v) const {
688
+ return *this ? **this
689
+ : detail_::convert<typename std::decay<T>::type>(
690
+ constexpr_forward<V>(v));
691
+ }
692
+
693
+ // x.x.x.x, modifiers
694
+ void reset() noexcept {
695
+ ref = nullptr;
696
+ }
697
+ };
698
+
699
+ template <class T>
700
+ class optional<T&&> {
701
+ static_assert(sizeof(T) == 0, "optional rvalue references disallowed");
702
+ };
703
+
704
+ // 20.5.8, Relational operators
705
+ template <class T>
706
+ constexpr bool operator==(const optional<T>& x, const optional<T>& y) {
707
+ return bool(x) != bool(y) ? false : bool(x) == false ? true : *x == *y;
708
+ }
709
+
710
+ template <class T>
711
+ constexpr bool operator!=(const optional<T>& x, const optional<T>& y) {
712
+ return !(x == y);
713
+ }
714
+
715
+ template <class T>
716
+ constexpr bool operator<(const optional<T>& x, const optional<T>& y) {
717
+ return (!y) ? false : (!x) ? true : *x < *y;
718
+ }
719
+
720
+ template <class T>
721
+ constexpr bool operator>(const optional<T>& x, const optional<T>& y) {
722
+ return (y < x);
723
+ }
724
+
725
+ template <class T>
726
+ constexpr bool operator<=(const optional<T>& x, const optional<T>& y) {
727
+ return !(y < x);
728
+ }
729
+
730
+ template <class T>
731
+ constexpr bool operator>=(const optional<T>& x, const optional<T>& y) {
732
+ return !(x < y);
733
+ }
734
+
735
+ // 20.5.9, Comparison with nullopt
736
+ template <class T>
737
+ constexpr bool operator==(const optional<T>& x, nullopt_t) noexcept {
738
+ return (!x);
739
+ }
740
+
741
+ template <class T>
742
+ constexpr bool operator==(nullopt_t, const optional<T>& x) noexcept {
743
+ return (!x);
744
+ }
745
+
746
+ template <class T>
747
+ constexpr bool operator!=(const optional<T>& x, nullopt_t) noexcept {
748
+ return bool(x);
749
+ }
750
+
751
+ template <class T>
752
+ constexpr bool operator!=(nullopt_t, const optional<T>& x) noexcept {
753
+ return bool(x);
754
+ }
755
+
756
+ template <class T>
757
+ constexpr bool operator<(const optional<T>&, nullopt_t) noexcept {
758
+ return false;
759
+ }
760
+
761
+ template <class T>
762
+ constexpr bool operator<(nullopt_t, const optional<T>& x) noexcept {
763
+ return bool(x);
764
+ }
765
+
766
+ template <class T>
767
+ constexpr bool operator<=(const optional<T>& x, nullopt_t) noexcept {
768
+ return (!x);
769
+ }
770
+
771
+ template <class T>
772
+ constexpr bool operator<=(nullopt_t, const optional<T>&) noexcept {
773
+ return true;
774
+ }
775
+
776
+ template <class T>
777
+ constexpr bool operator>(const optional<T>& x, nullopt_t) noexcept {
778
+ return bool(x);
779
+ }
780
+
781
+ template <class T>
782
+ constexpr bool operator>(nullopt_t, const optional<T>&) noexcept {
783
+ return false;
784
+ }
785
+
786
+ template <class T>
787
+ constexpr bool operator>=(const optional<T>&, nullopt_t) noexcept {
788
+ return true;
789
+ }
790
+
791
+ template <class T>
792
+ constexpr bool operator>=(nullopt_t, const optional<T>& x) noexcept {
793
+ return (!x);
794
+ }
795
+
796
+ // 20.5.10, Comparison with T
797
+ template <class T>
798
+ constexpr bool operator==(const optional<T>& x, const T& v) {
799
+ return bool(x) ? *x == v : false;
800
+ }
801
+
802
+ template <class T>
803
+ constexpr bool operator==(const T& v, const optional<T>& x) {
804
+ return bool(x) ? v == *x : false;
805
+ }
806
+
807
+ template <class T>
808
+ constexpr bool operator!=(const optional<T>& x, const T& v) {
809
+ return bool(x) ? *x != v : true;
810
+ }
811
+
812
+ template <class T>
813
+ constexpr bool operator!=(const T& v, const optional<T>& x) {
814
+ return bool(x) ? v != *x : true;
815
+ }
816
+
817
+ template <class T>
818
+ constexpr bool operator<(const optional<T>& x, const T& v) {
819
+ return bool(x) ? *x < v : true;
820
+ }
821
+
822
+ template <class T>
823
+ constexpr bool operator>(const T& v, const optional<T>& x) {
824
+ return bool(x) ? v > *x : true;
825
+ }
826
+
827
+ template <class T>
828
+ constexpr bool operator>(const optional<T>& x, const T& v) {
829
+ return bool(x) ? *x > v : false;
830
+ }
831
+
832
+ template <class T>
833
+ constexpr bool operator<(const T& v, const optional<T>& x) {
834
+ return bool(x) ? v < *x : false;
835
+ }
836
+
837
+ template <class T>
838
+ constexpr bool operator>=(const optional<T>& x, const T& v) {
839
+ return bool(x) ? *x >= v : false;
840
+ }
841
+
842
+ template <class T>
843
+ constexpr bool operator<=(const T& v, const optional<T>& x) {
844
+ return bool(x) ? v <= *x : false;
845
+ }
846
+
847
+ template <class T>
848
+ constexpr bool operator<=(const optional<T>& x, const T& v) {
849
+ return bool(x) ? *x <= v : true;
850
+ }
851
+
852
+ template <class T>
853
+ constexpr bool operator>=(const T& v, const optional<T>& x) {
854
+ return bool(x) ? v >= *x : true;
855
+ }
856
+
857
+ // Comparison of optional<T&> with T
858
+ template <class T>
859
+ constexpr bool operator==(const optional<T&>& x, const T& v) {
860
+ return bool(x) ? *x == v : false;
861
+ }
862
+
863
+ template <class T>
864
+ constexpr bool operator==(const T& v, const optional<T&>& x) {
865
+ return bool(x) ? v == *x : false;
866
+ }
867
+
868
+ template <class T>
869
+ constexpr bool operator!=(const optional<T&>& x, const T& v) {
870
+ return bool(x) ? *x != v : true;
871
+ }
872
+
873
+ template <class T>
874
+ constexpr bool operator!=(const T& v, const optional<T&>& x) {
875
+ return bool(x) ? v != *x : true;
876
+ }
877
+
878
+ template <class T>
879
+ constexpr bool operator<(const optional<T&>& x, const T& v) {
880
+ return bool(x) ? *x < v : true;
881
+ }
882
+
883
+ template <class T>
884
+ constexpr bool operator>(const T& v, const optional<T&>& x) {
885
+ return bool(x) ? v > *x : true;
886
+ }
887
+
888
+ template <class T>
889
+ constexpr bool operator>(const optional<T&>& x, const T& v) {
890
+ return bool(x) ? *x > v : false;
891
+ }
892
+
893
+ template <class T>
894
+ constexpr bool operator<(const T& v, const optional<T&>& x) {
895
+ return bool(x) ? v < *x : false;
896
+ }
897
+
898
+ template <class T>
899
+ constexpr bool operator>=(const optional<T&>& x, const T& v) {
900
+ return bool(x) ? *x >= v : false;
901
+ }
902
+
903
+ template <class T>
904
+ constexpr bool operator<=(const T& v, const optional<T&>& x) {
905
+ return bool(x) ? v <= *x : false;
906
+ }
907
+
908
+ template <class T>
909
+ constexpr bool operator<=(const optional<T&>& x, const T& v) {
910
+ return bool(x) ? *x <= v : true;
911
+ }
912
+
913
+ template <class T>
914
+ constexpr bool operator>=(const T& v, const optional<T&>& x) {
915
+ return bool(x) ? v >= *x : true;
916
+ }
917
+
918
+ // Comparison of optional<T const&> with T
919
+ template <class T>
920
+ constexpr bool operator==(const optional<const T&>& x, const T& v) {
921
+ return bool(x) ? *x == v : false;
922
+ }
923
+
924
+ template <class T>
925
+ constexpr bool operator==(const T& v, const optional<const T&>& x) {
926
+ return bool(x) ? v == *x : false;
927
+ }
928
+
929
+ template <class T>
930
+ constexpr bool operator!=(const optional<const T&>& x, const T& v) {
931
+ return bool(x) ? *x != v : true;
932
+ }
933
+
934
+ template <class T>
935
+ constexpr bool operator!=(const T& v, const optional<const T&>& x) {
936
+ return bool(x) ? v != *x : true;
937
+ }
938
+
939
+ template <class T>
940
+ constexpr bool operator<(const optional<const T&>& x, const T& v) {
941
+ return bool(x) ? *x < v : true;
942
+ }
943
+
944
+ template <class T>
945
+ constexpr bool operator>(const T& v, const optional<const T&>& x) {
946
+ return bool(x) ? v > *x : true;
947
+ }
948
+
949
+ template <class T>
950
+ constexpr bool operator>(const optional<const T&>& x, const T& v) {
951
+ return bool(x) ? *x > v : false;
952
+ }
953
+
954
+ template <class T>
955
+ constexpr bool operator<(const T& v, const optional<const T&>& x) {
956
+ return bool(x) ? v < *x : false;
957
+ }
958
+
959
+ template <class T>
960
+ constexpr bool operator>=(const optional<const T&>& x, const T& v) {
961
+ return bool(x) ? *x >= v : false;
962
+ }
963
+
964
+ template <class T>
965
+ constexpr bool operator<=(const T& v, const optional<const T&>& x) {
966
+ return bool(x) ? v <= *x : false;
967
+ }
968
+
969
+ template <class T>
970
+ constexpr bool operator<=(const optional<const T&>& x, const T& v) {
971
+ return bool(x) ? *x <= v : true;
972
+ }
973
+
974
+ template <class T>
975
+ constexpr bool operator>=(const T& v, const optional<const T&>& x) {
976
+ return bool(x) ? v >= *x : true;
977
+ }
978
+
979
+ // 20.5.12, Specialized algorithms
980
+ template <class T>
981
+ void swap(optional<T>& x, optional<T>& y) noexcept(noexcept(x.swap(y))) {
982
+ x.swap(y);
983
+ }
984
+
985
+ template <class T>
986
+ constexpr optional<typename std::decay<T>::type> make_optional(T&& v) {
987
+ return optional<typename std::decay<T>::type>(constexpr_forward<T>(v));
988
+ }
989
+
990
+ template <class X>
991
+ constexpr optional<X&> make_optional(std::reference_wrapper<X> v) {
992
+ return optional<X&>(v.get());
993
+ }
994
+
995
+ } // namespace tensorpipe
996
+
997
+ namespace std {
998
+ template <typename T>
999
+ struct hash<tensorpipe::optional<T>> {
1000
+ typedef typename hash<T>::result_type result_type;
1001
+ typedef tensorpipe::optional<T> argument_type;
1002
+
1003
+ constexpr result_type operator()(argument_type const& arg) const {
1004
+ return arg ? std::hash<T>{}(*arg) : result_type{};
1005
+ }
1006
+ };
1007
+
1008
+ template <typename T>
1009
+ struct hash<tensorpipe::optional<T&>> {
1010
+ typedef typename hash<T>::result_type result_type;
1011
+ typedef tensorpipe::optional<T&> argument_type;
1012
+
1013
+ constexpr result_type operator()(argument_type const& arg) const {
1014
+ return arg ? std::hash<T>{}(*arg) : result_type{};
1015
+ }
1016
+ };
1017
+ } // namespace std
1018
+
1019
+ #undef TR2_OPTIONAL_REQUIRES
1020
+ #undef TR2_OPTIONAL_ASSERTED_EXPRESSION
videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/config.h ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ #pragma once
10
+
11
+ #define TENSORPIPE_HAS_SHM_TRANSPORT 1
12
+ #define TENSORPIPE_HAS_IBV_TRANSPORT 1
13
+
14
+ #define TENSORPIPE_HAS_CMA_CHANNEL 1
videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/core/message.h ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ #pragma once
10
+
11
+ #include <cstddef>
12
+ #include <string>
13
+ #include <vector>
14
+
15
+ #include <tensorpipe/common/buffer.h>
16
+ #include <tensorpipe/common/optional.h>
17
+
18
+ namespace tensorpipe {
19
+
20
+ // Messages consist of a primary buffer and zero or more separate
21
+ // buffers. The primary buffer is always a host-side memory region that
22
+ // contains a serialized version of the message we're dealing with. This
23
+ // serialized message, in turn, may have references to the separate
24
+ // buffers that accompany the primary buffer. These separate buffers may
25
+ // point to any type of memory, host-side or device-side.
26
+ //
27
+ class Message final {
28
+ public:
29
+ std::string metadata;
30
+
31
+ struct Payload {
32
+ void* data{nullptr};
33
+ size_t length{0};
34
+
35
+ // Users may include arbitrary metadata in the following fields.
36
+ // This may contain allocation hints for the receiver, for example.
37
+ std::string metadata;
38
+ };
39
+
40
+ // Holds the payloads that are transferred over the primary connection.
41
+ std::vector<Payload> payloads;
42
+
43
+ struct Tensor {
44
+ tensorpipe::Buffer buffer;
45
+ size_t length{0};
46
+
47
+ // Users may optionally specify the target device, on which the receiver
48
+ // should allocate memory for this tensor. If left unset, the receiver will
49
+ // choose one at their convenience.
50
+ optional<Device> targetDevice;
51
+
52
+ // Users may include arbitrary metadata in the following field.
53
+ // This may contain allocation hints for the receiver, for example.
54
+ std::string metadata;
55
+ };
56
+
57
+ // Holds the tensors that are offered to the side channels.
58
+ std::vector<Tensor> tensors;
59
+ };
60
+
61
+ // Descriptors consist of metadata required by the receiver to allocate memory
62
+ // for an incoming message.
63
+ class Descriptor final {
64
+ public:
65
+ std::string metadata;
66
+
67
+ struct Payload {
68
+ size_t length{0};
69
+ std::string metadata;
70
+ };
71
+ std::vector<Payload> payloads;
72
+
73
+ struct Tensor {
74
+ size_t length{0};
75
+
76
+ // This is the sender-side device from which this tensor is being sent.
77
+ Device sourceDevice;
78
+
79
+ // The sender may optionally specify a target device, in which case the
80
+ // receiver must allocate memory for this tensor on the specified device.
81
+ optional<Device> targetDevice;
82
+
83
+ std::string metadata;
84
+ };
85
+ std::vector<Tensor> tensors;
86
+ };
87
+
88
+ // Allocations consist of actual memory allocations provided by the receiver for
89
+ // an incoming message. They must match the length and target devices specified
90
+ // in the corresponding Descriptor.
91
+ class Allocation final {
92
+ public:
93
+ struct Payload {
94
+ void* data{nullptr};
95
+ };
96
+ std::vector<Payload> payloads;
97
+
98
+ struct Tensor {
99
+ tensorpipe::Buffer buffer;
100
+ };
101
+ std::vector<Tensor> tensors;
102
+ };
103
+
104
+ } // namespace tensorpipe
videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/core/pipe.h ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ #pragma once
10
+
11
+ #include <functional>
12
+ #include <memory>
13
+ #include <string>
14
+
15
+ #include <tensorpipe/common/error.h>
16
+ #include <tensorpipe/core/message.h>
17
+ #include <tensorpipe/transport/context.h>
18
+
19
+ namespace tensorpipe {
20
+
21
+ class ContextImpl;
22
+ class ListenerImpl;
23
+ class PipeImpl;
24
+
25
+ // The pipe.
26
+ //
27
+ // Pipes represent a set of connections between a pair of processes.
28
+ // Unlike POSIX pipes, they are message oriented instead of byte
29
+ // oriented. Messages that are sent through the pipe may use whatever
30
+ // channels are at their disposal to make it happen. If the pair of
31
+ // processes happen to be colocated on the same machine, they may
32
+ // leverage a region of shared memory to communicate the primary
33
+ // buffer of a message. Secondary buffers may use shared memory as
34
+ // well, if they're located in CPU memory, or use a CUDA device to
35
+ // device copy if they're located in NVIDIA GPU memory. If the pair is
36
+ // located across the world, they may simply use a set of TCP
37
+ // connections to communicate.
38
+ //
39
+ class Pipe final {
40
+ // Use the passkey idiom to allow make_shared to call what should be a private
41
+ // constructor. See https://abseil.io/tips/134 for more information.
42
+ struct ConstructorToken {};
43
+
44
+ public:
45
+ //
46
+ // Initialization
47
+ //
48
+
49
+ Pipe(
50
+ ConstructorToken token,
51
+ std::shared_ptr<ContextImpl> context,
52
+ std::string id,
53
+ std::string remoteName,
54
+ const std::string& url);
55
+
56
+ Pipe(ConstructorToken token, std::shared_ptr<PipeImpl> impl);
57
+
58
+ //
59
+ // Entry points for user code
60
+ //
61
+
62
+ using read_descriptor_callback_fn =
63
+ std::function<void(const Error&, Descriptor)>;
64
+
65
+ void readDescriptor(read_descriptor_callback_fn fn);
66
+
67
+ using read_callback_fn = std::function<void(const Error&)>;
68
+
69
+ void read(Allocation allocation, read_callback_fn fn);
70
+
71
+ using write_callback_fn = std::function<void(const Error&)>;
72
+
73
+ void write(Message message, write_callback_fn fn);
74
+
75
+ // Retrieve the user-defined name that was given to the constructor of the
76
+ // context on the remote side, if any (if not, this will be the empty string).
77
+ // This is intended to help in logging and debugging only.
78
+ const std::string& getRemoteName();
79
+
80
+ // Put the pipe in a terminal state, aborting its pending operations and
81
+ // rejecting future ones, and release its resrouces. This may be carried out
82
+ // asynchronously, in background.
83
+ void close();
84
+
85
+ ~Pipe();
86
+
87
+ private:
88
+ // Using a shared_ptr allows us to detach the lifetime of the implementation
89
+ // from the public object's one and perform the destruction asynchronously.
90
+ const std::shared_ptr<PipeImpl> impl_;
91
+
92
+ // Allow context to access constructor token.
93
+ friend ContextImpl;
94
+ // Allow listener to access constructor token.
95
+ friend ListenerImpl;
96
+ };
97
+
98
+ } // namespace tensorpipe
videollama2/lib/python3.10/site-packages/torch/include/tensorpipe/transport/uv/factory.h ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ #pragma once
10
+
11
+ #include <memory>
12
+
13
+ #include <tensorpipe/transport/context.h>
14
+
15
+ namespace tensorpipe {
16
+ namespace transport {
17
+ namespace uv {
18
+
19
+ std::shared_ptr<Context> create();
20
+
21
+ } // namespace uv
22
+ } // namespace transport
23
+ } // namespace tensorpipe
videollama2/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/datasets/base.h ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #include <torch/data/example.h>
4
+ #include <torch/types.h>
5
+
6
+ #include <c10/util/ArrayRef.h>
7
+
8
+ #include <cstddef>
9
+ #include <cstdint>
10
+ #include <type_traits>
11
+ #include <utility>
12
+ #include <vector>
13
+
14
+ namespace torch {
15
+ namespace data {
16
+ namespace datasets {
17
+ template <typename S, typename T>
18
+ class MapDataset;
19
+ template <typename D, typename T>
20
+ MapDataset<D, T> map(D, T); // NOLINT
21
+ } // namespace datasets
22
+ } // namespace data
23
+ } // namespace torch
24
+
25
+ namespace torch {
26
+ namespace data {
27
+ namespace datasets {
28
+ namespace detail {
29
+ template <typename T>
30
+ struct is_optional : std::false_type {};
31
+ template <typename T>
32
+ struct is_optional<optional<T>> : std::true_type {};
33
+ } // namespace detail
34
+
35
+ /// A dataset that can yield data only in batches.
36
+ template <
37
+ typename Self,
38
+ typename Batch = std::vector<Example<>>,
39
+ typename BatchRequest = ArrayRef<size_t>>
40
+ class BatchDataset {
41
+ public:
42
+ using SelfType = Self;
43
+ using BatchType = Batch;
44
+ using BatchRequestType = BatchRequest;
45
+ constexpr static bool is_stateful = detail::is_optional<BatchType>::value;
46
+
47
+ virtual ~BatchDataset() = default;
48
+
49
+ /// Returns a batch of data given an index.
50
+ virtual Batch get_batch(BatchRequest request) = 0;
51
+
52
+ /// Returns the size of the dataset, or an empty optional if it is unsized.
53
+ virtual optional<size_t> size() const = 0;
54
+
55
+ /// Creates a `MapDataset` that applies the given `transform` to this dataset.
56
+ template <typename TransformType>
57
+ MapDataset<Self, TransformType> map(TransformType transform) & {
58
+ return datasets::map(static_cast<Self&>(*this), std::move(transform));
59
+ }
60
+
61
+ /// Creates a `MapDataset` that applies the given `transform` to this dataset.
62
+ template <typename TransformType>
63
+ MapDataset<Self, TransformType> map(TransformType transform) && {
64
+ return datasets::map(
65
+ std::move(static_cast<Self&>(*this)), std::move(transform));
66
+ }
67
+ };
68
+
69
+ /// A dataset that can yield data in batches, or as individual examples.
70
+ ///
71
+ /// A `Dataset` is a `BatchDataset`, because it supports random access and
72
+ /// therefore batched access is implemented (by default) by calling the random
73
+ /// access indexing function for each index in the requested batch of indices.
74
+ /// This can be customized.
75
+ template <typename Self, typename SingleExample = Example<>>
76
+ class Dataset : public BatchDataset<Self, std::vector<SingleExample>> {
77
+ public:
78
+ using ExampleType = SingleExample;
79
+
80
+ /// Returns the example at the given index.
81
+ virtual ExampleType get(size_t index) = 0;
82
+
83
+ /// Returns a batch of data.
84
+ /// The default implementation calls `get()` for every requested index
85
+ /// in the batch.
86
+ std::vector<ExampleType> get_batch(ArrayRef<size_t> indices) override {
87
+ std::vector<ExampleType> batch;
88
+ batch.reserve(indices.size());
89
+ for (const auto i : indices) {
90
+ batch.push_back(get(i));
91
+ }
92
+ return batch;
93
+ }
94
+ };
95
+
96
+ /// A `StreamDataset` represents a dataset that is a potentially infinite
97
+ /// stream. It takes as batch index only a number, which is the batch size, and
98
+ /// yields that many elements from the stream.
99
+ template <typename Self, typename Batch = std::vector<Example<>>>
100
+ using StreamDataset = BatchDataset<Self, Batch, /*BatchRequest=*/size_t>;
101
+ } // namespace datasets
102
+ } // namespace data
103
+ } // namespace torch
videollama2/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/datasets/shared.h ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #include <torch/data/datasets/base.h>
4
+
5
+ #include <memory>
6
+ #include <utility>
7
+
8
+ namespace torch {
9
+ namespace data {
10
+ namespace datasets {
11
+
12
+ /// A dataset that wraps another dataset in a shared pointer and implements the
13
+ /// `BatchDataset` API, delegating all calls to the shared instance. This is
14
+ /// useful when you want all worker threads in the dataloader to access the same
15
+ /// dataset instance. The dataset must take care of synchronization and
16
+ /// thread-safe access itself.
17
+ ///
18
+ /// Use `torch::data::datasets::make_shared_dataset()` to create a new
19
+ /// `SharedBatchDataset` like you would a `std::shared_ptr`.
20
+ template <typename UnderlyingDataset>
21
+ class SharedBatchDataset : public BatchDataset<
22
+ SharedBatchDataset<UnderlyingDataset>,
23
+ typename UnderlyingDataset::BatchType,
24
+ typename UnderlyingDataset::BatchRequestType> {
25
+ public:
26
+ using BatchType = typename UnderlyingDataset::BatchType;
27
+ using BatchRequestType = typename UnderlyingDataset::BatchRequestType;
28
+
29
+ /// Constructs a new `SharedBatchDataset` from a `shared_ptr` to the
30
+ /// `UnderlyingDataset`.
31
+ /* implicit */ SharedBatchDataset(
32
+ std::shared_ptr<UnderlyingDataset> shared_dataset)
33
+ : dataset_(std::move(shared_dataset)) {}
34
+
35
+ /// Calls `get_batch` on the underlying dataset.
36
+ BatchType get_batch(BatchRequestType request) override {
37
+ return dataset_->get_batch(std::move(request));
38
+ }
39
+
40
+ /// Returns the `size` from the underlying dataset.
41
+ optional<size_t> size() const override {
42
+ return dataset_->size();
43
+ }
44
+
45
+ /// Accesses the underlying dataset.
46
+ UnderlyingDataset& operator*() {
47
+ return *dataset_;
48
+ }
49
+
50
+ /// Accesses the underlying dataset.
51
+ const UnderlyingDataset& operator*() const {
52
+ return *dataset_;
53
+ }
54
+
55
+ /// Accesses the underlying dataset.
56
+ UnderlyingDataset* operator->() {
57
+ return dataset_.get();
58
+ }
59
+
60
+ /// Accesses the underlying dataset.
61
+ const UnderlyingDataset* operator->() const {
62
+ return dataset_.get();
63
+ }
64
+
65
+ /// Calls `reset()` on the underlying dataset.
66
+ void reset() {
67
+ dataset_->reset();
68
+ }
69
+
70
+ private:
71
+ std::shared_ptr<UnderlyingDataset> dataset_;
72
+ };
73
+
74
+ /// Constructs a new `SharedBatchDataset` by creating a
75
+ /// `shared_ptr<UnderlyingDatase>`. All arguments are forwarded to
76
+ /// `make_shared<UnderlyingDataset>`.
77
+ template <typename UnderlyingDataset, typename... Args>
78
+ SharedBatchDataset<UnderlyingDataset> make_shared_dataset(Args&&... args) {
79
+ return std::make_shared<UnderlyingDataset>(std::forward<Args>(args)...);
80
+ }
81
+ } // namespace datasets
82
+ } // namespace data
83
+ } // namespace torch
videollama2/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/datasets/stateful.h ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #include <torch/data/datasets/base.h>
4
+ #include <torch/data/example.h>
5
+
6
+ #include <cstddef>
7
+ #include <vector>
8
+
9
+ namespace torch {
10
+ namespace serialize {
11
+ class OutputArchive;
12
+ class InputArchive;
13
+ } // namespace serialize
14
+ } // namespace torch
15
+
16
+ namespace torch {
17
+ namespace data {
18
+ namespace datasets {
19
+
20
+ /// A stateful dataset is a dataset that maintains some internal state, which
21
+ /// will be `reset()` at the beginning of each epoch. Subclasses can override
22
+ /// the `reset()` method to configure this behavior. Further, the return type of
23
+ /// a stateful dataset's `get_batch()` method is always an `optional`. When the
24
+ /// stateful dataset wants to indicate to the dataloader that its epoch has
25
+ /// ended, it should return an empty optional. The dataloader knows to modify
26
+ /// its implementation based on whether the dataset is stateless or stateful.
27
+ ///
28
+ /// Note that when subclassing a from `StatefulDataset<Self, T>`, the return
29
+ /// type of `get_batch()`, which the subclass must override, will be
30
+ /// `optional<T>` (i.e. the type specified in the `StatefulDataset`
31
+ /// specialization is automatically boxed into an `optional` for the dataset's
32
+ /// `BatchType`).
33
+ template <
34
+ typename Self,
35
+ typename Batch = std::vector<Example<>>,
36
+ typename BatchRequest = size_t>
37
+ class StatefulDataset
38
+ : public BatchDataset<Self, optional<Batch>, BatchRequest> {
39
+ public:
40
+ /// Resets internal state of the dataset.
41
+ virtual void reset() = 0;
42
+
43
+ /// Saves the statefulDataset's state to OutputArchive.
44
+ virtual void save(serialize::OutputArchive& archive) const = 0;
45
+
46
+ /// Deserializes the statefulDataset's state from the `archive`.
47
+ virtual void load(serialize::InputArchive& archive) = 0;
48
+ };
49
+
50
+ /// Serializes a statefulDataset to `OutputArchive`.
51
+ template <typename... Args>
52
+ serialize::OutputArchive& operator<<(
53
+ serialize::OutputArchive& archive,
54
+ const StatefulDataset<Args...>& statefulDataset) {
55
+ statefulDataset.save(archive);
56
+ return archive;
57
+ }
58
+
59
+ /// Deserializes a statefulDataset from an `InputArchive`.
60
+ template <typename... Args>
61
+ serialize::InputArchive& operator>>(
62
+ serialize::InputArchive& archive,
63
+ StatefulDataset<Args...>& statefulDataset) {
64
+ statefulDataset.load(archive);
65
+ return archive;
66
+ }
67
+
68
+ } // namespace datasets
69
+ } // namespace data
70
+ } // namespace torch
videollama2/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/samplers/base.h ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #include <torch/csrc/Export.h>
4
+ #include <torch/types.h>
5
+
6
+ #include <cstddef>
7
+ #include <mutex>
8
+ #include <vector>
9
+
10
+ namespace torch {
11
+ namespace serialize {
12
+ class OutputArchive;
13
+ class InputArchive;
14
+ } // namespace serialize
15
+ } // namespace torch
16
+
17
+ namespace torch {
18
+ namespace data {
19
+ namespace samplers {
20
+ /// A `Sampler` is an object that yields an index with which to access a
21
+ /// dataset.
22
+ template <typename BatchRequest = std::vector<size_t>>
23
+ class Sampler {
24
+ public:
25
+ using BatchRequestType = BatchRequest;
26
+
27
+ virtual ~Sampler() = default;
28
+
29
+ /// Resets the `Sampler`'s internal state.
30
+ /// Typically called before a new epoch.
31
+ /// Optionally, accepts a new size when reseting the sampler.
32
+ virtual void reset(optional<size_t> new_size) = 0;
33
+
34
+ /// Returns the next index if possible, or an empty optional if the
35
+ /// sampler is exhausted for this epoch.
36
+ virtual optional<BatchRequest> next(size_t batch_size) = 0;
37
+
38
+ /// Serializes the `Sampler` to the `archive`.
39
+ virtual void save(serialize::OutputArchive& archive) const = 0;
40
+
41
+ /// Deserializes the `Sampler` from the `archive`.
42
+ virtual void load(serialize::InputArchive& archive) = 0;
43
+ };
44
+
45
+ } // namespace samplers
46
+ } // namespace data
47
+ } // namespace torch
videollama2/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/samplers/distributed.h ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #include <torch/csrc/Export.h>
4
+ #include <torch/data/samplers/base.h>
5
+
6
+ #include <cstddef>
7
+ #include <vector>
8
+
9
+ namespace torch {
10
+ namespace serialize {
11
+ class OutputArchive;
12
+ class InputArchive;
13
+ } // namespace serialize
14
+ } // namespace torch
15
+
16
+ namespace torch {
17
+ namespace data {
18
+ namespace samplers {
19
+
20
+ /// A `Sampler` that selects a subset of indices to sample from and defines a
21
+ /// sampling behavior. In a distributed setting, this selects a subset of the
22
+ /// indices depending on the provided num_replicas and rank parameters. The
23
+ /// `Sampler` performs a rounding operation based on the `allow_duplicates`
24
+ /// parameter to decide the local sample count.
25
+ template <typename BatchRequest = std::vector<size_t>>
26
+ class DistributedSampler : public Sampler<BatchRequest> {
27
+ public:
28
+ DistributedSampler(
29
+ size_t size,
30
+ size_t num_replicas = 1,
31
+ size_t rank = 0,
32
+ bool allow_duplicates = true)
33
+ : size_(size),
34
+ num_replicas_(num_replicas),
35
+ rank_(rank),
36
+ epoch_(0),
37
+ allow_duplicates_(allow_duplicates) {}
38
+
39
+ /// Set the epoch for the current enumeration. This can be used to alter the
40
+ /// sample selection and shuffling behavior.
41
+ void set_epoch(size_t epoch) {
42
+ epoch_ = epoch;
43
+ }
44
+
45
+ size_t epoch() const {
46
+ return epoch_;
47
+ }
48
+
49
+ protected:
50
+ size_t local_sample_count() {
51
+ if (allow_duplicates_) {
52
+ return (size_ + num_replicas_ - 1) / num_replicas_;
53
+ } else {
54
+ return size_ / num_replicas_;
55
+ }
56
+ }
57
+
58
+ // NOLINTNEXTLINE(cppcoreguidelines-non-private-member-variables-in-classes)
59
+ size_t size_;
60
+ // NOLINTNEXTLINE(cppcoreguidelines-non-private-member-variables-in-classes)
61
+ size_t num_replicas_;
62
+ // NOLINTNEXTLINE(cppcoreguidelines-non-private-member-variables-in-classes)
63
+ size_t rank_;
64
+ // NOLINTNEXTLINE(cppcoreguidelines-non-private-member-variables-in-classes)
65
+ size_t epoch_;
66
+ // NOLINTNEXTLINE(cppcoreguidelines-non-private-member-variables-in-classes)
67
+ bool allow_duplicates_;
68
+ };
69
+
70
+ /// Select samples randomly. The sampling order is shuffled at each `reset()`
71
+ /// call.
72
+ class TORCH_API DistributedRandomSampler : public DistributedSampler<> {
73
+ public:
74
+ DistributedRandomSampler(
75
+ size_t size,
76
+ size_t num_replicas = 1,
77
+ size_t rank = 0,
78
+ bool allow_duplicates = true);
79
+
80
+ /// Resets the `DistributedRandomSampler` to a new set of indices.
81
+ void reset(optional<size_t> new_size = nullopt) override;
82
+
83
+ /// Returns the next batch of indices.
84
+ optional<std::vector<size_t>> next(size_t batch_size) override;
85
+
86
+ /// Serializes the `DistributedRandomSampler` to the `archive`.
87
+ void save(serialize::OutputArchive& archive) const override;
88
+
89
+ /// Deserializes the `DistributedRandomSampler` from the `archive`.
90
+ void load(serialize::InputArchive& archive) override;
91
+
92
+ /// Returns the current index of the `DistributedRandomSampler`.
93
+ size_t index() const noexcept;
94
+
95
+ private:
96
+ void populate_indices();
97
+
98
+ size_t begin_index_;
99
+ size_t end_index_;
100
+ size_t sample_index_;
101
+ std::vector<size_t> all_indices_;
102
+ };
103
+
104
+ /// Select samples sequentially.
105
+ class TORCH_API DistributedSequentialSampler : public DistributedSampler<> {
106
+ public:
107
+ DistributedSequentialSampler(
108
+ size_t size,
109
+ size_t num_replicas = 1,
110
+ size_t rank = 0,
111
+ bool allow_duplicates = true);
112
+
113
+ /// Resets the `DistributedSequentialSampler` to a new set of indices.
114
+ void reset(optional<size_t> new_size = nullopt) override;
115
+
116
+ /// Returns the next batch of indices.
117
+ optional<std::vector<size_t>> next(size_t batch_size) override;
118
+
119
+ /// Serializes the `DistributedSequentialSampler` to the `archive`.
120
+ void save(serialize::OutputArchive& archive) const override;
121
+
122
+ /// Deserializes the `DistributedSequentialSampler` from the `archive`.
123
+ void load(serialize::InputArchive& archive) override;
124
+
125
+ /// Returns the current index of the `DistributedSequentialSampler`.
126
+ size_t index() const noexcept;
127
+
128
+ private:
129
+ void populate_indices();
130
+
131
+ size_t begin_index_;
132
+ size_t end_index_;
133
+ size_t sample_index_;
134
+ std::vector<size_t> all_indices_;
135
+ };
136
+
137
+ } // namespace samplers
138
+ } // namespace data
139
+ } // namespace torch
videollama2/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/samplers/sequential.h ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #include <torch/csrc/Export.h>
4
+ #include <torch/data/samplers/base.h>
5
+ #include <torch/types.h>
6
+
7
+ #include <cstddef>
8
+ #include <vector>
9
+
10
+ namespace torch {
11
+ namespace serialize {
12
+ class OutputArchive;
13
+ class InputArchive;
14
+ } // namespace serialize
15
+ } // namespace torch
16
+
17
+ namespace torch {
18
+ namespace data {
19
+ namespace samplers {
20
+
21
+ /// A `Sampler` that returns indices sequentially.
22
+ class TORCH_API SequentialSampler : public Sampler<> {
23
+ public:
24
+ /// Creates a `SequentialSampler` that will return indices in the range
25
+ /// `0...size - 1`.
26
+ explicit SequentialSampler(size_t size);
27
+
28
+ /// Resets the `SequentialSampler` to zero.
29
+ void reset(optional<size_t> new_size = nullopt) override;
30
+
31
+ /// Returns the next batch of indices.
32
+ optional<std::vector<size_t>> next(size_t batch_size) override;
33
+
34
+ /// Serializes the `SequentialSampler` to the `archive`.
35
+ void save(serialize::OutputArchive& archive) const override;
36
+
37
+ /// Deserializes the `SequentialSampler` from the `archive`.
38
+ void load(serialize::InputArchive& archive) override;
39
+
40
+ /// Returns the current index of the `SequentialSampler`.
41
+ size_t index() const noexcept;
42
+
43
+ private:
44
+ size_t size_;
45
+ size_t index_{0};
46
+ };
47
+
48
+ } // namespace samplers
49
+ } // namespace data
50
+ } // namespace torch
videollama2/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/samplers/serialize.h ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #include <torch/data/samplers/base.h>
4
+ #include <torch/serialize/archive.h>
5
+
6
+ namespace torch {
7
+ namespace data {
8
+ namespace samplers {
9
+ /// Serializes a `Sampler` into an `OutputArchive`.
10
+ template <typename BatchRequest>
11
+ serialize::OutputArchive& operator<<(
12
+ serialize::OutputArchive& archive,
13
+ const Sampler<BatchRequest>& sampler) {
14
+ sampler.save(archive);
15
+ return archive;
16
+ }
17
+
18
+ /// Deserializes a `Sampler` from an `InputArchive`.
19
+ template <typename BatchRequest>
20
+ serialize::InputArchive& operator>>(
21
+ serialize::InputArchive& archive,
22
+ Sampler<BatchRequest>& sampler) {
23
+ sampler.load(archive);
24
+ return archive;
25
+ }
26
+ } // namespace samplers
27
+ } // namespace data
28
+ } // namespace torch
videollama2/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/samplers/stream.h ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #include <torch/csrc/Export.h>
4
+ #include <torch/data/samplers/base.h>
5
+ #include <torch/data/samplers/custom_batch_request.h>
6
+ #include <torch/types.h>
7
+
8
+ #include <cstddef>
9
+
10
+ namespace torch {
11
+ namespace serialize {
12
+ class InputArchive;
13
+ class OutputArchive;
14
+ } // namespace serialize
15
+ } // namespace torch
16
+
17
+ namespace torch {
18
+ namespace data {
19
+ namespace samplers {
20
+
21
+ /// A wrapper around a batch size value, which implements the
22
+ /// `CustomBatchRequest` interface.
23
+ struct TORCH_API BatchSize : public CustomBatchRequest {
24
+ explicit BatchSize(size_t size);
25
+ size_t size() const noexcept override;
26
+ operator size_t() const noexcept;
27
+ size_t size_;
28
+ };
29
+
30
+ /// A sampler for (potentially infinite) streams of data.
31
+ ///
32
+ /// The major feature of the `StreamSampler` is that it does not return
33
+ /// particular indices, but instead only the number of elements to fetch from
34
+ /// the dataset. The dataset has to decide how to produce those elements.
35
+ class TORCH_API StreamSampler : public Sampler<BatchSize> {
36
+ public:
37
+ /// Constructs the `StreamSampler` with the number of individual examples that
38
+ /// should be fetched until the sampler is exhausted.
39
+ explicit StreamSampler(size_t epoch_size);
40
+
41
+ /// Resets the internal state of the sampler.
42
+ void reset(optional<size_t> new_size = nullopt) override;
43
+
44
+ /// Returns a `BatchSize` object with the number of elements to fetch in the
45
+ /// next batch. This number is the minimum of the supplied `batch_size` and
46
+ /// the difference between the `epoch_size` and the current index. If the
47
+ /// `epoch_size` has been reached, returns an empty optional.
48
+ optional<BatchSize> next(size_t batch_size) override;
49
+
50
+ /// Serializes the `StreamSampler` to the `archive`.
51
+ void save(serialize::OutputArchive& archive) const override;
52
+
53
+ /// Deserializes the `StreamSampler` from the `archive`.
54
+ void load(serialize::InputArchive& archive) override;
55
+
56
+ private:
57
+ size_t examples_retrieved_so_far_ = 0;
58
+ size_t epoch_size_;
59
+ };
60
+
61
+ } // namespace samplers
62
+ } // namespace data
63
+ } // namespace torch
videollama2/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/transforms/base.h ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #include <torch/types.h>
4
+
5
+ #include <utility>
6
+ #include <vector>
7
+
8
+ namespace torch {
9
+ namespace data {
10
+ namespace transforms {
11
+
12
+ /// A transformation of a batch to a new batch.
13
+ template <typename InputBatch, typename OutputBatch>
14
+ class BatchTransform {
15
+ public:
16
+ using InputBatchType = InputBatch;
17
+ using OutputBatchType = OutputBatch;
18
+
19
+ virtual ~BatchTransform() = default;
20
+
21
+ /// Applies the transformation to the given `input_batch`.
22
+ virtual OutputBatch apply_batch(InputBatch input_batch) = 0;
23
+ };
24
+
25
+ /// A transformation of individual input examples to individual output examples.
26
+ ///
27
+ /// Just like a `Dataset` is a `BatchDataset`, a `Transform` is a
28
+ /// `BatchTransform` that can operate on the level of individual examples rather
29
+ /// than entire batches. The batch-level transform is implemented (by default)
30
+ /// in terms of the example-level transform, though this can be customized.
31
+ template <typename Input, typename Output>
32
+ class Transform
33
+ : public BatchTransform<std::vector<Input>, std::vector<Output>> {
34
+ public:
35
+ using InputType = Input;
36
+ using OutputType = Output;
37
+
38
+ /// Applies the transformation to the given `input`.
39
+ virtual OutputType apply(InputType input) = 0;
40
+
41
+ /// Applies the `transformation` over the entire `input_batch`.
42
+ std::vector<Output> apply_batch(std::vector<Input> input_batch) override {
43
+ std::vector<Output> output_batch;
44
+ output_batch.reserve(input_batch.size());
45
+ for (auto&& input : input_batch) {
46
+ output_batch.push_back(apply(std::move(input)));
47
+ }
48
+ return output_batch;
49
+ }
50
+ };
51
+ } // namespace transforms
52
+ } // namespace data
53
+ } // namespace torch
videollama2/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/transforms/tensor.h ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #include <torch/data/example.h>
4
+ #include <torch/data/transforms/base.h>
5
+ #include <torch/types.h>
6
+
7
+ #include <functional>
8
+ #include <utility>
9
+
10
+ namespace torch {
11
+ namespace data {
12
+ namespace transforms {
13
+
14
+ /// A `Transform` that is specialized for the typical `Example<Tensor, Tensor>`
15
+ /// combination. It exposes a single `operator()` interface hook (for
16
+ /// subclasses), and calls this function on input `Example` objects.
17
+ template <typename Target = Tensor>
18
+ class TensorTransform
19
+ : public Transform<Example<Tensor, Target>, Example<Tensor, Target>> {
20
+ public:
21
+ using E = Example<Tensor, Target>;
22
+ using typename Transform<E, E>::InputType;
23
+ using typename Transform<E, E>::OutputType;
24
+
25
+ /// Transforms a single input tensor to an output tensor.
26
+ virtual Tensor operator()(Tensor input) = 0;
27
+
28
+ /// Implementation of `Transform::apply` that calls `operator()`.
29
+ OutputType apply(InputType input) override {
30
+ input.data = (*this)(std::move(input.data));
31
+ return input;
32
+ }
33
+ };
34
+
35
+ /// A `Lambda` specialized for the typical `Example<Tensor, Tensor>` input type.
36
+ template <typename Target = Tensor>
37
+ class TensorLambda : public TensorTransform<Target> {
38
+ public:
39
+ using FunctionType = std::function<Tensor(Tensor)>;
40
+
41
+ /// Creates a `TensorLambda` from the given `function`.
42
+ explicit TensorLambda(FunctionType function)
43
+ : function_(std::move(function)) {}
44
+
45
+ /// Applies the user-provided functor to the input tensor.
46
+ Tensor operator()(Tensor input) override {
47
+ return function_(std::move(input));
48
+ }
49
+
50
+ private:
51
+ FunctionType function_;
52
+ };
53
+
54
+ /// Normalizes input tensors by subtracting the supplied mean and dividing by
55
+ /// the given standard deviation.
56
+ template <typename Target = Tensor>
57
+ struct Normalize : public TensorTransform<Target> {
58
+ /// Constructs a `Normalize` transform. The mean and standard deviation can be
59
+ /// anything that is broadcastable over the input tensors (like single
60
+ /// scalars).
61
+ Normalize(ArrayRef<double> mean, ArrayRef<double> stddev)
62
+ : mean(torch::tensor(mean, torch::kFloat32)
63
+ .unsqueeze(/*dim=*/1)
64
+ .unsqueeze(/*dim=*/2)),
65
+ stddev(torch::tensor(stddev, torch::kFloat32)
66
+ .unsqueeze(/*dim=*/1)
67
+ .unsqueeze(/*dim=*/2)) {}
68
+
69
+ torch::Tensor operator()(Tensor input) override {
70
+ return input.sub(mean).div(stddev);
71
+ }
72
+
73
+ torch::Tensor mean, stddev;
74
+ };
75
+ } // namespace transforms
76
+ } // namespace data
77
+ } // namespace torch
vllm/lib/python3.10/site-packages/cupy/_core/_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:612f9af4953b894a09608d5abb679f2229f41c28a649143e44ea40c2c33da8b6
3
+ size 3511368
vllm/lib/python3.10/site-packages/cupy/_core/_routines_math.cpython-310-x86_64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f478a65b2f7e1b484248375764876a4b3cb561d9c7b7e990c4151b5a544afa7e
3
+ size 1663424
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__barrier/barrier.h ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 __LIBCUDACXX___BARRIER_BARRIER_H
12
+ #define __LIBCUDACXX___BARRIER_BARRIER_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/__barrier/empty_completion.h>
25
+ #include <cuda/std/__barrier/poll_tester.h>
26
+ #include <cuda/std/__new_>
27
+ #include <cuda/std/atomic>
28
+ #include <cuda/std/chrono>
29
+ #include <cuda/std/cstddef>
30
+
31
+ #if _LIBCUDACXX_CUDA_ABI_VERSION < 3
32
+ # define _LIBCUDACXX_BARRIER_ALIGNMENTS alignas(64)
33
+ #else // ^^^ _LIBCUDACXX_CUDA_ABI_VERSION < 3 ^^^ / vvv _LIBCUDACXX_CUDA_ABI_VERSION >= 3 vvv
34
+ # define _LIBCUDACXX_BARRIER_ALIGNMENTS
35
+ #endif // _LIBCUDACXX_CUDA_ABI_VERSION >= 3
36
+
37
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
38
+
39
+ _CCCL_DIAG_PUSH
40
+ _CCCL_DIAG_SUPPRESS_MSVC(4324) // structure was padded due to alignment specifier
41
+
42
+ template <class _CompletionF, thread_scope _Sco = thread_scope_system>
43
+ class __barrier_base
44
+ {
45
+ _LIBCUDACXX_BARRIER_ALIGNMENTS __atomic_impl<ptrdiff_t, _Sco> __expected, __arrived;
46
+ _LIBCUDACXX_BARRIER_ALIGNMENTS _CompletionF __completion;
47
+ _LIBCUDACXX_BARRIER_ALIGNMENTS __atomic_impl<bool, _Sco> __phase;
48
+
49
+ public:
50
+ using arrival_token = bool;
51
+
52
+ private:
53
+ template <typename _Barrier>
54
+ friend class __barrier_poll_tester_phase;
55
+ template <typename _Barrier>
56
+ friend class __barrier_poll_tester_parity;
57
+ template <typename _Barrier>
58
+ _LIBCUDACXX_HIDE_FROM_ABI friend bool __call_try_wait(const _Barrier& __b, typename _Barrier::arrival_token&& __phase);
59
+ template <typename _Barrier>
60
+ _LIBCUDACXX_HIDE_FROM_ABI friend bool __call_try_wait_parity(const _Barrier& __b, bool __parity);
61
+
62
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI bool __try_wait(arrival_token __old) const
63
+ {
64
+ return __phase.load(memory_order_acquire) != __old;
65
+ }
66
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI bool __try_wait_parity(bool __parity) const
67
+ {
68
+ return __try_wait(__parity);
69
+ }
70
+
71
+ public:
72
+ _CCCL_HIDE_FROM_ABI __barrier_base() = default;
73
+
74
+ _LIBCUDACXX_HIDE_FROM_ABI __barrier_base(ptrdiff_t __expected, _CompletionF __completion = _CompletionF())
75
+ : __expected(__expected)
76
+ , __arrived(__expected)
77
+ , __completion(__completion)
78
+ , __phase(false)
79
+ {}
80
+
81
+ _CCCL_HIDE_FROM_ABI ~__barrier_base() = default;
82
+
83
+ __barrier_base(__barrier_base const&) = delete;
84
+ __barrier_base& operator=(__barrier_base const&) = delete;
85
+
86
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t __update = 1)
87
+ {
88
+ auto const __old_phase = __phase.load(memory_order_relaxed);
89
+ auto const __result = __arrived.fetch_sub(__update, memory_order_acq_rel) - __update;
90
+ auto const __new_expected = __expected.load(memory_order_relaxed);
91
+
92
+ _CCCL_ASSERT(__result >= 0, "");
93
+
94
+ if (0 == __result)
95
+ {
96
+ __completion();
97
+ __arrived.store(__new_expected, memory_order_relaxed);
98
+ __phase.store(!__old_phase, memory_order_release);
99
+ __atomic_notify_all(&__phase.__a, __scope_to_tag<_Sco>{});
100
+ }
101
+ return __old_phase;
102
+ }
103
+ _LIBCUDACXX_HIDE_FROM_ABI void wait(arrival_token&& __old_phase) const
104
+ {
105
+ __phase.wait(__old_phase, memory_order_acquire);
106
+ }
107
+ _LIBCUDACXX_HIDE_FROM_ABI void arrive_and_wait()
108
+ {
109
+ wait(arrive());
110
+ }
111
+ _LIBCUDACXX_HIDE_FROM_ABI void arrive_and_drop()
112
+ {
113
+ __expected.fetch_sub(1, memory_order_relaxed);
114
+ (void) arrive();
115
+ }
116
+
117
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI static constexpr ptrdiff_t max() noexcept
118
+ {
119
+ return numeric_limits<ptrdiff_t>::max();
120
+ }
121
+ };
122
+
123
+ _CCCL_DIAG_POP
124
+
125
+ template <thread_scope _Sco>
126
+ class __barrier_base<__empty_completion, _Sco>
127
+ {
128
+ static constexpr uint64_t __expected_unit = 1ull;
129
+ static constexpr uint64_t __arrived_unit = 1ull << 32;
130
+ static constexpr uint64_t __expected_mask = __arrived_unit - 1;
131
+ static constexpr uint64_t __phase_bit = 1ull << 63;
132
+ static constexpr uint64_t __arrived_mask = (__phase_bit - 1) & ~__expected_mask;
133
+
134
+ _LIBCUDACXX_BARRIER_ALIGNMENTS __atomic_impl<uint64_t, _Sco> __phase_arrived_expected;
135
+
136
+ public:
137
+ using arrival_token = uint64_t;
138
+
139
+ private:
140
+ template <typename _Barrier>
141
+ friend class __barrier_poll_tester_phase;
142
+ template <typename _Barrier>
143
+ friend class __barrier_poll_tester_parity;
144
+ template <typename _Barrier>
145
+ _LIBCUDACXX_HIDE_FROM_ABI friend bool __call_try_wait(const _Barrier& __b, typename _Barrier::arrival_token&& __phase);
146
+ template <typename _Barrier>
147
+ _LIBCUDACXX_HIDE_FROM_ABI friend bool __call_try_wait_parity(const _Barrier& __b, bool __parity);
148
+
149
+ static _LIBCUDACXX_HIDE_FROM_ABI constexpr uint64_t __init(ptrdiff_t __count) noexcept
150
+ {
151
+ #if _CCCL_STD_VER >= 2014
152
+ // This debug assert is not supported in C++11 due to resulting in a
153
+ // multi-statement constexpr function.
154
+ _CCCL_ASSERT(__count >= 0, "Count must be non-negative.");
155
+ #endif // _CCCL_STD_VER >= 2014
156
+ return (((1u << 31) - __count) << 32) | ((1u << 31) - __count);
157
+ }
158
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI bool __try_wait_phase(uint64_t __phase) const
159
+ {
160
+ uint64_t const __current = __phase_arrived_expected.load(memory_order_acquire);
161
+ return ((__current & __phase_bit) != __phase);
162
+ }
163
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI bool __try_wait(arrival_token __old) const
164
+ {
165
+ return __try_wait_phase(__old & __phase_bit);
166
+ }
167
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI bool __try_wait_parity(bool __parity) const
168
+ {
169
+ return __try_wait_phase(__parity ? __phase_bit : 0);
170
+ }
171
+
172
+ public:
173
+ _CCCL_HIDE_FROM_ABI __barrier_base() = default;
174
+
175
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14
176
+ __barrier_base(ptrdiff_t __count, __empty_completion = __empty_completion())
177
+ : __phase_arrived_expected(__init(__count))
178
+ {
179
+ _CCCL_ASSERT(__count >= 0, "");
180
+ }
181
+
182
+ _CCCL_HIDE_FROM_ABI ~__barrier_base() = default;
183
+
184
+ __barrier_base(__barrier_base const&) = delete;
185
+ __barrier_base& operator=(__barrier_base const&) = delete;
186
+
187
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t __update = 1)
188
+ {
189
+ auto const __inc = __arrived_unit * __update;
190
+ auto const __old = __phase_arrived_expected.fetch_add(__inc, memory_order_acq_rel);
191
+ if ((__old ^ (__old + __inc)) & __phase_bit)
192
+ {
193
+ __phase_arrived_expected.fetch_add((__old & __expected_mask) << 32, memory_order_relaxed);
194
+ __phase_arrived_expected.notify_all();
195
+ }
196
+ return __old & __phase_bit;
197
+ }
198
+ _LIBCUDACXX_HIDE_FROM_ABI void wait(arrival_token&& __phase) const
199
+ {
200
+ _CUDA_VSTD::__cccl_thread_poll_with_backoff(
201
+ __barrier_poll_tester_phase<__barrier_base>(this, _CUDA_VSTD::move(__phase)));
202
+ }
203
+ _LIBCUDACXX_HIDE_FROM_ABI void wait_parity(bool __parity) const
204
+ {
205
+ _CUDA_VSTD::__cccl_thread_poll_with_backoff(__barrier_poll_tester_parity<__barrier_base>(this, __parity));
206
+ }
207
+ _LIBCUDACXX_HIDE_FROM_ABI void arrive_and_wait()
208
+ {
209
+ wait(arrive());
210
+ }
211
+ _LIBCUDACXX_HIDE_FROM_ABI void arrive_and_drop()
212
+ {
213
+ __phase_arrived_expected.fetch_add(__expected_unit, memory_order_relaxed);
214
+ (void) arrive();
215
+ }
216
+
217
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI static constexpr ptrdiff_t max() noexcept
218
+ {
219
+ return numeric_limits<int32_t>::max();
220
+ }
221
+ };
222
+
223
+ template <class _CompletionF = __empty_completion>
224
+ class barrier : public __barrier_base<_CompletionF>
225
+ {
226
+ public:
227
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr barrier(ptrdiff_t __count, _CompletionF __completion = _CompletionF())
228
+ : __barrier_base<_CompletionF>(__count, __completion)
229
+ {}
230
+ };
231
+
232
+ _LIBCUDACXX_END_NAMESPACE_STD
233
+
234
+ #endif // __LIBCUDACXX___BARRIER_BARRIER_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__barrier/empty_completion.h ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 __LIBCUDACXX___BARRIER_EMPTY_COMPLETION_H
12
+ #define __LIBCUDACXX___BARRIER_EMPTY_COMPLETION_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
+ struct __empty_completion
27
+ {
28
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 void operator()() noexcept {}
29
+ };
30
+
31
+ _LIBCUDACXX_END_NAMESPACE_STD
32
+
33
+ #endif // __LIBCUDACXX___BARRIER_EMPTY_COMPLETION_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__barrier/poll_tester.h ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 __LIBCUDACXX___BARRIER_POLL_TESTER_H
12
+ #define __LIBCUDACXX___BARRIER_POLL_TESTER_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/__utility/move.h>
25
+
26
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
27
+
28
+ template <class _Barrier>
29
+ class __barrier_poll_tester_phase
30
+ {
31
+ _Barrier const* __this;
32
+ typename _Barrier::arrival_token __phase;
33
+
34
+ public:
35
+ _LIBCUDACXX_HIDE_FROM_ABI
36
+ __barrier_poll_tester_phase(_Barrier const* __this_, typename _Barrier::arrival_token&& __phase_)
37
+ : __this(__this_)
38
+ , __phase(_CUDA_VSTD::move(__phase_))
39
+ {}
40
+
41
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI bool operator()() const
42
+ {
43
+ return __this->__try_wait(__phase);
44
+ }
45
+ };
46
+
47
+ template <class _Barrier>
48
+ class __barrier_poll_tester_parity
49
+ {
50
+ _Barrier const* __this;
51
+ bool __parity;
52
+
53
+ public:
54
+ _LIBCUDACXX_HIDE_FROM_ABI __barrier_poll_tester_parity(_Barrier const* __this_, bool __parity_)
55
+ : __this(__this_)
56
+ , __parity(__parity_)
57
+ {}
58
+
59
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI bool operator()() const
60
+ {
61
+ return __this->__try_wait_parity(__parity);
62
+ }
63
+ };
64
+
65
+ template <class _Barrier>
66
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI bool
67
+ __call_try_wait(const _Barrier& __b, typename _Barrier::arrival_token&& __phase)
68
+ {
69
+ return __b.__try_wait(_CUDA_VSTD::move(__phase));
70
+ }
71
+
72
+ template <class _Barrier>
73
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI bool __call_try_wait_parity(const _Barrier& __b, bool __parity)
74
+ {
75
+ return __b.__try_wait_parity(__parity);
76
+ }
77
+
78
+ _LIBCUDACXX_END_NAMESPACE_STD
79
+
80
+ #endif // __LIBCUDACXX___BARRIER_POLL_TESTER_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__cuda/api_wrapper.h ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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__STD__CUDA_API_WRAPPER_H
12
+ #define _CUDA__STD__CUDA_API_WRAPPER_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_CUDA_COMPILER(CLANG)
25
+ # include <cuda_runtime_api.h>
26
+ #endif // _CCCL_CUDA_COMPILER(CLANG)
27
+
28
+ #include <cuda/std/__exception/cuda_error.h>
29
+
30
+ #if _CCCL_HAS_CUDA_COMPILER
31
+ # define _CCCL_TRY_CUDA_API(_NAME, _MSG, ...) \
32
+ { \
33
+ const ::cudaError_t __status = _NAME(__VA_ARGS__); \
34
+ switch (__status) \
35
+ { \
36
+ case ::cudaSuccess: \
37
+ break; \
38
+ default: \
39
+ ::cudaGetLastError(); \
40
+ ::cuda::__throw_cuda_error(__status, _MSG); \
41
+ } \
42
+ }
43
+
44
+ # define _CCCL_ASSERT_CUDA_API(_NAME, _MSG, ...) \
45
+ { \
46
+ const ::cudaError_t __status = _NAME(__VA_ARGS__); \
47
+ _CCCL_ASSERT(__status == cudaSuccess, _MSG); \
48
+ (void) __status; \
49
+ }
50
+ #else // ^^^ _CCCL_HAS_CUDA_COMPILER ^^^ / vvv !_CCCL_HAS_CUDA_COMPILER vvv
51
+ # define _CCCL_TRY_CUDA_API(_NAME, _MSG, ...)
52
+ # define _CCCL_ASSERT_CUDA_API(_NAME, _MSG, ...)
53
+ #endif // !_CCCL_HAS_CUDA_COMPILER
54
+
55
+ #endif //_CUDA__STD__CUDA_API_WRAPPER_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__cuda/chrono.h ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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___CUDA_CHRONO_H
12
+ #define _LIBCUDACXX___CUDA_CHRONO_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 defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
25
+ # pragma GCC system_header
26
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
27
+ # pragma clang system_header
28
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
29
+ # pragma system_header
30
+ #endif // no system header
31
+
32
+ #include <nv/target>
33
+
34
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
35
+
36
+ namespace chrono
37
+ {
38
+
39
+ _LIBCUDACXX_HIDE_FROM_ABI system_clock::time_point system_clock::now() noexcept
40
+ {
41
+ NV_DISPATCH_TARGET(
42
+ NV_IS_DEVICE,
43
+ (uint64_t __time; asm volatile("mov.u64 %0, %%globaltimer;"
44
+ : "=l"(__time)::);
45
+ return time_point(duration_cast<duration>(nanoseconds(__time)));),
46
+ NV_IS_HOST,
47
+ (return time_point(duration_cast<duration>(nanoseconds(
48
+ ::std::chrono::duration_cast<::std::chrono::nanoseconds>(::std::chrono::system_clock::now().time_since_epoch())
49
+ .count())));));
50
+ }
51
+
52
+ _LIBCUDACXX_HIDE_FROM_ABI time_t system_clock::to_time_t(const system_clock::time_point& __t) noexcept
53
+ {
54
+ return time_t(duration_cast<seconds>(__t.time_since_epoch()).count());
55
+ }
56
+
57
+ _LIBCUDACXX_HIDE_FROM_ABI system_clock::time_point system_clock::from_time_t(time_t __t) noexcept
58
+ {
59
+ return time_point(seconds(__t));
60
+ ;
61
+ }
62
+ } // namespace chrono
63
+
64
+ _LIBCUDACXX_END_NAMESPACE_STD
65
+
66
+ #endif // _LIBCUDACXX___CUDA_CHRONO_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__cuda/cstdint_prelude.h ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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___CUDA_CSTDINT_PRELUDE_H
12
+ #define _LIBCUDACXX___CUDA_CSTDINT_PRELUDE_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(NVRTC)
25
+ # include <cstdint>
26
+ #else // ^^^ !_CCCL_COMPILER(NVRTC) ^^^ / vvv _CCCL_COMPILER(NVRTC) vvv
27
+ typedef signed char int8_t;
28
+ typedef unsigned char uint8_t;
29
+ typedef signed short int16_t;
30
+ typedef unsigned short uint16_t;
31
+ typedef signed int int32_t;
32
+ typedef unsigned int uint32_t;
33
+ typedef signed long long int64_t;
34
+ typedef unsigned long long uint64_t;
35
+
36
+ # define _LIBCUDACXX_ADDITIONAL_INTS(N) \
37
+ typedef int##N##_t int_fast##N##_t; \
38
+ typedef uint##N##_t uint_fast##N##_t; \
39
+ typedef int##N##_t int_least##N##_t; \
40
+ typedef uint##N##_t uint_least##N##_t
41
+
42
+ _LIBCUDACXX_ADDITIONAL_INTS(8);
43
+ _LIBCUDACXX_ADDITIONAL_INTS(16);
44
+ _LIBCUDACXX_ADDITIONAL_INTS(32);
45
+ _LIBCUDACXX_ADDITIONAL_INTS(64);
46
+ # undef _LIBCUDACXX_ADDITIONAL_INTS
47
+
48
+ typedef int64_t intptr_t;
49
+ typedef uint64_t uintptr_t;
50
+ typedef int64_t intmax_t;
51
+ typedef uint64_t uintmax_t;
52
+
53
+ # define INT8_MIN SCHAR_MIN
54
+ # define INT16_MIN SHRT_MIN
55
+ # define INT32_MIN INT_MIN
56
+ # define INT64_MIN LLONG_MIN
57
+ # define INT8_MAX SCHAR_MAX
58
+ # define INT16_MAX SHRT_MAX
59
+ # define INT32_MAX INT_MAX
60
+ # define INT64_MAX LLONG_MAX
61
+ # define UINT8_MAX UCHAR_MAX
62
+ # define UINT16_MAX USHRT_MAX
63
+ # define UINT32_MAX UINT_MAX
64
+ # define UINT64_MAX ULLONG_MAX
65
+ # define INT_FAST8_MIN SCHAR_MIN
66
+ # define INT_FAST16_MIN SHRT_MIN
67
+ # define INT_FAST32_MIN INT_MIN
68
+ # define INT_FAST64_MIN LLONG_MIN
69
+ # define INT_FAST8_MAX SCHAR_MAX
70
+ # define INT_FAST16_MAX SHRT_MAX
71
+ # define INT_FAST32_MAX INT_MAX
72
+ # define INT_FAST64_MAX LLONG_MAX
73
+ # define UINT_FAST8_MAX UCHAR_MAX
74
+ # define UINT_FAST16_MAX USHRT_MAX
75
+ # define UINT_FAST32_MAX UINT_MAX
76
+ # define UINT_FAST64_MAX ULLONG_MAX
77
+
78
+ # define INT8_C(X) ((int_least8_t) (X))
79
+ # define INT16_C(X) ((int_least16_t) (X))
80
+ # define INT32_C(X) ((int_least32_t) (X))
81
+ # define INT64_C(X) ((int_least64_t) (X))
82
+ # define UINT8_C(X) ((uint_least8_t) (X))
83
+ # define UINT16_C(X) ((uint_least16_t) (X))
84
+ # define UINT32_C(X) ((uint_least32_t) (X))
85
+ # define UINT64_C(X) ((uint_least64_t) (X))
86
+ # define INTMAX_C(X) ((intmax_t) (X))
87
+ # define UINTMAX_C(X) ((uintmax_t) (X))
88
+ #endif // _CCCL_COMPILER(NVRTC)
89
+
90
+ #endif // _LIBCUDACXX___CUDA_CSTDINT_PRELUDE_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__cuda/ensure_current_device.h ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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__STD__CUDA_ENSURE_CURRENT_DEVICE_H
12
+ #define _CUDA__STD__CUDA_ENSURE_CURRENT_DEVICE_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_CUDA_COMPILER(CLANG)
25
+ # include <cuda_runtime_api.h>
26
+ #endif // _CCCL_CUDA_COMPILER(CLANG)
27
+
28
+ #include <cuda/std/__cuda/api_wrapper.h>
29
+
30
+ _LIBCUDACXX_BEGIN_NAMESPACE_CUDA
31
+
32
+ //! @brief `__ensure_current_device` is a simple helper that the current device is set to the right one.
33
+ //! Only changes the current device if the target device is not the current one
34
+ struct __ensure_current_device
35
+ {
36
+ int __target_device_ = 0;
37
+ int __original_device_ = 0;
38
+
39
+ //! @brief Queries the current device and if that is different than \p __target_device sets the current device to
40
+ //! \p __target_device
41
+ __ensure_current_device(const int __target_device)
42
+ : __target_device_(__target_device)
43
+ {
44
+ _CCCL_TRY_CUDA_API(::cudaGetDevice, "Failed to query current device", &__original_device_);
45
+ if (__original_device_ != __target_device_)
46
+ {
47
+ _CCCL_TRY_CUDA_API(::cudaSetDevice, "Failed to set device", __target_device_);
48
+ }
49
+ }
50
+
51
+ //! @brief If the \p __original_device was not equal to \p __target_device sets the current device back to
52
+ //! \p __original_device
53
+ ~__ensure_current_device()
54
+ {
55
+ if (__original_device_ != __target_device_)
56
+ {
57
+ _CCCL_TRY_CUDA_API(::cudaSetDevice, "Failed to set device", __original_device_);
58
+ }
59
+ }
60
+ };
61
+
62
+ _LIBCUDACXX_END_NAMESPACE_CUDA
63
+
64
+ #endif //_CUDA__STD__CUDA_ENSURE_CURRENT_DEVICE_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__internal/cpp_dialect.h ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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___INTERNAL_CPP_DIALECT_H
11
+ #define _LIBCUDACXX___INTERNAL_CPP_DIALECT_H
12
+
13
+ #include <cuda/__cccl_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
+ // Define LIBCUDACXX_COMPILER_DEPRECATION macro:
24
+ #if _CCCL_COMPILER(MSVC) || _CCCL_COMPILER(NVRTC)
25
+ # define LIBCUDACXX_COMP_DEPR_IMPL(msg) \
26
+ _CCCL_PRAGMA(message(__FILE__ ":" _CCCL_TO_STRING(__LINE__) ": warning: " #msg))
27
+ #else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC) vvv
28
+ # define LIBCUDACXX_COMP_DEPR_IMPL(msg) _CCCL_PRAGMA(GCC warning #msg)
29
+ #endif // !_CCCL_COMPILER(MSVC)
30
+
31
+ // clang-format off
32
+ #define LIBCUDACXX_DIALECT_DEPRECATION(REQ, CUR) \
33
+ LIBCUDACXX_COMP_DEPR_IMPL( \
34
+ libcu++ requires at least REQ. CUR is deprecated but still supported. CUR support will be removed in a \
35
+ future release. Define CCCL_IGNORE_DEPRECATED_CPP_DIALECT to suppress this message.)
36
+ // clang-format on
37
+
38
+ #if _CCCL_STD_VER < 2011
39
+ # error libcu++ requires C++11 or later.
40
+ #elif _CCCL_STD_VER == 2011 && !defined(CCCL_IGNORE_DEPRECATED_CPP_11)
41
+ LIBCUDACXX_DIALECT_DEPRECATION(C++ 17, C++ 11)
42
+ #elif _CCCL_STD_VER == 2014 && !defined(CCCL_IGNORE_DEPRECATED_CPP_14)
43
+ LIBCUDACXX_DIALECT_DEPRECATION(C++ 17, C++ 14)
44
+ #endif // _CCCL_STD_VER >= 2017
45
+
46
+ #endif // _LIBCUDACXX___INTERNAL_CPP_DIALECT_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__internal/features.h ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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___INTERNAL_FEATURES_H
11
+ #define _LIBCUDACXX___INTERNAL_FEATURES_H
12
+
13
+ #include <cuda/__cccl_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 NVCC is not being used <complex> can safely use `long double` without warnings
24
+ #if !_CCCL_CUDA_COMPILER(NVCC) && !_CCCL_COMPILER(NVRTC)
25
+ # define _LIBCUDACXX_HAS_COMPLEX_LONG_DOUBLE
26
+ #endif // !_CCCL_CUDA_COMPILER(NVCC) && !_CCCL_COMPILER(NVRTC)
27
+
28
+ #ifndef _LIBCUDACXX_HAS_EXTERNAL_ATOMIC_IMP
29
+ # define _LIBCUDACXX_HAS_EXTERNAL_ATOMIC_IMP
30
+ #endif // _LIBCUDACXX_HAS_EXTERNAL_ATOMIC_IMP
31
+
32
+ #ifndef _LIBCUDACXX_HAS_NO_ALIGNED_ALLOCATION
33
+ # if _CCCL_HAS_CUDA_COMPILER || __cpp_aligned_new < 201606
34
+ # define _LIBCUDACXX_HAS_NO_ALIGNED_ALLOCATION
35
+ # endif // _CCCL_HAS_CUDA_COMPILER || __cpp_aligned_new < 201606
36
+ #endif // _LIBCUDACXX_HAS_NO_ALIGNED_ALLOCATION
37
+
38
+ #ifndef _LIBCUDACXX_HAS_NO_CHAR8_T
39
+ # if _CCCL_STD_VER <= 2017 || !defined(__cpp_char8_t)
40
+ # define _LIBCUDACXX_HAS_NO_CHAR8_T
41
+ # endif // _CCCL_STD_VER <= 2017 || !defined(__cpp_char8_t)
42
+ #endif // _LIBCUDACXX_HAS_NO_CHAR8_T
43
+
44
+ // We need `is_constant_evaluated` for clang and gcc. MSVC also needs extensive rework
45
+ #if !defined(_CCCL_BUILTIN_IS_CONSTANT_EVALUATED)
46
+ # define _LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS
47
+ #elif _CCCL_COMPILER(NVRTC)
48
+ # define _LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS
49
+ #elif _CCCL_COMPILER(MSVC)
50
+ # define _LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS
51
+ #elif _CCCL_CUDACC_BELOW(11, 8)
52
+ # define _LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS
53
+ #elif _CCCL_CUDA_COMPILER(CLANG)
54
+ # define _LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS
55
+ #endif // _CCCL_CUDA_COMPILER(CLANG)
56
+
57
+ #ifndef _LIBCUDACXX_HAS_NO_CXX20_CHRONO_LITERALS
58
+ # define _LIBCUDACXX_HAS_NO_CXX20_CHRONO_LITERALS
59
+ #endif // _LIBCUDACXX_HAS_NO_CXX20_CHRONO_LITERALS
60
+
61
+ #ifndef _LIBCUDACXX_HAS_NO_INCOMPLETE_RANGES
62
+ # define _LIBCUDACXX_HAS_NO_INCOMPLETE_RANGES
63
+ #endif // _LIBCUDACXX_HAS_NO_INCOMPLETE_RANGES
64
+
65
+ #ifndef _LIBCUDACXX_HAS_NO_INT128
66
+ # if _CCCL_COMPILER(MSVC) || (_CCCL_COMPILER(NVRTC) && !defined(__CUDACC_RTC_INT128__)) \
67
+ || _CCCL_CUDA_COMPILER(NVCC, <, 11, 5) || !defined(__SIZEOF_INT128__)
68
+ # define _LIBCUDACXX_HAS_NO_INT128
69
+ # endif
70
+ #endif // !_LIBCUDACXX_HAS_NO_INT128
71
+
72
+ #ifndef _LIBCUDACXX_HAS_NO_LONG_DOUBLE
73
+ # if _CCCL_HAS_CUDA_COMPILER
74
+ # define _LIBCUDACXX_HAS_NO_LONG_DOUBLE
75
+ # endif // _CCCL_HAS_CUDA_COMPILER
76
+ #endif // _LIBCUDACXX_HAS_NO_LONG_DOUBLE
77
+
78
+ #ifndef _LIBCUDACXX_HAS_NO_MONOTONIC_CLOCK
79
+ # define _LIBCUDACXX_HAS_NO_MONOTONIC_CLOCK
80
+ #endif // _LIBCUDACXX_HAS_NO_MONOTONIC_CLOCK
81
+
82
+ #ifndef _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR
83
+ # define _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR
84
+ #endif // _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR
85
+
86
+ #ifndef _LIBCUDACXX_HAS_NO_WCHAR_H
87
+ # define _LIBCUDACXX_HAS_NO_WCHAR_H
88
+ #endif // _LIBCUDACXX_HAS_NO_WCHAR_H
89
+
90
+ // libcu++ requires host device support for its tests. Until then restrict usage to at least 12.2
91
+ #ifndef _LIBCUDACXX_HAS_NVFP16
92
+ # if defined(_CCCL_HAS_NVFP16) && _CCCL_CUDACC_AT_LEAST(12, 2) \
93
+ && (_CCCL_HAS_CUDA_COMPILER || defined(LIBCUDACXX_ENABLE_HOST_NVFP16))
94
+ # define _LIBCUDACXX_HAS_NVFP16
95
+ # endif // _CCCL_HAS_NVFP16 && _CCCL_CUDACC_AT_LEAST(12, 2)
96
+ #endif // !_LIBCUDACXX_HAS_NVFP16
97
+
98
+ // libcu++ requires host device support for its tests. Until then restrict usage to at least 12.2
99
+ #ifndef _LIBCUDACXX_HAS_NVBF16
100
+ # if defined(_CCCL_HAS_NVBF16) && _CCCL_CUDACC_AT_LEAST(12, 2)
101
+ # define _LIBCUDACXX_HAS_NVBF16
102
+ # endif // _CCCL_HAS_NVBF16 && _CCCL_CUDACC_AT_LEAST(12, 2)
103
+ #endif // !_LIBCUDACXX_HAS_NVBF16
104
+
105
+ // NVCC does not have a way of silencing non '_' prefixed UDLs
106
+ #if !_CCCL_CUDA_COMPILER(NVCC) && !_CCCL_COMPILER(NVRTC)
107
+ # define _LIBCUDACXX_HAS_STL_LITERALS
108
+ #endif // !_CCCL_CUDA_COMPILER(NVCC) && !_CCCL_COMPILER(NVRTC)
109
+
110
+ #endif // _LIBCUDACXX___INTERNAL_FEATURES_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__internal/namespaces.h ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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___INTERNAL_NAMESPACES_H
11
+ #define _LIBCUDACXX___INTERNAL_NAMESPACES_H
12
+
13
+ #include <cuda/__cccl_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
+ #define _LIBCUDACXX_CONCAT1(_LIBCUDACXX_X, _LIBCUDACXX_Y) _LIBCUDACXX_X##_LIBCUDACXX_Y
24
+ #define _LIBCUDACXX_CONCAT(_LIBCUDACXX_X, _LIBCUDACXX_Y) _LIBCUDACXX_CONCAT1(_LIBCUDACXX_X, _LIBCUDACXX_Y)
25
+
26
+ #ifndef _LIBCUDACXX_ABI_NAMESPACE
27
+ # define _LIBCUDACXX_ABI_NAMESPACE _LIBCUDACXX_CONCAT(__, _LIBCUDACXX_CUDA_ABI_VERSION)
28
+ #endif // _LIBCUDACXX_ABI_NAMESPACE
29
+
30
+ // clang-format off
31
+
32
+ // Standard namespaces with or without versioning
33
+ # define _LIBCUDACXX_BEGIN_NAMESPACE_STD_NOVERSION namespace cuda { namespace std {
34
+ # define _LIBCUDACXX_END_NAMESPACE_STD_NOVERSION } }
35
+ # define _LIBCUDACXX_BEGIN_NAMESPACE_STD namespace cuda { namespace std { inline namespace _LIBCUDACXX_ABI_NAMESPACE {
36
+ # define _LIBCUDACXX_END_NAMESPACE_STD } } }
37
+
38
+ // cuda specific namespaces
39
+ # define _LIBCUDACXX_BEGIN_NAMESPACE_CUDA namespace cuda { inline namespace _LIBCUDACXX_ABI_NAMESPACE {
40
+ # define _LIBCUDACXX_END_NAMESPACE_CUDA } }
41
+ # define _LIBCUDACXX_BEGIN_NAMESPACE_CUDA_MR namespace cuda { namespace mr { inline namespace _LIBCUDACXX_ABI_NAMESPACE {
42
+ # define _LIBCUDACXX_END_NAMESPACE_CUDA_MR } } }
43
+ # define _LIBCUDACXX_BEGIN_NAMESPACE_CUDA_DEVICE namespace cuda { namespace device { inline namespace _LIBCUDACXX_ABI_NAMESPACE {
44
+ # define _LIBCUDACXX_END_NAMESPACE_CUDA_DEVICE } } }
45
+ # define _LIBCUDACXX_BEGIN_NAMESPACE_CUDA_PTX namespace cuda { namespace ptx { inline namespace _LIBCUDACXX_ABI_NAMESPACE {
46
+ # define _LIBCUDACXX_END_NAMESPACE_CUDA_PTX } } }
47
+ # define _LIBCUDACXX_BEGIN_NAMESPACE_CUDA_DEVICE_EXPERIMENTAL namespace cuda { namespace device { namespace experimental { inline namespace _LIBCUDACXX_ABI_NAMESPACE {
48
+ # define _LIBCUDACXX_END_NAMESPACE_CUDA_DEVICE_EXPERIMENTAL } } } }
49
+
50
+ // Namespaces related to <ranges>
51
+ # define _LIBCUDACXX_BEGIN_NAMESPACE_RANGES namespace cuda { namespace std { namespace ranges { inline namespace _LIBCUDACXX_ABI_NAMESPACE {
52
+ # define _LIBCUDACXX_END_NAMESPACE_RANGES } } } }
53
+ # define _LIBCUDACXX_BEGIN_NAMESPACE_VIEWS namespace cuda { namespace std { namespace ranges { namespace views { inline namespace _LIBCUDACXX_ABI_NAMESPACE {
54
+ # define _LIBCUDACXX_END_NAMESPACE_VIEWS } } } } }
55
+
56
+ # if _CCCL_STD_VER >= 2020
57
+ # define _LIBCUDACXX_BEGIN_NAMESPACE_RANGES_ABI inline namespace __cxx20 {
58
+ # else
59
+ # define _LIBCUDACXX_BEGIN_NAMESPACE_RANGES_ABI inline namespace __cxx17 {
60
+ # endif
61
+ # define _LIBCUDACXX_END_NAMESPACE_RANGES_ABI }
62
+
63
+ # define _LIBCUDACXX_BEGIN_NAMESPACE_CPO(_CPO) namespace _CPO { _LIBCUDACXX_BEGIN_NAMESPACE_RANGES_ABI
64
+ # define _LIBCUDACXX_END_NAMESPACE_CPO } _LIBCUDACXX_END_NAMESPACE_RANGES_ABI
65
+
66
+ // Namespaces related to chrono / filesystem
67
+ # if _CCCL_STD_VER >= 2017
68
+ # define _LIBCUDACXX_BEGIN_NAMESPACE_FILESYSTEM namespace cuda { namespace std { inline namespace __fs { namespace filesystem { inline namespace _LIBCUDACXX_ABI_NAMESPACE {
69
+ # else // ^^^ C++17 ^^^ / vvv C++14 vvv
70
+ # define _LIBCUDACXX_BEGIN_NAMESPACE_FILESYSTEM namespace cuda { namespace std { namespace __fs { namespace filesystem { inline namespace _LIBCUDACXX_ABI_NAMESPACE {
71
+ # endif // _CCCL_STD_VER <= 2014
72
+ # define _LIBCUDACXX_END_NAMESPACE_FILESYSTEM } } } } }
73
+
74
+ // Shorthands for different qualifiers
75
+ # define _CUDA_VSTD_NOVERSION ::cuda::std
76
+ # define _CUDA_VSTD ::cuda::std::_LIBCUDACXX_ABI_NAMESPACE
77
+ # define _CUDA_VRANGES ::cuda::std::ranges::_LIBCUDACXX_ABI_NAMESPACE
78
+ # define _CUDA_VIEWS ::cuda::std::ranges::views::_LIBCUDACXX_CUDA_ABI_NAMESPACE
79
+ # define _CUDA_VMR ::cuda::mr::_LIBCUDACXX_ABI_NAMESPACE
80
+ # define _CUDA_VPTX ::cuda::ptx::_LIBCUDACXX_ABI_NAMESPACE
81
+ # define _CUDA_VSTD_FS ::cuda::std::__fs::filesystem::_LIBCUDACXX_ABI_NAMESPACE
82
+
83
+ // clang-format on
84
+
85
+ #endif // _LIBCUDACXX___INTERNAL_NAMESPACES_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__iterator/incrementable_traits.h ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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___ITERATOR_INCREMENTABLE_TRAITS_H
12
+ #define _LIBCUDACXX___ITERATOR_INCREMENTABLE_TRAITS_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/arithmetic.h>
25
+ #include <cuda/std/__concepts/same_as.h>
26
+ #include <cuda/std/__type_traits/conditional.h>
27
+ #include <cuda/std/__type_traits/enable_if.h>
28
+ #include <cuda/std/__type_traits/is_const.h>
29
+ #include <cuda/std/__type_traits/is_object.h>
30
+ #include <cuda/std/__type_traits/is_pointer.h>
31
+ #include <cuda/std/__type_traits/is_primary_template.h>
32
+ #include <cuda/std/__type_traits/make_signed.h>
33
+ #include <cuda/std/__type_traits/remove_cvref.h>
34
+ #include <cuda/std/__type_traits/void_t.h>
35
+ #include <cuda/std/__utility/declval.h>
36
+ #include <cuda/std/cstddef>
37
+
38
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
39
+
40
+ #if !defined(_CCCL_NO_CONCEPTS)
41
+
42
+ // [incrementable.traits]
43
+ template <class>
44
+ struct incrementable_traits
45
+ {};
46
+
47
+ template <class _Tp>
48
+ requires is_object_v<_Tp>
49
+ struct incrementable_traits<_Tp*>
50
+ {
51
+ using difference_type = ptrdiff_t;
52
+ };
53
+
54
+ template <class _Ip>
55
+ struct incrementable_traits<const _Ip> : incrementable_traits<_Ip>
56
+ {};
57
+
58
+ template <class _Tp>
59
+ concept __has_member_difference_type = requires { typename _Tp::difference_type; };
60
+
61
+ template <__has_member_difference_type _Tp>
62
+ struct incrementable_traits<_Tp>
63
+ {
64
+ using difference_type = typename _Tp::difference_type;
65
+ };
66
+
67
+ template <class _Tp>
68
+ concept __has_integral_minus = requires(const _Tp& __x, const _Tp& __y) {
69
+ { __x - __y } -> integral;
70
+ };
71
+
72
+ template <__has_integral_minus _Tp>
73
+ requires(!__has_member_difference_type<_Tp>)
74
+ struct incrementable_traits<_Tp>
75
+ {
76
+ using difference_type = make_signed_t<decltype(declval<_Tp>() - declval<_Tp>())>;
77
+ };
78
+
79
+ template <class>
80
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT iterator_traits;
81
+
82
+ // Let `RI` be `remove_cvref_t<I>`. The type `iter_difference_t<I>` denotes
83
+ // `incrementable_traits<RI>::difference_type` if `iterator_traits<RI>` names a specialization
84
+ // generated from the primary template, and `iterator_traits<RI>::difference_type` otherwise.
85
+ template <class _Ip>
86
+ using iter_difference_t =
87
+ typename conditional_t<__is_primary_template<iterator_traits<remove_cvref_t<_Ip>>>::value,
88
+ incrementable_traits<remove_cvref_t<_Ip>>,
89
+ iterator_traits<remove_cvref_t<_Ip>>>::difference_type;
90
+
91
+ #elif _CCCL_STD_VER >= 2014 // ^^^ !_CCCL_NO_CONCEPTS ^^^
92
+
93
+ // [incrementable.traits]
94
+ template <class, class = void>
95
+ struct incrementable_traits
96
+ {};
97
+
98
+ template <class _Tp>
99
+ struct incrementable_traits<_Tp*, enable_if_t<_CCCL_TRAIT(is_object, _Tp)>>
100
+ {
101
+ using difference_type = ptrdiff_t;
102
+ };
103
+
104
+ template <class _Ip>
105
+ struct incrementable_traits<const _Ip> : incrementable_traits<_Ip>
106
+ {};
107
+
108
+ template <class _Tp, class = void>
109
+ _CCCL_INLINE_VAR constexpr bool __has_member_difference_type = false;
110
+
111
+ template <class _Tp>
112
+ _CCCL_INLINE_VAR constexpr bool __has_member_difference_type<_Tp, void_t<typename _Tp::difference_type>> = true;
113
+
114
+ template <class _Tp, class = void, class = void>
115
+ _CCCL_INLINE_VAR constexpr bool __has_integral_minus = false;
116
+
117
+ // In C++17 we get issues trying to bind void* to a const& so special case it here
118
+ template <class _Tp>
119
+ _CCCL_INLINE_VAR constexpr bool
120
+ __has_integral_minus<_Tp,
121
+ enable_if_t<!same_as<_Tp, void*>>,
122
+ void_t<decltype(_CUDA_VSTD::declval<const _Tp&>() - _CUDA_VSTD::declval<const _Tp&>())>> =
123
+ integral<decltype(_CUDA_VSTD::declval<const _Tp&>() - _CUDA_VSTD::declval<const _Tp&>())>;
124
+
125
+ template <class _Tp>
126
+ struct incrementable_traits<
127
+ _Tp,
128
+ enable_if_t<!_CCCL_TRAIT(is_pointer, _Tp) && !_CCCL_TRAIT(is_const, _Tp) && __has_member_difference_type<_Tp>>>
129
+ {
130
+ using difference_type = typename _Tp::difference_type;
131
+ };
132
+
133
+ template <class _Tp>
134
+ struct incrementable_traits<_Tp,
135
+ enable_if_t<!_CCCL_TRAIT(is_pointer, _Tp) && !_CCCL_TRAIT(is_const, _Tp)
136
+ && !__has_member_difference_type<_Tp> && __has_integral_minus<_Tp>>>
137
+ {
138
+ using difference_type = make_signed_t<decltype(declval<_Tp>() - declval<_Tp>())>;
139
+ };
140
+
141
+ template <class, class = void>
142
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT iterator_traits;
143
+
144
+ // Let `RI` be `remove_cvref_t<I>`. The type `iter_difference_t<I>` denotes
145
+ // `incrementable_traits<RI>::difference_type` if `iterator_traits<RI>` names a specialization
146
+ // generated from the primary template, and `iterator_traits<RI>::difference_type` otherwise.
147
+ template <class _Ip>
148
+ using iter_difference_t =
149
+ typename conditional_t<__is_primary_template<iterator_traits<remove_cvref_t<_Ip>>>::value,
150
+ incrementable_traits<remove_cvref_t<_Ip>>,
151
+ iterator_traits<remove_cvref_t<_Ip>>>::difference_type;
152
+
153
+ #endif // _CCCL_STD_VER >= 2014
154
+
155
+ _LIBCUDACXX_END_NAMESPACE_STD
156
+
157
+ #endif // _LIBCUDACXX___ITERATOR_INCREMENTABLE_TRAITS_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__iterator/istream_iterator.h ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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___ITERATOR_ISTREAM_ITERATOR_H
12
+ #define _LIBCUDACXX___ITERATOR_ISTREAM_ITERATOR_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/__iterator/default_sentinel.h>
25
+ #include <cuda/std/__iterator/iterator.h>
26
+ #include <cuda/std/__iterator/iterator_traits.h>
27
+ #include <cuda/std/__memory/addressof.h>
28
+ #include <cuda/std/cstddef>
29
+ #include <cuda/std/detail/libcxx/include/iosfwd>
30
+
31
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
32
+
33
+ _CCCL_SUPPRESS_DEPRECATED_PUSH
34
+ template <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
35
+ class _CCCL_TYPE_VISIBILITY_DEFAULT istream_iterator
36
+ #if _CCCL_STD_VER <= 2014 || !defined(_LIBCUDACXX_ABI_NO_ITERATOR_BASES)
37
+ : public iterator<input_iterator_tag, _Tp, _Distance, const _Tp*, const _Tp&>
38
+ #endif
39
+ {
40
+ _CCCL_SUPPRESS_DEPRECATED_POP
41
+
42
+ public:
43
+ typedef input_iterator_tag iterator_category;
44
+ typedef _Tp value_type;
45
+ typedef _Distance difference_type;
46
+ typedef const _Tp* pointer;
47
+ typedef const _Tp& reference;
48
+ typedef _CharT char_type;
49
+ typedef _Traits traits_type;
50
+ typedef basic_istream<_CharT, _Traits> istream_type;
51
+
52
+ private:
53
+ istream_type* __in_stream_;
54
+ _Tp __value_;
55
+
56
+ public:
57
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr istream_iterator()
58
+ : __in_stream_(nullptr)
59
+ , __value_()
60
+ {}
61
+ #if _CCCL_STD_VER > 2014
62
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr istream_iterator(default_sentinel_t)
63
+ : istream_iterator()
64
+ {}
65
+ #endif // _CCCL_STD_VER > 2014
66
+ _LIBCUDACXX_HIDE_FROM_ABI istream_iterator(istream_type& __s)
67
+ : __in_stream_(_CUDA_VSTD::addressof(__s))
68
+ {
69
+ if (!(*__in_stream_ >> __value_))
70
+ {
71
+ __in_stream_ = nullptr;
72
+ }
73
+ }
74
+
75
+ _LIBCUDACXX_HIDE_FROM_ABI const _Tp& operator*() const
76
+ {
77
+ return __value_;
78
+ }
79
+ _LIBCUDACXX_HIDE_FROM_ABI const _Tp* operator->() const
80
+ {
81
+ return _CUDA_VSTD::addressof((operator*()));
82
+ }
83
+ _LIBCUDACXX_HIDE_FROM_ABI istream_iterator& operator++()
84
+ {
85
+ if (!(*__in_stream_ >> __value_))
86
+ {
87
+ __in_stream_ = nullptr;
88
+ }
89
+ return *this;
90
+ }
91
+ _LIBCUDACXX_HIDE_FROM_ABI istream_iterator operator++(int)
92
+ {
93
+ istream_iterator __t(*this);
94
+ ++(*this);
95
+ return __t;
96
+ }
97
+
98
+ template <class _Up, class _CharU, class _TraitsU, class _DistanceU>
99
+ friend _LIBCUDACXX_HIDE_FROM_ABI bool operator==(const istream_iterator<_Up, _CharU, _TraitsU, _DistanceU>& __x,
100
+ const istream_iterator<_Up, _CharU, _TraitsU, _DistanceU>& __y);
101
+
102
+ #if _CCCL_STD_VER > 2014
103
+ friend _LIBCUDACXX_HIDE_FROM_ABI bool operator==(const istream_iterator& __i, default_sentinel_t)
104
+ {
105
+ return __i.__in_stream_ == nullptr;
106
+ }
107
+ # if _CCCL_STD_VER < 2020
108
+ friend _LIBCUDACXX_HIDE_FROM_ABI bool operator==(default_sentinel_t, const istream_iterator& __i)
109
+ {
110
+ return __i.__in_stream_ == nullptr;
111
+ }
112
+ friend _LIBCUDACXX_HIDE_FROM_ABI bool operator!=(const istream_iterator& __i, default_sentinel_t)
113
+ {
114
+ return __i.__in_stream_ != nullptr;
115
+ }
116
+ friend _LIBCUDACXX_HIDE_FROM_ABI bool operator!=(default_sentinel_t, const istream_iterator& __i)
117
+ {
118
+ return __i.__in_stream_ != nullptr;
119
+ }
120
+ # endif // _CCCL_STD_VER < 2020
121
+ #endif // _CCCL_STD_VER > 2014
122
+ };
123
+
124
+ template <class _Tp, class _CharT, class _Traits, class _Distance>
125
+ _LIBCUDACXX_HIDE_FROM_ABI bool operator==(const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __x,
126
+ const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __y)
127
+ {
128
+ return __x.__in_stream_ == __y.__in_stream_;
129
+ }
130
+
131
+ template <class _Tp, class _CharT, class _Traits, class _Distance>
132
+ _LIBCUDACXX_HIDE_FROM_ABI bool operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __x,
133
+ const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __y)
134
+ {
135
+ return !(__x == __y);
136
+ }
137
+
138
+ _LIBCUDACXX_END_NAMESPACE_STD
139
+
140
+ #endif // _LIBCUDACXX___ITERATOR_ISTREAM_ITERATOR_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__iterator/iter_move.h ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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___ITERATOR_ITER_MOVE_H
12
+ #define _LIBCUDACXX___ITERATOR_ITER_MOVE_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/class_or_enum.h>
25
+ #include <cuda/std/__iterator/iterator_traits.h>
26
+ #include <cuda/std/__type_traits/enable_if.h>
27
+ #include <cuda/std/__type_traits/is_reference.h>
28
+ #include <cuda/std/__type_traits/remove_cvref.h>
29
+ #include <cuda/std/__utility/declval.h>
30
+ #include <cuda/std/__utility/forward.h>
31
+ #include <cuda/std/__utility/move.h>
32
+
33
+ _CCCL_DIAG_PUSH
34
+ _CCCL_DIAG_SUPPRESS_CLANG("-Wvoid-ptr-dereference")
35
+
36
+ #if _CCCL_STD_VER >= 2014
37
+
38
+ // [iterator.cust.move]
39
+
40
+ _LIBCUDACXX_BEGIN_NAMESPACE_RANGES
41
+ _LIBCUDACXX_BEGIN_NAMESPACE_CPO(__iter_move)
42
+
43
+ _CCCL_HOST_DEVICE void iter_move();
44
+
45
+ # if !defined(_CCCL_NO_CONCEPTS)
46
+ template <class _Tp>
47
+ concept __unqualified_iter_move =
48
+ __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) { iter_move(_CUDA_VSTD::forward<_Tp>(__t)); };
49
+
50
+ template <class _Tp>
51
+ concept __move_deref = !__unqualified_iter_move<_Tp> && requires(_Tp&& __t) {
52
+ *__t;
53
+ requires is_lvalue_reference_v<decltype(*__t)>;
54
+ };
55
+
56
+ template <class _Tp>
57
+ concept __just_deref = !__unqualified_iter_move<_Tp> && !__move_deref<_Tp> && requires(_Tp&& __t) {
58
+ *__t;
59
+ requires(!is_lvalue_reference_v<decltype(*__t)>);
60
+ };
61
+
62
+ # else // ^^^ !_CCCL_NO_CONCEPTS ^^^ / vvv _CCCL_NO_CONCEPTS vvv
63
+
64
+ template <class _Tp>
65
+ _CCCL_CONCEPT_FRAGMENT(
66
+ __unqualified_iter_move_,
67
+ requires(_Tp&& __t)(requires(__class_or_enum<remove_cvref_t<_Tp>>), (iter_move(_CUDA_VSTD::forward<_Tp>(__t)))));
68
+
69
+ template <class _Tp>
70
+ _CCCL_CONCEPT __unqualified_iter_move = _CCCL_FRAGMENT(__unqualified_iter_move_, _Tp);
71
+
72
+ template <class _Tp>
73
+ _CCCL_CONCEPT_FRAGMENT(
74
+ __move_deref_,
75
+ requires(_Tp&& __t)(requires(!__unqualified_iter_move<_Tp>), requires(is_lvalue_reference_v<decltype(*__t)>)));
76
+
77
+ template <class _Tp>
78
+ _CCCL_CONCEPT __move_deref = _CCCL_FRAGMENT(__move_deref_, _Tp);
79
+
80
+ template <class _Tp>
81
+ _CCCL_CONCEPT_FRAGMENT(__just_deref_,
82
+ requires(_Tp&& __t)(requires(!__unqualified_iter_move<_Tp>),
83
+ requires(!__move_deref<_Tp>),
84
+ requires(!is_lvalue_reference_v<decltype(*__t)>)));
85
+
86
+ template <class _Tp>
87
+ _CCCL_CONCEPT __just_deref = _CCCL_FRAGMENT(__just_deref_, _Tp);
88
+ # endif // _CCCL_NO_CONCEPTS
89
+
90
+ // [iterator.cust.move]
91
+
92
+ struct __fn
93
+ {
94
+ _CCCL_TEMPLATE(class _Ip)
95
+ _CCCL_REQUIRES(__unqualified_iter_move<_Ip>)
96
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr decltype(auto) operator()(_Ip&& __i) const
97
+ noexcept(noexcept(iter_move(_CUDA_VSTD::forward<_Ip>(__i))))
98
+ {
99
+ return iter_move(_CUDA_VSTD::forward<_Ip>(__i));
100
+ }
101
+
102
+ _CCCL_TEMPLATE(class _Ip)
103
+ _CCCL_REQUIRES(__move_deref<_Ip>)
104
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr auto operator()(_Ip&& __i) const noexcept(noexcept(
105
+ _CUDA_VSTD::move(*_CUDA_VSTD::forward<_Ip>(__i)))) -> decltype(_CUDA_VSTD::move(*_CUDA_VSTD::forward<_Ip>(__i)))
106
+ {
107
+ return _CUDA_VSTD::move(*_CUDA_VSTD::forward<_Ip>(__i));
108
+ }
109
+
110
+ _CCCL_TEMPLATE(class _Ip)
111
+ _CCCL_REQUIRES(__just_deref<_Ip>)
112
+ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr auto operator()(_Ip&& __i) const
113
+ noexcept(noexcept(*_CUDA_VSTD::forward<_Ip>(__i))) -> decltype(*_CUDA_VSTD::forward<_Ip>(__i))
114
+ {
115
+ return *_CUDA_VSTD::forward<_Ip>(__i);
116
+ }
117
+ };
118
+ _LIBCUDACXX_END_NAMESPACE_CPO
119
+ inline namespace __cpo
120
+ {
121
+ _CCCL_GLOBAL_CONSTANT auto iter_move = __iter_move::__fn{};
122
+ } // namespace __cpo
123
+ _LIBCUDACXX_END_NAMESPACE_RANGES
124
+
125
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
126
+
127
+ # if !defined(_CCCL_NO_CONCEPTS)
128
+ template <__dereferenceable _Tp>
129
+ requires requires(_Tp& __t) {
130
+ { _CUDA_VRANGES::iter_move(__t) } -> __can_reference;
131
+ }
132
+ using iter_rvalue_reference_t = decltype(_CUDA_VRANGES::iter_move(_CUDA_VSTD::declval<_Tp&>()));
133
+
134
+ # else // ^^^ !_CCCL_NO_CONCEPTS ^^^ / vvv _CCCL_NO_CONCEPTS vvv
135
+
136
+ template <class _Tp>
137
+ _CCCL_CONCEPT_FRAGMENT(__can_iter_rvalue_reference_t_,
138
+ requires(_Tp& __t)(requires(__dereferenceable<_Tp>),
139
+ requires(__can_reference<decltype(_CUDA_VRANGES::iter_move(__t))>)));
140
+
141
+ template <class _Tp>
142
+ _CCCL_CONCEPT __can_iter_rvalue_reference_t = _CCCL_FRAGMENT(__can_iter_rvalue_reference_t_, _Tp);
143
+
144
+ template <class _Tp>
145
+ using __iter_rvalue_reference_t = decltype(_CUDA_VRANGES::iter_move(_CUDA_VSTD::declval<_Tp&>()));
146
+
147
+ template <class _Tp>
148
+ using iter_rvalue_reference_t = enable_if_t<__can_iter_rvalue_reference_t<_Tp>, __iter_rvalue_reference_t<_Tp>>;
149
+ # endif // _CCCL_NO_CONCEPTS
150
+
151
+ _LIBCUDACXX_END_NAMESPACE_STD
152
+
153
+ #endif // _CCCL_STD_VER > 2014
154
+
155
+ _CCCL_DIAG_POP
156
+
157
+ #endif // _LIBCUDACXX___ITERATOR_ITER_MOVE_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__iterator/iterator.h ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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___ITERATOR_ITERATOR_H
12
+ #define _LIBCUDACXX___ITERATOR_ITERATOR_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/cstddef>
25
+
26
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
27
+
28
+ template <class _Category, class _Tp, class _Distance = ptrdiff_t, class _Pointer = _Tp*, class _Reference = _Tp&>
29
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT _LIBCUDACXX_DEPRECATED_IN_CXX17 iterator
30
+ {
31
+ typedef _Tp value_type;
32
+ typedef _Distance difference_type;
33
+ typedef _Pointer pointer;
34
+ typedef _Reference reference;
35
+ typedef _Category iterator_category;
36
+ };
37
+
38
+ _LIBCUDACXX_END_NAMESPACE_STD
39
+
40
+ #endif // _LIBCUDACXX___ITERATOR_ITERATOR_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__iterator/mergeable.h ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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___ITERATOR_MERGEABLE_H
12
+ #define _LIBCUDACXX___ITERATOR_MERGEABLE_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/__functional/identity.h>
25
+ #include <cuda/std/__functional/ranges_operations.h>
26
+ #include <cuda/std/__iterator/concepts.h>
27
+ #include <cuda/std/__iterator/projected.h>
28
+
29
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
30
+
31
+ #if _CCCL_STD_VER > 2017
32
+
33
+ template <class _Input1,
34
+ class _Input2,
35
+ class _Output,
36
+ class _Comp = _CUDA_VRANGES::less,
37
+ class _Proj1 = identity,
38
+ class _Proj2 = identity>
39
+ concept mergeable =
40
+ input_iterator<_Input1> && input_iterator<_Input2> && weakly_incrementable<_Output>
41
+ && indirectly_copyable<_Input1, _Output> && indirectly_copyable<_Input2, _Output>
42
+ && indirect_strict_weak_order<_Comp, projected<_Input1, _Proj1>, projected<_Input2, _Proj2>>;
43
+
44
+ #elif _CCCL_STD_VER >= 2014
45
+
46
+ template <class _Input1, class _Input2, class _Output, class _Comp, class _Proj1, class _Proj2>
47
+ _CCCL_CONCEPT_FRAGMENT(
48
+ __mergeable_,
49
+ requires()(requires(input_iterator<_Input1>),
50
+ requires(input_iterator<_Input2>),
51
+ requires(weakly_incrementable<_Output>),
52
+ requires(indirectly_copyable<_Input1, _Output>),
53
+ requires(indirectly_copyable<_Input2, _Output>),
54
+ requires(indirect_strict_weak_order<_Comp, projected<_Input1, _Proj1>, projected<_Input2, _Proj2>>)));
55
+
56
+ template <class _Input1,
57
+ class _Input2,
58
+ class _Output,
59
+ class _Comp = _CUDA_VRANGES::less,
60
+ class _Proj1 = identity,
61
+ class _Proj2 = identity>
62
+ _CCCL_CONCEPT mergeable = _CCCL_FRAGMENT(__mergeable_, _Input1, _Input2, _Output, _Comp, _Proj1, _Proj2);
63
+
64
+ #endif // _CCCL_STD_VER > 2014
65
+
66
+ _LIBCUDACXX_END_NAMESPACE_STD
67
+
68
+ #endif // _LIBCUDACXX___ITERATOR_MERGEABLE_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__iterator/move_sentinel.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___ITERATOR_MOVE_SENTINEL_H
11
+ #define _LIBCUDACXX___ITERATOR_MOVE_SENTINEL_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/__concepts/assignable.h>
24
+ #include <cuda/std/__concepts/convertible_to.h>
25
+ #include <cuda/std/__concepts/semiregular.h>
26
+ #include <cuda/std/__utility/move.h>
27
+
28
+ #if _CCCL_STD_VER > 2014
29
+
30
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
31
+
32
+ # if _CCCL_STD_VER > 2017
33
+ template <semiregular _Sent>
34
+ # else
35
+ template <class _Sent, enable_if_t<semiregular<_Sent>, int> = 0>
36
+ # endif
37
+ class _CCCL_TYPE_VISIBILITY_DEFAULT move_sentinel
38
+ {
39
+ public:
40
+ _CCCL_HIDE_FROM_ABI constexpr move_sentinel() = default;
41
+
42
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr explicit move_sentinel(_Sent __s)
43
+ : __last_(_CUDA_VSTD::move(__s))
44
+ {}
45
+
46
+ _CCCL_TEMPLATE(class _S2)
47
+ _CCCL_REQUIRES(convertible_to<const _S2&, _Sent>)
48
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr move_sentinel(const move_sentinel<_S2>& __s)
49
+ : __last_(__s.base())
50
+ {}
51
+
52
+ _CCCL_TEMPLATE(class _S2)
53
+ _CCCL_REQUIRES(assignable_from<const _S2&, _Sent>)
54
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr move_sentinel& operator=(const move_sentinel<_S2>& __s)
55
+ {
56
+ __last_ = __s.base();
57
+ return *this;
58
+ }
59
+
60
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr _Sent base() const
61
+ {
62
+ return __last_;
63
+ }
64
+
65
+ private:
66
+ _Sent __last_ = _Sent();
67
+ };
68
+
69
+ _LIBCUDACXX_END_NAMESPACE_STD
70
+
71
+ #endif // _CCCL_STD_VER > 2014
72
+
73
+ #endif // _LIBCUDACXX___ITERATOR_MOVE_SENTINEL_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__iterator/next.h ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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___ITERATOR_NEXT_H
12
+ #define _LIBCUDACXX___ITERATOR_NEXT_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/__iterator/advance.h>
25
+ #include <cuda/std/__iterator/concepts.h>
26
+ #include <cuda/std/__iterator/incrementable_traits.h>
27
+ #include <cuda/std/__iterator/iterator_traits.h>
28
+ #include <cuda/std/__type_traits/enable_if.h>
29
+
30
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
31
+
32
+ template <class _InputIter>
33
+ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 enable_if_t<__is_cpp17_input_iterator<_InputIter>::value, _InputIter>
34
+ next(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = 1)
35
+ {
36
+ _CCCL_ASSERT(__n >= 0 || __is_cpp17_bidirectional_iterator<_InputIter>::value,
37
+ "Attempt to next(it, n) with negative n on a non-bidirectional iterator");
38
+
39
+ _CUDA_VSTD::advance(__x, __n);
40
+ return __x;
41
+ }
42
+
43
+ _LIBCUDACXX_END_NAMESPACE_STD
44
+
45
+ #if _CCCL_STD_VER > 2014 && !_CCCL_COMPILER(MSVC2017)
46
+
47
+ // [range.iter.op.next]
48
+
49
+ _LIBCUDACXX_BEGIN_NAMESPACE_RANGES
50
+ _LIBCUDACXX_BEGIN_NAMESPACE_CPO(__next)
51
+ struct __fn
52
+ {
53
+ _CCCL_TEMPLATE(class _Ip)
54
+ _CCCL_REQUIRES(input_or_output_iterator<_Ip>)
55
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x) const
56
+ {
57
+ ++__x;
58
+ return __x;
59
+ }
60
+
61
+ _CCCL_TEMPLATE(class _Ip)
62
+ _CCCL_REQUIRES(input_or_output_iterator<_Ip>)
63
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x, iter_difference_t<_Ip> __n) const
64
+ {
65
+ _CUDA_VRANGES::advance(__x, __n);
66
+ return __x;
67
+ }
68
+
69
+ _CCCL_TEMPLATE(class _Ip, class _Sp)
70
+ _CCCL_REQUIRES(input_or_output_iterator<_Ip>&& sentinel_for<_Sp, _Ip>)
71
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x, _Sp __bound_sentinel) const
72
+ {
73
+ _CUDA_VRANGES::advance(__x, __bound_sentinel);
74
+ return __x;
75
+ }
76
+
77
+ _CCCL_TEMPLATE(class _Ip, class _Sp)
78
+ _CCCL_REQUIRES(input_or_output_iterator<_Ip>&& sentinel_for<_Sp, _Ip>)
79
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x, iter_difference_t<_Ip> __n, _Sp __bound_sentinel) const
80
+ {
81
+ _CUDA_VRANGES::advance(__x, __n, __bound_sentinel);
82
+ return __x;
83
+ }
84
+ };
85
+ _LIBCUDACXX_END_NAMESPACE_CPO
86
+
87
+ inline namespace __cpo
88
+ {
89
+ _CCCL_GLOBAL_CONSTANT auto next = __next::__fn{};
90
+ } // namespace __cpo
91
+ _LIBCUDACXX_END_NAMESPACE_RANGES
92
+
93
+ #endif // _CCCL_STD_VER > 2014 && !_CCCL_COMPILER(MSVC2017)
94
+
95
+ #endif // _LIBCUDACXX___ITERATOR_NEXT_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__iterator/permutable.h ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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___ITERATOR_PERMUTABLE_H
12
+ #define _LIBCUDACXX___ITERATOR_PERMUTABLE_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/__iterator/concepts.h>
25
+ #include <cuda/std/__iterator/iter_swap.h>
26
+
27
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
28
+
29
+ #if _CCCL_STD_VER > 2017
30
+
31
+ template <class _Iterator>
32
+ concept permutable = forward_iterator<_Iterator> && indirectly_movable_storable<_Iterator, _Iterator>
33
+ && indirectly_swappable<_Iterator, _Iterator>;
34
+
35
+ #elif _CCCL_STD_VER >= 2014
36
+
37
+ template <class _Iterator>
38
+ _CCCL_CONCEPT_FRAGMENT(__permutable_,
39
+ requires()(requires(forward_iterator<_Iterator>),
40
+ requires(indirectly_movable_storable<_Iterator, _Iterator>),
41
+ requires(indirectly_swappable<_Iterator, _Iterator>)));
42
+
43
+ template <class _Iterator>
44
+ _CCCL_CONCEPT permutable = _CCCL_FRAGMENT(__permutable_, _Iterator);
45
+
46
+ #endif // _CCCL_STD_VER >= 2014
47
+
48
+ _LIBCUDACXX_END_NAMESPACE_STD
49
+
50
+ #endif // _LIBCUDACXX___ITERATOR_PERMUTABLE_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__iterator/sortable.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___ITERATOR_SORTABLE_H
12
+ #define _LIBCUDACXX___ITERATOR_SORTABLE_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/__functional/identity.h>
25
+ #include <cuda/std/__functional/ranges_operations.h>
26
+ #include <cuda/std/__iterator/concepts.h>
27
+ #include <cuda/std/__iterator/permutable.h>
28
+ #include <cuda/std/__iterator/projected.h>
29
+
30
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
31
+
32
+ #if _CCCL_STD_VER > 2017
33
+
34
+ template <class _Iter, class _Comp = _CUDA_VRANGES::less, class _Proj = identity>
35
+ concept sortable = permutable<_Iter> && indirect_strict_weak_order<_Comp, projected<_Iter, _Proj>>;
36
+
37
+ #elif _CCCL_STD_VER >= 2014
38
+
39
+ template <class _Iter, class _Comp, class _Proj>
40
+ _CCCL_CONCEPT_FRAGMENT(
41
+ __sortable_,
42
+ requires()(requires(permutable<_Iter>), requires(indirect_strict_weak_order<_Comp, projected<_Iter, _Proj>>)));
43
+
44
+ template <class _Iter, class _Comp = _CUDA_VRANGES::less, class _Proj = identity>
45
+ _CCCL_CONCEPT sortable = _CCCL_FRAGMENT(__sortable_, _Iter, _Comp, _Proj);
46
+
47
+ #endif // _CCCL_STD_VER >= 2014
48
+
49
+ _LIBCUDACXX_END_NAMESPACE_STD
50
+
51
+ #endif // _LIBCUDACXX___ITERATOR_SORTABLE_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__tuple_dir/ignore.h ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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___TUPLE_IGNORE_H
11
+ #define _LIBCUDACXX___TUPLE_IGNORE_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
+ struct __ignore_t
26
+ {
27
+ __ignore_t() = default;
28
+
29
+ template <class _Tp, class... _Ts>
30
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr __ignore_t(const _Tp&, const _Ts&...) noexcept
31
+ {}
32
+
33
+ template <class _Tp>
34
+ _LIBCUDACXX_HIDE_FROM_ABI constexpr const __ignore_t& operator=(const _Tp&) const noexcept
35
+ {
36
+ return *this;
37
+ }
38
+ };
39
+
40
+ namespace
41
+ {
42
+ _CCCL_GLOBAL_CONSTANT __ignore_t ignore{};
43
+ } // namespace
44
+
45
+ _LIBCUDACXX_END_NAMESPACE_STD
46
+
47
+ #endif // _LIBCUDACXX___TUPLE_IGNORE_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__tuple_dir/make_tuple_types.h ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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___TUPLE_MAKE_TUPLE_TYPES_H
11
+ #define _LIBCUDACXX___TUPLE_MAKE_TUPLE_TYPES_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/array.h>
24
+ #include <cuda/std/__fwd/tuple.h>
25
+ #include <cuda/std/__tuple_dir/tuple_element.h>
26
+ #include <cuda/std/__tuple_dir/tuple_indices.h>
27
+ #include <cuda/std/__tuple_dir/tuple_size.h>
28
+ #include <cuda/std/__tuple_dir/tuple_types.h>
29
+ #include <cuda/std/__type_traits/copy_cvref.h>
30
+ #include <cuda/std/__type_traits/remove_cv.h>
31
+ #include <cuda/std/__type_traits/remove_reference.h>
32
+ #include <cuda/std/__type_traits/type_list.h>
33
+ #include <cuda/std/cstddef>
34
+
35
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
36
+
37
+ // __make_tuple_types<_Tuple<_Types...>, _Ep, _Sp>::type is a
38
+ // __tuple_types<_Types...> using only those _Types in the range [_Sp, _Ep).
39
+ // _Sp defaults to 0 and _Ep defaults to tuple_size<_Tuple>. If _Tuple is a
40
+ // lvalue_reference type, then __tuple_types<_Types&...> is the result.
41
+
42
+ template <class _TupleTypes, class _TupleIndices>
43
+ struct __make_tuple_types_flat;
44
+
45
+ template <template <class...> class _Tuple, class... _Types, size_t... _Idx>
46
+ struct __make_tuple_types_flat<_Tuple<_Types...>, __tuple_indices<_Idx...>>
47
+ {
48
+ using __tuple_types_list = __type_list<_Types...>;
49
+
50
+ // Specialization for pair, tuple, and __tuple_types
51
+ template <class _Tp, class _ApplyFn = __apply_cvref_fn<_Tp>>
52
+ using __apply_quals _CCCL_NODEBUG_ALIAS =
53
+ __tuple_types<__type_call<_ApplyFn, __type_at_c<_Idx, __tuple_types_list>>...>;
54
+ };
55
+
56
+ template <class _Vt, size_t _Np, size_t... _Idx>
57
+ struct __make_tuple_types_flat<array<_Vt, _Np>, __tuple_indices<_Idx...>>
58
+ {
59
+ template <size_t>
60
+ using __value_type = _Vt;
61
+ template <class _Tp, class _ApplyFn = __apply_cvref_fn<_Tp>>
62
+ using __apply_quals = __tuple_types<__type_call<_ApplyFn, __value_type<_Idx>>...>;
63
+ };
64
+
65
+ template <class _Tp,
66
+ size_t _Ep = tuple_size<remove_reference_t<_Tp>>::value,
67
+ size_t _Sp = 0,
68
+ bool _SameSize = (_Ep == tuple_size<remove_reference_t<_Tp>>::value)>
69
+ struct __make_tuple_types
70
+ {
71
+ static_assert(_Sp <= _Ep, "__make_tuple_types input error");
72
+ using _RawTp = remove_cv_t<remove_reference_t<_Tp>>;
73
+ using _Maker = __make_tuple_types_flat<_RawTp, __make_tuple_indices_t<_Ep, _Sp>>;
74
+ using type = typename _Maker::template __apply_quals<_Tp>;
75
+ };
76
+
77
+ template <class... _Types, size_t _Ep>
78
+ struct __make_tuple_types<tuple<_Types...>, _Ep, 0, true>
79
+ {
80
+ typedef _CCCL_NODEBUG_ALIAS __tuple_types<_Types...> type;
81
+ };
82
+
83
+ template <class... _Types, size_t _Ep>
84
+ struct __make_tuple_types<__tuple_types<_Types...>, _Ep, 0, true>
85
+ {
86
+ typedef _CCCL_NODEBUG_ALIAS __tuple_types<_Types...> type;
87
+ };
88
+
89
+ template <class _Tp, size_t _Ep = tuple_size<remove_reference_t<_Tp>>::value, size_t _Sp = 0>
90
+ using __make_tuple_types_t = typename __make_tuple_types<_Tp, _Ep, _Sp>::type;
91
+
92
+ _LIBCUDACXX_END_NAMESPACE_STD
93
+
94
+ #endif // _LIBCUDACXX___TUPLE_MAKE_TUPLE_TYPES_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__tuple_dir/sfinae_helpers.h ADDED
@@ -0,0 +1,232 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-24 NVIDIA CORPORATION & AFFILIATES.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___TUPLE_SFINAE_HELPERS_H
11
+ #define _LIBCUDACXX___TUPLE_SFINAE_HELPERS_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/tuple.h>
24
+ #include <cuda/std/__tuple_dir/make_tuple_types.h>
25
+ #include <cuda/std/__tuple_dir/tuple_element.h>
26
+ #include <cuda/std/__tuple_dir/tuple_like_ext.h>
27
+ #include <cuda/std/__tuple_dir/tuple_size.h>
28
+ #include <cuda/std/__tuple_dir/tuple_types.h>
29
+ #include <cuda/std/__type_traits/enable_if.h>
30
+ #include <cuda/std/__type_traits/integral_constant.h>
31
+ #include <cuda/std/__type_traits/is_assignable.h>
32
+ #include <cuda/std/__type_traits/is_constructible.h>
33
+ #include <cuda/std/__type_traits/is_convertible.h>
34
+ #include <cuda/std/__type_traits/is_copy_assignable.h>
35
+ #include <cuda/std/__type_traits/is_move_assignable.h>
36
+ #include <cuda/std/__type_traits/is_same.h>
37
+ #include <cuda/std/__type_traits/remove_cvref.h>
38
+ #include <cuda/std/__type_traits/remove_reference.h>
39
+ #include <cuda/std/cstddef>
40
+
41
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
42
+
43
+ template <bool... _Preds>
44
+ struct __all_dummy;
45
+
46
+ template <bool... _Pred>
47
+ using __all = is_same<__all_dummy<_Pred...>, __all_dummy<((void) _Pred, true)...>>;
48
+
49
+ struct __tuple_sfinae_base
50
+ {
51
+ template <class, class>
52
+ struct __test_size : false_type
53
+ {};
54
+
55
+ template <class... _Tp, class... _Up>
56
+ struct __test_size<__tuple_types<_Tp...>, __tuple_types<_Up...>> : bool_constant<sizeof...(_Tp) == sizeof...(_Up)>
57
+ {};
58
+
59
+ template <template <class, class...> class, class _Tp, class _Up, bool = __test_size<_Tp, _Up>::value>
60
+ struct __test : false_type
61
+ {};
62
+
63
+ template <template <class, class...> class _Trait, class... _LArgs, class... _RArgs>
64
+ struct __test<_Trait, __tuple_types<_LArgs...>, __tuple_types<_RArgs...>, true>
65
+ : __all<_Trait<_LArgs, _RArgs>::value...>
66
+ {};
67
+
68
+ template <class _FromArgs, class _ToArgs>
69
+ using __constructible = __test<is_constructible, _ToArgs, _FromArgs>;
70
+ template <class _FromArgs, class _ToArgs>
71
+ using __convertible = __test<is_convertible, _FromArgs, _ToArgs>;
72
+ template <class _FromArgs, class _ToArgs>
73
+ using __assignable = __test<is_assignable, _ToArgs, _FromArgs>;
74
+ };
75
+
76
+ // __tuple_convertible
77
+
78
+ template <class _Tp,
79
+ class _Up,
80
+ bool = __tuple_like_ext<remove_reference_t<_Tp>>::value,
81
+ bool = __tuple_like_ext<_Up>::value>
82
+ struct __tuple_convertible : public false_type
83
+ {};
84
+
85
+ template <class _Tp, class _Up>
86
+ struct __tuple_convertible<_Tp, _Up, true, true>
87
+ : public __tuple_sfinae_base::__convertible<__make_tuple_types_t<_Tp>, __make_tuple_types_t<_Up>>
88
+ {};
89
+
90
+ // __tuple_constructible
91
+
92
+ template <class _Tp,
93
+ class _Up,
94
+ bool = __tuple_like_ext<remove_reference_t<_Tp>>::value,
95
+ bool = __tuple_like_ext<_Up>::value>
96
+ struct __tuple_constructible : public false_type
97
+ {};
98
+
99
+ template <class _Tp, class _Up>
100
+ struct __tuple_constructible<_Tp, _Up, true, true>
101
+ : public __tuple_sfinae_base::__constructible<__make_tuple_types_t<_Tp>, __make_tuple_types_t<_Up>>
102
+ {};
103
+
104
+ // __tuple_assignable
105
+
106
+ template <class _Tp,
107
+ class _Up,
108
+ bool = __tuple_like_ext<remove_reference_t<_Tp>>::value,
109
+ bool = __tuple_like_ext<_Up>::value>
110
+ struct __tuple_assignable : public false_type
111
+ {};
112
+
113
+ template <class _Tp, class _Up>
114
+ struct __tuple_assignable<_Tp, _Up, true, true>
115
+ : public __tuple_sfinae_base::__assignable<__make_tuple_types_t<_Tp>, __make_tuple_types_t<_Up&>>
116
+ {};
117
+
118
+ template <size_t _Ip, class... _Tp>
119
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT tuple_element<_Ip, tuple<_Tp...>>
120
+ {
121
+ typedef _CCCL_NODEBUG_ALIAS __tuple_element_t<_Ip, __tuple_types<_Tp...>> type;
122
+ };
123
+
124
+ template <bool _IsTuple, class _SizeTrait, size_t _Expected>
125
+ struct __tuple_like_with_size_imp : false_type
126
+ {};
127
+
128
+ template <class _SizeTrait, size_t _Expected>
129
+ struct __tuple_like_with_size_imp<true, _SizeTrait, _Expected> : integral_constant<bool, _SizeTrait::value == _Expected>
130
+ {};
131
+
132
+ template <class _Tuple, size_t _ExpectedSize, class _RawTuple = remove_cvref_t<_Tuple>>
133
+ using __tuple_like_with_size _CCCL_NODEBUG_ALIAS =
134
+ __tuple_like_with_size_imp<__tuple_like_ext<_RawTuple>::value, tuple_size<_RawTuple>, _ExpectedSize>;
135
+
136
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT __check_tuple_constructor_fail
137
+ {
138
+ template <int&...>
139
+ using __enable_explicit_default = false_type;
140
+ template <int&...>
141
+ using __enable_implicit_default = false_type;
142
+ template <class...>
143
+ using __enable_explicit = false_type;
144
+ template <class...>
145
+ using __enable_implicit = false_type;
146
+ template <class...>
147
+ using __enable_assign = false_type;
148
+ };
149
+
150
+ enum class __smf_availability
151
+ {
152
+ __trivial,
153
+ __available,
154
+ __deleted,
155
+ };
156
+
157
+ template <bool _CanCopy>
158
+ struct __sfinae_copy_base
159
+ {};
160
+ template <>
161
+ struct __sfinae_copy_base<false>
162
+ {
163
+ _CCCL_HIDE_FROM_ABI __sfinae_copy_base() = default;
164
+ __sfinae_copy_base(__sfinae_copy_base const&) = delete;
165
+ _CCCL_HIDE_FROM_ABI __sfinae_copy_base(__sfinae_copy_base&&) = default;
166
+ _CCCL_HIDE_FROM_ABI __sfinae_copy_base& operator=(__sfinae_copy_base const&) = default;
167
+ _CCCL_HIDE_FROM_ABI __sfinae_copy_base& operator=(__sfinae_copy_base&&) = default;
168
+ };
169
+
170
+ template <bool _CanCopy, bool _CanMove>
171
+ struct __sfinae_move_base : __sfinae_copy_base<_CanCopy>
172
+ {};
173
+ template <bool _CanCopy>
174
+ struct __sfinae_move_base<_CanCopy, false> : __sfinae_copy_base<_CanCopy>
175
+ {
176
+ _CCCL_HIDE_FROM_ABI __sfinae_move_base() = default;
177
+ _CCCL_HIDE_FROM_ABI __sfinae_move_base(__sfinae_move_base const&) = default;
178
+ __sfinae_move_base(__sfinae_move_base&&) = delete;
179
+ _CCCL_HIDE_FROM_ABI __sfinae_move_base& operator=(__sfinae_move_base const&) = default;
180
+ _CCCL_HIDE_FROM_ABI __sfinae_move_base& operator=(__sfinae_move_base&&) = default;
181
+ };
182
+
183
+ template <bool _CanCopy, bool _CanMove, bool _CanCopyAssign>
184
+ struct __sfinae_copy_assign_base : __sfinae_move_base<_CanCopy, _CanMove>
185
+ {};
186
+ template <bool _CanCopy, bool _CanMove>
187
+ struct __sfinae_copy_assign_base<_CanCopy, _CanMove, false> : __sfinae_move_base<_CanCopy, _CanMove>
188
+ {
189
+ _CCCL_HIDE_FROM_ABI __sfinae_copy_assign_base() = default;
190
+ _CCCL_HIDE_FROM_ABI __sfinae_copy_assign_base(__sfinae_copy_assign_base const&) = default;
191
+ _CCCL_HIDE_FROM_ABI __sfinae_copy_assign_base(__sfinae_copy_assign_base&&) = default;
192
+ __sfinae_copy_assign_base& operator=(__sfinae_copy_assign_base const&) = delete;
193
+ _CCCL_HIDE_FROM_ABI __sfinae_copy_assign_base& operator=(__sfinae_copy_assign_base&&) = default;
194
+ };
195
+
196
+ template <bool _CanCopy, bool _CanMove, bool _CanCopyAssign, bool _CanMoveAssign>
197
+ struct __sfinae_move_assign_base : __sfinae_copy_assign_base<_CanCopy, _CanMove, _CanCopyAssign>
198
+ {};
199
+ template <bool _CanCopy, bool _CanMove, bool _CanCopyAssign>
200
+ struct __sfinae_move_assign_base<_CanCopy, _CanMove, _CanCopyAssign, false>
201
+ : __sfinae_copy_assign_base<_CanCopy, _CanMove, _CanCopyAssign>
202
+ {
203
+ _CCCL_HIDE_FROM_ABI __sfinae_move_assign_base() = default;
204
+ _CCCL_HIDE_FROM_ABI __sfinae_move_assign_base(__sfinae_move_assign_base const&) = default;
205
+ _CCCL_HIDE_FROM_ABI __sfinae_move_assign_base(__sfinae_move_assign_base&&) = default;
206
+ _CCCL_HIDE_FROM_ABI __sfinae_move_assign_base& operator=(__sfinae_move_assign_base const&) = default;
207
+ __sfinae_move_assign_base& operator=(__sfinae_move_assign_base&&) = delete;
208
+ };
209
+
210
+ template <bool _CanCopy, bool _CanMove, bool _CanCopyAssign, bool _CanMoveAssign>
211
+ using __sfinae_base = __sfinae_move_assign_base<_CanCopy, _CanMove, _CanCopyAssign, _CanMoveAssign>;
212
+
213
+ // We need to synthesize the copy / move assignment if it would be implicitly deleted as a member of a class
214
+ // In that case _Tp would be copy assignable but _TestSynthesizeAssignment<_Tp> would not
215
+ // This happens e.g for reference types
216
+ template <class _Tp>
217
+ struct _TestSynthesizeAssignment
218
+ {
219
+ _Tp __dummy;
220
+ };
221
+
222
+ template <class _Tp>
223
+ struct __must_synthesize_assignment
224
+ : integral_constant<
225
+ bool,
226
+ (_CCCL_TRAIT(is_copy_assignable, _Tp) && !_CCCL_TRAIT(is_copy_assignable, _TestSynthesizeAssignment<_Tp>))
227
+ || (_CCCL_TRAIT(is_move_assignable, _Tp) && !_CCCL_TRAIT(is_move_assignable, _TestSynthesizeAssignment<_Tp>))>
228
+ {};
229
+
230
+ _LIBCUDACXX_END_NAMESPACE_STD
231
+
232
+ #endif // _LIBCUDACXX___TUPLE_SFINAE_HELPERS_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__tuple_dir/structured_bindings.h ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-24 NVIDIA CORPORATION & AFFILIATES.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___TUPLE_STRUCTURED_BINDINGS_H
11
+ #define _LIBCUDACXX___TUPLE_STRUCTURED_BINDINGS_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
+ _CCCL_DIAG_PUSH
24
+ _CCCL_DIAG_SUPPRESS_CLANG("-Wmismatched-tags")
25
+
26
+ #if !_CCCL_COMPILER(NVRTC)
27
+ // Fetch utility to get primary template for ::std::tuple_size necessary for the specialization of
28
+ // ::std::tuple_size<cuda::std::tuple> to enable structured bindings.
29
+ // See https://github.com/NVIDIA/libcudacxx/issues/316
30
+ # include <utility>
31
+ #endif // !_CCCL_COMPILER(NVRTC)
32
+
33
+ #include <cuda/std/__fwd/array.h>
34
+ #include <cuda/std/__fwd/complex.h>
35
+ #include <cuda/std/__fwd/pair.h>
36
+ #include <cuda/std/__fwd/subrange.h>
37
+ #include <cuda/std/__fwd/tuple.h>
38
+ #include <cuda/std/__tuple_dir/tuple_element.h>
39
+ #include <cuda/std/__tuple_dir/tuple_size.h>
40
+ #include <cuda/std/__type_traits/integral_constant.h>
41
+
42
+ // This is a workaround for the fact that structured bindings require that the specializations of
43
+ // `tuple_size` and `tuple_element` reside in namespace std (https://eel.is/c++draft/dcl.struct.bind#4).
44
+ // See https://github.com/NVIDIA/libcudacxx/issues/316 for a short discussion
45
+ #if _CCCL_STD_VER >= 2017
46
+ namespace std
47
+ {
48
+ # if _CCCL_COMPILER(NVRTC)
49
+ template <class... _Tp>
50
+ struct tuple_size;
51
+
52
+ template <size_t _Ip, class... _Tp>
53
+ struct tuple_element;
54
+ # endif // _CCCL_COMPILER(NVRTC)
55
+
56
+ template <class _Tp, size_t _Size>
57
+ struct tuple_size<_CUDA_VSTD::array<_Tp, _Size>> : _CUDA_VSTD::tuple_size<_CUDA_VSTD::array<_Tp, _Size>>
58
+ {};
59
+
60
+ template <class _Tp, size_t _Size>
61
+ struct tuple_size<const _CUDA_VSTD::array<_Tp, _Size>> : _CUDA_VSTD::tuple_size<_CUDA_VSTD::array<_Tp, _Size>>
62
+ {};
63
+
64
+ template <class _Tp, size_t _Size>
65
+ struct tuple_size<volatile _CUDA_VSTD::array<_Tp, _Size>> : _CUDA_VSTD::tuple_size<_CUDA_VSTD::array<_Tp, _Size>>
66
+ {};
67
+
68
+ template <class _Tp, size_t _Size>
69
+ struct tuple_size<const volatile _CUDA_VSTD::array<_Tp, _Size>> : _CUDA_VSTD::tuple_size<_CUDA_VSTD::array<_Tp, _Size>>
70
+ {};
71
+
72
+ template <size_t _Ip, class _Tp, size_t _Size>
73
+ struct tuple_element<_Ip, _CUDA_VSTD::array<_Tp, _Size>> : _CUDA_VSTD::tuple_element<_Ip, _CUDA_VSTD::array<_Tp, _Size>>
74
+ {};
75
+
76
+ template <size_t _Ip, class _Tp, size_t _Size>
77
+ struct tuple_element<_Ip, const _CUDA_VSTD::array<_Tp, _Size>>
78
+ : _CUDA_VSTD::tuple_element<_Ip, const _CUDA_VSTD::array<_Tp, _Size>>
79
+ {};
80
+
81
+ template <size_t _Ip, class _Tp, size_t _Size>
82
+ struct tuple_element<_Ip, volatile _CUDA_VSTD::array<_Tp, _Size>>
83
+ : _CUDA_VSTD::tuple_element<_Ip, volatile _CUDA_VSTD::array<_Tp, _Size>>
84
+ {};
85
+
86
+ template <size_t _Ip, class _Tp, size_t _Size>
87
+ struct tuple_element<_Ip, const volatile _CUDA_VSTD::array<_Tp, _Size>>
88
+ : _CUDA_VSTD::tuple_element<_Ip, const volatile _CUDA_VSTD::array<_Tp, _Size>>
89
+ {};
90
+
91
+ template <class _Tp>
92
+ struct tuple_size<_CUDA_VSTD::complex<_Tp>> : _CUDA_VSTD::tuple_size<_CUDA_VSTD::complex<_Tp>>
93
+ {};
94
+
95
+ template <size_t _Ip, class _Tp>
96
+ struct tuple_element<_Ip, _CUDA_VSTD::complex<_Tp>> : _CUDA_VSTD::tuple_element<_Ip, _CUDA_VSTD::complex<_Tp>>
97
+ {};
98
+
99
+ template <class _Tp, class _Up>
100
+ struct tuple_size<_CUDA_VSTD::pair<_Tp, _Up>> : _CUDA_VSTD::tuple_size<_CUDA_VSTD::pair<_Tp, _Up>>
101
+ {};
102
+
103
+ template <class _Tp, class _Up>
104
+ struct tuple_size<const _CUDA_VSTD::pair<_Tp, _Up>> : _CUDA_VSTD::tuple_size<_CUDA_VSTD::pair<_Tp, _Up>>
105
+ {};
106
+
107
+ template <class _Tp, class _Up>
108
+ struct tuple_size<volatile _CUDA_VSTD::pair<_Tp, _Up>> : _CUDA_VSTD::tuple_size<_CUDA_VSTD::pair<_Tp, _Up>>
109
+ {};
110
+
111
+ template <class _Tp, class _Up>
112
+ struct tuple_size<const volatile _CUDA_VSTD::pair<_Tp, _Up>> : _CUDA_VSTD::tuple_size<_CUDA_VSTD::pair<_Tp, _Up>>
113
+ {};
114
+
115
+ template <size_t _Ip, class _Tp, class _Up>
116
+ struct tuple_element<_Ip, _CUDA_VSTD::pair<_Tp, _Up>> : _CUDA_VSTD::tuple_element<_Ip, _CUDA_VSTD::pair<_Tp, _Up>>
117
+ {};
118
+
119
+ template <size_t _Ip, class _Tp, class _Up>
120
+ struct tuple_element<_Ip, const _CUDA_VSTD::pair<_Tp, _Up>>
121
+ : _CUDA_VSTD::tuple_element<_Ip, const _CUDA_VSTD::pair<_Tp, _Up>>
122
+ {};
123
+
124
+ template <size_t _Ip, class _Tp, class _Up>
125
+ struct tuple_element<_Ip, volatile _CUDA_VSTD::pair<_Tp, _Up>>
126
+ : _CUDA_VSTD::tuple_element<_Ip, volatile _CUDA_VSTD::pair<_Tp, _Up>>
127
+ {};
128
+
129
+ template <size_t _Ip, class _Tp, class _Up>
130
+ struct tuple_element<_Ip, const volatile _CUDA_VSTD::pair<_Tp, _Up>>
131
+ : _CUDA_VSTD::tuple_element<_Ip, const volatile _CUDA_VSTD::pair<_Tp, _Up>>
132
+ {};
133
+
134
+ template <class... _Tp>
135
+ struct tuple_size<_CUDA_VSTD::tuple<_Tp...>> : _CUDA_VSTD::tuple_size<_CUDA_VSTD::tuple<_Tp...>>
136
+ {};
137
+
138
+ template <class... _Tp>
139
+ struct tuple_size<const _CUDA_VSTD::tuple<_Tp...>> : _CUDA_VSTD::tuple_size<_CUDA_VSTD::tuple<_Tp...>>
140
+ {};
141
+
142
+ template <class... _Tp>
143
+ struct tuple_size<volatile _CUDA_VSTD::tuple<_Tp...>> : _CUDA_VSTD::tuple_size<_CUDA_VSTD::tuple<_Tp...>>
144
+ {};
145
+
146
+ template <class... _Tp>
147
+ struct tuple_size<const volatile _CUDA_VSTD::tuple<_Tp...>> : _CUDA_VSTD::tuple_size<_CUDA_VSTD::tuple<_Tp...>>
148
+ {};
149
+
150
+ template <size_t _Ip, class... _Tp>
151
+ struct tuple_element<_Ip, _CUDA_VSTD::tuple<_Tp...>> : _CUDA_VSTD::tuple_element<_Ip, _CUDA_VSTD::tuple<_Tp...>>
152
+ {};
153
+
154
+ template <size_t _Ip, class... _Tp>
155
+ struct tuple_element<_Ip, const _CUDA_VSTD::tuple<_Tp...>>
156
+ : _CUDA_VSTD::tuple_element<_Ip, const _CUDA_VSTD::tuple<_Tp...>>
157
+ {};
158
+
159
+ template <size_t _Ip, class... _Tp>
160
+ struct tuple_element<_Ip, volatile _CUDA_VSTD::tuple<_Tp...>>
161
+ : _CUDA_VSTD::tuple_element<_Ip, volatile _CUDA_VSTD::tuple<_Tp...>>
162
+ {};
163
+
164
+ template <size_t _Ip, class... _Tp>
165
+ struct tuple_element<_Ip, const volatile _CUDA_VSTD::tuple<_Tp...>>
166
+ : _CUDA_VSTD::tuple_element<_Ip, const volatile _CUDA_VSTD::tuple<_Tp...>>
167
+ {};
168
+
169
+ # if !_CCCL_COMPILER(MSVC2017)
170
+ template <class _Ip, class _Sp, _CUDA_VRANGES::subrange_kind _Kp>
171
+ struct tuple_size<_CUDA_VRANGES::subrange<_Ip, _Sp, _Kp>>
172
+ : _CUDA_VSTD::tuple_size<_CUDA_VRANGES::subrange<_Ip, _Sp, _Kp>>
173
+ {};
174
+
175
+ template <class _Ip, class _Sp, _CUDA_VRANGES::subrange_kind _Kp>
176
+ struct tuple_size<const _CUDA_VRANGES::subrange<_Ip, _Sp, _Kp>>
177
+ : _CUDA_VSTD::tuple_size<_CUDA_VRANGES::subrange<_Ip, _Sp, _Kp>>
178
+ {};
179
+
180
+ template <class _Ip, class _Sp, _CUDA_VRANGES::subrange_kind _Kp>
181
+ struct tuple_size<volatile _CUDA_VRANGES::subrange<_Ip, _Sp, _Kp>>
182
+ : _CUDA_VSTD::tuple_size<_CUDA_VRANGES::subrange<_Ip, _Sp, _Kp>>
183
+ {};
184
+
185
+ template <class _Ip, class _Sp, _CUDA_VRANGES::subrange_kind _Kp>
186
+ struct tuple_size<const volatile _CUDA_VRANGES::subrange<_Ip, _Sp, _Kp>>
187
+ : _CUDA_VSTD::tuple_size<_CUDA_VRANGES::subrange<_Ip, _Sp, _Kp>>
188
+ {};
189
+
190
+ template <size_t _Idx, class _Ip, class _Sp, _CUDA_VRANGES::subrange_kind _Kp>
191
+ struct tuple_element<_Idx, _CUDA_VRANGES::subrange<_Ip, _Sp, _Kp>>
192
+ : _CUDA_VSTD::tuple_element<_Idx, _CUDA_VRANGES::subrange<_Ip, _Sp, _Kp>>
193
+ {};
194
+
195
+ template <size_t _Idx, class _Ip, class _Sp, _CUDA_VRANGES::subrange_kind _Kp>
196
+ struct tuple_element<_Idx, const _CUDA_VRANGES::subrange<_Ip, _Sp, _Kp>>
197
+ : _CUDA_VSTD::tuple_element<_Idx, const _CUDA_VRANGES::subrange<_Ip, _Sp, _Kp>>
198
+ {};
199
+
200
+ template <size_t _Idx, class _Ip, class _Sp, _CUDA_VRANGES::subrange_kind _Kp>
201
+ struct tuple_element<_Idx, volatile _CUDA_VRANGES::subrange<_Ip, _Sp, _Kp>>
202
+ : _CUDA_VSTD::tuple_element<_Idx, volatile _CUDA_VRANGES::subrange<_Ip, _Sp, _Kp>>
203
+ {};
204
+
205
+ template <size_t _Idx, class _Ip, class _Sp, _CUDA_VRANGES::subrange_kind _Kp>
206
+ struct tuple_element<_Idx, const volatile _CUDA_VRANGES::subrange<_Ip, _Sp, _Kp>>
207
+ : _CUDA_VSTD::tuple_element<_Idx, const volatile _CUDA_VRANGES::subrange<_Ip, _Sp, _Kp>>
208
+ {};
209
+ # endif // !_CCCL_COMPILER(MSVC2017)
210
+ } // namespace std
211
+ #endif // _CCCL_STD_VER >= 2017
212
+
213
+ _CCCL_DIAG_POP
214
+
215
+ #endif // _LIBCUDACXX___TUPLE_STRUCTURED_BINDINGS_H
vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/libcudacxx/cuda/std/__tuple_dir/tuple_element.h ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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___TUPLE_TUPLE_ELEMENT_H
11
+ #define _LIBCUDACXX___TUPLE_TUPLE_ELEMENT_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/__tuple_dir/tuple_indices.h>
24
+ #include <cuda/std/__tuple_dir/tuple_types.h>
25
+ #include <cuda/std/__type_traits/add_const.h>
26
+ #include <cuda/std/__type_traits/add_cv.h>
27
+ #include <cuda/std/__type_traits/add_volatile.h>
28
+ #include <cuda/std/__type_traits/type_list.h>
29
+ #include <cuda/std/cstddef>
30
+
31
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
32
+
33
+ template <size_t _Ip, class _Tp>
34
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT tuple_element;
35
+
36
+ template <size_t _Ip, class... _Tp>
37
+ using __tuple_element_t _CCCL_NODEBUG_ALIAS = typename tuple_element<_Ip, _Tp...>::type;
38
+
39
+ template <size_t _Ip, class _Tp>
40
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT tuple_element<_Ip, const _Tp>
41
+ {
42
+ typedef _CCCL_NODEBUG_ALIAS typename add_const<__tuple_element_t<_Ip, _Tp>>::type type;
43
+ };
44
+
45
+ template <size_t _Ip, class _Tp>
46
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT tuple_element<_Ip, volatile _Tp>
47
+ {
48
+ typedef _CCCL_NODEBUG_ALIAS typename add_volatile<__tuple_element_t<_Ip, _Tp>>::type type;
49
+ };
50
+
51
+ template <size_t _Ip, class _Tp>
52
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT tuple_element<_Ip, const volatile _Tp>
53
+ {
54
+ typedef _CCCL_NODEBUG_ALIAS typename add_cv<__tuple_element_t<_Ip, _Tp>>::type type;
55
+ };
56
+
57
+ template <size_t _Ip, class... _Types>
58
+ struct _CCCL_TYPE_VISIBILITY_DEFAULT tuple_element<_Ip, __tuple_types<_Types...>>
59
+ {
60
+ static_assert(_Ip < sizeof...(_Types), "tuple_element index out of range");
61
+ typedef _CCCL_NODEBUG_ALIAS __type_index_c<_Ip, _Types...> type;
62
+ };
63
+
64
+ #if _CCCL_STD_VER > 2011
65
+ template <size_t _Ip, class... _Tp>
66
+ using tuple_element_t _CCCL_NODEBUG_ALIAS = typename tuple_element<_Ip, _Tp...>::type;
67
+ #endif
68
+
69
+ _LIBCUDACXX_END_NAMESPACE_STD
70
+
71
+ #endif // _LIBCUDACXX___TUPLE_TUPLE_ELEMENT_H