From a6f59e5109b09aef61f8f00f2f5904378d71068b Mon Sep 17 00:00:00 2001 From: meiravgri Date: Sun, 11 Jan 2026 14:39:41 +0000 Subject: [PATCH 1/9] use HNSWParams in VecSimHNSWDiskParams (intead of duplicate) add VecSimHNSWDiskParams to AlgoParams --- src/VecSim/vec_sim_common.h | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/VecSim/vec_sim_common.h b/src/VecSim/vec_sim_common.h index 8b30a5fc5..ddf7039ce 100644 --- a/src/VecSim/vec_sim_common.h +++ b/src/VecSim/vec_sim_common.h @@ -231,6 +231,7 @@ typedef union { BFParams bfParams; TieredIndexParams tieredParams; SVSParams svsParams; + VecSimHNSWDiskParams hnswDiskParams; } AlgoParams; struct VecSimParams { @@ -241,18 +242,10 @@ struct VecSimParams { // Parameters for creating a disk-based vector index. Currently only HNSW Disk is supported. typedef struct VecSimHNSWDiskParams { - size_t dim; - VecSimType type; - VecSimMetric metric; - size_t M; - size_t efConstruction; - size_t efRuntime; - size_t blockSize; - bool multi; + HNSWParams hnswParams; void *storage; // Opaque pointer to disk storage const char *indexName; size_t indexNameLen; - void *logCtx; } VecSimHNSWDiskParams; /** From 32a98e037b97bec091621aa5ea5695dc00aa1cee Mon Sep 17 00:00:00 2001 From: meiravgri Date: Mon, 12 Jan 2026 04:51:11 +0000 Subject: [PATCH 2/9] VecSimAlgo : VecSimAlgo_HNSWDISK VecSimHNSWDiskParams: replace hnsw alg parametrs with HNSWParams struct introduce TieredHNSWDiskParams have TieredHNSWDiskParams in the union of TieredIndexParams --- src/VecSim/vec_sim_common.h | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/VecSim/vec_sim_common.h b/src/VecSim/vec_sim_common.h index ddf7039ce..7800c6622 100644 --- a/src/VecSim/vec_sim_common.h +++ b/src/VecSim/vec_sim_common.h @@ -69,7 +69,13 @@ typedef enum { } VecSimType; // Algorithm type/library. -typedef enum { VecSimAlgo_BF, VecSimAlgo_HNSWLIB, VecSimAlgo_TIERED, VecSimAlgo_SVS } VecSimAlgo; +typedef enum { + VecSimAlgo_BF, + VecSimAlgo_HNSWLIB, + VecSimAlgo_TIERED, + VecSimAlgo_SVS, + VecSimAlgo_HNSWDISK +} VecSimAlgo; typedef enum { VecSimOption_AUTO = 0, @@ -162,6 +168,14 @@ typedef struct { size_t blockSize; } BFParams; +// Parameters for creating a disk-based vector index. Currently only HNSW Disk is supported. +typedef struct VecSimHNSWDiskParams { + HNSWParams hnswParams; + void *storage; // Opaque pointer to disk storage + const char *indexName; + size_t indexNameLen; +} VecSimHNSWDiskParams; + typedef enum { VecSimSvsQuant_NONE = 0, // No quantization. VecSimSvsQuant_Scalar = 1, // 8-bit scalar quantization @@ -202,6 +216,10 @@ typedef struct { // all the ready swap jobs in a batch. } TieredHNSWParams; +// A struct that contains HNSW Disk tiered index specific params. +typedef struct { +} TieredHNSWDiskParams; + // A struct that contains SVS tiered index specific params. typedef struct { size_t trainingTriggerThreshold; // The flat index size threshold to trigger the initialization @@ -223,6 +241,7 @@ typedef struct { union { TieredHNSWParams tieredHnswParams; TieredSVSParams tieredSVSParams; + TieredHNSWDiskParams tieredHnswDiskParams; } specificParams; } TieredIndexParams; @@ -240,14 +259,6 @@ struct VecSimParams { void *logCtx; // External context that stores the index log. }; -// Parameters for creating a disk-based vector index. Currently only HNSW Disk is supported. -typedef struct VecSimHNSWDiskParams { - HNSWParams hnswParams; - void *storage; // Opaque pointer to disk storage - const char *indexName; - size_t indexNameLen; -} VecSimHNSWDiskParams; - /** * The specific job types in use (to be extended in the future by demand) */ From 18cf3fe44b6e53d5c22c1bad1327df4320437a36 Mon Sep 17 00:00:00 2001 From: meiravgri Date: Mon, 12 Jan 2026 12:29:43 +0000 Subject: [PATCH 3/9] introduce VecSimParamsDisk move disk params to VecSimParamsDisk --- .../index_factories/components/components_factory.h | 1 + src/VecSim/vec_sim_common.h | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/VecSim/index_factories/components/components_factory.h b/src/VecSim/index_factories/components/components_factory.h index 05112f7e8..f52db7c5f 100644 --- a/src/VecSim/index_factories/components/components_factory.h +++ b/src/VecSim/index_factories/components/components_factory.h @@ -24,6 +24,7 @@ CreateIndexComponents(std::shared_ptr allocator, VecSimMetric m // Currently we have only one distance calculator implementation auto indexCalculator = new (allocator) DistanceCalculatorCommon(allocator, distFunc); + // TODO: take into account quantization auto preprocessors = CreatePreprocessorsContainer(allocator, metric, dim, is_normalized, alignment); diff --git a/src/VecSim/vec_sim_common.h b/src/VecSim/vec_sim_common.h index 7800c6622..85fe8785d 100644 --- a/src/VecSim/vec_sim_common.h +++ b/src/VecSim/vec_sim_common.h @@ -171,9 +171,6 @@ typedef struct { // Parameters for creating a disk-based vector index. Currently only HNSW Disk is supported. typedef struct VecSimHNSWDiskParams { HNSWParams hnswParams; - void *storage; // Opaque pointer to disk storage - const char *indexName; - size_t indexNameLen; } VecSimHNSWDiskParams; typedef enum { @@ -259,6 +256,13 @@ struct VecSimParams { void *logCtx; // External context that stores the index log. }; +typedef struct { + VecSimParams params; // Algorithm parameters (TIERED, BF, HNSW, etc.) + void *storage; // Opaque pointer to disk storage + const char *indexName; + size_t indexNameLen; +} VecSimParamsDisk; + /** * The specific job types in use (to be extended in the future by demand) */ From 75212361a793f1007e10fa782a6966332c626e70 Mon Sep 17 00:00:00 2001 From: meiravgri Date: Mon, 12 Jan 2026 16:35:29 +0000 Subject: [PATCH 4/9] remove VecSimAlgo_HNSWDISK, use VecSimAlgo_HNSWLIB --- src/VecSim/vec_sim_common.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/VecSim/vec_sim_common.h b/src/VecSim/vec_sim_common.h index 85fe8785d..90f70960f 100644 --- a/src/VecSim/vec_sim_common.h +++ b/src/VecSim/vec_sim_common.h @@ -69,13 +69,7 @@ typedef enum { } VecSimType; // Algorithm type/library. -typedef enum { - VecSimAlgo_BF, - VecSimAlgo_HNSWLIB, - VecSimAlgo_TIERED, - VecSimAlgo_SVS, - VecSimAlgo_HNSWDISK -} VecSimAlgo; +typedef enum { VecSimAlgo_BF, VecSimAlgo_HNSWLIB, VecSimAlgo_TIERED, VecSimAlgo_SVS } VecSimAlgo; typedef enum { VecSimOption_AUTO = 0, From da785874631615ca8c551e2df70b3893f408ac5e Mon Sep 17 00:00:00 2001 From: meiravgri Date: Mon, 12 Jan 2026 16:52:31 +0000 Subject: [PATCH 5/9] dd something in TieredHNSWDiskParams to fix compilation error --- src/VecSim/vec_sim_common.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/VecSim/vec_sim_common.h b/src/VecSim/vec_sim_common.h index 90f70960f..960ea147b 100644 --- a/src/VecSim/vec_sim_common.h +++ b/src/VecSim/vec_sim_common.h @@ -209,6 +209,7 @@ typedef struct { // A struct that contains HNSW Disk tiered index specific params. typedef struct { + char _placeholder; // Reserved for future fields and avoid compiler errors } TieredHNSWDiskParams; // A struct that contains SVS tiered index specific params. From a62d771a37f8a59447fdb61533318e7bd70c19ed Mon Sep 17 00:00:00 2001 From: meiravgri Date: Mon, 12 Jan 2026 16:53:21 +0000 Subject: [PATCH 6/9] add commen --- src/VecSim/vec_sim_common.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/VecSim/vec_sim_common.h b/src/VecSim/vec_sim_common.h index 960ea147b..8a87c759c 100644 --- a/src/VecSim/vec_sim_common.h +++ b/src/VecSim/vec_sim_common.h @@ -208,6 +208,7 @@ typedef struct { } TieredHNSWParams; // A struct that contains HNSW Disk tiered index specific params. +// Consider removing and use TieredHNSWParams instead if they both share swapJobThreshold typedef struct { char _placeholder; // Reserved for future fields and avoid compiler errors } TieredHNSWDiskParams; From 25dba5b1c7ed7ecbedd07fdcfd906490fbebfc80 Mon Sep 17 00:00:00 2001 From: meiravgri Date: Tue, 13 Jan 2026 09:37:29 +0000 Subject: [PATCH 7/9] 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; --- src/VecSim/vec_sim_common.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/VecSim/vec_sim_common.h b/src/VecSim/vec_sim_common.h index 8a87c759c..4a6e3ee3c 100644 --- a/src/VecSim/vec_sim_common.h +++ b/src/VecSim/vec_sim_common.h @@ -253,11 +253,15 @@ struct VecSimParams { }; typedef struct { - VecSimParams params; // Algorithm parameters (TIERED, BF, HNSW, etc.) - void *storage; // Opaque pointer to disk storage + void *storage; // Opaque pointer to disk storage const char *indexName; size_t indexNameLen; -} VecSimParamsDisk; +} VecSimDiskContext; + +typedef struct { + VecSimParams *indexParams; + VecSimDiskContext *diskContext; +} VecSimDiskParams; /** * The specific job types in use (to be extended in the future by demand) From ef9a4de7f87039512430e49895db33a19ef72b27 Mon Sep 17 00:00:00 2001 From: meiravgri Date: Tue, 13 Jan 2026 10:09:29 +0000 Subject: [PATCH 8/9] rename --- src/VecSim/vec_sim_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/VecSim/vec_sim_common.h b/src/VecSim/vec_sim_common.h index 4a6e3ee3c..7116be9a0 100644 --- a/src/VecSim/vec_sim_common.h +++ b/src/VecSim/vec_sim_common.h @@ -261,7 +261,7 @@ typedef struct { typedef struct { VecSimParams *indexParams; VecSimDiskContext *diskContext; -} VecSimDiskParams; +} VecSimParamsDisk; /** * The specific job types in use (to be extended in the future by demand) From a2806ddaae16c28b6896c2b3d246547ad83ee334 Mon Sep 17 00:00:00 2001 From: meiravgri Date: Tue, 13 Jan 2026 11:32:14 +0000 Subject: [PATCH 9/9] remove hnswdiskparams --- src/VecSim/vec_sim_common.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/VecSim/vec_sim_common.h b/src/VecSim/vec_sim_common.h index 7116be9a0..fa136b7fe 100644 --- a/src/VecSim/vec_sim_common.h +++ b/src/VecSim/vec_sim_common.h @@ -162,11 +162,6 @@ typedef struct { size_t blockSize; } BFParams; -// Parameters for creating a disk-based vector index. Currently only HNSW Disk is supported. -typedef struct VecSimHNSWDiskParams { - HNSWParams hnswParams; -} VecSimHNSWDiskParams; - typedef enum { VecSimSvsQuant_NONE = 0, // No quantization. VecSimSvsQuant_Scalar = 1, // 8-bit scalar quantization @@ -243,7 +238,6 @@ typedef union { BFParams bfParams; TieredIndexParams tieredParams; SVSParams svsParams; - VecSimHNSWDiskParams hnswDiskParams; } AlgoParams; struct VecSimParams {