From 8f6094233ad762eb208021041477b937146ee188 Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Tue, 21 Sep 2021 14:01:04 +0200 Subject: [PATCH] re-enable auto-vectorization --- src/include/access.h | 12 +++++++----- src/include/cxz_operation.cc.h | 10 +++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/include/access.h b/src/include/access.h index c9ffeb1..bd46f56 100644 --- a/src/include/access.h +++ b/src/include/access.h @@ -90,6 +90,7 @@ namespace CNORXZ protected: AccessTemplate() = default; + }; template @@ -146,22 +147,23 @@ namespace CNORXZ public: VPointerAccess(T* ptr, T* origPtr) : mPtr(ptr), mOrigPtr(origPtr) {} + + VPointerAccess(const PointerAccess& in) : mPtr(in.get(0)), mOrigPtr(in.oget(0)) {} VPointerAccess(const VPointerAccess& in) = default; VPointerAccess(VPointerAccess&& in) = default; VPointerAccess& operator=(const VPointerAccess& in) = default; VPointerAccess& operator=(VPointerAccess&& in) = default; - VType* get(size_t pos) { return reinterpret_cast*>(mPtr+pos); } - VType* get(size_t pos) const { return reinterpret_cast*>(mPtr+pos); } + value_type* get(size_t pos) { return reinterpret_cast(mPtr+pos); } + value_type* get(size_t pos) const { return reinterpret_cast(mPtr+pos); } VPointerAccess& set(size_t pos) { mPtr = mOrigPtr + pos; return *this; } - VType* oget(size_t pos) const { return reinterpret_cast*>(mOrigPtr+pos); } + value_type* oget(size_t pos) const { return reinterpret_cast(mOrigPtr+pos); } template inline void exec(size_t pos, const Op& op, ExtType e) const { - CHECK; - F::selfApply(*get(pos),op.vget(e)); + F::selfApply(*get(pos),op.template vget(e)); } }; diff --git a/src/include/cxz_operation.cc.h b/src/include/cxz_operation.cc.h index bb995d9..52b2fa6 100644 --- a/src/include/cxz_operation.cc.h +++ b/src/include/cxz_operation.cc.h @@ -483,8 +483,8 @@ namespace CNORXZ auto OperationRoot::asxExpr(const OpClass& in) const { static_assert( OpClass::SIZE == decltype(in.rootSteps())::SIZE, "Ext Size mismatch" ); - return in.loop(AssignmentExpr,OperationRoot,OpClass> - (mDataAcc,*this,in)); + return in.loop(AssignmentExpr,OpClass> + (Access(mDataAcc),*this,in)); } template @@ -541,9 +541,9 @@ namespace CNORXZ if constexpr(VABLE){ CHECK; typedef typename TarOp::value_type T; - auto x = th.template asx>(in); - //if(x.rootSteps(x.vI()) == 1){ - if(0){ + auto x = th.template asx,VPointerAccess>(in); + if(x.rootSteps(x.vI()) == 1){ + //if(0){ CHECK; x(); }