Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -326,20 +326,34 @@ ROCPRIM_DEVICE ROCPRIM_FORCE_INLINE static void

} // namespace batch_memcpy

// This is a helper struct that defines the type used for the batch memcpy operation.
// Use template specialization on IsMemCpy is done in order to avoid using std::conditional.
// Using std::conditional can result in build errors because the compiler evaluates both sides
// of the conditional.
template <bool IsMemCpy, typename InputBufferItType>
struct AliasType { };

template<typename InputBufferItType>
struct AliasType<false, InputBufferItType>
{
using type = typename std::iterator_traits<typename std::iterator_traits<InputBufferItType>::value_type>::value_type;
};

template<typename InputBufferItType>
struct AliasType<true, InputBufferItType>
{
using type = unsigned char;
};

template<bool IsMemCpy, class InputBufferItType, class OutputBufferItType, class BufferSizeItType>
struct batch_memcpy_impl
{
using input_buffer_type = typename std::iterator_traits<InputBufferItType>::value_type;
using output_buffer_type = typename std::iterator_traits<OutputBufferItType>::value_type;
using buffer_size_type = typename std::iterator_traits<BufferSizeItType>::value_type;

using input_type = typename std::iterator_traits<input_buffer_type>::value_type;
Comment thread
Naraenda marked this conversation as resolved.

using Alias =
typename std::conditional<IsMemCpy,
unsigned char,
typename std::iterator_traits<typename std::iterator_traits<
InputBufferItType>::value_type>::value_type>::type;
// This type is either unsigned char (if IsMemCpy is true) or the InputBufferItType's value type.
using Alias = typename AliasType<IsMemCpy, InputBufferItType>::type;

// Offset over buffers.
using buffer_offset_type = uint32_t;
Expand Down
Loading