feat optim
This commit is contained in:
parent
4b572d8cfa
commit
a7d47c26f6
@ -337,7 +337,7 @@ find_row_mask(std::vector<set_t> &sets,
|
|||||||
fprintf(stderr, "worker_step: %ld\n", step);
|
fprintf(stderr, "worker_step: %ld\n", step);
|
||||||
|
|
||||||
for (int i = 0; i < thread_num; ++i) {
|
for (int i = 0; i < thread_num; ++i) {
|
||||||
workers.emplace_back([&] {
|
workers.emplace_back([=, &row_mask, &found, &lock] {
|
||||||
while (!found) {
|
while (!found) {
|
||||||
uint64_t cur_mask = last_mask;
|
uint64_t cur_mask = last_mask;
|
||||||
{
|
{
|
||||||
@ -350,7 +350,29 @@ find_row_mask(std::vector<set_t> &sets,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < step && cur_mask < last_mask; ++i) {
|
for (int i = 0; i < step && cur_mask < last_mask; ++i) {
|
||||||
if (!found.load(std::memory_order_relaxed) && resolve(cur_mask)) {
|
if (found.load(std::memory_order_relaxed)) { break; }
|
||||||
|
|
||||||
|
if (cur_mask & LS_BITMASK(CL_SHIFT)) {
|
||||||
|
cur_mask = next_bit_permutation(row_mask);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
bool mismatch = false;
|
||||||
|
for (auto addr_pool : same_row_sets) {
|
||||||
|
addr_tuple base_addr = addr_pool[0];
|
||||||
|
for (int i = 1; i < addr_pool.size(); i++) {
|
||||||
|
addr_tuple tmp = addr_pool[i];
|
||||||
|
if ((tmp.p_addr & row_mask) != (base_addr.p_addr & cur_mask)) {
|
||||||
|
mismatch = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mismatch) { break; }
|
||||||
|
}
|
||||||
|
if (mismatch) {
|
||||||
|
cur_mask = next_bit_permutation(row_mask);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> _(lock);
|
std::lock_guard<std::mutex> _(lock);
|
||||||
if (!found.exchange(true)) {
|
if (!found.exchange(true)) {
|
||||||
row_mask = cur_mask;
|
row_mask = cur_mask;
|
||||||
@ -358,7 +380,6 @@ find_row_mask(std::vector<set_t> &sets,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user