Skip to content

Commit db77809

Browse files
committed
Use length 1 SIMD arrays for AD Types.
1 parent f89bcfd commit db77809

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Common/include/parallelization/vectorization.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,18 @@ constexpr size_t PREFERRED_SIZE = 8;
5656
*/
5757
template<class T>
5858
constexpr size_t preferredLen() { return PREFERRED_SIZE / sizeof(T); }
59+
60+
#if !defined(CODI_REVERSE_TYPE) && !defined(CODI_FORWARD_TYPE)
5961
template<>
6062
constexpr size_t preferredLen<su2double>() { return PREFERRED_SIZE / sizeof(passivedouble); }
63+
#else
64+
/* enforce one element per SIMD array since (1) arrays of AD types cannot be auto vectorized and (2) they might violate
65+
* exclusive read declarations if masking is not applied throughout */
66+
template<>
67+
constexpr size_t preferredLen<su2double>() { return 1; }
68+
#endif
69+
70+
6171

6272
/*!
6373
* \class Array

0 commit comments

Comments
 (0)