From 3c5ddb73d4b28248c068b6f067ed23a40abbd517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20BRIOL?= Date: Tue, 21 May 2024 10:49:18 +0200 Subject: [PATCH 1/6] Refactor Eigen code to use constexpr for data() functions --- Eigen/src/Core/ArrayWrapper.h | 8 ++++---- Eigen/src/Core/Block.h | 2 +- Eigen/src/Core/DenseStorage.h | 26 +++++++++++++------------- Eigen/src/Core/GeneralProduct.h | 8 ++++---- Eigen/src/Core/MapBase.h | 6 +++--- Eigen/src/Core/Transpose.h | 4 ++-- Eigen/src/Core/util/MaxSizeVector.h | 12 ++++++------ Eigen/src/SparseCore/SparseVector.h | 4 ++-- 8 files changed, 35 insertions(+), 35 deletions(-) diff --git a/Eigen/src/Core/ArrayWrapper.h b/Eigen/src/Core/ArrayWrapper.h index b45395d7a..b636d88ad 100644 --- a/Eigen/src/Core/ArrayWrapper.h +++ b/Eigen/src/Core/ArrayWrapper.h @@ -65,8 +65,8 @@ class ArrayWrapper : public ArrayBase > { return m_expression.innerStride(); } - EIGEN_DEVICE_FUNC inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } - EIGEN_DEVICE_FUNC inline const Scalar* data() const { return m_expression.data(); } + EIGEN_DEVICE_FUNC constexpr ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } + EIGEN_DEVICE_FUNC constexpr const Scalar* data() const { return m_expression.data(); } EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index rowId, Index colId) const { return m_expression.coeffRef(rowId, colId); @@ -144,8 +144,8 @@ class MatrixWrapper : public MatrixBase > { return m_expression.innerStride(); } - EIGEN_DEVICE_FUNC inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } - EIGEN_DEVICE_FUNC inline const Scalar* data() const { return m_expression.data(); } + EIGEN_DEVICE_FUNC constexpr ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } + EIGEN_DEVICE_FUNC constexpr const Scalar* data() const { return m_expression.data(); } EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index rowId, Index colId) const { return m_expression.derived().coeffRef(rowId, colId); diff --git a/Eigen/src/Core/Block.h b/Eigen/src/Core/Block.h index 9b16ed289..709264c69 100644 --- a/Eigen/src/Core/Block.h +++ b/Eigen/src/Core/Block.h @@ -278,7 +278,7 @@ class BlockImpl_dense : public internal::dense_xpr_base { m_cols = cols; eigen_assert(m_rows * m_cols == 0 && "The number of rows times columns must equal the storage size."); } - EIGEN_DEVICE_FUNC const T* data() const { return nullptr; } - EIGEN_DEVICE_FUNC T* data() { return nullptr; } + EIGEN_DEVICE_FUNC constexpr const T* data() const { return nullptr; } + EIGEN_DEVICE_FUNC constexpr T* data() { return nullptr; } }; template @@ -288,8 +288,8 @@ class DenseStorage { m_cols = cols; eigen_assert(Rows_ * m_cols == 0 && "The number of rows times columns must equal the storage size."); } - EIGEN_DEVICE_FUNC const T* data() const { return nullptr; } - EIGEN_DEVICE_FUNC T* data() { return nullptr; } + EIGEN_DEVICE_FUNC constexpr const T* data() const { return nullptr; } + EIGEN_DEVICE_FUNC constexpr T* data() { return nullptr; } }; template @@ -318,8 +318,8 @@ class DenseStorage { m_rows = rows; eigen_assert(m_rows * Cols_ == 0 && "The number of rows times columns must equal the storage size."); } - EIGEN_DEVICE_FUNC const T* data() const { return nullptr; } - EIGEN_DEVICE_FUNC T* data() { return nullptr; } + EIGEN_DEVICE_FUNC constexpr const T* data() const { return nullptr; } + EIGEN_DEVICE_FUNC constexpr T* data() { return nullptr; } }; // dynamic-size matrix with fixed-size storage @@ -507,8 +507,8 @@ class DenseStorage { m_rows = rows; m_cols = cols; } - EIGEN_DEVICE_FUNC const T* data() const { return m_data; } - EIGEN_DEVICE_FUNC T* data() { return m_data; } + EIGEN_DEVICE_FUNC constexpr const T* data() const { return m_data; } + EIGEN_DEVICE_FUNC constexpr T* data() { return m_data; } }; // matrix with dynamic width and fixed height (so that matrix has dynamic size). @@ -574,8 +574,8 @@ class DenseStorage { } m_cols = cols; } - EIGEN_DEVICE_FUNC const T* data() const { return m_data; } - EIGEN_DEVICE_FUNC T* data() { return m_data; } + EIGEN_DEVICE_FUNC constexpr const T* data() const { return m_data; } + EIGEN_DEVICE_FUNC constexpr T* data() { return m_data; } }; // matrix with dynamic height and fixed width (so that matrix has dynamic size). @@ -640,9 +640,9 @@ class DenseStorage { EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) } m_rows = rows; - } - EIGEN_DEVICE_FUNC const T* data() const { return m_data; } - EIGEN_DEVICE_FUNC T* data() { return m_data; } + }constexpr + EIGEN_DEVICE_FUNC constexpr const T* data() const { return m_data; } + EIGEN_DEVICE_FUNC constexpr T* data() { return m_data; } }; } // end namespace Eigen diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index b7ae44fda..c2fbcddb3 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -229,7 +229,7 @@ struct gemv_static_vector_if; template struct gemv_static_vector_if { - EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Scalar* data() { + EIGEN_STRONG_INLINE constexpr Scalar* data() { eigen_internal_assert(false && "should never be called"); return 0; } @@ -237,19 +237,19 @@ struct gemv_static_vector_if { template struct gemv_static_vector_if { - EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Scalar* data() { return 0; } + EIGEN_STRONG_INLINE constexpr Scalar* data() { return 0; } }; template struct gemv_static_vector_if { #if EIGEN_MAX_STATIC_ALIGN_BYTES != 0 internal::plain_array m_data; - EIGEN_STRONG_INLINE Scalar* data() { return m_data.array; } + constexpr Scalar* data() { return m_data.array; } #else // Some architectures cannot align on the stack, // => let's manually enforce alignment by allocating more data and return the address of the first aligned element. internal::plain_array m_data; - EIGEN_STRONG_INLINE Scalar* data() { + constexpr Scalar* data() { return reinterpret_cast((std::uintptr_t(m_data.array) & ~(std::size_t(EIGEN_MAX_ALIGN_BYTES - 1))) + EIGEN_MAX_ALIGN_BYTES); } diff --git a/Eigen/src/Core/MapBase.h b/Eigen/src/Core/MapBase.h index da95b5c40..1e83fdf70 100644 --- a/Eigen/src/Core/MapBase.h +++ b/Eigen/src/Core/MapBase.h @@ -94,7 +94,7 @@ class MapBase : public internal::dense_xpr_base : public MapBase::value, Scalar, const Scalar> ScalarWithConstIfNotLvalue; - EIGEN_DEVICE_FUNC inline const Scalar* data() const { return this->m_data; } - EIGEN_DEVICE_FUNC inline ScalarWithConstIfNotLvalue* data() { + EIGEN_DEVICE_FUNC constexpr const Scalar* data() const { return this->m_data; } + EIGEN_DEVICE_FUNC constexpr ScalarWithConstIfNotLvalue* data() { return this->m_data; } // no const-cast here so non-const-correct code will give a compile error diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h index 1cc7a2867..e54a33584 100644 --- a/Eigen/src/Core/Transpose.h +++ b/Eigen/src/Core/Transpose.h @@ -119,10 +119,10 @@ class TransposeImpl : public internal::TransposeImpl_base::value, Scalar, const Scalar> ScalarWithConstIfNotLvalue; - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ScalarWithConstIfNotLvalue* data() { + EIGEN_DEVICE_FUNC constexpr ScalarWithConstIfNotLvalue* data() { return derived().nestedExpression().data(); } - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar* data() const { return derived().nestedExpression().data(); } + EIGEN_DEVICE_FUNC constexpr const Scalar* data() const { return derived().nestedExpression().data(); } // FIXME: shall we keep the const version of coeffRef? EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& coeffRef(Index rowId, Index colId) const { diff --git a/Eigen/src/Core/util/MaxSizeVector.h b/Eigen/src/Core/util/MaxSizeVector.h index 2f1e3d35e..276dc2cf9 100644 --- a/Eigen/src/Core/util/MaxSizeVector.h +++ b/Eigen/src/Core/util/MaxSizeVector.h @@ -116,17 +116,17 @@ class MaxSizeVector { EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool empty() const { return size_ == 0; } - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T* data() { return data_; } + EIGEN_DEVICE_FUNC constexpr T* data() { return data_; } - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const T* data() const { return data_; } + EIGEN_DEVICE_FUNC constexpr const T* data() const { return data_; } - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T* begin() { return data_; } + EIGEN_DEVICE_FUNC constexpr T* begin() { return data_; } - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T* end() { return data_ + size_; } + EIGEN_DEVICE_FUNC constexpr T* end() { return data_ + size_; } - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const T* begin() const { return data_; } + EIGEN_DEVICE_FUNC constexpr const T* begin() const { return data_; } - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const T* end() const { return data_ + size_; } + EIGEN_DEVICE_FUNC constexpr const T* end() const { return data_ + size_; } private: size_t reserve_; diff --git a/Eigen/src/SparseCore/SparseVector.h b/Eigen/src/SparseCore/SparseVector.h index fac162e93..e390a3b18 100644 --- a/Eigen/src/SparseCore/SparseVector.h +++ b/Eigen/src/SparseCore/SparseVector.h @@ -90,9 +90,9 @@ class SparseVector : public SparseCompressedBase= 0 && row < m_size) : (row == 0 && col >= 0 && col < m_size)); -- GitLab From a833f17c290242e2c7a1bb01d61f425fa4322023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20BRIOL?= Date: Tue, 21 May 2024 10:58:23 +0200 Subject: [PATCH 2/6] Refactor DenseStorage.h to remove unnecessary constexpr keyword --- Eigen/src/Core/DenseStorage.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Eigen/src/Core/DenseStorage.h b/Eigen/src/Core/DenseStorage.h index fcf25a486..49c409941 100644 --- a/Eigen/src/Core/DenseStorage.h +++ b/Eigen/src/Core/DenseStorage.h @@ -640,7 +640,7 @@ class DenseStorage { EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) } m_rows = rows; - }constexpr + } EIGEN_DEVICE_FUNC constexpr const T* data() const { return m_data; } EIGEN_DEVICE_FUNC constexpr T* data() { return m_data; } }; -- GitLab From 4391e30fd2c238dde23b9f997156757ecae11b04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20BRIOL?= Date: Tue, 21 May 2024 10:59:12 +0200 Subject: [PATCH 3/6] Refactor data() functions to use constexpr --- Eigen/src/Core/PlainObjectBase.h | 4 ++-- Eigen/src/Core/Reshaped.h | 2 +- Eigen/src/Core/util/BlasUtil.h | 4 ++-- Eigen/src/Geometry/Transform.h | 4 ++-- Eigen/src/SparseCore/SparseMatrix.h | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Eigen/src/Core/PlainObjectBase.h b/Eigen/src/Core/PlainObjectBase.h index 5f846a0f1..c06dd8bb2 100644 --- a/Eigen/src/Core/PlainObjectBase.h +++ b/Eigen/src/Core/PlainObjectBase.h @@ -270,10 +270,10 @@ class PlainObjectBase : public internal::dense_xpr_base::type } /** \returns a const pointer to the data array of this matrix */ - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar* data() const { return m_storage.data(); } + EIGEN_DEVICE_FUNC constexpr const Scalar* data() const { return m_storage.data(); } /** \returns a pointer to the data array of this matrix */ - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar* data() { return m_storage.data(); } + EIGEN_DEVICE_FUNC constexpr Scalar* data() { return m_storage.data(); } /** Resizes \c *this to a \a rows x \a cols matrix. * diff --git a/Eigen/src/Core/Reshaped.h b/Eigen/src/Core/Reshaped.h index b881dd6cd..4b34e16f6 100644 --- a/Eigen/src/Core/Reshaped.h +++ b/Eigen/src/Core/Reshaped.h @@ -173,7 +173,7 @@ class ReshapedImpl_dense #ifdef EIGEN_PARSED_BY_DOXYGEN /** \sa MapBase::data() */ - EIGEN_DEVICE_FUNC inline const Scalar* data() const; + EIGEN_DEVICE_FUNC constexpr const Scalar* data() const; EIGEN_DEVICE_FUNC inline Index innerStride() const; EIGEN_DEVICE_FUNC inline Index outerStride() const; #endif diff --git a/Eigen/src/Core/util/BlasUtil.h b/Eigen/src/Core/util/BlasUtil.h index c2994b204..19d9917d7 100644 --- a/Eigen/src/Core/util/BlasUtil.h +++ b/Eigen/src/Core/util/BlasUtil.h @@ -241,7 +241,7 @@ class blas_data_mapper { EIGEN_DEVICE_FUNC const Index stride() const { return m_stride; } EIGEN_DEVICE_FUNC const Index incr() const { return 1; } - EIGEN_DEVICE_FUNC const Scalar* data() const { return m_data; } + EIGEN_DEVICE_FUNC constexpr const Scalar* data() const { return m_data; } EIGEN_DEVICE_FUNC Index firstAligned(Index size) const { if (std::uintptr_t(m_data) % sizeof(Scalar)) { @@ -430,7 +430,7 @@ class blas_data_mapper { EIGEN_DEVICE_FUNC const Index stride() const { return m_stride; } EIGEN_DEVICE_FUNC const Index incr() const { return m_incr.value(); } - EIGEN_DEVICE_FUNC Scalar* data() const { return m_data; } + EIGEN_DEVICE_FUNC constexpr Scalar* data() const { return m_data; } protected: Scalar* EIGEN_RESTRICT m_data; diff --git a/Eigen/src/Geometry/Transform.h b/Eigen/src/Geometry/Transform.h index fd3fc58f4..b1a9f21fa 100644 --- a/Eigen/src/Geometry/Transform.h +++ b/Eigen/src/Geometry/Transform.h @@ -588,9 +588,9 @@ class Transform { EIGEN_DEVICE_FUNC inline Transform inverse(TransformTraits traits = (TransformTraits)Mode) const; /** \returns a const pointer to the column major internal matrix */ - EIGEN_DEVICE_FUNC const Scalar* data() const { return m_matrix.data(); } + EIGEN_DEVICE_FUNC constexpr const Scalar* data() const { return m_matrix.data(); } /** \returns a non-const pointer to the column major internal matrix */ - EIGEN_DEVICE_FUNC Scalar* data() { return m_matrix.data(); } + EIGEN_DEVICE_FUNC constexpr Scalar* data() { return m_matrix.data(); } /** \returns \c *this with scalar type casted to \a NewScalarType * diff --git a/Eigen/src/SparseCore/SparseMatrix.h b/Eigen/src/SparseCore/SparseMatrix.h index fd92ab076..cabaa48fd 100644 --- a/Eigen/src/SparseCore/SparseMatrix.h +++ b/Eigen/src/SparseCore/SparseMatrix.h @@ -202,9 +202,9 @@ class SparseMatrix : public SparseCompressedBase Date: Tue, 21 May 2024 11:12:37 +0200 Subject: [PATCH 4/6] Apply clang-format. --- Eigen/src/Core/Transpose.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h index e54a33584..0b00f2de1 100644 --- a/Eigen/src/Core/Transpose.h +++ b/Eigen/src/Core/Transpose.h @@ -119,9 +119,7 @@ class TransposeImpl : public internal::TransposeImpl_base::value, Scalar, const Scalar> ScalarWithConstIfNotLvalue; - EIGEN_DEVICE_FUNC constexpr ScalarWithConstIfNotLvalue* data() { - return derived().nestedExpression().data(); - } + EIGEN_DEVICE_FUNC constexpr ScalarWithConstIfNotLvalue* data() { return derived().nestedExpression().data(); } EIGEN_DEVICE_FUNC constexpr const Scalar* data() const { return derived().nestedExpression().data(); } // FIXME: shall we keep the const version of coeffRef? -- GitLab From 431f93c5711ae060f1c7634c8dc6dbcd3961cb61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20BRIOL?= Date: Sat, 21 Sep 2024 22:17:54 +0200 Subject: [PATCH 5/6] Fix compiler warnings: definition of implicit copy assignment operator for Stride is deprecated due to the presence of a user-provided copy constructor [-Wdeprecated-copy-with-user-provided-copy] --- Eigen/src/Core/Stride.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Eigen/src/Core/Stride.h b/Eigen/src/Core/Stride.h index a8fdeaf37..14b025c46 100644 --- a/Eigen/src/Core/Stride.h +++ b/Eigen/src/Core/Stride.h @@ -70,6 +70,13 @@ class Stride { /** Copy constructor */ EIGEN_DEVICE_FUNC Stride(const Stride& other) : m_outer(other.outer()), m_inner(other.inner()) {} + /** Copy assignment operator */ + EIGEN_DEVICE_FUNC Stride& operator=(const Stride& other) { + m_outer.setValue(other.outer()); + m_inner.setValue(other.inner()); + return *this; + } + /** \returns the outer stride */ EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index outer() const { return m_outer.value(); } /** \returns the inner stride */ -- GitLab From 4839bfada6769375b9be609476505e550e49e6b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20BRIOL?= Date: Sat, 21 Sep 2024 22:32:11 +0200 Subject: [PATCH 6/6] Keep EIGEN_STRONG_INLINE or EIGEN_ALWAYS_INLINE macros even if the functions are constexpr. --- Eigen/src/Core/GeneralProduct.h | 8 ++++---- Eigen/src/Core/Transpose.h | 8 ++++++-- Eigen/src/Core/util/MaxSizeVector.h | 12 ++++++------ 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index c2fbcddb3..dc1248137 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -229,7 +229,7 @@ struct gemv_static_vector_if; template struct gemv_static_vector_if { - EIGEN_STRONG_INLINE constexpr Scalar* data() { + EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC constexpr Scalar* data() { eigen_internal_assert(false && "should never be called"); return 0; } @@ -237,19 +237,19 @@ struct gemv_static_vector_if { template struct gemv_static_vector_if { - EIGEN_STRONG_INLINE constexpr Scalar* data() { return 0; } + EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC constexpr Scalar* data() { return 0; } }; template struct gemv_static_vector_if { #if EIGEN_MAX_STATIC_ALIGN_BYTES != 0 internal::plain_array m_data; - constexpr Scalar* data() { return m_data.array; } + EIGEN_STRONG_INLINE constexpr Scalar* data() { return m_data.array; } #else // Some architectures cannot align on the stack, // => let's manually enforce alignment by allocating more data and return the address of the first aligned element. internal::plain_array m_data; - constexpr Scalar* data() { + EIGEN_STRONG_INLINE constexpr Scalar* data() { return reinterpret_cast((std::uintptr_t(m_data.array) & ~(std::size_t(EIGEN_MAX_ALIGN_BYTES - 1))) + EIGEN_MAX_ALIGN_BYTES); } diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h index 0b00f2de1..89e3d95fd 100644 --- a/Eigen/src/Core/Transpose.h +++ b/Eigen/src/Core/Transpose.h @@ -119,8 +119,12 @@ class TransposeImpl : public internal::TransposeImpl_base::value, Scalar, const Scalar> ScalarWithConstIfNotLvalue; - EIGEN_DEVICE_FUNC constexpr ScalarWithConstIfNotLvalue* data() { return derived().nestedExpression().data(); } - EIGEN_DEVICE_FUNC constexpr const Scalar* data() const { return derived().nestedExpression().data(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr ScalarWithConstIfNotLvalue* data() { + return derived().nestedExpression().data(); + } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const Scalar* data() const { + return derived().nestedExpression().data(); + } // FIXME: shall we keep the const version of coeffRef? EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& coeffRef(Index rowId, Index colId) const { diff --git a/Eigen/src/Core/util/MaxSizeVector.h b/Eigen/src/Core/util/MaxSizeVector.h index 276dc2cf9..54b556dd0 100644 --- a/Eigen/src/Core/util/MaxSizeVector.h +++ b/Eigen/src/Core/util/MaxSizeVector.h @@ -116,17 +116,17 @@ class MaxSizeVector { EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool empty() const { return size_ == 0; } - EIGEN_DEVICE_FUNC constexpr T* data() { return data_; } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return data_; } - EIGEN_DEVICE_FUNC constexpr const T* data() const { return data_; } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return data_; } - EIGEN_DEVICE_FUNC constexpr T* begin() { return data_; } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* begin() { return data_; } - EIGEN_DEVICE_FUNC constexpr T* end() { return data_ + size_; } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* end() { return data_ + size_; } - EIGEN_DEVICE_FUNC constexpr const T* begin() const { return data_; } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* begin() const { return data_; } - EIGEN_DEVICE_FUNC constexpr const T* end() const { return data_ + size_; } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* end() const { return data_ + size_; } private: size_t reserve_; -- GitLab