Use avx512f across entire checkRangeRead call tree

Keeping the avx fallback
This commit is contained in:
2024-07-01 13:07:34 -07:00
parent 1f421e95ff
commit bb84792cff
+29 -2
View File
@@ -1907,8 +1907,8 @@ bool scan16(const InternalVersionT *vs, const uint8_t *is, int begin, int end,
//
// always_inline So that we can optimize when begin or end is a constant.
template <bool kAVX512>
inline __attribute((always_inline)) bool scan16(const InternalVersionT *vs,
int begin, int end,
inline __attribute__((always_inline)) bool
scan16(const InternalVersionT *vs, int begin, int end,
InternalVersionT readVersion) {
assert(0 <= begin && begin < 16);
assert(0 <= end && end <= 16);
@@ -2512,6 +2512,33 @@ bool checkRangeReadImpl(Node *n, std::span<const uint8_t> begin,
return checkRangeLeftSide.ok & checkRangeRightSide.ok;
}
#ifdef __x86_64__
// Explicitly instantiate with target avx512f attribute so the compiler can
// inline compare16_32bit_avx512, and generally use avx512f within more
// functions
template __attribute__((target("avx512f"))) bool
scan16<true>(const InternalVersionT *vs, const uint8_t *is, int begin, int end,
InternalVersionT readVersion);
template __attribute__((always_inline, target("avx512f"))) bool
scan16<true>(const InternalVersionT *vs, int begin, int end,
InternalVersionT readVersion);
template __attribute__((target("avx512f"))) bool
checkMaxBetweenExclusive<true>(Node *n, int begin, int end,
InternalVersionT readVersion);
template __attribute__((target("avx512f"))) bool
checkRangeStartsWith<true>(Node *n, std::span<const uint8_t> key, int begin,
int end, InternalVersionT readVersion,
ConflictSet::Impl *impl);
template __attribute__((target("avx512f"))) bool
CheckRangeLeftSide<true>::step();
template __attribute__((target("avx512f"))) bool
CheckRangeRightSide<true>::step();
template __attribute__((target("avx512f"))) bool
checkRangeReadImpl<true>(Node *n, std::span<const uint8_t> begin,
std::span<const uint8_t> end,
InternalVersionT readVersion, ConflictSet::Impl *impl);
#endif
#if defined(__SANITIZE_THREAD__) || !defined(__x86_64__)
bool checkRangeRead(Node *n, std::span<const uint8_t> begin,
std::span<const uint8_t> end, InternalVersionT readVersion,