Skip to content

Commit

Permalink
Rename internal SIMD load/store functions
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardmgruber committed Jan 2, 2024
1 parent 7c7bd39 commit 82ab735
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
11 changes: 7 additions & 4 deletions include/llama/RecordRef.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,10 @@ namespace llama
= isDirectListInitializable<T, Args...>;

template<typename T, typename Simd, typename RecordCoord>
LLAMA_FN_HOST_ACC_INLINE void loadSimdRecord(const T& srcRef, Simd& dstSimd, RecordCoord rc);
LLAMA_FN_HOST_ACC_INLINE void loadSimdFromField(const T& srcRef, Simd& dstSimd, RecordCoord rc);

template<typename Simd, typename T, typename RecordCoord>
LLAMA_FN_HOST_ACC_INLINE void storeSimdRecord(const Simd& srcSimd, T&& dstRef, RecordCoord rc);
LLAMA_FN_HOST_ACC_INLINE void storeSimdToField(const Simd& srcSimd, T&& dstRef, RecordCoord rc);
} // namespace internal

/// Record reference type returned by \ref View after resolving an array dimensions coordinate or partially
Expand Down Expand Up @@ -757,9 +757,12 @@ namespace llama
// to find subsequent elements. This is not a great design for now and the SIMD load/store functions should
// probably take iterators to records.
template<typename T, typename Simd, typename RecordCoord>
friend LLAMA_FN_HOST_ACC_INLINE void internal::loadSimdRecord(const T& srcRef, Simd& dstSimd, RecordCoord rc);
friend LLAMA_FN_HOST_ACC_INLINE void internal::loadSimdFromField(
const T& srcRef,
Simd& dstSimd,
RecordCoord rc);
template<typename Simd, typename T, typename RecordCoord>
friend LLAMA_FN_HOST_ACC_INLINE void internal::storeSimdRecord(
friend LLAMA_FN_HOST_ACC_INLINE void internal::storeSimdToField(
const Simd& srcSimd,
T&& dstRef,
RecordCoord rc);
Expand Down
8 changes: 4 additions & 4 deletions include/llama/Simd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ namespace llama
}();

template<typename T, typename Simd, typename RecordCoord>
LLAMA_FN_HOST_ACC_INLINE void loadSimdRecord(const T& srcRef, Simd& dstSimd, RecordCoord rc)
LLAMA_FN_HOST_ACC_INLINE void loadSimdFromField(const T& srcRef, Simd& dstSimd, RecordCoord rc)
{
using RecordDim = typename T::AccessibleRecordDim;
using FieldType = GetType<RecordDim, decltype(rc)>;
Expand Down Expand Up @@ -251,7 +251,7 @@ namespace llama
}

template<typename Simd, typename TFwd, typename RecordCoord>
LLAMA_FN_HOST_ACC_INLINE void storeSimdRecord(const Simd& srcSimd, TFwd&& dstRef, RecordCoord rc)
LLAMA_FN_HOST_ACC_INLINE void storeSimdToField(const Simd& srcSimd, TFwd&& dstRef, RecordCoord rc)
{
using T = std::remove_reference_t<TFwd>;
using RecordDim = typename T::AccessibleRecordDim;
Expand Down Expand Up @@ -313,7 +313,7 @@ namespace llama
if constexpr(isRecordRef<Simd> && isRecordRef<T>)
{
forEachLeafCoord<typename Simd::AccessibleRecordDim>([&](auto rc) LLAMA_LAMBDA_INLINE
{ internal::loadSimdRecord(srcRef, dstSimd, rc); });
{ internal::loadSimdFromField(srcRef, dstSimd, rc); });
}
// unstructured dstSimd and reference type
else if constexpr(!isRecordRef<Simd> && !isRecordRef<T>)
Expand Down Expand Up @@ -341,7 +341,7 @@ namespace llama
if constexpr(isRecordRef<Simd> && isRecordRef<T>)
{
forEachLeafCoord<typename T::AccessibleRecordDim>([&](auto rc) LLAMA_LAMBDA_INLINE
{ internal::storeSimdRecord(srcSimd, dstRef, rc); });
{ internal::storeSimdToField(srcSimd, dstRef, rc); });
}
// unstructured srcSimd and reference type
else if constexpr(!isRecordRef<Simd> && !isRecordRef<T>)
Expand Down

0 comments on commit 82ab735

Please sign in to comment.