Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #487 from allisonvacanti/histogram_mixed_type/gh.479
Browse files Browse the repository at this point in the history
Fix DeviceHistogram::Even for mixed float/int levels and sample types.
  • Loading branch information
alliepiper authored Aug 10, 2022
2 parents 832f5c8 + 3b3bf92 commit 5e990ba
Show file tree
Hide file tree
Showing 4 changed files with 337 additions and 142 deletions.
28 changes: 28 additions & 0 deletions cub/detail/cpp_compatibility.cuh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright 2022 NVIDIA Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


#pragma once

#include <cub/util_cpp_dialect.cuh>

#if CUB_CPP_DIALECT >= 2017 && __cpp_if_constexpr
# define CUB_IF_CONSTEXPR if constexpr
# define CUB_ELSE_IF_CONSTEXPR else if constexpr
#else
# define CUB_IF_CONSTEXPR if
# define CUB_ELSE_IF_CONSTEXPR else if
#endif
12 changes: 12 additions & 0 deletions cub/device/device_histogram.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ struct DeviceHistogram
* - The ranges `[d_samples, d_samples + num_samples)` and
* `[d_histogram, d_histogram + num_levels - 1)` shall not overlap
* in any way.
* - `cuda::std::common_type<LevelT, SampleT>` must be valid, and both LevelT
* and SampleT must be valid arithmetic types. The common type must be
* convertible to `int` and trivially copyable.
* - @devicestorage
*
* @par Snippet
Expand Down Expand Up @@ -247,6 +250,9 @@ struct DeviceHistogram
* `row_end = row_begin + num_row_samples`. The ranges
* `[row_begin, row_end)` and `[d_histogram, d_histogram + num_levels - 1)`
* shall not overlap in any way.
* - `cuda::std::common_type<LevelT, SampleT>` must be valid, and both LevelT
* and SampleT must be valid arithmetic types. The common type must be
* convertible to `int` and trivially copyable.
* - @devicestorage
*
* @par Snippet
Expand Down Expand Up @@ -432,6 +438,9 @@ struct DeviceHistogram
* `[d_samples, d_samples + NUM_CHANNELS * num_pixels)` and
* `[d_histogram[c], d_histogram[c] + num_levels[c] - 1)` shall not overlap
* in any way.
* - `cuda::std::common_type<LevelT, SampleT>` must be valid, and both LevelT
* and SampleT must be valid arithmetic types. The common type must be
* convertible to `int` and trivially copyable.
* - @devicestorage
*
* @par Snippet
Expand Down Expand Up @@ -633,6 +642,9 @@ struct DeviceHistogram
* `[sample_begin, sample_end)` and
* `[d_histogram[c], d_histogram[c] + num_levels[c] - 1)` shall not overlap
* in any way.
* - `cuda::std::common_type<LevelT, SampleT>` must be valid, and both LevelT
* and SampleT must be valid arithmetic types. The common type must be
* convertible to `int` and trivially copyable.
* - @devicestorage
*
* @par Snippet
Expand Down
Loading

0 comments on commit 5e990ba

Please sign in to comment.