rocPRIM
device_histogram_config.hpp
1 // Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to deal
5 // in the Software without restriction, including without limitation the rights
6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 // copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 // THE SOFTWARE.
20 
21 #ifndef ROCPRIM_DEVICE_DEVICE_HISTOGRAM_CONFIG_HPP_
22 #define ROCPRIM_DEVICE_DEVICE_HISTOGRAM_CONFIG_HPP_
23 
24 #include "config_types.hpp"
25 #include "detail/config/device_histogram.hpp"
26 
29 
30 BEGIN_ROCPRIM_NAMESPACE
31 
32 namespace detail
33 {
34 
35 template<typename HistogramConfig>
36 constexpr histogram_config_params wrap_histogram_config()
37 {
38  return histogram_config_params{
39  {HistogramConfig::histogram::block_size,
40  HistogramConfig::histogram::items_per_thread,
41  HistogramConfig::histogram::size_limit},
42  HistogramConfig::max_grid_size,
43  HistogramConfig::shared_impl_max_bins,
44  HistogramConfig::shared_impl_histograms
45  };
46 }
47 
48 template<typename HistogramConfig, typename, unsigned int, unsigned int>
50 {
51  template<target_arch Arch>
53  {
54  static constexpr histogram_config_params params = wrap_histogram_config<HistogramConfig>();
55  };
56 };
57 
58 template<typename Sample, unsigned int Channels, unsigned int ActiveChannels>
59 struct wrapped_histogram_config<default_config, Sample, Channels, ActiveChannels>
60 {
61  template<target_arch Arch>
62  struct architecture_config
63  {
64  static constexpr histogram_config_params params
65  = wrap_histogram_config<default_histogram_config<static_cast<unsigned int>(Arch),
66  Sample,
67  Channels,
68  ActiveChannels>>();
69  };
70 };
71 
72 #ifndef DOXYGEN_SHOULD_SKIP_THIS
73 template<typename HistogramConfig,
74  typename Sample,
75  unsigned int Channels,
76  unsigned int ActiveChannels>
77 template<target_arch Arch>
80  architecture_config<Arch>::params;
81 
82 template<typename Sample, unsigned int Channels, unsigned int ActiveChannels>
83 template<target_arch Arch>
86  Arch>::params;
87 #endif // DOXYGEN_SHOULD_SKIP_THIS
88 
89 } // end namespace detail
90 
91 END_ROCPRIM_NAMESPACE
92 
94 // end of group primitivesmodule_deviceconfigs
95 
96 #endif // ROCPRIM_DEVICE_DEVICE_HISTOGRAM_CONFIG_HPP_
Definition: device_histogram_config.hpp:52
Special type used to show that the given device-level operation will be executed with optimal configu...
Definition: config_types.hpp:45
Deprecated: Configuration of device-level scan primitives.
Definition: block_histogram.hpp:62
Definition: device_histogram_config.hpp:49
Definition: test_device_binary_search.cpp:37
Provides the kernel parameters for histogram_even, multi_histogram_even, histogram_range, and multi_histogram_range based on autotuned configurations or user-provided configurations.
Definition: device_config_helper.hpp:607