39 template <
typename SizeType> ARCCORE_HOST_DEVICE
inline static SizeType
44 SizeType modulo = size % SIMD_PADDING_SIZE;
48 SizeType
padding_size = ((size / SIMD_PADDING_SIZE) + 1) * SIMD_PADDING_SIZE;
52 template <
typename DataType>
55 using SizeType = Int64;
56 const SizeType size = ids.size();
61 template <
typename DataType> ARCCORE_HOST_DEVICE
static void applySimdPaddingView(Span<DataType> ids)
66 if (padding_size <= size)
71 Span<DataType> padded_ids(ids.data(), padding_size);
73 DataType last_value = ids[size - 1];
74 for (SizeType k = size; k < padding_size; ++k)
75 padded_ids[k] = last_value;
78 template <
typename DataType>
79 static void applySimdPadding(Array<DataType>& ids)
81 const Int64 size = ids.largeSize();
83 if (padding_size <= size)
85 MemoryAllocationArgs args;
87 ARCANE_FATAL(
"Allocator guaranted alignment ({0}) has to be greated than {1}",
89 if (padding_size > ids.capacity())
90 ARCANE_FATAL(
"Not enough capacity c={0} min_expected={1}", ids.capacity(),
92 applySimdPaddingView(ids.span());
95 template <
typename DataType>
96 static void checkSimdPadding(Span<const DataType> ids)
99 const Int64 size = ids.size();
101 if (padding_size <= size)
106 Span<const DataType> padded_ids(ids.data(), padding_size);
110 for (SizeType k = size; k < padding_size; ++k)
111 if (padded_ids[k] != last_id)
112 ARCANE_FATAL(
"Bad padding value i={0} expected={1} value={2}",
113 k, last_id, padded_ids[k]);