cuda-cccl 0.3.0__cp310-cp310-manylinux_2_24_aarch64.whl → 0.3.1__cp310-cp310-manylinux_2_24_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cuda-cccl might be problematic. Click here for more details.
- cuda/cccl/cooperative/__init__.py +7 -1
- cuda/cccl/cooperative/experimental/__init__.py +21 -5
- cuda/cccl/headers/include/cub/agent/agent_adjacent_difference.cuh +2 -5
- cuda/cccl/headers/include/cub/agent/agent_batch_memcpy.cuh +2 -5
- cuda/cccl/headers/include/cub/agent/agent_for.cuh +2 -5
- cuda/cccl/headers/include/cub/agent/agent_merge.cuh +23 -21
- cuda/cccl/headers/include/cub/agent/agent_merge_sort.cuh +21 -3
- cuda/cccl/headers/include/cub/agent/agent_radix_sort_downsweep.cuh +2 -5
- cuda/cccl/headers/include/cub/agent/agent_radix_sort_histogram.cuh +2 -5
- cuda/cccl/headers/include/cub/agent/agent_radix_sort_onesweep.cuh +2 -5
- cuda/cccl/headers/include/cub/agent/agent_radix_sort_upsweep.cuh +2 -5
- cuda/cccl/headers/include/cub/agent/agent_rle.cuh +2 -5
- cuda/cccl/headers/include/cub/agent/agent_scan.cuh +5 -1
- cuda/cccl/headers/include/cub/agent/agent_scan_by_key.cuh +2 -5
- cuda/cccl/headers/include/cub/agent/agent_segmented_radix_sort.cuh +2 -5
- cuda/cccl/headers/include/cub/agent/agent_select_if.cuh +2 -5
- cuda/cccl/headers/include/cub/agent/agent_sub_warp_merge_sort.cuh +2 -5
- cuda/cccl/headers/include/cub/agent/agent_three_way_partition.cuh +2 -5
- cuda/cccl/headers/include/cub/agent/agent_unique_by_key.cuh +22 -5
- cuda/cccl/headers/include/cub/block/block_radix_rank.cuh +3 -2
- cuda/cccl/headers/include/cub/block/block_radix_sort.cuh +4 -2
- cuda/cccl/headers/include/cub/detail/device_memory_resource.cuh +1 -0
- cuda/cccl/headers/include/cub/device/device_segmented_reduce.cuh +158 -247
- cuda/cccl/headers/include/cub/device/dispatch/dispatch_merge.cuh +4 -4
- cuda/cccl/headers/include/cub/device/dispatch/dispatch_radix_sort.cuh +2 -11
- cuda/cccl/headers/include/cub/device/dispatch/dispatch_reduce.cuh +8 -26
- cuda/cccl/headers/include/cub/device/dispatch/dispatch_reduce_deterministic.cuh +1 -6
- cuda/cccl/headers/include/cub/device/dispatch/dispatch_reduce_nondeterministic.cuh +0 -1
- cuda/cccl/headers/include/cub/device/dispatch/dispatch_segmented_sort.cuh +2 -3
- cuda/cccl/headers/include/cub/device/dispatch/kernels/reduce.cuh +2 -5
- cuda/cccl/headers/include/cub/device/dispatch/kernels/scan.cuh +2 -5
- cuda/cccl/headers/include/cub/device/dispatch/kernels/segmented_reduce.cuh +2 -5
- cuda/cccl/headers/include/cub/device/dispatch/tuning/tuning_adjacent_difference.cuh +2 -5
- cuda/cccl/headers/include/cub/device/dispatch/tuning/tuning_batch_memcpy.cuh +2 -5
- cuda/cccl/headers/include/cub/device/dispatch/tuning/tuning_for.cuh +2 -5
- cuda/cccl/headers/include/cub/device/dispatch/tuning/tuning_histogram.cuh +2 -5
- cuda/cccl/headers/include/cub/device/dispatch/tuning/tuning_merge.cuh +2 -5
- cuda/cccl/headers/include/cub/device/dispatch/tuning/tuning_merge_sort.cuh +8 -0
- cuda/cccl/headers/include/cub/device/dispatch/tuning/tuning_radix_sort.cuh +2 -5
- cuda/cccl/headers/include/cub/device/dispatch/tuning/tuning_reduce_by_key.cuh +2 -5
- cuda/cccl/headers/include/cub/device/dispatch/tuning/tuning_run_length_encode.cuh +2 -5
- cuda/cccl/headers/include/cub/device/dispatch/tuning/tuning_scan.cuh +2 -5
- cuda/cccl/headers/include/cub/device/dispatch/tuning/tuning_scan_by_key.cuh +2 -5
- cuda/cccl/headers/include/cub/device/dispatch/tuning/tuning_segmented_sort.cuh +2 -5
- cuda/cccl/headers/include/cub/device/dispatch/tuning/tuning_three_way_partition.cuh +2 -5
- cuda/cccl/headers/include/cub/device/dispatch/tuning/tuning_unique_by_key.cuh +10 -0
- cuda/cccl/headers/include/cub/warp/specializations/warp_reduce_shfl.cuh +3 -2
- cuda/cccl/headers/include/cub/warp/specializations/warp_reduce_smem.cuh +3 -2
- cuda/cccl/headers/include/cub/warp/specializations/warp_scan_shfl.cuh +2 -2
- cuda/cccl/headers/include/cuda/__algorithm/common.h +1 -1
- cuda/cccl/headers/include/cuda/__algorithm/copy.h +1 -1
- cuda/cccl/headers/include/cuda/__algorithm/fill.h +1 -1
- cuda/cccl/headers/include/cuda/__device/all_devices.h +46 -143
- cuda/cccl/headers/include/cuda/__device/arch_traits.h +48 -46
- cuda/cccl/headers/include/cuda/__device/attributes.h +171 -121
- cuda/cccl/headers/include/cuda/__device/device_ref.h +30 -42
- cuda/cccl/headers/include/cuda/__device/physical_device.h +120 -91
- cuda/cccl/headers/include/cuda/__driver/driver_api.h +105 -3
- cuda/cccl/headers/include/cuda/__event/event.h +1 -0
- cuda/cccl/headers/include/cuda/__event/timed_event.h +1 -0
- cuda/cccl/headers/include/cuda/__fwd/devices.h +44 -0
- cuda/cccl/headers/include/cuda/__fwd/zip_iterator.h +9 -0
- cuda/cccl/headers/include/cuda/__iterator/zip_common.h +158 -0
- cuda/cccl/headers/include/cuda/__iterator/zip_iterator.h +8 -120
- cuda/cccl/headers/include/cuda/__iterator/zip_transform_iterator.h +593 -0
- cuda/cccl/headers/include/cuda/__runtime/ensure_current_context.h +4 -3
- cuda/cccl/headers/include/cuda/__stream/stream_ref.h +1 -0
- cuda/cccl/headers/include/cuda/__utility/basic_any.h +1 -1
- cuda/cccl/headers/include/cuda/algorithm +1 -1
- cuda/cccl/headers/include/cuda/devices +10 -0
- cuda/cccl/headers/include/cuda/iterator +1 -0
- cuda/cccl/headers/include/cuda/std/__bit/countl.h +8 -1
- cuda/cccl/headers/include/cuda/std/__bit/countr.h +2 -2
- cuda/cccl/headers/include/cuda/std/__bit/reference.h +11 -11
- cuda/cccl/headers/include/cuda/std/__chrono/duration.h +16 -16
- cuda/cccl/headers/include/cuda/std/__chrono/steady_clock.h +5 -5
- cuda/cccl/headers/include/cuda/std/__chrono/system_clock.h +5 -5
- cuda/cccl/headers/include/cuda/std/__floating_point/fp.h +1 -1
- cuda/cccl/headers/include/cuda/std/__tuple_dir/make_tuple_types.h +23 -1
- cuda/cccl/headers/include/cuda/std/__tuple_dir/tuple_like.h +4 -0
- cuda/cccl/headers/include/cuda/std/__tuple_dir/tuple_like_ext.h +4 -0
- cuda/cccl/headers/include/cuda/std/string_view +12 -5
- cuda/cccl/headers/include/cuda/std/version +1 -4
- cuda/cccl/headers/include/thrust/detail/integer_math.h +3 -20
- cuda/cccl/headers/include/thrust/iterator/iterator_traits.h +11 -0
- cuda/cccl/headers/include/thrust/system/cuda/detail/copy.h +33 -0
- cuda/cccl/parallel/experimental/__init__.py +21 -74
- cuda/compute/__init__.py +77 -0
- cuda/{cccl/parallel/experimental → compute}/_bindings_impl.pyx +1 -1
- cuda/{cccl/parallel/experimental → compute}/algorithms/_histogram.py +2 -2
- cuda/{cccl/parallel/experimental → compute}/algorithms/_merge_sort.py +2 -2
- cuda/{cccl/parallel/experimental → compute}/algorithms/_radix_sort.py +3 -3
- cuda/{cccl/parallel/experimental → compute}/algorithms/_reduce.py +2 -2
- cuda/{cccl/parallel/experimental → compute}/algorithms/_scan.py +4 -4
- cuda/{cccl/parallel/experimental → compute}/algorithms/_segmented_reduce.py +2 -2
- cuda/{cccl/parallel/experimental → compute}/algorithms/_three_way_partition.py +2 -2
- cuda/{cccl/parallel/experimental → compute}/algorithms/_transform.py +4 -4
- cuda/{cccl/parallel/experimental → compute}/algorithms/_unique_by_key.py +2 -2
- cuda/{cccl/parallel/experimental → compute}/cu12/_bindings_impl.cpython-310-aarch64-linux-gnu.so +0 -0
- cuda/{cccl/parallel/experimental → compute}/cu12/cccl/libcccl.c.parallel.so +0 -0
- cuda/{cccl/parallel/experimental → compute}/cu13/_bindings_impl.cpython-310-aarch64-linux-gnu.so +0 -0
- cuda/{cccl/parallel/experimental → compute}/cu13/cccl/libcccl.c.parallel.so +0 -0
- cuda/{cccl/parallel/experimental → compute}/iterators/_factories.py +8 -8
- cuda/{cccl/parallel/experimental → compute}/struct.py +2 -2
- cuda/coop/__init__.py +8 -0
- cuda/{cccl/cooperative/experimental → coop}/_nvrtc.py +3 -2
- cuda/{cccl/cooperative/experimental → coop}/_scan_op.py +3 -3
- cuda/{cccl/cooperative/experimental → coop}/_types.py +2 -2
- cuda/{cccl/cooperative/experimental → coop}/_typing.py +1 -1
- cuda/{cccl/cooperative/experimental → coop}/block/__init__.py +6 -6
- cuda/{cccl/cooperative/experimental → coop}/block/_block_exchange.py +4 -4
- cuda/{cccl/cooperative/experimental → coop}/block/_block_load_store.py +6 -6
- cuda/{cccl/cooperative/experimental → coop}/block/_block_merge_sort.py +4 -4
- cuda/{cccl/cooperative/experimental → coop}/block/_block_radix_sort.py +6 -6
- cuda/{cccl/cooperative/experimental → coop}/block/_block_reduce.py +6 -6
- cuda/{cccl/cooperative/experimental → coop}/block/_block_scan.py +7 -7
- cuda/coop/warp/__init__.py +9 -0
- cuda/{cccl/cooperative/experimental → coop}/warp/_warp_merge_sort.py +3 -3
- cuda/{cccl/cooperative/experimental → coop}/warp/_warp_reduce.py +6 -6
- cuda/{cccl/cooperative/experimental → coop}/warp/_warp_scan.py +4 -4
- {cuda_cccl-0.3.0.dist-info → cuda_cccl-0.3.1.dist-info}/METADATA +1 -1
- {cuda_cccl-0.3.0.dist-info → cuda_cccl-0.3.1.dist-info}/RECORD +141 -138
- cuda/cccl/cooperative/experimental/warp/__init__.py +0 -9
- cuda/cccl/headers/include/cub/device/dispatch/dispatch_advance_iterators.cuh +0 -111
- cuda/cccl/parallel/experimental/.gitignore +0 -4
- /cuda/{cccl/parallel/experimental → compute}/_bindings.py +0 -0
- /cuda/{cccl/parallel/experimental → compute}/_bindings.pyi +0 -0
- /cuda/{cccl/parallel/experimental → compute}/_caching.py +0 -0
- /cuda/{cccl/parallel/experimental → compute}/_cccl_interop.py +0 -0
- /cuda/{cccl/parallel/experimental → compute}/_utils/__init__.py +0 -0
- /cuda/{cccl/parallel/experimental → compute}/_utils/protocols.py +0 -0
- /cuda/{cccl/parallel/experimental → compute}/_utils/temp_storage_buffer.py +0 -0
- /cuda/{cccl/parallel/experimental → compute}/algorithms/__init__.py +0 -0
- /cuda/{cccl/parallel/experimental → compute}/cccl/.gitkeep +0 -0
- /cuda/{cccl/parallel/experimental → compute}/iterators/__init__.py +0 -0
- /cuda/{cccl/parallel/experimental → compute}/iterators/_iterators.py +0 -0
- /cuda/{cccl/parallel/experimental → compute}/iterators/_zip_iterator.py +0 -0
- /cuda/{cccl/parallel/experimental → compute}/numba_utils.py +0 -0
- /cuda/{cccl/parallel/experimental → compute}/op.py +0 -0
- /cuda/{cccl/parallel/experimental → compute}/typing.py +0 -0
- /cuda/{cccl/cooperative/experimental → coop}/_caching.py +0 -0
- /cuda/{cccl/cooperative/experimental → coop}/_common.py +0 -0
- {cuda_cccl-0.3.0.dist-info → cuda_cccl-0.3.1.dist-info}/WHEEL +0 -0
- {cuda_cccl-0.3.0.dist-info → cuda_cccl-0.3.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,158 @@
|
|
|
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) 2025 NVIDIA CORPORATION & AFFILIATES
|
|
8
|
+
//
|
|
9
|
+
//===----------------------------------------------------------------------===//
|
|
10
|
+
#ifndef _CUDA___ITERATOR_ZIP_COMMON_H
|
|
11
|
+
#define _CUDA___ITERATOR_ZIP_COMMON_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/__fwd/zip_iterator.h>
|
|
24
|
+
#include <cuda/std/__fwd/pair.h>
|
|
25
|
+
#include <cuda/std/__fwd/tuple.h>
|
|
26
|
+
#include <cuda/std/__iterator/concepts.h>
|
|
27
|
+
#include <cuda/std/__iterator/iter_move.h>
|
|
28
|
+
#include <cuda/std/__iterator/iter_swap.h>
|
|
29
|
+
#include <cuda/std/__iterator/iterator_traits.h>
|
|
30
|
+
#include <cuda/std/__type_traits/is_nothrow_default_constructible.h>
|
|
31
|
+
#include <cuda/std/__type_traits/is_nothrow_move_constructible.h>
|
|
32
|
+
#include <cuda/std/__utility/declval.h>
|
|
33
|
+
|
|
34
|
+
#include <cuda/std/__cccl/prologue.h>
|
|
35
|
+
|
|
36
|
+
_CCCL_BEGIN_NAMESPACE_CUDA
|
|
37
|
+
|
|
38
|
+
_CCCL_TEMPLATE(class... _Iterators)
|
|
39
|
+
_CCCL_REQUIRES((sizeof...(_Iterators) != 2))
|
|
40
|
+
[[nodiscard]] _CCCL_API constexpr auto __tuple_or_pair_impl() noexcept -> ::cuda::std::tuple<_Iterators...>;
|
|
41
|
+
|
|
42
|
+
template <class _Tp, class _Up>
|
|
43
|
+
[[nodiscard]] _CCCL_API constexpr auto __tuple_or_pair_impl() noexcept -> ::cuda::std::pair<_Tp, _Up>;
|
|
44
|
+
|
|
45
|
+
template <class... _Iterators>
|
|
46
|
+
using __tuple_or_pair = decltype(::cuda::__tuple_or_pair_impl<_Iterators...>());
|
|
47
|
+
|
|
48
|
+
template <class... _Iterators>
|
|
49
|
+
struct __zip_iter_constraints
|
|
50
|
+
{
|
|
51
|
+
static constexpr bool __all_forward = (::cuda::std::__has_forward_traversal<_Iterators> && ...);
|
|
52
|
+
static constexpr bool __all_bidirectional = (::cuda::std::__has_bidirectional_traversal<_Iterators> && ...);
|
|
53
|
+
static constexpr bool __all_random_access = (::cuda::std::__has_random_access_traversal<_Iterators> && ...);
|
|
54
|
+
|
|
55
|
+
static constexpr bool __all_equality_comparable = (::cuda::std::equality_comparable<_Iterators> && ...);
|
|
56
|
+
|
|
57
|
+
#if _LIBCUDACXX_HAS_SPACESHIP_OPERATOR()
|
|
58
|
+
static constexpr bool __all_three_way_comparable = (::cuda::std::three_way_comparable<_Iterators> && ...);
|
|
59
|
+
#endif // _LIBCUDACXX_HAS_SPACESHIP_OPERATOR()
|
|
60
|
+
|
|
61
|
+
// Our C++17 iterators sometimes do not satisfy `sized_sentinel_for` but they should all be random_access
|
|
62
|
+
static constexpr bool __all_sized_sentinel =
|
|
63
|
+
(::cuda::std::sized_sentinel_for<_Iterators, _Iterators> && ...) || __all_random_access;
|
|
64
|
+
|
|
65
|
+
static constexpr bool __all_nothrow_iter_movable =
|
|
66
|
+
(noexcept(::cuda::std::ranges::iter_move(::cuda::std::declval<const _Iterators&>())) && ...)
|
|
67
|
+
&& (::cuda::std::is_nothrow_move_constructible_v<::cuda::std::iter_rvalue_reference_t<_Iterators>> && ...);
|
|
68
|
+
|
|
69
|
+
static constexpr bool __all_indirectly_swappable = (::cuda::std::indirectly_swappable<_Iterators> && ...);
|
|
70
|
+
|
|
71
|
+
static constexpr bool __all_noexcept_swappable = (::cuda::std::__noexcept_swappable<_Iterators> && ...);
|
|
72
|
+
|
|
73
|
+
static constexpr bool __all_nothrow_move_constructible =
|
|
74
|
+
(::cuda::std::is_nothrow_move_constructible_v<_Iterators> && ...);
|
|
75
|
+
|
|
76
|
+
static constexpr bool __all_default_initializable = (::cuda::std::default_initializable<_Iterators> && ...);
|
|
77
|
+
|
|
78
|
+
static constexpr bool __all_nothrow_default_constructible =
|
|
79
|
+
(::cuda::std::is_nothrow_default_constructible_v<_Iterators> && ...);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
template <class... _Iterators>
|
|
83
|
+
[[nodiscard]] _CCCL_API _CCCL_CONSTEVAL auto __get_zip_iterator_concept()
|
|
84
|
+
{
|
|
85
|
+
using _Constraints = __zip_iter_constraints<_Iterators...>;
|
|
86
|
+
if constexpr (_Constraints::__all_random_access)
|
|
87
|
+
{
|
|
88
|
+
return ::cuda::std::random_access_iterator_tag();
|
|
89
|
+
}
|
|
90
|
+
else if constexpr (_Constraints::__all_bidirectional)
|
|
91
|
+
{
|
|
92
|
+
return ::cuda::std::bidirectional_iterator_tag();
|
|
93
|
+
}
|
|
94
|
+
else if constexpr (_Constraints::__all_forward)
|
|
95
|
+
{
|
|
96
|
+
return ::cuda::std::forward_iterator_tag();
|
|
97
|
+
}
|
|
98
|
+
else
|
|
99
|
+
{
|
|
100
|
+
return ::cuda::std::input_iterator_tag();
|
|
101
|
+
}
|
|
102
|
+
_CCCL_UNREACHABLE();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
//! @note Not static functions because nvc++ sometimes has issues with class static functions in device code
|
|
106
|
+
struct __zip_op_star
|
|
107
|
+
{
|
|
108
|
+
template <class... _Iterators>
|
|
109
|
+
using reference = __tuple_or_pair<::cuda::std::iter_reference_t<_Iterators>...>;
|
|
110
|
+
|
|
111
|
+
_CCCL_EXEC_CHECK_DISABLE
|
|
112
|
+
template <class... _Iterators>
|
|
113
|
+
[[nodiscard]] _CCCL_API constexpr reference<_Iterators...> operator()(const _Iterators&... __iters) const
|
|
114
|
+
noexcept(noexcept(reference<_Iterators...>{*__iters...}))
|
|
115
|
+
{
|
|
116
|
+
return reference<_Iterators...>{*__iters...};
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
struct __zip_op_increment
|
|
121
|
+
{
|
|
122
|
+
_CCCL_EXEC_CHECK_DISABLE
|
|
123
|
+
template <class... _Iterators>
|
|
124
|
+
_CCCL_API constexpr void operator()(_Iterators&... __iters) const noexcept(noexcept(((void) ++__iters, ...)))
|
|
125
|
+
{
|
|
126
|
+
((void) ++__iters, ...);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
struct __zip_op_decrement
|
|
131
|
+
{
|
|
132
|
+
_CCCL_EXEC_CHECK_DISABLE
|
|
133
|
+
template <class... _Iterators>
|
|
134
|
+
_CCCL_API constexpr void operator()(_Iterators&... __iters) const noexcept(noexcept(((void) --__iters, ...)))
|
|
135
|
+
{
|
|
136
|
+
((void) --__iters, ...);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
struct __zip_iter_move
|
|
141
|
+
{
|
|
142
|
+
template <class... _Iterators>
|
|
143
|
+
using __iter_move_ret = __tuple_or_pair<::cuda::std::iter_rvalue_reference_t<_Iterators>...>;
|
|
144
|
+
|
|
145
|
+
_CCCL_EXEC_CHECK_DISABLE
|
|
146
|
+
template <class... _Iterators>
|
|
147
|
+
[[nodiscard]] _CCCL_API constexpr __iter_move_ret<_Iterators...> operator()(const _Iterators&... __iters) const
|
|
148
|
+
noexcept(noexcept(__iter_move_ret<_Iterators...>{::cuda::std::ranges::iter_move(__iters)...}))
|
|
149
|
+
{
|
|
150
|
+
return __iter_move_ret<_Iterators...>{::cuda::std::ranges::iter_move(__iters)...};
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
_CCCL_END_NAMESPACE_CUDA
|
|
155
|
+
|
|
156
|
+
#include <cuda/std/__cccl/epilogue.h>
|
|
157
|
+
|
|
158
|
+
#endif // _CUDA___ITERATOR_ZIP_COMMON_H
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
#if _LIBCUDACXX_HAS_SPACESHIP_OPERATOR()
|
|
26
26
|
# include <cuda/std/__compare/three_way_comparable.h>
|
|
27
27
|
#endif // _LIBCUDACXX_HAS_SPACESHIP_OPERATOR()
|
|
28
|
+
#include <cuda/__iterator/zip_common.h>
|
|
28
29
|
#include <cuda/std/__concepts/convertible_to.h>
|
|
29
30
|
#include <cuda/std/__concepts/equality_comparable.h>
|
|
30
31
|
#include <cuda/std/__functional/invoke.h>
|
|
@@ -51,46 +52,6 @@ _CCCL_BEGIN_NAMESPACE_CUDA
|
|
|
51
52
|
//! @addtogroup iterators
|
|
52
53
|
//! @{
|
|
53
54
|
|
|
54
|
-
template <class... _Iterators>
|
|
55
|
-
struct __tuple_or_pair_impl
|
|
56
|
-
{
|
|
57
|
-
using type = ::cuda::std::tuple<_Iterators...>;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
template <class _Iterator1, class _Iterator2>
|
|
61
|
-
struct __tuple_or_pair_impl<_Iterator1, _Iterator2>
|
|
62
|
-
{
|
|
63
|
-
using type = ::cuda::std::pair<_Iterator1, _Iterator2>;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
template <class... _Iterators>
|
|
67
|
-
using __tuple_or_pair = typename __tuple_or_pair_impl<_Iterators...>::type;
|
|
68
|
-
|
|
69
|
-
template <class... _Iterators>
|
|
70
|
-
struct __zip_iter_constraints
|
|
71
|
-
{
|
|
72
|
-
static constexpr bool __all_forward = (::cuda::std::__has_forward_traversal<_Iterators> && ...);
|
|
73
|
-
static constexpr bool __all_bidirectional = (::cuda::std::__has_bidirectional_traversal<_Iterators> && ...);
|
|
74
|
-
static constexpr bool __all_random_access = (::cuda::std::__has_random_access_traversal<_Iterators> && ...);
|
|
75
|
-
|
|
76
|
-
static constexpr bool __all_equality_comparable = (::cuda::std::equality_comparable<_Iterators> && ...);
|
|
77
|
-
|
|
78
|
-
#if _LIBCUDACXX_HAS_SPACESHIP_OPERATOR()
|
|
79
|
-
static constexpr bool __all_three_way_comparable = (::cuda::std::three_way_comparable<_Iterators> && ...);
|
|
80
|
-
#endif // _LIBCUDACXX_HAS_SPACESHIP_OPERATOR()
|
|
81
|
-
|
|
82
|
-
// Our C++17 iterators sometimes do not satisfy `sized_sentinel_for` but they should all be random_access
|
|
83
|
-
static constexpr bool __all_sized_sentinel =
|
|
84
|
-
(::cuda::std::sized_sentinel_for<_Iterators, _Iterators> && ...) || __all_random_access;
|
|
85
|
-
static constexpr bool __all_nothrow_iter_movable =
|
|
86
|
-
(noexcept(::cuda::std::ranges::iter_move(::cuda::std::declval<const _Iterators&>())) && ...)
|
|
87
|
-
&& (::cuda::std::is_nothrow_move_constructible_v<::cuda::std::iter_rvalue_reference_t<_Iterators>> && ...);
|
|
88
|
-
|
|
89
|
-
static constexpr bool __all_indirectly_swappable = (::cuda::std::indirectly_swappable<_Iterators> && ...);
|
|
90
|
-
|
|
91
|
-
static constexpr bool __all_noexcept_swappable = (::cuda::std::__noexcept_swappable<_Iterators> && ...);
|
|
92
|
-
};
|
|
93
|
-
|
|
94
55
|
struct __zv_iter_category_base_none
|
|
95
56
|
{};
|
|
96
57
|
|
|
@@ -105,77 +66,8 @@ using __zv_iter_category_base =
|
|
|
105
66
|
__zv_iter_category_base_tag,
|
|
106
67
|
__zv_iter_category_base_none>;
|
|
107
68
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
{
|
|
111
|
-
using _Constraints = __zip_iter_constraints<_Iterators...>;
|
|
112
|
-
if constexpr (_Constraints::__all_random_access)
|
|
113
|
-
{
|
|
114
|
-
return ::cuda::std::random_access_iterator_tag();
|
|
115
|
-
}
|
|
116
|
-
else if constexpr (_Constraints::__all_bidirectional)
|
|
117
|
-
{
|
|
118
|
-
return ::cuda::std::bidirectional_iterator_tag();
|
|
119
|
-
}
|
|
120
|
-
else if constexpr (_Constraints::__all_forward)
|
|
121
|
-
{
|
|
122
|
-
return ::cuda::std::forward_iterator_tag();
|
|
123
|
-
}
|
|
124
|
-
else
|
|
125
|
-
{
|
|
126
|
-
return ::cuda::std::input_iterator_tag();
|
|
127
|
-
}
|
|
128
|
-
_CCCL_UNREACHABLE();
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
//! @note Not static functions because nvc++ sometimes has issues with class static functions in device code
|
|
132
|
-
struct __zip_op_star
|
|
133
|
-
{
|
|
134
|
-
template <class... _Iterators>
|
|
135
|
-
using reference = __tuple_or_pair<::cuda::std::iter_reference_t<_Iterators>...>;
|
|
136
|
-
|
|
137
|
-
_CCCL_EXEC_CHECK_DISABLE
|
|
138
|
-
template <class... _Iterators>
|
|
139
|
-
[[nodiscard]] _CCCL_API constexpr reference<_Iterators...> operator()(const _Iterators&... __iters) const
|
|
140
|
-
noexcept(noexcept(reference<_Iterators...>{*__iters...}))
|
|
141
|
-
{
|
|
142
|
-
return reference<_Iterators...>{*__iters...};
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
struct __zip_op_increment
|
|
147
|
-
{
|
|
148
|
-
_CCCL_EXEC_CHECK_DISABLE
|
|
149
|
-
template <class... _Iterators>
|
|
150
|
-
_CCCL_API constexpr void operator()(_Iterators&... __iters) const noexcept(noexcept(((void) ++__iters, ...)))
|
|
151
|
-
{
|
|
152
|
-
((void) ++__iters, ...);
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
struct __zip_op_decrement
|
|
157
|
-
{
|
|
158
|
-
_CCCL_EXEC_CHECK_DISABLE
|
|
159
|
-
template <class... _Iterators>
|
|
160
|
-
_CCCL_API constexpr void operator()(_Iterators&... __iters) const noexcept(noexcept(((void) --__iters, ...)))
|
|
161
|
-
{
|
|
162
|
-
((void) --__iters, ...);
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
struct __zip_iter_move
|
|
167
|
-
{
|
|
168
|
-
template <class... _Iterators>
|
|
169
|
-
using __iter_move_ret = __tuple_or_pair<::cuda::std::iter_rvalue_reference_t<_Iterators>...>;
|
|
170
|
-
|
|
171
|
-
_CCCL_EXEC_CHECK_DISABLE
|
|
172
|
-
template <class... _Iterators>
|
|
173
|
-
[[nodiscard]] _CCCL_API constexpr __iter_move_ret<_Iterators...> operator()(const _Iterators&... __iters) const
|
|
174
|
-
noexcept(noexcept(__iter_move_ret<_Iterators...>{::cuda::std::ranges::iter_move(__iters)...}))
|
|
175
|
-
{
|
|
176
|
-
return __iter_move_ret<_Iterators...>{::cuda::std::ranges::iter_move(__iters)...};
|
|
177
|
-
}
|
|
178
|
-
};
|
|
69
|
+
//! @addtogroup iterators
|
|
70
|
+
//! @{
|
|
179
71
|
|
|
180
72
|
//! @brief @c zip_iterator is an iterator which represents a @c tuple of iterators. This iterator is useful for creating
|
|
181
73
|
//! a virtual array of structures while achieving the same performance and bandwidth as the structure of arrays idiom.
|
|
@@ -270,7 +162,7 @@ public:
|
|
|
270
162
|
: __current_(::cuda::std::move(__iters)...)
|
|
271
163
|
{}
|
|
272
164
|
|
|
273
|
-
using iterator_concept = decltype(
|
|
165
|
+
using iterator_concept = decltype(__get_zip_iterator_concept<_Iterators...>());
|
|
274
166
|
using value_type = __tuple_or_pair<::cuda::std::iter_value_t<_Iterators>...>;
|
|
275
167
|
using reference = __tuple_or_pair<::cuda::std::iter_reference_t<_Iterators>...>;
|
|
276
168
|
using difference_type = ::cuda::std::common_type_t<::cuda::std::iter_difference_t<_Iterators>...>;
|
|
@@ -595,17 +487,13 @@ public:
|
|
|
595
487
|
return ::cuda::std::apply(__zip_iter_move{}, __iter.__current_);
|
|
596
488
|
}
|
|
597
489
|
|
|
598
|
-
template <class... _OtherIterators>
|
|
599
|
-
static constexpr bool __all_nothrow_swappable =
|
|
600
|
-
(::cuda::std::__noexcept_swappable<_OtherIterators, _OtherIterators> && ...);
|
|
601
|
-
|
|
602
490
|
struct __zip_op_iter_swap
|
|
603
491
|
{
|
|
604
492
|
template <size_t... _Indices>
|
|
605
|
-
_CCCL_API constexpr void
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
493
|
+
_CCCL_API constexpr void operator()(const __tuple_or_pair<_Iterators...>& __iters1,
|
|
494
|
+
const __tuple_or_pair<_Iterators...>& __iters2,
|
|
495
|
+
::cuda::std::index_sequence<_Indices...>) const
|
|
496
|
+
noexcept(__zip_iter_constraints<_Iterators...>::__all_noexcept_swappable)
|
|
609
497
|
{
|
|
610
498
|
(::cuda::std::ranges::iter_swap(::cuda::std::get<_Indices>(__iters1), ::cuda::std::get<_Indices>(__iters2)), ...);
|
|
611
499
|
}
|