Skip to content

Commit

Permalink
Deprecate cub::IterateThreadStore (#3337)
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardmgruber committed Jan 10, 2025
1 parent 13b8f7c commit 463a49b
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions cub/cub/thread/thread_store.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -116,28 +116,30 @@ _CCCL_DEVICE _CCCL_FORCEINLINE void ThreadStore(OutputIteratorT itr, T val);

#ifndef _CCCL_DOXYGEN_INVOKED // Do not document

namespace detail
{
/// Helper structure for templated store iteration (inductive case)
template <int COUNT, int MAX>
struct IterateThreadStore
struct iterate_thread_store
{
template <CacheStoreModifier MODIFIER, typename T>
static _CCCL_DEVICE _CCCL_FORCEINLINE void Store(T* ptr, T* vals)
{
ThreadStore<MODIFIER>(ptr + COUNT, vals[COUNT]);
IterateThreadStore<COUNT + 1, MAX>::template Store<MODIFIER>(ptr, vals);
iterate_thread_store<COUNT + 1, MAX>::template Store<MODIFIER>(ptr, vals);
}

template <typename OutputIteratorT, typename T>
static _CCCL_DEVICE _CCCL_FORCEINLINE void Dereference(OutputIteratorT ptr, T* vals)
{
ptr[COUNT] = vals[COUNT];
IterateThreadStore<COUNT + 1, MAX>::Dereference(ptr, vals);
iterate_thread_store<COUNT + 1, MAX>::Dereference(ptr, vals);
}
};

/// Helper structure for templated store iteration (termination case)
template <int MAX>
struct IterateThreadStore<MAX, MAX>
struct iterate_thread_store<MAX, MAX>
{
template <CacheStoreModifier MODIFIER, typename T>
static _CCCL_DEVICE _CCCL_FORCEINLINE void Store(T* /*ptr*/, T* /*vals*/)
Expand All @@ -147,6 +149,10 @@ struct IterateThreadStore<MAX, MAX>
static _CCCL_DEVICE _CCCL_FORCEINLINE void Dereference(OutputIteratorT /*ptr*/, T* /*vals*/)
{}
};
} // namespace detail

template <int COUNT, int MAX>
using IterateThreadStore CCCL_DEPRECATED = detail::iterate_thread_store<COUNT, MAX>;

/**
* Define a uint4 (16B) ThreadStore specialization for the given Cache load modifier
Expand Down Expand Up @@ -305,7 +311,7 @@ _CCCL_DEVICE _CCCL_FORCEINLINE void ThreadStoreVolatilePtr(T* ptr, T val, Int2Ty
reinterpret_cast<ShuffleWord*>(words)[i] = reinterpret_cast<ShuffleWord*>(&val)[i];
}

IterateThreadStore<0, VOLATILE_MULTIPLE>::Dereference(reinterpret_cast<volatile VolatileWord*>(ptr), words);
detail::iterate_thread_store<0, VOLATILE_MULTIPLE>::Dereference(reinterpret_cast<volatile VolatileWord*>(ptr), words);
}

/**
Expand Down Expand Up @@ -340,7 +346,7 @@ ThreadStore(T* ptr, T val, Int2Type<MODIFIER> /*modifier*/, Int2Type<true> /*is_
reinterpret_cast<ShuffleWord*>(words)[i] = reinterpret_cast<ShuffleWord*>(&val)[i];
}

IterateThreadStore<0, DEVICE_MULTIPLE>::template Store<CacheStoreModifier(MODIFIER)>(
detail::iterate_thread_store<0, DEVICE_MULTIPLE>::template Store<CacheStoreModifier(MODIFIER)>(
reinterpret_cast<DeviceWord*>(ptr), words);
}

Expand Down

0 comments on commit 463a49b

Please sign in to comment.