/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-hipcub/checkouts/docs-5.7.0/hipcub/include/hipcub/backend/cub/device/device_histogram.hpp Source File

/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-hipcub/checkouts/docs-5.7.0/hipcub/include/hipcub/backend/cub/device/device_histogram.hpp Source File#

hipCUB: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-hipcub/checkouts/docs-5.7.0/hipcub/include/hipcub/backend/cub/device/device_histogram.hpp Source File
device_histogram.hpp
1 /******************************************************************************
2  * Copyright (c) 2010-2011, Duane Merrill. All rights reserved.
3  * Copyright (c) 2011-2018, NVIDIA CORPORATION. All rights reserved.
4  * Modifications Copyright (c) 2017-2023, Advanced Micro Devices, Inc. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the NVIDIA CORPORATION nor the
14  * names of its contributors may be used to endorse or promote products
15  * derived from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  ******************************************************************************/
29 
30 #ifndef HIPCUB_CUB_DEVICE_DEVICE_HISTOGRAM_HPP_
31 #define HIPCUB_CUB_DEVICE_DEVICE_HISTOGRAM_HPP_
32 
33 #include "../../../config.hpp"
34 
35 #include <cub/device/device_histogram.cuh>
36 
37 BEGIN_HIPCUB_NAMESPACE
38 
40 {
41  template<
42  typename SampleIteratorT,
43  typename CounterT,
44  typename LevelT,
45  typename OffsetT
46  >
47  HIPCUB_RUNTIME_FUNCTION static
48  hipError_t HistogramEven(void * d_temp_storage,
49  size_t& temp_storage_bytes,
50  SampleIteratorT d_samples,
51  CounterT * d_histogram,
52  int num_levels,
53  LevelT lower_level,
54  LevelT upper_level,
55  OffsetT num_samples,
56  hipStream_t stream = 0,
57  bool debug_synchronous = false)
58  {
59  (void)debug_synchronous;
60  return hipCUDAErrorTohipError(::cub::DeviceHistogram::HistogramEven(d_temp_storage,
61  temp_storage_bytes,
62  d_samples,
63  d_histogram,
64  num_levels,
65  lower_level,
66  upper_level,
67  num_samples,
68  stream));
69  }
70 
71  template<
72  typename SampleIteratorT,
73  typename CounterT,
74  typename LevelT,
75  typename OffsetT
76  >
77  HIPCUB_RUNTIME_FUNCTION static
78  hipError_t HistogramEven(void * d_temp_storage,
79  size_t& temp_storage_bytes,
80  SampleIteratorT d_samples,
81  CounterT * d_histogram,
82  int num_levels,
83  LevelT lower_level,
84  LevelT upper_level,
85  OffsetT num_row_samples,
86  OffsetT num_rows,
87  size_t row_stride_bytes,
88  hipStream_t stream = 0,
89  bool debug_synchronous = false)
90  {
91  (void)debug_synchronous;
92  return hipCUDAErrorTohipError(::cub::DeviceHistogram::HistogramEven(d_temp_storage,
93  temp_storage_bytes,
94  d_samples,
95  d_histogram,
96  num_levels,
97  lower_level,
98  upper_level,
99  num_row_samples,
100  num_rows,
101  row_stride_bytes,
102  stream));
103  }
104 
105  template<
106  int NUM_CHANNELS,
107  int NUM_ACTIVE_CHANNELS,
108  typename SampleIteratorT,
109  typename CounterT,
110  typename LevelT,
111  typename OffsetT
112  >
113  HIPCUB_RUNTIME_FUNCTION static
114  hipError_t MultiHistogramEven(void * d_temp_storage,
115  size_t& temp_storage_bytes,
116  SampleIteratorT d_samples,
117  CounterT * d_histogram[NUM_ACTIVE_CHANNELS],
118  int num_levels[NUM_ACTIVE_CHANNELS],
119  LevelT lower_level[NUM_ACTIVE_CHANNELS],
120  LevelT upper_level[NUM_ACTIVE_CHANNELS],
121  OffsetT num_pixels,
122  hipStream_t stream = 0,
123  bool debug_synchronous = false)
124  {
125  (void)debug_synchronous;
126  return hipCUDAErrorTohipError(
127  ::cub::DeviceHistogram::MultiHistogramEven<NUM_CHANNELS, NUM_ACTIVE_CHANNELS>(
128  d_temp_storage,
129  temp_storage_bytes,
130  d_samples,
131  d_histogram,
132  num_levels,
133  lower_level,
134  upper_level,
135  num_pixels,
136  stream));
137  }
138 
139  template<
140  int NUM_CHANNELS,
141  int NUM_ACTIVE_CHANNELS,
142  typename SampleIteratorT,
143  typename CounterT,
144  typename LevelT,
145  typename OffsetT
146  >
147  HIPCUB_RUNTIME_FUNCTION static
148  hipError_t MultiHistogramEven(void * d_temp_storage,
149  size_t& temp_storage_bytes,
150  SampleIteratorT d_samples,
151  CounterT * d_histogram[NUM_ACTIVE_CHANNELS],
152  int num_levels[NUM_ACTIVE_CHANNELS],
153  LevelT lower_level[NUM_ACTIVE_CHANNELS],
154  LevelT upper_level[NUM_ACTIVE_CHANNELS],
155  OffsetT num_row_pixels,
156  OffsetT num_rows,
157  size_t row_stride_bytes,
158  hipStream_t stream = 0,
159  bool debug_synchronous = false)
160  {
161  (void)debug_synchronous;
162  return hipCUDAErrorTohipError(
163  ::cub::DeviceHistogram::MultiHistogramEven<NUM_CHANNELS, NUM_ACTIVE_CHANNELS>(
164  d_temp_storage,
165  temp_storage_bytes,
166  d_samples,
167  d_histogram,
168  num_levels,
169  lower_level,
170  upper_level,
171  num_row_pixels,
172  num_rows,
173  row_stride_bytes,
174  stream));
175  }
176 
177  template<
178  typename SampleIteratorT,
179  typename CounterT,
180  typename LevelT,
181  typename OffsetT
182  >
183  HIPCUB_RUNTIME_FUNCTION static
184  hipError_t HistogramRange(void * d_temp_storage,
185  size_t& temp_storage_bytes,
186  SampleIteratorT d_samples,
187  CounterT * d_histogram,
188  int num_levels,
189  LevelT * d_levels,
190  OffsetT num_samples,
191  hipStream_t stream = 0,
192  bool debug_synchronous = false)
193  {
194  (void)debug_synchronous;
195  return hipCUDAErrorTohipError(::cub::DeviceHistogram::HistogramRange(d_temp_storage,
196  temp_storage_bytes,
197  d_samples,
198  d_histogram,
199  num_levels,
200  d_levels,
201  num_samples,
202  stream));
203  }
204 
205  template<
206  typename SampleIteratorT,
207  typename CounterT,
208  typename LevelT,
209  typename OffsetT
210  >
211  HIPCUB_RUNTIME_FUNCTION static
212  hipError_t HistogramRange(void * d_temp_storage,
213  size_t& temp_storage_bytes,
214  SampleIteratorT d_samples,
215  CounterT * d_histogram,
216  int num_levels,
217  LevelT * d_levels,
218  OffsetT num_row_samples,
219  OffsetT num_rows,
220  size_t row_stride_bytes,
221  hipStream_t stream = 0,
222  bool debug_synchronous = false)
223  {
224  (void)debug_synchronous;
225  return hipCUDAErrorTohipError(::cub::DeviceHistogram::HistogramRange(d_temp_storage,
226  temp_storage_bytes,
227  d_samples,
228  d_histogram,
229  num_levels,
230  d_levels,
231  num_row_samples,
232  num_rows,
233  row_stride_bytes,
234  stream));
235  }
236 
237  template<
238  int NUM_CHANNELS,
239  int NUM_ACTIVE_CHANNELS,
240  typename SampleIteratorT,
241  typename CounterT,
242  typename LevelT,
243  typename OffsetT
244  >
245  HIPCUB_RUNTIME_FUNCTION static
246  hipError_t MultiHistogramRange(void * d_temp_storage,
247  size_t& temp_storage_bytes,
248  SampleIteratorT d_samples,
249  CounterT * d_histogram[NUM_ACTIVE_CHANNELS],
250  int num_levels[NUM_ACTIVE_CHANNELS],
251  LevelT * d_levels[NUM_ACTIVE_CHANNELS],
252  OffsetT num_pixels,
253  hipStream_t stream = 0,
254  bool debug_synchronous = false)
255  {
256  (void)debug_synchronous;
257  return hipCUDAErrorTohipError(
258  ::cub::DeviceHistogram::MultiHistogramRange<NUM_CHANNELS, NUM_ACTIVE_CHANNELS>(
259  d_temp_storage,
260  temp_storage_bytes,
261  d_samples,
262  d_histogram,
263  num_levels,
264  d_levels,
265  num_pixels,
266  stream));
267  }
268 
269  template<
270  int NUM_CHANNELS,
271  int NUM_ACTIVE_CHANNELS,
272  typename SampleIteratorT,
273  typename CounterT,
274  typename LevelT,
275  typename OffsetT
276  >
277  HIPCUB_RUNTIME_FUNCTION static
278  hipError_t MultiHistogramRange(void * d_temp_storage,
279  size_t& temp_storage_bytes,
280  SampleIteratorT d_samples,
281  CounterT * d_histogram[NUM_ACTIVE_CHANNELS],
282  int num_levels[NUM_ACTIVE_CHANNELS],
283  LevelT * d_levels[NUM_ACTIVE_CHANNELS],
284  OffsetT num_row_pixels,
285  OffsetT num_rows,
286  size_t row_stride_bytes,
287  hipStream_t stream = 0,
288  bool debug_synchronous = false)
289  {
290  (void)debug_synchronous;
291  return hipCUDAErrorTohipError(
292  ::cub::DeviceHistogram::MultiHistogramRange<NUM_CHANNELS, NUM_ACTIVE_CHANNELS>(
293  d_temp_storage,
294  temp_storage_bytes,
295  d_samples,
296  d_histogram,
297  num_levels,
298  d_levels,
299  num_row_pixels,
300  num_rows,
301  row_stride_bytes,
302  stream));
303  }
304 };
305 
306 END_HIPCUB_NAMESPACE
307 
308 #endif // HIPCUB_CUB_DEVICE_DEVICE_HISTOGRAM_HPP_
Definition: device_histogram.hpp:40