10 #ifndef __cpp_lib_atomic_ref 
   11 #    include <boost/atomic/atomic_ref.hpp> 
   17     template<
typename TArrayExtents, 
typename TRecordDim>
 
   47         template<
typename ArrayExtents>
 
   56         template<
typename ArrayExtents>
 
   68                     address *= extents[i];
 
   85         template<
typename ArrayExtents>
 
   94         template<
typename ArrayExtents>
 
  106                     address *= extents[i];
 
  121         template<
typename ArrayExtents>
 
  129                 auto longest = extents[0];
 
  131                     longest = std::max(longest, extents[i]);
 
  132                 const auto longestPO2 = bitCeil(longest);
 
  140         template<
typename ArrayExtents>
 
  148             for(size_type bit = 0; bit < (static_cast<size_type>(
sizeof(size_type)) * CHAR_BIT) / rank; bit++)
 
  149                 for(size_type i = 0; i < rank; i++)
 
  150                     r |= (ai[i] & (size_type{1} << bit)) << ((bit + 1) * (rank - 1) - i);
 
  180     template<
typename TFlatRecordDim>
 
  185         template<std::
size_t FlatRecordCoord>
 
  186         static constexpr std::size_t 
permute = FlatRecordCoord;
 
  193     template<
typename FlatOrigRecordDim, 
template<
typename, 
typename> 
typename Less>
 
  197         using FlatSortedRecordDim = mp_sort<FlatOrigRecordDim, Less>;
 
  199         template<
typename A, 
typename B>
 
  200         using LessWithIndices = Less<mp_at<FlatOrigRecordDim, A>, mp_at<FlatOrigRecordDim, B>>;
 
  203         using PermutedIndices = mp_sort<mp_iota<mp_size<FlatOrigRecordDim>>, LessWithIndices>;
 
  205         template<
typename A, 
typename B>
 
  206         using LessInvertPermutation
 
  207             = std::bool_constant<(mp_at<PermutedIndices, A>::value < mp_at<PermutedIndices, B>::value)>;
 
  210         using InversePermutedIndices = mp_sort<mp_iota<mp_size<FlatOrigRecordDim>>, LessInvertPermutation>;
 
  215         template<std::
size_t FlatRecordCoord>
 
  216         static constexpr std::size_t 
permute = mp_at_c<InversePermutedIndices, FlatRecordCoord>::value;
 
  221         template<
typename A, 
typename B>
 
  224         template<
typename A, 
typename B>
 
  230     template<
typename FlatRecordDim>
 
  235     template<
typename FlatRecordDim>
 
  240     template<
typename FlatRecordDim>
 
  248         template<
typename CountType>
 
  254             if constexpr(mp_contains<mp_list<int, unsigned int, unsigned long long int>, CountType>::value)
 
  255                 atomicAdd(&i, CountType{1});
 
  256             else if constexpr(
sizeof(CountType) == 
sizeof(
unsigned int))
 
  257                 atomicAdd(
reinterpret_cast<unsigned int*
>(&i), 1u);
 
  258             else if constexpr(
sizeof(CountType) == 
sizeof(
unsigned long long int))
 
  259                 atomicAdd(
reinterpret_cast<unsigned long long int*
>(&i), 1ull);
 
  261                 static_assert(
sizeof(CountType) == 0, 
"There is no CUDA atomicAdd for your CountType");
 
  262 #elif defined(__cpp_lib_atomic_ref) 
  263             ++std::atomic_ref<CountType>{i};
 
  265             ++boost::atomic_ref<CountType>{i};
 
#define LLAMA_FN_HOST_ACC_INLINE
std::bool_constant< alignof(A)< alignof(B)> LessAlignment
std::bool_constant<(alignof(A) > alignof(B))> MoreAlignment
void atomicInc(CountType &i)
constexpr auto product(Array< T, N > a) -> T
static constexpr std::size_t rank
ArrayIndex< T, rank > Index
constexpr auto size(const ArrayExtents &extents) -> typename ArrayExtents::value_type
constexpr auto operator()(const typename ArrayExtents::Index &ai, const ArrayExtents &extents) const -> typename ArrayExtents::value_type
Functor that maps an ArrayIndex into linear numbers using the Z-order space filling curve (Morton cod...
constexpr auto operator()(const typename ArrayExtents::Index &ai, [[maybe_unused]] const ArrayExtents &extents) const -> typename ArrayExtents::value_type
constexpr auto size(const ArrayExtents &extents) const -> typename ArrayExtents::value_type
constexpr auto operator()(const typename ArrayExtents::Index &ai, const ArrayExtents &extents) const -> typename ArrayExtents::value_type
constexpr auto size(const ArrayExtents &extents) -> typename ArrayExtents::value_type
constexpr MappingBase()=default
typename ArrayExtents::value_type size_type
typename ArrayExtents::Index ArrayIndex
TArrayExtents ArrayExtents
constexpr MappingBase(ArrayExtents extents, RecordDim={})
constexpr auto extents() const -> ArrayExtents
Retains the order of the record dimension's fields.
TFlatRecordDim FlatRecordDim
static constexpr std::size_t permute
FlatSortedRecordDim FlatRecordDim
static constexpr std::size_t permute