Template Struct BaseDigitExtractor

Inheritance Relationships

Derived Types

Struct Documentation

template<typename KeyT>
struct hipcub::BaseDigitExtractor

Base struct for digit extractor. Contains common code to provide special handling for floating-point -0.0.

Note

This handles correctly both the case when the keys are bitwise-complemented after twiddling for descending sort (in onesweep) as well as when the keys are not bit-negated, but the implementation handles descending sort separately (in other implementations in CUB). Twiddling alone maps -0.0f to 0x7fffffff and +0.0f to 0x80000000 for float, which are subsequent bit patterns and bitwise complements of each other. For onesweep, both -0.0f and +0.0f are mapped to the bit pattern of +0.0f (0x80000000) for ascending sort, and to the pattern of -0.0f (0x7fffffff) for descending sort. For all other sorting implementations in CUB, both are always mapped to +0.0f. Since bit patterns for both -0.0f and +0.0f are next to each other and only one of them is used, the sorting works correctly. For double, the same applies, but with 64-bit patterns.

Subclassed by hipcub::BFEDigitExtractor< KeyT >, hipcub::ShiftDigitExtractor< KeyT >

Public Types

enum [anonymous]

Values:

enumerator FLOAT_KEY
typedef Traits<KeyT> TraitsT
typedef TraitsT::UnsignedBits UnsignedBits

Public Static Functions

__device__ __forceinline__ static inline UnsignedBits ProcessFloatMinusZero(UnsignedBits key)