perf(spectrum): software-prefetch SA entries in the boundary-search and forward/tabled probe loops - #21
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR adds software prefetch hints for suffix array cache optimization in binary search operations. A new ChangesSA Prefetching Cache Optimization
🎯 2 (Simple) | ⏱️ ~12 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
185815b to
6a15607
Compare
…robe loop find_boundary's binary search is the backward-extension hot loop, and every go_right(mid) is a cold DRAM read of SA entry mid (position + key, one cache line). Prefetch both possible next-probe entries before the compare so the next iteration's miss is already in flight — the prefetch-discipline BWA-MEME uses (_mm_prefetch before each binary-search step) that prmi was missing. - SaFileReader::prefetch(i): cfg-gated x86_64 _mm_prefetch(T0) / aarch64 prfm pldl1keep, no-op elsewhere; lives in the sa_file unsafe island, exposed as a safe LearnedIndex::prefetch_sa for the deny(unsafe_code) search code. - Advisory only: it never changes the boundary returned, just its latency (verified byte-identical — all 156 lib proptests pass). The win shows only on a genomic-scale, cache-cold SA; on the laptop synthetic the SA fits in cache. Covers the backward bottleneck; the cold-forward inline searches and the gallop phase can take the same treatment as a follow-up.
|
@coderabbitai review |
✅ Action performedReview finished.
|
PR #8 of the v0.2 stack (carries
6c5abb3, withd77b83bfolded in). Base isfeat/v0.2-benches(#20).Software-prefetches SA entries in the boundary-search probe loop, extended to the forward + tabled binary searches (
d77b83bfolded). Pure perf — byte-identical (oracle proptests unchanged). Clean cherry-pick onto #7.Green-pass: build / clippy -D warnings / nightly fmt /
cargo test --workspaceall ✅ (162 lib + all FFI; only Plan-3 deferrals ignored).Summary by CodeRabbit