Skip to content

Commit d45369e

Browse files
authored
[MOD-13164] [MOD-13481] Introduce VecSimDiskParams Wrapper for Disk-Based Vector Indexes (#887)
* use HNSWParams in VecSimHNSWDiskParams (intead of duplicate) add VecSimHNSWDiskParams to AlgoParams * VecSimAlgo : VecSimAlgo_HNSWDISK VecSimHNSWDiskParams: replace hnsw alg parametrs with HNSWParams struct introduce TieredHNSWDiskParams have TieredHNSWDiskParams in the union of TieredIndexParams * introduce VecSimParamsDisk move disk params to VecSimParamsDisk * remove VecSimAlgo_HNSWDISK, use VecSimAlgo_HNSWLIB * dd something in TieredHNSWDiskParams to fix compilation error * add commen * introduce VecSimDiskContext: typedef struct { void *storage; // Opaque pointer to disk storage const char *indexName; size_t indexNameLen; } VecSimDiskContext; split VecSimParamsDisk to: typedef struct { VecSimParams *indexParams; VecSimDiskContext *diskContext; } VecSimDiskParams; * rename * remove hnswdiskparams
1 parent 7e1a78c commit d45369e

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

src/VecSim/index_factories/components/components_factory.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ CreateIndexComponents(std::shared_ptr<VecSimAllocator> allocator, VecSimMetric m
2424
// Currently we have only one distance calculator implementation
2525
auto indexCalculator = new (allocator) DistanceCalculatorCommon<DistType>(allocator, distFunc);
2626

27+
// TODO: take into account quantization
2728
auto preprocessors =
2829
CreatePreprocessorsContainer<DataType>(allocator, metric, dim, is_normalized, alignment);
2930

src/VecSim/vec_sim_common.h

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,12 @@ typedef struct {
202202
// all the ready swap jobs in a batch.
203203
} TieredHNSWParams;
204204

205+
// A struct that contains HNSW Disk tiered index specific params.
206+
// Consider removing and use TieredHNSWParams instead if they both share swapJobThreshold
207+
typedef struct {
208+
char _placeholder; // Reserved for future fields and avoid compiler errors
209+
} TieredHNSWDiskParams;
210+
205211
// A struct that contains SVS tiered index specific params.
206212
typedef struct {
207213
size_t trainingTriggerThreshold; // The flat index size threshold to trigger the initialization
@@ -223,6 +229,7 @@ typedef struct {
223229
union {
224230
TieredHNSWParams tieredHnswParams;
225231
TieredSVSParams tieredSVSParams;
232+
TieredHNSWDiskParams tieredHnswDiskParams;
226233
} specificParams;
227234
} TieredIndexParams;
228235

@@ -239,21 +246,16 @@ struct VecSimParams {
239246
void *logCtx; // External context that stores the index log.
240247
};
241248

242-
// Parameters for creating a disk-based vector index. Currently only HNSW Disk is supported.
243-
typedef struct VecSimHNSWDiskParams {
244-
size_t dim;
245-
VecSimType type;
246-
VecSimMetric metric;
247-
size_t M;
248-
size_t efConstruction;
249-
size_t efRuntime;
250-
size_t blockSize;
251-
bool multi;
249+
typedef struct {
252250
void *storage; // Opaque pointer to disk storage
253251
const char *indexName;
254252
size_t indexNameLen;
255-
void *logCtx;
256-
} VecSimHNSWDiskParams;
253+
} VecSimDiskContext;
254+
255+
typedef struct {
256+
VecSimParams *indexParams;
257+
VecSimDiskContext *diskContext;
258+
} VecSimParamsDisk;
257259

258260
/**
259261
* The specific job types in use (to be extended in the future by demand)

0 commit comments

Comments
 (0)