Skip to content

Commit

Permalink
default to Vc_RECURSIVE_MEMORY 1
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardmgruber authored and amadio committed May 4, 2022
1 parent 0d3597d commit fa49f6c
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 45 deletions.
8 changes: 0 additions & 8 deletions Vc/common/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define Vc_TEMPLATES_DROP_ATTRIBUTES 1
#endif

#if Vc_IS_VERSION_2 || (defined Vc_GCC && Vc_GCC >= 0x60000)
// GCC 6 optimizes the RowMemory::fromRawData hack away (common/memorybase.h). Therefore
// the 2D Memory class is implemented recursively using 1D Memory members. Since this is
// an ABI break this is only enabled for GCC 6. With Vc 2.x all implementations should do
// this.
#define Vc_RECURSIVE_MEMORY 1
#endif

#if defined Vc_CLANG || defined Vc_APPLECLANG
# define Vc_UNREACHABLE __builtin_unreachable
# define Vc_NEVER_INLINE [[gnu::noinline]]
Expand Down
29 changes: 0 additions & 29 deletions Vc/common/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,14 @@ template<typename V, size_t Size> struct _MemorySizeCalculation
* \param Size2 Number of columns
*/
template <typename V, size_t Size1, size_t Size2, bool InitPadding>
#ifdef Vc_RECURSIVE_MEMORY
class Memory : public MemoryBase<V, Memory<V, Size1, Size2, InitPadding>, 2,
Memory<V, Size2, 0, InitPadding>>
#else
class Memory : public AlignedBase<V::MemoryAlignment>,
public MemoryBase<V, Memory<V, Size1, Size2, InitPadding>, 2,
Memory<V, Size2, 0, false>>
#endif
{
public:
typedef typename V::EntryType EntryType;

private:
#ifdef Vc_RECURSIVE_MEMORY
using RowMemory = Memory<V, Size2, 0, InitPadding>;
#else
using RowMemory = Memory<V, Size2, 0, false>;
#endif
typedef MemoryBase<V, Memory<V, Size1, Size2, InitPadding>, 2, RowMemory> Base;
friend class MemoryBase<V, Memory<V, Size1, Size2, InitPadding>, 2, RowMemory>;
friend class MemoryDimensionBase<V, Memory<V, Size1, Size2, InitPadding>, 2,
Expand All @@ -93,11 +83,7 @@ class Memory : public AlignedBase<V::MemoryAlignment>,
alignas(static_cast<size_t>(Alignment)) // GCC complains about 'is not an
// integer constant' unless the
// static_cast is present
#ifdef Vc_RECURSIVE_MEMORY
RowMemory m_mem[Size1];
#else
EntryType m_mem[Size1][PaddedSize2];
#endif

public:
using Base::vector;
Expand All @@ -106,19 +92,7 @@ class Memory : public AlignedBase<V::MemoryAlignment>,
VectorsCount = PaddedSize2 / V::Size
};

#ifdef Vc_RECURSIVE_MEMORY
Memory() = default;
#else
Memory()
{
if (InitPadding) {
if (Size1 > 32)
for (size_t i = 0; i < Size1; ++i) {
V::Zero().store(&m_mem[i][PaddedSize2 - V::Size], Vc::Streaming);
}
}
}
#endif

/**
* \return the number of rows in the array.
Expand Down Expand Up @@ -223,9 +197,6 @@ class Memory : public AlignedBase<V::MemoryAlignment>,
*/
template <typename V, size_t Size, bool InitPadding>
class Memory<V, Size, 0u, InitPadding> :
#ifndef Vc_RECURSIVE_MEMORY
public AlignedBase<V::MemoryAlignment>,
#endif
public MemoryBase<V, Memory<V, Size, 0u, InitPadding>, 1, void>
{
public:
Expand Down
8 changes: 0 additions & 8 deletions Vc/common/memorybase.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,19 +330,11 @@ template<typename V, typename Parent, typename RowMemory> class MemoryDimensionB
* Returns the \p i-th row in the memory.
*/
Vc_ALWAYS_INLINE Vc_PURE RowMemory &operator[](size_t i) {
#ifdef Vc_RECURSIVE_MEMORY
return p()->m_mem[i];
#else
return RowMemory::fromRawData(entries(i));
#endif
}
/// Const overload of the above function.
Vc_ALWAYS_INLINE Vc_PURE const RowMemory &operator[](size_t i) const {
#ifdef Vc_RECURSIVE_MEMORY
return p()->m_mem[i];
#else
return RowMemory::fromRawData(const_cast<EntryType *>(entries(i)));
#endif
}

/**
Expand Down

0 comments on commit fa49f6c

Please sign in to comment.