Skip to content

remove alignedslice and replace with direct poly calls#994

Merged
JordanMaples merged 4 commits intomainfrom
jordanmaples/remove_alignedslice
Apr 28, 2026
Merged

remove alignedslice and replace with direct poly calls#994
JordanMaples merged 4 commits intomainfrom
jordanmaples/remove_alignedslice

Conversation

@JordanMaples
Copy link
Copy Markdown
Contributor

I synced up with @hildebrandmw after he returned from vacation and learned that I misunderstood the brief of #907 with my #965 pr. Rather than removing the struct and replace it with a type-alias for slightly less overhead, the ask was to just replace all calls. So, this follow-up PR does just that and removes AlignedSlice & aligned_slice and replaces all sites with Poly::broadcast calls.

This also introduces PowerOfTwo consts for 0..64 P and value mappings and AlignedAllocator consts for 4...4096

@JordanMaples JordanMaples requested review from a team and Copilot April 28, 2026 15:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR completes the follow-up to #907 by removing the AlignedSlice/aligned_slice abstraction and migrating call sites to use Poly::broadcast directly, while also adding pre-defined alignment/power-of-two constants to simplify common allocations.

Changes:

  • Remove AlignedSlice type alias and aligned_slice() constructor from diskann-quantization::alloc and update all call sites to use Poly::broadcast.
  • Add PowerOfTwo consts (P0..P63 + value-mapped V*) and AlignedAllocator consts (A4..A4096) for common alignments.
  • Drop unused workspace dependency (once_cell).

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
diskann-quantization/src/num.rs Adds many PowerOfTwo constants (P*/V*) to avoid repeated runtime construction.
diskann-quantization/src/alloc/mod.rs Stops exporting AlignedSlice/aligned_slice from the public alloc module API.
diskann-quantization/src/alloc/aligned_slice.rs Deletes the alias + constructor and the associated tests.
diskann-quantization/src/alloc/aligned.rs Adds AlignedAllocator::{A4..A4096} convenience constants.
diskann-disk/src/utils/aligned_file_reader/windows_aligned_file_reader.rs Updates tests to allocate aligned buffers via Poly::broadcast + AlignedAllocator.
diskann-disk/src/utils/aligned_file_reader/storage_provider_aligned_file_reader.rs Same as above for storage-provider aligned reader tests.
diskann-disk/src/utils/aligned_file_reader/linux_aligned_file_reader.rs Same as above for Linux aligned reader tests.
diskann-disk/src/search/provider/disk_vertex_provider_factory.rs Switches header read buffer allocation to Poly::broadcast.
diskann-disk/src/search/provider/disk_sector_graph.rs Replaces AlignedSlice<u8> storage with Poly<[u8], AlignedAllocator> and allocates via Poly::broadcast.
diskann-disk/src/search/pq/pq_scratch.rs Replaces aligned scratch buffers with Poly::broadcast allocations.
diskann-disk/benches/benchmarks_iai/aligned_file_reader_bench_iai.rs Updates benchmark allocations to Poly::broadcast.
diskann-disk/benches/benchmarks/aligned_file_reader_bench.rs Updates benchmark allocations to Poly::broadcast.
Cargo.toml Removes once_cell from workspace dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread diskann-disk/src/search/provider/disk_sector_graph.rs
Comment thread diskann-disk/src/search/provider/disk_sector_graph.rs
Comment thread diskann-disk/src/search/pq/pq_scratch.rs
Comment thread diskann-disk/src/search/provider/disk_vertex_provider_factory.rs
Comment thread diskann-quantization/src/num.rs Outdated
Comment thread diskann-quantization/src/alloc/mod.rs
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.42%. Comparing base (cb52a9f) to head (4a2b598).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #994      +/-   ##
==========================================
- Coverage   89.43%   89.42%   -0.01%     
==========================================
  Files         449      448       -1     
  Lines       83779    83743      -36     
==========================================
- Hits        74928    74890      -38     
- Misses       8851     8853       +2     
Flag Coverage Δ
miri 89.42% <100.00%> (-0.01%) ⬇️
unittests 89.26% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
diskann-disk/src/search/pq/pq_scratch.rs 79.54% <100.00%> (ø)
...kann-disk/src/search/provider/disk_sector_graph.rs 96.96% <100.00%> (+0.02%) ⬆️
...rc/search/provider/disk_vertex_provider_factory.rs 95.70% <100.00%> (ø)
...s/aligned_file_reader/linux_aligned_file_reader.rs 82.65% <100.00%> (ø)
...ile_reader/storage_provider_aligned_file_reader.rs 98.36% <100.00%> (ø)
diskann-quantization/src/alloc/aligned.rs 97.82% <ø> (ø)
diskann-quantization/src/alloc/mod.rs 100.00% <ø> (ø)
diskann-quantization/src/num.rs 100.00% <ø> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JordanMaples
Copy link
Copy Markdown
Contributor Author

@copilot could you review again? I believe that I've fully addressed your comments

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 28, 2026

@copilot could you review again? I believe that I've fully addressed your comments

All five issues from the previous review have been addressed in commit afa3f89:

  • Error propagation (no more .unwrap()) in DiskSectorGraph::new, reconfigure, PQScratch::new, and get_header — all now use .map_err(ANNError::log_index_error)?
  • PowerOfTwo constants P32–P63 (and their V* aliases) are gated behind #[cfg(target_pointer_width = "64")] to prevent compile-time overflow on 32-bit targets

Clippy and tests pass cleanly.

Comment thread diskann-quantization/src/num.rs Outdated
@JordanMaples JordanMaples merged commit a1791ce into main Apr 28, 2026
26 checks passed
@JordanMaples JordanMaples deleted the jordanmaples/remove_alignedslice branch April 28, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants