Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 59 additions & 1 deletion .github/workflows/ut.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,19 @@ jobs:
conan profile detect --force \
&& conan remote add default-conan-local2 https://milvus01.jfrog.io/artifactory/api/conan/default-conan-local2 --force
- name: Build & Run
env:
KNOWHERE_REQUIRE_IO_URING: "1"
run: |
make test BUILD_TYPE=Release CONAN_EXTRA='-o \&:with_asan=True -s compiler.version=12'
make conan BUILD_TYPE=Release CONAN_EXTRA='-o \&:with_ut=True -o \&:with_asan=True -s compiler.version=12 -s compiler.cppstd=20'
sudo apt update && sudo apt install -y liburing-dev
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/build/conan_toolchain.cmake \
-DWITH_COMMON_UT=ON \
-DENABLE_SYNCPOINT=ON \
-Wno-dev
cmake --build build -j$(nproc)
. build/conanrun.sh && ctest --test-dir build --output-on-failure
- name: Save Conan Packages
uses: actions/cache/save@v4
with:
Expand Down Expand Up @@ -95,3 +106,50 @@ jobs:
with:
path: ~/.conan2
key: milvus-common-macos-15-${{ hashFiles('conanfile.py')}}

ut-no-liburing:
name: UT without liburing on ubuntu-22.04
runs-on: ubuntu-22.04
timeout-minutes: 240
env:
CC: gcc-12
CXX: g++-12
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Dependency
run: |
sudo apt update && sudo apt install -y cmake libaio-dev g++-12 gcc-12 python3 python3-pip \
&& pip3 install conan==2.25.1
- name: Restore Conan Packages
uses: actions/cache@v4
with:
path: ~/.conan2
key: milvus-common-no-liburing-ubuntu-22.04-${{ hashFiles('conanfile.py')}}
restore-keys: milvus-common-no-liburing-ubuntu-22.04-
- name: Setup Conan
run: |
conan profile detect --force \
&& conan remote add default-conan-local2 https://milvus01.jfrog.io/artifactory/api/conan/default-conan-local2 --force
- name: Build & Run
run: |
make conan BUILD_TYPE=Release CONAN_EXTRA='-o \&:with_ut=True -o \&:with_asan=True -s compiler.version=12 -s compiler.cppstd=20'
cmake -S . -B build-no-liburing \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/build/conan_toolchain.cmake \
-DWITH_COMMON_UT=ON \
-DENABLE_SYNCPOINT=ON \
-DURING_INCLUDE_DIR=URING_INCLUDE_DIR-NOTFOUND \
-DURING_LIBRARY=URING_LIBRARY-NOTFOUND \
-Wno-dev
cmake --build build-no-liburing -j$(nproc)
. build/conanrun.sh && ctest --test-dir build-no-liburing --output-on-failure
- name: Save Conan Packages
uses: actions/cache/save@v4
with:
path: ~/.conan2
key: milvus-common-no-liburing-ubuntu-22.04-${{ hashFiles('conanfile.py')}}
30 changes: 29 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,33 @@ else()
list(APPEND COMMON_LINKER_LIBS ${LIBAIO_LIBRARY})
endif()

set(MILVUS_COMMON_WITH_IO_URING OFF)
find_path(URING_INCLUDE_DIR liburing.h)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The C++20 standard is linked as PUBLIC, meaning every target that depends on this library is forced to compile with C++20. This is driven by std::span usage in headers. Downstream projects that cannot adopt C++20 will fail to build. The requirement should be PRIVATE, and std::span-using headers should be isolated or guarded.

find_library(URING_LIBRARY NAMES uring)
if(URING_INCLUDE_DIR AND URING_LIBRARY)
message(STATUS "liburing found: ${URING_LIBRARY}, enabling io_uring support")
list(APPEND COMMON_LINKER_LIBS ${URING_LIBRARY})
list(APPEND MILVUS_COMMON_EXTRA_INCLUDE_DIRS ${URING_INCLUDE_DIR})
set(MILVUS_COMMON_WITH_IO_URING ON)
else()
list(REMOVE_ITEM SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/knowhere/uring_context_pool.cc)
message(STATUS "liburing not found, disabling io_uring support (keeping completion reader shim)")
endif()

add_library(milvus-common SHARED ${SRC_FILES})
target_compile_features(milvus-common PRIVATE cxx_std_20)

# Use std::shared_ptr etc. instead of opentelemetry::nostd:: equivalents
target_compile_definitions(milvus-common PUBLIC OPENTELEMETRY_STL_VERSION=2017)
if(LIBAIO_LIBRARY)
target_compile_definitions(milvus-common PUBLIC MILVUS_COMMON_WITH_LIBAIO)
endif()
if(MILVUS_COMMON_WITH_IO_URING)
target_compile_definitions(milvus-common PUBLIC WITH_IO_URING)
endif()
if(MILVUS_COMMON_EXTRA_INCLUDE_DIRS)
target_include_directories(milvus-common PUBLIC ${MILVUS_COMMON_EXTRA_INCLUDE_DIRS})
endif()

if(APPLE)
target_compile_definitions(milvus-common PUBLIC BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED)
Expand All @@ -141,7 +164,12 @@ target_link_libraries(milvus-common PUBLIC OpenMP::OpenMP_CXX)
# thread_pool.cc uses openblas-specific API (openblas_set_num_threads) under OPENBLAS_OS_LINUX
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(OpenBLAS CONFIG REQUIRED)
target_link_libraries(milvus-common PUBLIC OpenBLAS::OpenBLAS)
if(TARGET OpenBLAS::OpenBLAS)
target_link_libraries(milvus-common PUBLIC OpenBLAS::OpenBLAS)
else()
target_include_directories(milvus-common PUBLIC ${OpenBLAS_INCLUDE_DIRS})
target_link_libraries(milvus-common PUBLIC ${OpenBLAS_LIBRARIES})
endif()
endif()

if(WITH_COMMON_UT)
Expand Down
Loading