Skip to content

Commit 3a86e00

Browse files
Deprecated and replace cub::AlignBytes (#8118)
1 parent dcd87e3 commit 3a86e00

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

cub/cub/agent/agent_histogram.cuh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,8 +636,8 @@ struct AgentHistogram
636636
OffsetT num_row_pixels, OffsetT num_rows, OffsetT row_stride_samples, int tiles_per_row, GridQueue<int> tile_queue)
637637
{
638638
// Check whether all row starting offsets are vec-aligned (in single-channel) or pixel-aligned (in multi-channel)
639-
constexpr int vec_mask = AlignBytes<VecT>::ALIGN_BYTES - 1;
640-
constexpr int pixel_mask = AlignBytes<PixelT>::ALIGN_BYTES - 1;
639+
constexpr int vec_mask = alignof(VecT) - 1;
640+
constexpr int pixel_mask = alignof(PixelT) - 1;
641641
const size_t row_bytes = sizeof(SampleT) * row_stride_samples;
642642

643643
const bool vec_aligned_rows =

cub/cub/util_type.cuh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,8 @@ private:
300300
* Size and alignment
301301
******************************************************************************/
302302

303+
namespace detail
304+
{
303305
/// Structure alignment
304306
template <typename T>
305307
struct AlignBytes
@@ -375,17 +377,21 @@ template <typename T> struct AlignBytes<volatile T> : AlignBytes<T> {};
375377
template <typename T> struct AlignBytes<const T> : AlignBytes<T> {};
376378
template <typename T> struct AlignBytes<const volatile T> : AlignBytes<T> {};
377379
// clang-format on
380+
} // namespace detail
381+
382+
template <typename T>
383+
using AlignBytes CCCL_DEPRECATED_BECAUSE("Use alignof(T) directly") = detail::AlignBytes<T>;
378384

379385
/// Unit-words of data movement
380386
template <typename T>
381387
struct UnitWord
382388
{
383-
static constexpr auto ALIGN_BYTES = AlignBytes<T>::ALIGN_BYTES;
389+
static constexpr auto ALIGN_BYTES = alignof(T);
384390

385391
template <typename Unit>
386392
struct IsMultiple
387393
{
388-
static constexpr auto UNIT_ALIGN_BYTES = AlignBytes<Unit>::ALIGN_BYTES;
394+
static constexpr auto UNIT_ALIGN_BYTES = alignof(Unit);
389395
static constexpr bool IS_MULTIPLE =
390396
(sizeof(T) % sizeof(Unit) == 0) && (int(ALIGN_BYTES) % int(UNIT_ALIGN_BYTES) == 0);
391397
};

0 commit comments

Comments
 (0)