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
1 change: 1 addition & 0 deletions cmake/VSAGOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ option (ENABLE_PYBINDS "Whether compile Python bindings" OFF)
option (ENABLE_NODE_BINDS "Whether compile Node.js bindings" OFF)
option (ENABLE_MOCKIMPL "Whether compile mock implementation" OFF)
option (ENABLE_LIBAIO "Whether to enable libaio support" ON)
option (ENABLE_LIBURING "Whether to enable liburing support" ON)
option (ENABLE_SOVERSION "Whether to set SO version on the shared library" ON)
option (DISABLE_SSE_FORCE "Force disable sse and higher instructions" OFF)
option (DISABLE_AVX_FORCE "Force disable avx and higher instructions" OFF)
Expand Down
31 changes: 31 additions & 0 deletions cmake/VSAGSystemDeps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
include_guard (GLOBAL)

set (HAVE_LIBAIO 0)
set (HAVE_LIBURING 0)
unset (AIO_LIBRARY)
unset (URING_LIBRARY)
unset (URING_LIBRARY CACHE)
unset (URING_INCLUDE_DIR)
unset (URING_INCLUDE_DIR CACHE)

if (ENABLE_LIBAIO)
find_library (AIO_LIBRARY aio)
Expand All @@ -34,6 +39,32 @@ if (NOT HAVE_LIBAIO)
add_compile_definitions (NO_LIBAIO=1)
endif ()

if (ENABLE_LIBURING)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_library (URING_LIBRARY uring)
find_path (URING_INCLUDE_DIR liburing.h)
if (URING_LIBRARY AND URING_INCLUDE_DIR)
set (HAVE_LIBURING 1)
message (STATUS "Found liburing: ${URING_LIBRARY}, include: ${URING_INCLUDE_DIR}")
else ()
message (WARNING "liburing not found, disabling io_uring support")
unset (URING_LIBRARY)
unset (URING_LIBRARY CACHE)
unset (URING_INCLUDE_DIR)
unset (URING_INCLUDE_DIR CACHE)
endif ()
else ()
message (STATUS "liburing support is only available on Linux")
endif ()
else ()
message (STATUS "liburing support disabled by user")
endif ()

add_compile_definitions (HAVE_LIBURING=${HAVE_LIBURING})
if (NOT HAVE_LIBURING)
add_compile_definitions (NO_LIBURING=1)
endif ()

find_program (CCACHE_PROGRAM ccache)
if (ENABLE_CCACHE)
if (CCACHE_PROGRAM)
Expand Down
4 changes: 4 additions & 0 deletions src/datacell/bucket_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "bucket_datacell.h"
#include "inner_string_params.h"
#include "io/io_headers.h"
#include "io/uring_io/uring_io.h"
#include "quantization/quantizer_headers.h"

namespace vsag {
Expand Down Expand Up @@ -109,6 +110,9 @@ BucketInterface::MakeInstance(const BucketDataCellParamPtr& param,
if (io_type_name == IO_TYPE_VALUE_ASYNC_IO) {
return make_instance<NonContinuousIO<AsyncIO>>(param, common_param);
}
if (io_type_name == IO_TYPE_VALUE_URING_IO) {
return make_instance<NonContinuousIO<UringIO>>(param, common_param);
}
if (io_type_name == IO_TYPE_VALUE_BUFFER_IO) {
return make_instance<NonContinuousIO<BufferIO>>(param, common_param);
}
Expand Down
4 changes: 4 additions & 0 deletions src/datacell/flatten_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "index_common_param.h"
#include "inner_string_params.h"
#include "io/io_headers.h"
#include "io/uring_io/uring_io.h"
#include "multi_vector_datacell.h"
Comment on lines 19 to 22
#include "quantization/int8_quantizer.h"
#include "quantization/quantizer_adapter.h"
Expand Down Expand Up @@ -297,6 +298,9 @@ FlattenInterface::MakeInstance(const FlattenInterfaceParamPtr& param,
if (io_type_name == IO_TYPE_VALUE_ASYNC_IO) {
return make_instance<AsyncIO>(param, common_param);
}
if (io_type_name == IO_TYPE_VALUE_URING_IO) {
return make_instance<UringIO>(param, common_param);
}
if (io_type_name == IO_TYPE_VALUE_MMAP_IO) {
return make_instance<MMapIO>(param, common_param);
}
Expand Down
4 changes: 4 additions & 0 deletions src/datacell/graph_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "compressed_graph_datacell.h"
#include "graph_datacell.h"
#include "io/io_headers.h"
#include "io/uring_io/uring_io.h"
#include "sparse_graph_datacell.h"

namespace vsag {
Expand Down Expand Up @@ -74,6 +75,9 @@ GraphInterface::MakeInstance(const GraphInterfaceParamPtr& graph_param,
if (io_string == IO_TYPE_VALUE_ASYNC_IO) {
return std::make_shared<GraphDataCell<AsyncIO>>(graph_param, common_param);
}
if (io_string == IO_TYPE_VALUE_URING_IO) {
return std::make_shared<GraphDataCell<UringIO>>(graph_param, common_param);
}
if (io_string == IO_TYPE_VALUE_READER_IO) {
return std::make_shared<GraphDataCell<ReaderIO>>(graph_param, common_param);
}
Expand Down
3 changes: 2 additions & 1 deletion src/datacell/rabitq_split_datacell.h
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,8 @@ class RaBitQSplitDataCell : public FlattenInterface {
IsKnownIOType(const std::string& io_type) {
return io_type == IO_TYPE_VALUE_MEMORY_IO or io_type == IO_TYPE_VALUE_BUFFER_IO or
io_type == IO_TYPE_VALUE_MMAP_IO or io_type == IO_TYPE_VALUE_READER_IO or
io_type == IO_TYPE_VALUE_ASYNC_IO or io_type == IO_TYPE_VALUE_BLOCK_MEMORY_IO;
io_type == IO_TYPE_VALUE_ASYNC_IO or io_type == IO_TYPE_VALUE_URING_IO or
io_type == IO_TYPE_VALUE_BLOCK_MEMORY_IO;
}

void
Expand Down
1 change: 1 addition & 0 deletions src/inner_string_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const char* const IO_TYPE_VALUE_BUFFER_IO = "buffer_io";
const char* const IO_TYPE_VALUE_MMAP_IO = "mmap_io";
const char* const IO_TYPE_VALUE_READER_IO = "reader_io";
const char* const IO_TYPE_VALUE_ASYNC_IO = "async_io";
const char* const IO_TYPE_VALUE_URING_IO = "uring_io";
const char* const IO_TYPE_VALUE_BLOCK_MEMORY_IO = "block_memory_io";
const char* const BLOCK_IO_BLOCK_SIZE_KEY = "block_size";

Expand Down
20 changes: 18 additions & 2 deletions src/io/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ set (IO_SRC
buffer_io/buffer_io.cpp
async_io/async_io_parameter.cpp
async_io/async_io.cpp
uring_io/uring_io_parameter.cpp
uring_io/uring_io.cpp
mmap_io/mmap_io_parameter.cpp
mmap_io/mmap_io.cpp
memory_block_io/memory_block_io.cpp
Expand All @@ -31,14 +33,28 @@ set (IO_SRC
)

add_library (io OBJECT ${IO_SRC})

set (IO_LINK_LIBRARIES coverage_config vsag_src_common)

if (HAVE_LIBAIO)
target_link_libraries (io PRIVATE aio coverage_config vsag_src_common)
list (APPEND IO_LINK_LIBRARIES aio)
message (STATUS "io module: linking with libaio")
else ()
target_link_libraries (io PRIVATE coverage_config vsag_src_common)
message (STATUS "io module: libaio not available, async I/O disabled")
endif ()

if (HAVE_LIBURING)
list (APPEND IO_LINK_LIBRARIES ${URING_LIBRARY})
message (STATUS "io module: linking with liburing")
else ()
message (STATUS "io module: liburing not available, io_uring disabled")
endif ()

target_link_libraries (io PRIVATE ${IO_LINK_LIBRARIES})
if (HAVE_LIBURING)
target_include_directories (io PRIVATE ${URING_INCLUDE_DIR})
endif ()

if (ENABLE_TESTS)
file (GLOB_RECURSE IO_TESTS "*_test.cpp")
add_library (io_test STATIC ${IO_TESTS})
Expand Down
12 changes: 12 additions & 0 deletions src/io/common/io_parameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@
#include "io/memory_io/memory_io_parameter.h"
#include "io/mmap_io/mmap_io_parameter.h"
#include "io/reader_io/reader_io_parameter.h"
#include "io/uring_io/uring_io_parameter.h"

namespace vsag {

namespace {
std::once_flag async_io_fallback_warn_once;
std::once_flag uring_io_fallback_warn_once;
} // namespace

IOParamPtr
Expand All @@ -54,6 +56,16 @@ IOParameter::GetIOParameterByJson(const JsonType& json) {
logger::warn("libaio is unavailable, async_io is falling back to buffer_io");
});
io_ptr = std::make_shared<BufferIOParameter>();
#endif
io_ptr->FromJson(json);
} else if (type_name == IO_TYPE_VALUE_URING_IO) {
#if HAVE_LIBURING
io_ptr = std::make_shared<UringIOParameter>();
#else
std::call_once(uring_io_fallback_warn_once, []() {
logger::warn("liburing is unavailable, uring_io is falling back to buffer_io");
});
io_ptr = std::make_shared<BufferIOParameter>();
#endif
io_ptr->FromJson(json);
} else if (type_name == IO_TYPE_VALUE_MMAP_IO) {
Expand Down
Loading
Loading