refactor(diskann): decouple from libaio via dlopen#532
Conversation
… into refactor/diskann_dlopen
|
可以把workflow里,打包相关的libaio-devel依赖,在这个PR里移除 |
| # so these exports are no longer needed for runtime plugin loading, | ||
| # but they are still required for the C API and for C++ consumers | ||
| # that link against the shared module. | ||
| extern "C++" { |
There was a problem hiding this comment.
我建议删掉除了判断diskann with aio available的接口外,任何diskann plugin的接口。
站在用户侧,只需要关注当前runtime是否支持libaio的diskann就够了。
| // on these symbols; they may change or be removed in future releases. On | ||
| // hosts missing libaio the bring-up fails cleanly and only DiskAnn becomes | ||
| // unavailable — other index types (HNSW / IVF / Flat / Vamana) keep working. | ||
| // on these symbols; they may change or be removed in future releases. |
There was a problem hiding this comment.
这个头文件还有必要留着吗?可能只需要放一个static标记位就可以了
There was a problem hiding this comment.
diskann plugin命名歧义,已经去掉了改成diskann runtime,并只保留了load aio检测判断的必要代码。
| sudo apt-get install -y clang libomp-dev | ||
| shell: bash | ||
|
|
||
| - name: Install AIO |
There was a problem hiding this comment.
ci移除了aio,如何验证w aio的情况?这里w aio和w/o aio的情况都要测
There was a problem hiding this comment.
add a job to test w/ libaio, since main job is test on default env
| transform(log_level.begin(), log_level.end(), log_level.begin(), ::tolower); | ||
| if (LOG_LEVEL.find(log_level) != LOG_LEVEL.end()) { | ||
| IndexLoggerBroker::SetLevel(LOG_LEVEL[log_level]); | ||
| zvec::ailego::LoggerBroker::SetLevel(LOG_LEVEL[log_level]); |
There was a problem hiding this comment.
去掉了,之前的没有生效,改成了新的log库
| transform(log_level.begin(), log_level.end(), log_level.begin(), ::tolower); | ||
| if (LOG_LEVEL.find(log_level) != LOG_LEVEL.end()) { | ||
| IndexLoggerBroker::SetLevel(LOG_LEVEL[log_level]); | ||
| zvec::ailego::LoggerBroker::SetLevel(LOG_LEVEL[log_level]); |
There was a problem hiding this comment.
去掉了,之前的没有生效,改成了新的log库
|
|
||
| set(CONFIGURE_ENV_LIST "") | ||
| if(USE_OSS_MIRROR) | ||
| set(_OSS_BASE "https://zvec-bj.oss-cn-beijing.aliyuncs.com/thirdparty") |
| --no-build-isolation \ | ||
| --config-settings='cmake.define.BUILD_TOOLS=ON' \ | ||
| --config-settings='cmake.define.ENABLE_WERROR=ON' \ | ||
| --config-settings='cmake.define.CMAKE_C_COMPILER_LAUNCHER=ccache' \ |
There was a problem hiding this comment.
为啥要新开一个yml文件,理论上编译过程和03-macos-linux-build完全一样吧?没必要重复编译吧
There was a problem hiding this comment.
放在一个里面,跑两次ut?第二次之前安装libaio库吧?
| sudo apt-get update | ||
| sudo apt-get install -y --no-install-recommends \ | ||
| lcov libaio-dev | ||
| lcov |
There was a problem hiding this comment.
coverage可以不用去掉吧?不然也测不到diskann代码的覆盖度了?
| # libaio-devel lives in BaseOS; disable EPEL so a flaky EPEL mirror cannot | ||
| # break metadata refresh. | ||
| before-all = "dnf install -y --disablerepo=epel libaio-devel" | ||
| # libaio is loaded at runtime via dlopen (no build-time dependency). |
There was a problem hiding this comment.
这句注释也去掉好了,没有上下文看到这句话也挺让人疑惑的,或者把注释写完整一些也行
| namespace zvec { | ||
|
|
||
| // Return codes for InitDiskAnnRuntime(). | ||
| enum DiskAnnRuntimeStatus { |
There was a problem hiding this comment.
这里的接口如何考虑后续给diskann引入io uring?
There was a problem hiding this comment.
已经把runtime去掉。改成在diskannxxx几个类初始化的时候,进行判断。
| // | ||
| // The ``path`` parameter is retained for API compatibility but is ignored. | ||
| int InitDiskAnnRuntime(const std::string &path = ""); | ||
|
|
There was a problem hiding this comment.
这里要放在core层的interface吗?作为db层需要用到这个吗?
c api是不是没调整?
There was a problem hiding this comment.
这个是在构建索引的时候给用户提供warning信息。去掉了,改成在diskannxxx几个类初始化的时候,进行判断。
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