fix: crash
This commit is contained in:
parent
50b7472da7
commit
75a468ec85
@ -304,9 +304,10 @@ find_row_mask(std::vector<set_t> &sets,
|
|||||||
const uint64_t last_mask = (row_mask << (40 - 16));
|
const uint64_t last_mask = (row_mask << (40 - 16));
|
||||||
row_mask <<= CL_SHIFT;// skip the lowest 6 bits since they're used for CL addressing
|
row_mask <<= CL_SHIFT;// skip the lowest 6 bits since they're used for CL addressing
|
||||||
|
|
||||||
auto resolve = [=](uint64_t row_mask) -> bool {
|
auto resolve = [=](uint64_t row_mask, std::atomic<bool> &stopped) -> bool {
|
||||||
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; }
|
||||||
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];
|
||||||
@ -325,9 +326,9 @@ find_row_mask(std::vector<set_t> &sets,
|
|||||||
row_mask = next_bit_permutation(row_mask);
|
row_mask = next_bit_permutation(row_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::thread> worker;
|
std::vector<std::thread> workers;
|
||||||
for (int i = 0; i < 8; ++i) {
|
for (int i = 0; i < 8; ++i) {
|
||||||
worker.emplace_back([&] {
|
workers.emplace_back([&] {
|
||||||
while (!found) {
|
while (!found) {
|
||||||
uint64_t cur_mask;
|
uint64_t cur_mask;
|
||||||
{
|
{
|
||||||
@ -338,16 +339,19 @@ find_row_mask(std::vector<set_t> &sets,
|
|||||||
verbose_printerr("[LOG] - Row mask: 0x%0lx \t\t bits: %s\n", cur_mask, bit_string(cur_mask));
|
verbose_printerr("[LOG] - Row mask: 0x%0lx \t\t bits: %s\n", cur_mask, bit_string(cur_mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resolve(cur_mask)) {
|
if (resolve(cur_mask, found)) {
|
||||||
std::lock_guard<std::mutex> _(lock);
|
std::lock_guard<std::mutex> _(lock);
|
||||||
found.store(true);
|
if (!found.exchange(true)) {
|
||||||
row_mask = cur_mask;
|
row_mask = cur_mask;
|
||||||
while (!mask_task.empty()) mask_task.pop();
|
while (!mask_task.empty()) mask_task.pop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto &worker : workers) { worker.join(); }
|
||||||
|
|
||||||
// super hackish way to recover the real row mask
|
// super hackish way to recover the real row mask
|
||||||
for (auto m : fn_masks) {
|
for (auto m : fn_masks) {
|
||||||
uint64_t lsb = (1 << (__builtin_ctzl(m) + 1));
|
uint64_t lsb = (1 << (__builtin_ctzl(m) + 1));
|
||||||
|
Loading…
Reference in New Issue
Block a user