Skip to content

Commit cb42297

Browse files
authored
fix(diskann): add diskann into zvec core lib (#602)
1 parent e89be98 commit cb42297

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

src/core/CMakeLists.txt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,16 @@ if(NOT RABITQ_SUPPORTED)
6060
list(FILTER ALL_CORE_SRCS EXCLUDE REGEX ".*/algorithm/hnsw_rabitq/.*")
6161
endif()
6262

63-
# Always exclude algorithm/diskann implementation files from zvec_core.
64-
# The DiskAnn algorithm is provided by the separate core_knn_diskann library
65-
# (STATIC+SHARED, real on Linux x86_64, stub on other platforms). The static
66-
# variant is whole-archived into _zvec.so for the Python wheel; the shared
67-
# variant is used by C++ tools and tests. Including the sources here would
68-
# cause duplicate symbols.
69-
list(FILTER ALL_CORE_SRCS EXCLUDE REGEX ".*/algorithm/diskann/.*")
63+
# Exclude algorithm/diskann implementation files from zvec_core when not
64+
# supported (matching the hnsw_rabitq pattern above). When DISKANN_SUPPORTED,
65+
# the diskann sources are packed into zvec_core directly, so libzvec_core.so
66+
# includes diskann symbols without needing a separate whole-archive step.
67+
# The standalone core_knn_diskann library (built by algorithm/diskann) is still
68+
# whole-archived into _zvec.so; since _zvec.so links zvec_core *normally*
69+
# (not --whole-archive), the linker skips zvec_core's diskann objects there
70+
# (symbols already resolved by core_knn_diskann_static) — no duplicates.
7071
if(NOT DISKANN_SUPPORTED)
72+
list(FILTER ALL_CORE_SRCS EXCLUDE REGEX ".*/algorithm/diskann/.*")
7173
list(FILTER ALL_CORE_SRCS EXCLUDE REGEX ".*/interface/indexes/diskann_index\\.cc")
7274
endif()
7375

0 commit comments

Comments
 (0)