[eigen] Replacing AVX code with Eigen PacketMath ? |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: [eigen] Replacing AVX code with Eigen PacketMath ?
- From: Bogdan Burlacu <bogdan.burlacu@xxxxx>
- Date: Fri, 17 Jan 2020 14:35:18 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=proton; t=1579271726; bh=slPrcFOdHE4dpphQSPe3pKHXBTqNMqw/3HCeS5cqvaA=; h=Date:To:From:Reply-To:Subject:Feedback-ID:From; b=dgG/CKZ9Ro3nt5bQnQKmgXatMtqfXx8JWfHoDsf8ZTVXq792YkIwseCFhP+iExzY7 pcvG1lrQrtVCfmuU2cnRLxXIPpLLc11vA5lEEXl8pEgie8lidZISX6VV+dt1vejX+v jq0zUvTbGkqfgdSUEr2k4UME2b18lqC8pUOmBOG+kqiIv4BMqud5Tdvfwr/5d171La BhmpTZd+xMXXKRGHr9xb0Udn+zhl7EYRwS8Tw0sT+B6109khzyw08mUjzDwycEvN/v +Rbr3BkksO7rHoaJZJP1r2kyIRjgD18Q6Raf5hJLqAMBgV/WqB3LIPdRBKWPUtxz+g JSxWNXkYY0Pxg==
- Feedback-id: fwJjt3cPE9kRNe5yN0sXh3uywMpKdyZRIWOQjGds0aRXWN0Fn0jqkSiAi9HkNMNTBb0oRei8vJP2wFfXRUWMeg==:Ext:ProtonMail
Hi,
I have a project where I'm already using Eigen for computations. I was
wondering if I can rewrite some hand-written AVX2 code using Eigen types
(I'm looking at Packets in particular):
constexpr int shift_one { _MM_SHUFFLE(0, 3, 2, 1) };
constexpr int shift_two { _MM_SHUFFLE(1, 0, 3, 2) };
constexpr int shift_thr { _MM_SHUFFLE(2, 1, 0, 3) };
static inline bool _mm256_is_zero(__m256i m) noexcept { return
_mm256_testz_si256(m, m); }
static inline bool NullIntersectProbe(uint64_t const* lhs,
uint64_t const* rhs) noexcept
{
__m256i a { _mm256_load_si256((__m256i*)lhs) };
__m256i b { _mm256_load_si256((__m256i*)rhs) };
__m256i r0 { _mm256_cmpeq_epi64(a, b) };
if (!_mm256_is_zero(r0))
return false;
__m256i r1 { _mm256_cmpeq_epi64(a,
_mm256_permute4x64_epi64(b, shift_one)) };
if (!_mm256_is_zero(r1))
return false;
__m256i r2 { _mm256_cmpeq_epi64(a,
_mm256_permute4x64_epi64(b, shift_two)) };
if (!_mm256_is_zero(r2))
return false;
__m256i r3 { _mm256_cmpeq_epi64(a,
_mm256_permute4x64_epi64(b, shift_thr)) };
return _mm256_is_zero(r3);
}
I would like to make the code more generic so that it would work on
other x86_64 CPU flavors.
Is there any documentation for this low-level stuff or should I just
look at eg PacketMath.h?
Best,
Bogdan