refactor(diskann): decouple from libaio via dlopen#532
Conversation
… into refactor/diskann_dlopen
|
可以把workflow里,打包相关的libaio-devel依赖,在这个PR里移除 |
… into refactor/diskann_dlopen
|
DiskANN 以及本 PR 新增的 IO backend API 在运行时绑定和 type hints 之间存在多处不一致,建议合入前一起补齐。 1. Python stubs 没有声明 DiskANN 参数运行时已经导出了:
对应绑定位于:
但 与此同时,顶层 建议在 class DiskAnnIndexParam(IndexParam):
metric_type: MetricType
max_degree: int
list_size: int
pq_chunk_num: int
quantize_type: QuantizeType
quantizer_param: QuantizerParam
class DiskAnnQueryParam(QueryParam):
list_size: int构造函数签名和默认值需要与 pybind 保持一致: DiskAnnIndexParam(
metric_type=MetricType.IP,
max_degree=100,
list_size=50,
pq_chunk_num=0,
quantize_type=QuantizeType.UNDEFINED,
quantizer_param=QuantizerParam(),
)
DiskAnnQueryParam(list_size=300)2.
|
fixed. add missing hints, stub, etc. and also changed the macro guard. |
| @@ -0,0 +1,242 @@ | |||
| # Copyright 2025-present the zvec project | |||
| # | |||
| # Licensed under the Apache License, Version 2.0 (the "License"); | |||
There was a problem hiding this comment.
一条 runtime API 与 type hints 的一致性测试,详情见zhourrr的comment。
Re-express the ARM64 DiskANN enablement on top of PR alibaba#532's dlopen-based libaio decoupling (the plugin architecture is gone, so the old plugin/EnsureDiskAnnRuntimeReady error-message tweaks no longer apply). - CMakeLists.txt: widen DISKANN_SUPPORTED gate to x86_64|i686|i386|aarch64|arm64|riscv64. - cmake/option.cmake: _setup_armv8_march now tries "armv8-a" before the bare "armv8" (GCC/Clang on aarch64 reject the bare form). - src/core/algorithm/diskann/CMakeLists.txt: widen the ${CMAKE_DL_LIBS} (dlopen) link gate to match the supported-platform set. - src/db/index/common/schema.cc: update the unsupported-platform message to reflect the widened platform list. libaio_def.h already provides aarch64 ABI struct layouts; libaio is loaded at runtime via dlopen with a synchronous pread() fallback when absent.
| include_directories(${ZVEC_INCLUDE_DIR}) | ||
| # src/include → public headers (<zvec/...>) | ||
| # src → internal headers (<ailego/...>) referenced by public headers | ||
| include_directories(${ZVEC_INCLUDE_DIR} ${ZVEC_ROOT_DIR}/src) |
There was a problem hiding this comment.
为啥要加上${ZVEC_ROOT_DIR}/src
Currently, DiskAnn ships as a separate runtime-loaded .so (libzvec_diskann_plugin.so) file which requires a hard build-time dependency on libaio-dev.
This PR improves with a simpler, more robust design. Probing libaio.so file, a thread-safe singleton dlopens it and caches the syscall pointers. If libaio is absent, it will fall back to degrade to synchronous pread() with a warning.
The following shows the performance comparison on Cohere 1M between pread w/ and w/o AIO enabled. (Aliyun g9i, PL0, 10000 IOPS)
Pread w/ AIO Enabled
Pread w/o AIO Enabled