[C API] Feature request: expose block-growth headroom for a dynamic index
Les mainteneurs répondent en général sous 5 jours
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 72/100
Piste de recherche
Start in bindings/c/include/svs/c/svs_c.h beside svs_index_get_memory_usage and svs_index_get_memory_breakdown, then trace the dynamic index implementation in dynamic_index.h and its resize/unsafe_resize paths. Add the read-only API and verify it reports capacity minus size for dynamic indices, returns zero for unsupported indices, and preserves the documented error-handling shape.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Problem
A dynamic index's memory reservation is tracked as committed capacity, not live occupancy. add_points grows data_/graph_/status_ in blocks (dynamic_index.h, resize/unsafe_resize calls), so a block often has spare rows left over after a resize. Committed capacity therefore overstates how many bytes an insert will actually consume.
An insert-admission gate that enforces a memory budget needs to know how much of that committed capacity is still unoccupied headroom, so it can allow an insert that would land in already-allocated spare rows and cost zero real bytes. Without that visibility, the gate must charge a fixed conservative growth cost per insert, and near the budget limit it refuses inserts that would not have grown memory at all.
What is needed is a cheap way to read how many rows of spare capacity a dynamic index currently has, without walking the graph.
Requested API
Add a new C API call, alongside the existing memory-usage family (svs_index_get_memory_usage, svs_index_get_memory_breakdown in bindings/c/include/svs/c/svs_c.h):
/// @brief Get the unused row capacity of a dynamic index before its next
/// internal block resize
/// @param index The index handle
/// @param out_vectors Pointer to store the number of rows of headroom
/// @param out_err An optional error handle to capture errors
/// @return true on success, false on failure
/// @remarks O(1). Reads capacity() - size() off the dynamic index's
/// blocked dataset. Returns 0 for indices that do not support dynamic
/// growth (e.g. static/read-only indices).
SVS_API bool svs_index_get_capacity_headroom(
svs_index_h index, size_t* out_vectors, svs_error_h out_err /*=NULL*/
);
Why this shape
- Mirrors the existing
svs_index_get_memory_usage/svs_index_get_memory_breakdownsignatures and doc-comment style, so it fits the current API family added for PR #364. - Returns a row count, not bytes. The caller already knows per-row byte cost from its own dimension/element-size config; a row count avoids duplicating SVS's internal block-size math on the caller side. A byte count works too, if that fits the existing memory-usage API family better; the caller can convert either way.
- O(1): a
capacity() - size()read, no graph walk.
Non-goals
- Does not need to account for
Deletedslots.delete_entrymarks a slotDeleted, notEmpty(dynamic_index.h), andadd_points's reuse scan only matchesEmpty(dynamic_index.h:752). Onlycompact()turnsDeletedback into usable capacity, so headroom from block growth and headroom from delete/compact are different numbers; this request is only for the former. - No behavior change to
add_points,resize, orcompactis being requested; this is a read-only accessor.
- Langage dominant
- C++
- Étoiles
- 241
- Forks
- 48
- Merge moyen
- 4 j 21 h
- PR mergées (30 j)
- 11
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de intel/ScalableVectorSearch
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
intel/ScalableVectorSearch#356 ·
Les mainteneurs répondent en général sous 5 jours
-
Difficulté 4/5 3-5 jours Accessibilité débutants 42/100
intel/ScalableVectorSearch#469 ·
Les mainteneurs répondent en général sous 5 jours
-
Add CI test for C API on ARMOuverteenhancement
Difficulté 3/5 1-2 jours Accessibilité débutants 32/100
intel/ScalableVectorSearch#460 ·
Les mainteneurs répondent en général sous 5 jours
-
Difficulté 4/5 3-5 jours Accessibilité débutants 55/100
intel/ScalableVectorSearch#438 ·
Les mainteneurs répondent en général sous 5 jours
-
CI: tier the test matrix into PR / main / nightly to cut Actions minutesPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 32/100
intel/ScalableVectorSearch#432 · 1 commentaire ·
Les mainteneurs répondent en général sous 5 jours
Toutes les issues de intel/ScalableVectorSearch
Issues similaires
-
runtime: lf_f128_mod is documented as fmodq (truncating) but implements floor-based modulo; unusedOuverteinternal correctness low priority rt_lib
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 87/100
-
PriorityNotificationQueue::wakeUpAll() loses the wake-up for a thread that is not waiting yetPeut-être pris @matejk l’a pris aujourd’hui. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
pocoproject/poco#5674 ·
Les mainteneurs répondent en général sous 2 jours
-
bug docs GUI
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
sonic-pi-net/sonic-pi#3609 ·
-
Unreachable code warningOuvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
SanderMertens/flecs#2395 ·
Les mainteneurs répondent en général sous 1 jour