Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions cub/cub/agent/agent_histogram.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ enum BlockHistogramMemoryPreference
#if _CCCL_HOSTED()
namespace detail
{
[[nodiscard]] constexpr const char* to_string(BlockHistogramMemoryPreference mempref) noexcept
_CCCL_API [[nodiscard]] constexpr const char* to_string(BlockHistogramMemoryPreference mempref) noexcept
{
switch (mempref)
{
Expand All @@ -53,9 +53,8 @@ namespace detail
return "SMEM";
case BLEND:
return "BLEND";
default:
return "<unknown BlockHistogramMemoryPreference>";
}
return "<unknown BlockHistogramMemoryPreference>";
}
} // namespace detail

Expand All @@ -69,7 +68,7 @@ CUB_NAMESPACE_END

#if __cpp_lib_format >= 201907L && !defined(_CCCL_DOXYGEN_INVOKED)
template <::cuda::std::same_as<char> CharT>
struct std::formatter<CUB_NS_QUALIFIER::BlockHistogramMemoryPreference, CharT> : formatter<const CharT*, CharT>
struct ::std::formatter<CUB_NS_QUALIFIER::BlockHistogramMemoryPreference, CharT> : formatter<const CharT*, CharT>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatter as well? Or is that in the cub namespace?

{
template <class FmtCtx>
auto format(const CUB_NS_QUALIFIER::BlockHistogramMemoryPreference& mempref, FmtCtx& ctx) const
Expand Down
7 changes: 3 additions & 4 deletions cub/cub/agent/agent_radix_sort_onesweep.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,16 @@ enum RadixSortStoreAlgorithm
#if _CCCL_HOSTED()
namespace detail
{
[[nodiscard]] constexpr const char* to_string(RadixSortStoreAlgorithm algo) noexcept
_CCCL_API [[nodiscard]] constexpr const char* to_string(RadixSortStoreAlgorithm algo) noexcept
{
switch (algo)
{
case RADIX_SORT_STORE_DIRECT:
return "RADIX_SORT_STORE_DIRECT";
case RADIX_SORT_STORE_ALIGNED:
return "RADIX_SORT_STORE_ALIGNED";
default:
return "<unknown RadixSortStoreAlgorithm>";
}
return "<unknown RadixSortStoreAlgorithm>";
}
} // namespace detail
#endif // _CCCL_HOSTED()
Expand All @@ -82,7 +81,7 @@ CUB_NAMESPACE_END

#if __cpp_lib_format >= 201907L && !defined(_CCCL_DOXYGEN_INVOKED)
template <::cuda::std::same_as<char> CharT>
struct std::formatter<CUB_NS_QUALIFIER::RadixSortStoreAlgorithm, CharT> : formatter<const CharT*, CharT>
struct ::std::formatter<CUB_NS_QUALIFIER::RadixSortStoreAlgorithm, CharT> : formatter<const CharT*, CharT>
{
template <class FmtCtx>
auto format(const CUB_NS_QUALIFIER::RadixSortStoreAlgorithm& algo, FmtCtx& ctx) const
Expand Down
7 changes: 3 additions & 4 deletions cub/cub/block/block_load.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ enum BlockLoadAlgorithm
#if _CCCL_HOSTED() && !defined(_CCCL_DOXYGEN_INVOKED)
namespace detail
{
[[nodiscard]] constexpr const char* to_string(BlockLoadAlgorithm algo) noexcept
_CCCL_API [[nodiscard]] constexpr const char* to_string(BlockLoadAlgorithm algo) noexcept
{
switch (algo)
{
Expand All @@ -748,9 +748,8 @@ namespace detail
return "BLOCK_LOAD_WARP_TRANSPOSE";
case BLOCK_LOAD_WARP_TRANSPOSE_TIMESLICED:
return "BLOCK_LOAD_WARP_TRANSPOSE_TIMESLICED";
default:
return "<unknown BlockLoadAlgorithm>";
}
return "<unknown BlockLoadAlgorithm>";
}
} // namespace detail

Expand All @@ -764,7 +763,7 @@ CUB_NAMESPACE_END

#if __cpp_lib_format >= 201907L && !defined(_CCCL_DOXYGEN_INVOKED)
template <::cuda::std::same_as<char> CharT>
struct std::formatter<CUB_NS_QUALIFIER::BlockLoadAlgorithm, CharT> : formatter<const CharT*, CharT>
struct ::std::formatter<CUB_NS_QUALIFIER::BlockLoadAlgorithm, CharT> : formatter<const CharT*, CharT>
{
template <class FmtCtx>
auto format(const CUB_NS_QUALIFIER::BlockLoadAlgorithm& algo, FmtCtx& ctx) const
Expand Down
7 changes: 3 additions & 4 deletions cub/cub/block/block_radix_rank.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ enum RadixRankAlgorithm
#if _CCCL_HOSTED() && !defined(_CCCL_DOXYGEN_INVOKED)
namespace detail
{
[[nodiscard]] constexpr const char* to_string(RadixRankAlgorithm algo) noexcept
_CCCL_API [[nodiscard]] constexpr const char* to_string(RadixRankAlgorithm algo) noexcept
{
switch (algo)
{
Expand All @@ -90,9 +90,8 @@ namespace detail
return "RADIX_RANK_MATCH_EARLY_COUNTS_ANY";
case RADIX_RANK_MATCH_EARLY_COUNTS_ATOMIC_OR:
return "RADIX_RANK_MATCH_EARLY_COUNTS_ATOMIC_OR";
default:
return "<unknown RadixRankAlgorithm>";
}
return "<unknown RadixRankAlgorithm>";
}
} // namespace detail

Expand All @@ -106,7 +105,7 @@ CUB_NAMESPACE_END

#if __cpp_lib_format >= 201907L && !defined(_CCCL_DOXYGEN_INVOKED)
template <::cuda::std::same_as<char> CharT>
struct std::formatter<CUB_NS_QUALIFIER::RadixRankAlgorithm, CharT> : formatter<const CharT*, CharT>
struct ::std::formatter<CUB_NS_QUALIFIER::RadixRankAlgorithm, CharT> : formatter<const CharT*, CharT>
{
template <class FmtCtx>
auto format(const CUB_NS_QUALIFIER::RadixRankAlgorithm& algo, FmtCtx& ctx) const
Expand Down
7 changes: 3 additions & 4 deletions cub/cub/block/block_reduce.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ enum BlockReduceAlgorithm
#if _CCCL_HOSTED() && !defined(_CCCL_DOXYGEN_INVOKED)
namespace detail
{
[[nodiscard]] constexpr const char* to_string(BlockReduceAlgorithm algo) noexcept
_CCCL_API [[nodiscard]] constexpr const char* to_string(BlockReduceAlgorithm algo) noexcept

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_CCCL_API [[nodiscard]] constexpr const char* to_string(BlockReduceAlgorithm algo) noexcept
[[nodiscard]] _CCCL_API constexpr const char* to_string(BlockReduceAlgorithm algo) noexcept

{
switch (algo)
{
Expand All @@ -166,9 +166,8 @@ namespace detail
return "BLOCK_REDUCE_WARP_REDUCTIONS";
case BLOCK_REDUCE_WARP_REDUCTIONS_NONDETERMINISTIC:
return "BLOCK_REDUCE_WARP_REDUCTIONS_NONDETERMINISTIC";
default:
return "<unknown BlockReduceAlgorithm>";
}
return "<unknown BlockReduceAlgorithm>";
}
} // namespace detail

Expand All @@ -182,7 +181,7 @@ CUB_NAMESPACE_END

#if __cpp_lib_format >= 201907L && !defined(_CCCL_DOXYGEN_INVOKED)
template <::cuda::std::same_as<char> CharT>
struct std::formatter<CUB_NS_QUALIFIER::BlockReduceAlgorithm, CharT> : formatter<const CharT*, CharT>
struct ::std::formatter<CUB_NS_QUALIFIER::BlockReduceAlgorithm, CharT> : formatter<const CharT*, CharT>
{
template <class FmtCtx>
auto format(const CUB_NS_QUALIFIER::BlockReduceAlgorithm& algo, FmtCtx& ctx) const
Expand Down
7 changes: 3 additions & 4 deletions cub/cub/block/block_scan.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ enum BlockScanAlgorithm
#if _CCCL_HOSTED() && !defined(_CCCL_DOXYGEN_INVOKED)
namespace detail
{
[[nodiscard]] constexpr const char* to_string(BlockScanAlgorithm algo) noexcept
_CCCL_API [[nodiscard]] constexpr const char* to_string(BlockScanAlgorithm algo) noexcept
{
switch (algo)
{
Expand All @@ -115,9 +115,8 @@ namespace detail
return "BLOCK_SCAN_RAKING_MEMOIZE";
case BLOCK_SCAN_WARP_SCANS:
return "BLOCK_SCAN_WARP_SCANS";
default:
return "<unknown BlockScanAlgorithm>";
}
return "<unknown BlockScanAlgorithm>";
}
} // namespace detail

Expand All @@ -131,7 +130,7 @@ CUB_NAMESPACE_END

#if __cpp_lib_format >= 201907L && !defined(_CCCL_DOXYGEN_INVOKED)
template <::cuda::std::same_as<char> CharT>
struct std::formatter<CUB_NS_QUALIFIER::BlockScanAlgorithm, CharT> : formatter<const CharT*, CharT>
struct ::std::formatter<CUB_NS_QUALIFIER::BlockScanAlgorithm, CharT> : formatter<const CharT*, CharT>
{
template <class FmtCtx>
auto format(const CUB_NS_QUALIFIER::BlockScanAlgorithm& algo, FmtCtx& ctx) const
Expand Down
7 changes: 3 additions & 4 deletions cub/cub/block/block_store.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ enum BlockStoreAlgorithm
#if _CCCL_HOSTED() && !defined(_CCCL_DOXYGEN_INVOKED)
namespace detail
{
[[nodiscard]] constexpr const char* to_string(BlockStoreAlgorithm algo) noexcept
_CCCL_API [[nodiscard]] constexpr const char* to_string(BlockStoreAlgorithm algo) noexcept
{
switch (algo)
{
Expand All @@ -564,9 +564,8 @@ namespace detail
return "BLOCK_STORE_WARP_TRANSPOSE";
case BLOCK_STORE_WARP_TRANSPOSE_TIMESLICED:
return "BLOCK_STORE_WARP_TRANSPOSE_TIMESLICED";
default:
return "<unknown BlockStoreAlgorithm>";
}
return "<unknown BlockStoreAlgorithm>";
}
} // namespace detail

Expand All @@ -580,7 +579,7 @@ CUB_NAMESPACE_END

#if __cpp_lib_format >= 201907L && !defined(_CCCL_DOXYGEN_INVOKED)
template <::cuda::std::same_as<char> CharT>
struct std::formatter<CUB_NS_QUALIFIER::BlockStoreAlgorithm, CharT> : formatter<const CharT*, CharT>
struct ::std::formatter<CUB_NS_QUALIFIER::BlockStoreAlgorithm, CharT> : formatter<const CharT*, CharT>
{
template <class FmtCtx>
auto format(const CUB_NS_QUALIFIER::BlockStoreAlgorithm& algo, FmtCtx& ctx) const
Expand Down
100 changes: 1 addition & 99 deletions cub/cub/detail/delay_constructor.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -14,110 +14,12 @@
#endif // no system header

#include <cub/agent/single_pass_scan_operators.cuh>
#include <cub/device/dispatch/tuning/common.cuh>

#include <cuda/std/__concepts/same_as.h>
#include <cuda/std/__fwd/format.h>
#include <cuda/std/__host_stdlib/ostream>

CUB_NAMESPACE_BEGIN

//! The delay algorithm used by decoupled lookback
enum class LookbackDelayAlgorithm
{
no_delay,
fixed_delay,
exponential_backoff,
exponential_backoff_jitter,
exponential_backoff_jitter_window,
exponential_backon_jitter_window,
exponential_backon_jitter,
exponential_backon,
__reduce_by_key //!< Internal
};

#if _CCCL_HOSTED()
namespace detail
{
[[nodiscard]] constexpr const char* to_string(LookbackDelayAlgorithm algo) noexcept
{
switch (algo)
{
case LookbackDelayAlgorithm::no_delay:
return "LookbackDelayAlgorithm::no_delay";
case LookbackDelayAlgorithm::fixed_delay:
return "LookbackDelayAlgorithm::fixed_delay";
case LookbackDelayAlgorithm::exponential_backoff:
return "LookbackDelayAlgorithm::exponential_backoff";
case LookbackDelayAlgorithm::exponential_backoff_jitter:
return "LookbackDelayAlgorithm::exponential_backoff_jitter";
case LookbackDelayAlgorithm::exponential_backoff_jitter_window:
return "LookbackDelayAlgorithm::exponential_backoff_jitter_window";
case LookbackDelayAlgorithm::exponential_backon_jitter_window:
return "LookbackDelayAlgorithm::exponential_backon_jitter_window";
case LookbackDelayAlgorithm::exponential_backon_jitter:
return "LookbackDelayAlgorithm::exponential_backon_jitter";
case LookbackDelayAlgorithm::exponential_backon:
return "LookbackDelayAlgorithm::exponential_backon";
case LookbackDelayAlgorithm::__reduce_by_key:
return "LookbackDelayAlgorithm::__reduce_by_key";
default:
return "<unknown LookbackDelayAlgorithm>";
}
}
} // namespace detail
#endif // _CCCL_HOSTED()

#if _CCCL_HOSTED()
inline ::std::ostream& operator<<(::std::ostream& os, LookbackDelayAlgorithm algo)
{
return os << CUB_NS_QUALIFIER::detail::to_string(algo);
}
#endif // _CCCL_HOSTED()

CUB_NAMESPACE_END

#if __cpp_lib_format >= 201907L && !defined(_CCCL_DOXYGEN_INVOKED)
template <::cuda::std::same_as<char> CharT>
struct std::formatter<CUB_NS_QUALIFIER::LookbackDelayAlgorithm, CharT> : formatter<const CharT*, CharT>
{
template <class FmtCtx>
auto format(const CUB_NS_QUALIFIER::LookbackDelayAlgorithm& algo, FmtCtx& ctx) const
{
return formatter<const CharT*, CharT>::format(CUB_NS_QUALIFIER::detail::to_string(algo), ctx);
}
};
#endif // __cpp_lib_format >= 201907L && !defined(_CCCL_DOXYGEN_INVOKED)

CUB_NAMESPACE_BEGIN

//! The policy configuring the delay algorithm used by decoupled lookback
struct LookbackDelayPolicy
{
LookbackDelayAlgorithm kind; //!< The algorithm used for delaying during decoupled lookback
unsigned int delay; //!< The delay in nanoseconds
unsigned int l2_write_latency; //!< The write latency of the L2 cache in nanoseconds

[[nodiscard]] _CCCL_HOST_DEVICE_API constexpr friend bool
operator==(const LookbackDelayPolicy& lhs, const LookbackDelayPolicy& rhs) noexcept
{
return lhs.kind == rhs.kind && lhs.delay == rhs.delay && lhs.l2_write_latency == rhs.l2_write_latency;
}

[[nodiscard]] _CCCL_HOST_DEVICE_API constexpr friend bool
operator!=(const LookbackDelayPolicy& lhs, const LookbackDelayPolicy& rhs) noexcept
{
return !(lhs == rhs);
}

#if _CCCL_HOSTED()
friend ::std::ostream& operator<<(::std::ostream& os, const LookbackDelayPolicy& p)
{
return os << "LookbackDelayPolicy { .kind = " << p.kind << ", .delay = " << p.delay
<< ", .l2_write_latency = " << p.l2_write_latency << " }";
}
#endif // _CCCL_HOSTED()
};

namespace detail
{
template <typename DelayConstructor>
Expand Down
Loading
Loading