[C API] Feature request: expose block-growth headroom for a dynamic index
Mantenedores costumam responder em até 5 dias
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 72/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- C++
- Estrelas
- 241
- Forks
- 48
- Merge médio
- 4d 21h
- PRs com merge (30d)
- 11
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de intel/ScalableVectorSearch
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
intel/ScalableVectorSearch#356 ·
Mantenedores costumam responder em até 5 dias
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 42/100
intel/ScalableVectorSearch#469 ·
Mantenedores costumam responder em até 5 dias
-
Add CI test for C API on ARMAbertaenhancement
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 32/100
intel/ScalableVectorSearch#460 ·
Mantenedores costumam responder em até 5 dias
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 55/100
intel/ScalableVectorSearch#438 ·
Mantenedores costumam responder em até 5 dias
-
CI: tier the test matrix into PR / main / nightly to cut Actions minutesTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 32/100
intel/ScalableVectorSearch#432 · 1 comentário ·
Mantenedores costumam responder em até 5 dias
Todas as issues de intel/ScalableVectorSearch
Issues semelhantes
-
runtime: lf_f128_mod is documented as fmodq (truncating) but implements floor-based modulo; unusedAbertainternal correctness low priority rt_lib
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 87/100
-
PriorityNotificationQueue::wakeUpAll() loses the wake-up for a thread that is not waiting yetTalvez já em andamento @matejk assumiu hoje. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
pocoproject/poco#5674 ·
Mantenedores costumam responder em até 2 dias
-
bug docs GUI
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
sonic-pi-net/sonic-pi#3609 ·
-
Unreachable code warningAbertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
SanderMertens/flecs#2395 ·
Mantenedores costumam responder em até 1 dia