feat: remove queue
This commit is contained in:
parent
75a468ec85
commit
578fc8e937
@ -308,6 +308,7 @@ find_row_mask(std::vector<set_t> &sets,
|
|||||||
if (row_mask & LS_BITMASK(CL_SHIFT)) { return false; }
|
if (row_mask & LS_BITMASK(CL_SHIFT)) { return false; }
|
||||||
for (auto addr_pool : same_row_sets) {
|
for (auto addr_pool : same_row_sets) {
|
||||||
if (stopped.load(std::memory_order_relaxed)) { return false; }
|
if (stopped.load(std::memory_order_relaxed)) { return false; }
|
||||||
|
|
||||||
addr_tuple base_addr = addr_pool[0];
|
addr_tuple base_addr = addr_pool[0];
|
||||||
for (int i = 1; i < addr_pool.size(); i++) {
|
for (int i = 1; i < addr_pool.size(); i++) {
|
||||||
addr_tuple tmp = addr_pool[i];
|
addr_tuple tmp = addr_pool[i];
|
||||||
@ -319,32 +320,28 @@ find_row_mask(std::vector<set_t> &sets,
|
|||||||
|
|
||||||
std::atomic_bool found{false};
|
std::atomic_bool found{false};
|
||||||
std::mutex lock;
|
std::mutex lock;
|
||||||
std::queue<uint64_t> mask_task;
|
|
||||||
|
|
||||||
while (row_mask < last_mask) {
|
// while (row_mask < last_mask) {
|
||||||
mask_task.push(row_mask);
|
// row_mask = next_bit_permutation(row_mask);
|
||||||
row_mask = next_bit_permutation(row_mask);
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::thread> workers;
|
std::vector<std::thread> workers;
|
||||||
for (int i = 0; i < 8; ++i) {
|
for (int i = 0; i < 8; ++i) {
|
||||||
workers.emplace_back([&] {
|
workers.emplace_back([&] {
|
||||||
while (!found) {
|
while (!found) {
|
||||||
uint64_t cur_mask;
|
uint64_t cur_mask = last_mask;
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> _(lock);
|
std::lock_guard<std::mutex> _(lock);
|
||||||
if (mask_task.empty()) { break; }
|
cur_mask = row_mask;
|
||||||
cur_mask = mask_task.front();
|
if (row_mask >= last_mask) { break; }
|
||||||
mask_task.pop();
|
|
||||||
verbose_printerr("[LOG] - Row mask: 0x%0lx \t\t bits: %s\n", cur_mask, bit_string(cur_mask));
|
row_mask = next_bit_permutation(row_mask);
|
||||||
|
verbose_printerr("[LOG] - Cur Row mask: 0x%0lx \t\t bits: %s\n", cur_mask, bit_string(cur_mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resolve(cur_mask, found)) {
|
if (resolve(cur_mask, found)) {
|
||||||
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;
|
|
||||||
while (!mask_task.empty()) mask_task.pop();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user