BufferedFnPtr and take UnalignedSlice.#1113
Open
hildebrandmw wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an oversight from #981 by extending BufferedDistance so it can evaluate distances against potentially unaligned input buffers via UnalignedSlice, aligning diskann’s buffered query-distance wrapper with the updated diskann-vector unaligned-distance API.
Changes:
- Import
AsUnalignedandUnalignedSlicefromdiskann_vector. - Add
PreprocessedDistanceFunction<UnalignedSlice<'_, T>>impl forBufferedDistance<T, U>, forwarding throughDistance::call_unaligned.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+241
to
+245
| impl<T, U> PreprocessedDistanceFunction<UnalignedSlice<'_, T>> for BufferedDistance<T, U> { | ||
| #[inline(always)] | ||
| fn evaluate_similarity(&self, x: UnalignedSlice<'_, T>) -> f32 { | ||
| self.f.call_unaligned((&*self.query).as_unaligned(), x) | ||
| } |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1113 +/- ##
==========================================
+ Coverage 89.46% 90.53% +1.07%
==========================================
Files 482 482
Lines 91092 91108 +16
==========================================
+ Hits 81497 82488 +991
+ Misses 9595 8620 -975
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
harsha-simhadri
approved these changes
May 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An oversight from #981.