Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/svs/lib/prefetch.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "svs/lib/misc.h"

#include <atomic>
#include <cstdint>
#include <iterator>
#include <span>
Expand Down Expand Up @@ -56,8 +57,11 @@ template <typename T, size_t Extent> void prefetch_l0(std::span<T, Extent> span)
);
}

// The fence is a no-op at runtime; without it GCC 12 drops all but the first
// prefetch here, so neighbor vectors load cold from DRAM and search slows ~24%.
for (size_t i = 0; i < num_prefetches; ++i) {
prefetch_l0(base + CACHELINE_BYTES * i);
std::atomic_signal_fence(std::memory_order_seq_cst);
}
}

Expand Down
Loading