Skip to content
Merged
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
1 change: 0 additions & 1 deletion src/VecSim/algorithms/hnsw/hnsw_tiered.h
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,6 @@ VecSimDebugInfoIterator *TieredHNSWIndex<DataType, DistType>::debugInfoIterator(
template <typename DataType, typename DistType>
VecSimIndexBasicInfo TieredHNSWIndex<DataType, DistType>::basicInfo() const {
VecSimIndexBasicInfo info = this->backendIndex->getBasicInfo();
info.blockSize = info.blockSize;
info.isTiered = true;
info.algo = VecSimAlgo_HNSWLIB;
return info;
Expand Down
1 change: 1 addition & 0 deletions src/VecSim/index_factories/factory_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ static AbstractIndexInitParams NewAbstractInitParams(const IndexParams *algo_par
.metric = algo_params->metric,
.blockSize = algo_params->blockSize,
.multi = algo_params->multi,
.isDisk = false,
.logCtx = logCtx,
.inputBlobSize = inputBlobSize};
return abstractInitParams;
Expand Down
1 change: 1 addition & 0 deletions src/VecSim/utils/vec_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const char *VecSimCommonStrings::DIMENSION_STRING = "DIMENSION";
const char *VecSimCommonStrings::INDEX_SIZE_STRING = "INDEX_SIZE";
const char *VecSimCommonStrings::INDEX_LABEL_COUNT_STRING = "INDEX_LABEL_COUNT";
const char *VecSimCommonStrings::IS_MULTI_STRING = "IS_MULTI_VALUE";
const char *VecSimCommonStrings::IS_DISK_STRING = "IS_DISK";
const char *VecSimCommonStrings::MEMORY_STRING = "MEMORY";

const char *VecSimCommonStrings::HNSW_EF_RUNTIME_STRING = "EF_RUNTIME";
Expand Down
1 change: 1 addition & 0 deletions src/VecSim/utils/vec_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct VecSimCommonStrings {
static const char *INDEX_SIZE_STRING;
static const char *INDEX_LABEL_COUNT_STRING;
static const char *IS_MULTI_STRING;
static const char *IS_DISK_STRING;
static const char *MEMORY_STRING;

static const char *HNSW_EF_RUNTIME_STRING;
Expand Down
1 change: 1 addition & 0 deletions src/VecSim/vec_sim_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ typedef struct {
VecSimType type; // Datatype the index holds.
bool isMulti; // Determines if the index should multi-index or not.
bool isTiered; // Is the index is tiered or not.
bool isDisk; // Is the index stored on disk.
size_t blockSize; // Brute force algorithm vector block (mini matrix) size
size_t dim; // Vector size (dimension).
} VecSimIndexBasicInfo;
Expand Down
9 changes: 8 additions & 1 deletion src/VecSim/vec_sim_index.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ struct AbstractIndexInitParams {
VecSimMetric metric;
size_t blockSize;
bool multi;
bool isDisk; // Whether the index stores vectors on disk
void *logCtx;
size_t inputBlobSize;
};
Expand Down Expand Up @@ -80,6 +81,7 @@ struct VecSimIndexAbstract : public VecSimIndexInterface {
// resizing)
mutable VecSearchMode lastMode; // The last search mode in RediSearch (used for debug/testing).
bool isMulti; // Determines if the index should multi-index or not.
bool isDisk; // Whether the index stores vectors on disk.
void *logCallbackCtx; // Context for the log callback.
RawDataContainer *vectors; // The raw vectors data container.
private:
Expand Down Expand Up @@ -119,7 +121,7 @@ struct VecSimIndexAbstract : public VecSimIndexInterface {
: VecSimIndexInterface(params.allocator), dim(params.dim), vecType(params.vecType),
metric(params.metric),
blockSize(params.blockSize ? params.blockSize : DEFAULT_BLOCK_SIZE), lastMode(EMPTY_MODE),
isMulti(params.multi), logCallbackCtx(params.logCtx),
isMulti(params.multi), isDisk(params.isDisk), logCallbackCtx(params.logCtx),
indexCalculator(components.indexCalculator), preprocessors(components.preprocessors),
inputBlobSize(params.inputBlobSize), storedDataSize(params.storedDataSize) {
assert(VecSimType_sizeof(vecType));
Expand Down Expand Up @@ -243,6 +245,10 @@ struct VecSimIndexAbstract : public VecSimIndexInterface {
VecSim_InfoField{.fieldName = VecSimCommonStrings::IS_MULTI_STRING,
.fieldType = INFOFIELD_UINT64,
.fieldValue = {FieldValue{.uintegerValue = info.basicInfo.isMulti}}});
infoIterator->addInfoField(
VecSim_InfoField{.fieldName = VecSimCommonStrings::IS_DISK_STRING,
.fieldType = INFOFIELD_UINT64,
.fieldValue = {FieldValue{.uintegerValue = info.basicInfo.isDisk}}});
infoIterator->addInfoField(
VecSim_InfoField{.fieldName = VecSimCommonStrings::INDEX_SIZE_STRING,
.fieldType = INFOFIELD_UINT64,
Expand Down Expand Up @@ -271,6 +277,7 @@ struct VecSimIndexAbstract : public VecSimIndexInterface {
.metric = this->metric,
.type = this->vecType,
.isMulti = this->isMulti,
.isDisk = this->isDisk,
.blockSize = this->blockSize,
.dim = this->dim,
};
Expand Down
1 change: 1 addition & 0 deletions src/VecSim/vec_sim_tiered_index.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ VecSimIndexDebugInfo VecSimTieredIndex<DataType, DistType>::debugInfo() const {
.type = backendInfo.commonInfo.basicInfo.type,
.isMulti = this->backendIndex->isMultiValue(),
.isTiered = true,
.isDisk = backendInfo.commonInfo.basicInfo.isDisk,
.blockSize = backendInfo.commonInfo.basicInfo.blockSize,
.dim = backendInfo.commonInfo.basicInfo.dim,
};
Expand Down
35 changes: 26 additions & 9 deletions tests/unit/unit_test_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ using float16 = vecsim_types::float16;

// Map index types to their expected number of debug iterator fields
namespace DebugInfoIteratorFieldCount {
constexpr size_t FLAT = 10;
constexpr size_t HNSW = 17;
constexpr size_t SVS = 24;
constexpr size_t TIERED_HNSW = 15;
constexpr size_t TIERED_SVS = 17;
constexpr size_t FLAT = 11;
constexpr size_t HNSW = 18;
constexpr size_t SVS = 25;
constexpr size_t TIERED_HNSW = 16;
constexpr size_t TIERED_SVS = 18;
} // namespace DebugInfoIteratorFieldCount

static void chooseCompareIndexInfoToIterator(VecSimIndexDebugInfo info,
Expand Down Expand Up @@ -314,6 +314,10 @@ void compareFlatIndexInfoToIterator(VecSimIndexDebugInfo info, VecSimDebugInfoIt
// Is the index multi value.
ASSERT_EQ(infoField->fieldType, INFOFIELD_UINT64);
ASSERT_EQ(infoField->fieldValue.uintegerValue, info.commonInfo.basicInfo.isMulti);
} else if (!strcmp(infoField->fieldName, VecSimCommonStrings::IS_DISK_STRING)) {
// Is the index disk-based.
ASSERT_EQ(infoField->fieldType, INFOFIELD_UINT64);
ASSERT_EQ(infoField->fieldValue.uintegerValue, info.commonInfo.basicInfo.isDisk);
} else if (!strcmp(infoField->fieldName, VecSimCommonStrings::BLOCK_SIZE_STRING)) {
// Block size.
ASSERT_EQ(infoField->fieldType, INFOFIELD_UINT64);
Expand Down Expand Up @@ -368,6 +372,10 @@ void compareHNSWIndexInfoToIterator(VecSimIndexDebugInfo info, VecSimDebugInfoIt
// Is the index multi value.
ASSERT_EQ(infoField->fieldType, INFOFIELD_UINT64);
ASSERT_EQ(infoField->fieldValue.uintegerValue, info.commonInfo.basicInfo.isMulti);
} else if (!strcmp(infoField->fieldName, VecSimCommonStrings::IS_DISK_STRING)) {
// Is the index disk-based.
ASSERT_EQ(infoField->fieldType, INFOFIELD_UINT64);
ASSERT_EQ(infoField->fieldValue.uintegerValue, info.commonInfo.basicInfo.isDisk);
} else if (!strcmp(infoField->fieldName,
VecSimCommonStrings::HNSW_EF_CONSTRUCTION_STRING)) {
// EF construction.
Expand Down Expand Up @@ -464,6 +472,10 @@ void compareTieredIndexInfoToIterator(VecSimIndexDebugInfo info,
// Is the index multi value.
ASSERT_EQ(infoField->fieldType, INFOFIELD_UINT64);
ASSERT_EQ(infoField->fieldValue.uintegerValue, info.commonInfo.basicInfo.isMulti);
} else if (!strcmp(infoField->fieldName, VecSimCommonStrings::IS_DISK_STRING)) {
// Is the index disk-based.
ASSERT_EQ(infoField->fieldType, INFOFIELD_UINT64);
ASSERT_EQ(infoField->fieldValue.uintegerValue, info.commonInfo.basicInfo.isDisk);
} else if (!strcmp(infoField->fieldName, VecSimCommonStrings::MEMORY_STRING)) {
// Memory.
ASSERT_EQ(infoField->fieldType, INFOFIELD_UINT64);
Expand Down Expand Up @@ -574,6 +586,10 @@ void compareSVSIndexInfoToIterator(VecSimIndexDebugInfo info, VecSimDebugInfoIte
// Is the index multi value.
ASSERT_EQ(infoField->fieldType, INFOFIELD_UINT64);
ASSERT_EQ(infoField->fieldValue.uintegerValue, info.commonInfo.basicInfo.isMulti);
} else if (!strcmp(infoField->fieldName, VecSimCommonStrings::IS_DISK_STRING)) {
// Is the index disk-based.
ASSERT_EQ(infoField->fieldType, INFOFIELD_UINT64);
ASSERT_EQ(infoField->fieldValue.uintegerValue, info.commonInfo.basicInfo.isDisk);
} else if (!strcmp(infoField->fieldName, VecSimCommonStrings::MEMORY_STRING)) {
// Memory.
ASSERT_EQ(infoField->fieldType, INFOFIELD_UINT64);
Expand Down Expand Up @@ -726,10 +742,11 @@ std::vector<std::string> getCommonFields() {
VecSimCommonStrings::DIMENSION_STRING, // 2. DIMENSION
VecSimCommonStrings::METRIC_STRING, // 3. METRIC
VecSimCommonStrings::IS_MULTI_STRING, // 4. IS_MULTI
VecSimCommonStrings::INDEX_SIZE_STRING, // 5. INDEX_SIZE
VecSimCommonStrings::INDEX_LABEL_COUNT_STRING, // 6. INDEX_LABEL_COUNT
VecSimCommonStrings::MEMORY_STRING, // 7. MEMORY
VecSimCommonStrings::SEARCH_MODE_STRING // 8. SEARCH_MODE
VecSimCommonStrings::IS_DISK_STRING, // 5. IS_DISK
VecSimCommonStrings::INDEX_SIZE_STRING, // 6. INDEX_SIZE
VecSimCommonStrings::INDEX_LABEL_COUNT_STRING, // 7. INDEX_LABEL_COUNT
VecSimCommonStrings::MEMORY_STRING, // 8. MEMORY
VecSimCommonStrings::SEARCH_MODE_STRING // 9. SEARCH_MODE
};
}

Expand Down
Loading