Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion diskann-garnet/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ impl<T: VectorRepr> DefaultPostProcessor<GarnetProvider<T>, &[T], GarnetId> for
impl<T: VectorRepr> PruneStrategy<GarnetProvider<T>> for FullPrecision {
type PruneAccessor<'a> = FullAccessor<'a, T>;
type PruneAccessorError = GarnetProviderError;
type DistanceComputer = T::Distance;
type DistanceComputer<'a> = T::Distance;
type WorkingSet = WorkingSet<T>;

fn prune_accessor<'a>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,7 @@ where
D: AsyncFriendly,
{
type WorkingSet = map::Map<u32, Box<[T]>, map::Ref<[T]>>;
type DistanceComputer = T::Distance;
type DistanceComputer<'a> = T::Distance;
type PruneAccessor<'a> = FullAccessor<'a, T, Q, D>;
type PruneAccessorError = diskann::error::Infallible;

Expand All @@ -1548,7 +1548,7 @@ where
D: AsyncFriendly,
{
type WorkingSet = distances::pq::HybridMap<T, u8>;
type DistanceComputer = distances::pq::HybridComputer<T>;
type DistanceComputer<'a> = distances::pq::HybridComputer<T>;
type PruneAccessor<'a> = HybridAccessor<'a, T, D>;
type PruneAccessorError = diskann::error::Infallible;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ where
E: StandardError,
{
type WorkingSet = Cached<S::WorkingSet>;
type DistanceComputer = S::DistanceComputer;
type DistanceComputer<'a> = S::DistanceComputer<'a>;
type PruneAccessor<'a> = CachingAccessor<
PruneAccessor<'a, S, DP>,
<C as AsCacheAccessorFor<'a, PruneAccessor<'a, S, DP>>>::Accessor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ where
D: AsyncFriendly,
Ctx: ExecutionContext,
{
type DistanceComputer = T::Distance;
type DistanceComputer<'a> = T::Distance;
type PruneAccessor<'a> = FullAccessor<'a, T, Q, D, Ctx>;
type PruneAccessorError = diskann::error::Infallible;
type WorkingSet = PassThrough;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ where
D: AsyncFriendly + DeletionCheck,
Ctx: ExecutionContext,
{
type DistanceComputer = distances::pq::HybridComputer<T>;
type DistanceComputer<'a> = distances::pq::HybridComputer<T>;
type PruneAccessor<'a> = HybridAccessor<'a, T, D, Ctx>;
type PruneAccessorError = diskann::error::Infallible;
type WorkingSet = FullPrecisionTracker;
Expand Down Expand Up @@ -692,7 +692,7 @@ where
D: AsyncFriendly + DeletionCheck,
Ctx: ExecutionContext,
{
type DistanceComputer = pq::distance::DistanceComputer<Arc<FixedChunkPQTable>>;
type DistanceComputer<'a> = pq::distance::DistanceComputer<Arc<FixedChunkPQTable>>;
type PruneAccessor<'a> = QuantAccessor<'a, NoStore, D, Ctx>;
type PruneAccessorError = diskann::error::Infallible;
type WorkingSet = PassThrough;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ where
Unsigned: Representation<NBITS>,
DistanceComputer: for<'a, 'b> DistanceFunction<CVRef<'a, NBITS>, CVRef<'b, NBITS>, f32>,
{
type DistanceComputer = DistanceComputer;
type DistanceComputer<'a> = DistanceComputer;
type PruneAccessor<'a> = QuantAccessor<'a, NBITS, V, D, Ctx>;
type PruneAccessorError = diskann::error::Infallible;
type WorkingSet = PassThrough;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ where
D: AsyncFriendly + DeletionCheck,
Ctx: ExecutionContext,
{
type DistanceComputer =
type DistanceComputer<'a> =
UnwrapErr<spherical::iface::DistanceComputer, spherical::iface::DistanceError>;
type PruneAccessor<'a> = QuantAccessor<'a, V, D, Ctx>;
type PruneAccessorError = diskann::error::Infallible;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ static START_COUNT: Mutex<usize> = Mutex::new(STATIC_PRUNE_THRESHOLD);
type WorkingSet = map::Map<u32, Box<[f32]>, map::Ref<[f32]>>;

impl PruneStrategy<TestProvider> for Flaky {
type DistanceComputer = <FullAccessor<'static> as BuildDistanceComputer>::DistanceComputer;
type DistanceComputer<'a> = <FullAccessor<'static> as BuildDistanceComputer>::DistanceComputer;
Comment thread
hildebrandmw marked this conversation as resolved.
Outdated
type PruneAccessor<'a> = FlakyAccessor<'a>;
type PruneAccessorError = diskann::error::Infallible;
type WorkingSet = WorkingSet;
Expand Down
4 changes: 2 additions & 2 deletions diskann/src/graph/glue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ where
///
/// We could grab this type from the `PruneAccessor` associated type, but it's
/// useful enough that we move it up here.
type DistanceComputer: for<'a, 'b, 'c, 'd> DistanceFunction<
type DistanceComputer<'computer>: for<'a, 'b, 'c, 'd> DistanceFunction<
<Self::PruneAccessor<'a> as Accessor>::ElementRef<'b>,
<Self::PruneAccessor<'c> as Accessor>::ElementRef<'d>,
f32,
Expand All @@ -630,7 +630,7 @@ where
/// Implementations are encouraged to have [`Accessor::get_element`] return the
/// highest-precision applicable value for a given element type.
type PruneAccessor<'a>: Accessor<Id = Provider::InternalId>
+ BuildDistanceComputer<DistanceComputer = Self::DistanceComputer>
+ BuildDistanceComputer<DistanceComputer = Self::DistanceComputer<'a>>
+ AsNeighborMut
+ workingset::Fill<Self::WorkingSet>;

Expand Down
2 changes: 1 addition & 1 deletion diskann/src/graph/test/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ impl glue::DefaultPostProcessor<Provider, &[f32]> for Strategy {

impl glue::PruneStrategy<Provider> for Strategy {
type WorkingSet = workingset::Map<u32, Box<[f32]>, workingset::map::Ref<[f32]>>;
type DistanceComputer = <f32 as VectorRepr>::Distance;
type DistanceComputer<'a> = <f32 as VectorRepr>::Distance;
type PruneAccessor<'a> = Accessor<'a>;
type PruneAccessorError = Infallible;

Expand Down
3 changes: 1 addition & 2 deletions diskann/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,7 @@ pub trait BuildDistanceComputer: Accessor {
/// of elements yielded by the [`Accessor`].
type DistanceComputer: for<'a, 'b> DistanceFunction<Self::ElementRef<'a>, Self::ElementRef<'b>>
+ Send
+ Sync
+ 'static;
+ Sync;

/// Build the random-access distance computer for this accessor.
///
Expand Down
Loading