Vectorize all bounds checks for Node256 scan
Some checks failed
Tests / Clang total: 1038, passed: 1038
Clang |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |0|0|0|0|:clap:
Tests / SIMD fallback total: 1038, passed: 1038
Tests / Release [gcc] total: 1038, passed: 1038
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |0|0|0|0|:clap:
Tests / Release [gcc,aarch64] total: 775, passed: 775
Tests / Coverage total: 779, passed: 779
weaselab/conflict-set/pipeline/head There was a failure building this commit

This commit is contained in:
2024-06-27 17:40:23 -07:00
parent 12c6ed2568
commit 5378a06c39

View File

@@ -1779,6 +1779,7 @@ bool checkMaxBetweenExclusive(Node *n, int begin, int end,
}
// [begin, end) is now the half-open interval of children we're interested in.
assert(begin < end);
const unsigned shiftUpperBound = end - begin;
const unsigned shiftAmount = begin;
@@ -1825,31 +1826,54 @@ bool checkMaxBetweenExclusive(Node *n, int begin, int end,
}
const int firstPage = begin >> Node256::kMaxOfMaxShift;
const int lastPage = (end - 1) >> Node256::kMaxOfMaxShift;
if (firstPage == lastPage) {
if (self->maxOfMax[firstPage] <= readVersion) {
return true;
}
uint64_t conflict = 0;
// Check all in page
for (int i = 0; i < Node256::kMaxOfMaxPageSize; ++i) {
conflict |=
(self->childMaxVersion[(firstPage << Node256::kMaxOfMaxShift) + i] >
readVersion)
<< i;
}
// Mask away out of bounds
const int intraPageBegin = begin & (Node256::kMaxOfMaxPageSize - 1);
const int intraPageEnd = end - (lastPage << Node256::kMaxOfMaxShift);
conflict &= (1 << intraPageEnd) - 1;
conflict >>= intraPageBegin;
return !conflict;
}
// Check the first page
if (self->maxOfMax[firstPage] > readVersion) {
bool result = true;
uint64_t conflict = 0;
for (int i = 0; i < Node256::kMaxOfMaxPageSize; ++i) {
int j = (begin & ~(Node256::kMaxOfMaxPageSize - 1)) + i;
result &= !((self->childMaxVersion[j] > readVersion) & inBounds(j));
int j = (firstPage << Node256::kMaxOfMaxShift) + i;
conflict |= (self->childMaxVersion[j] > readVersion) << i;
}
if (!result) {
return result;
const int intraPageBegin = begin & (Node256::kMaxOfMaxPageSize - 1);
conflict >>= intraPageBegin;
if (conflict) {
return false;
}
}
// Check the last page
if (self->maxOfMax[lastPage] > readVersion) {
bool result = true;
uint64_t conflict = 0;
for (int i = 0; i < Node256::kMaxOfMaxPageSize; ++i) {
int j = ((end - 1) & ~(Node256::kMaxOfMaxPageSize - 1)) + i;
result &= !((self->childMaxVersion[j] > readVersion) & inBounds(j));
int j = (lastPage << Node256::kMaxOfMaxShift) + i;
conflict |= (self->childMaxVersion[j] > readVersion) << i;
}
if (!result) {
return result;
const int intraPageEnd = end - (lastPage << Node256::kMaxOfMaxShift);
conflict &= (1 << intraPageEnd) - 1;
if (conflict) {
return false;
}
}
uint64_t conflict = 0;
// Check all pages
for (int i = 0; i < Node256::kMaxOfMaxTotalPages; ++i) {
// Check all possible inner pages
for (int i = 1; i < Node256::kMaxOfMaxTotalPages - 1; ++i) {
conflict |= (self->maxOfMax[i] > readVersion) << i;
}
// Only keep inner pages