Skip to content
Draft
Show file tree
Hide file tree
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
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ jobs:
os:
- windows-latest
- ubuntu-latest
- macos-latest

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -267,6 +268,7 @@ jobs:
os:
- windows-latest
- ubuntu-latest
- macos-latest

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -296,6 +298,43 @@ jobs:

cargo test --locked --doc --workspace --profile ci --config "$RUST_CONFIG"

# Test that diskann-benchmark compiles and runs on macOS
# This specifically verifies the io_uring macOS compatibility fix
test-benchmark-macos:
needs: basics
name: test benchmark on macOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
lfs: true

- name: Install Rust ${{ env.rust_stable }}
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust_stable }}

- uses: Swatinem/rust-cache@v2

- name: Build diskann-benchmark
run: |
set -euxo pipefail
cargo build --locked --package diskann-benchmark --release --config "$RUST_CONFIG"

- name: Test benchmark help command
run: |
set -euxo pipefail
cargo run --locked --package diskann-benchmark --release -- --help

- name: Test benchmark dry-run with example config
run: |
set -euxo pipefail
# Verify it can load the config file and validate it without running
cargo run --locked --package diskann-benchmark --release -- run \
--input-file ./diskann-benchmark/example/async.json \
--output-file /tmp/output.json \
--dry-run

coverage:
needs: basics
name: code coverage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use diskann::ANNResult;

#[cfg(all(not(miri), target_os = "linux"))]
use super::LinuxAlignedFileReader;
#[cfg(miri)]
#[cfg(any(miri, all(not(target_os = "linux"), not(target_os = "windows"))))]
use super::StorageProviderAlignedFileReader;
#[cfg(all(not(miri), target_os = "windows"))]
use super::WindowsAlignedFileReader;
Expand Down Expand Up @@ -45,6 +45,10 @@ impl AlignedReaderFactory for AlignedFileReaderFactory {
#[cfg(all(not(miri), target_os = "windows"))]
type AlignedReaderType = WindowsAlignedFileReader;

// Use StorageProviderAlignedFileReader for macOS and other Unix-like systems
#[cfg(all(not(miri), not(target_os = "linux"), not(target_os = "windows")))]
type AlignedReaderType = StorageProviderAlignedFileReader;

fn build(&self) -> ANNResult<Self::AlignedReaderType> {
#[cfg(miri)]
return StorageProviderAlignedFileReader::new(
Expand All @@ -57,6 +61,12 @@ impl AlignedReaderFactory for AlignedFileReaderFactory {

#[cfg(all(not(miri), target_os = "linux"))]
return LinuxAlignedFileReader::new(self.file_path.as_str());

#[cfg(all(not(miri), not(target_os = "linux"), not(target_os = "windows")))]
return StorageProviderAlignedFileReader::new(
&crate::storage::FileStorageProvider,
self.file_path.as_str(),
);
}
}

Expand Down
4 changes: 2 additions & 2 deletions diskann-platform/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ pub mod win;
#[cfg(windows)]
pub use win::*;

#[cfg(not(windows))]
#[cfg(target_os = "linux")]
pub mod linux;

#[cfg(not(windows))]
#[cfg(target_os = "linux")]
pub use linux::*;
4 changes: 4 additions & 0 deletions diskann-platform/src/linux/ssd_io_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@
* Licensed under the MIT license.
*/

#[cfg(target_os = "linux")]
use std::fs::File;

#[cfg(target_os = "linux")]
use io_uring::IoUring;

// The IOContext struct for disk I/O. One for each thread.
#[cfg(target_os = "linux")]
pub struct IOContext {
pub file_handle: File,
pub ring: IoUring,
}

#[cfg(target_os = "linux")]
impl IOContext {
pub fn new(file_handle: File, ring: IoUring) -> Self {
IOContext { file_handle, ring }
Expand Down