under test, not sure no errors
This commit is contained in:
2
upstream_ref/xllm/third_party/.clang-format
vendored
Normal file
2
upstream_ref/xllm/third_party/.clang-format
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
DisableFormat: true
|
||||
SortIncludes: Never
|
||||
66
upstream_ref/xllm/third_party/CMakeLists.txt
vendored
Normal file
66
upstream_ref/xllm/third_party/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
include(cc_library)
|
||||
|
||||
add_subdirectory(sentencepiece)
|
||||
add_subdirectory(minja)
|
||||
add_subdirectory(brpc)
|
||||
add_subdirectory(smhasher/src)
|
||||
add_subdirectory(cpprestsdk)
|
||||
set(CPPREST_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cpprestsdk/Release/include)
|
||||
set(CPPREST_LIB ${CMAKE_BINARY_DIR}/third_party/cpprestsdk/Release/Binaries/libcpprest.a)
|
||||
|
||||
# GCC 12+ strict check workaround for cpprestsdk
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND
|
||||
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
|
||||
if(TARGET cpprest)
|
||||
target_compile_options(cpprest PRIVATE -Wno-restrict -Wno-attributes)
|
||||
message(STATUS "Applied GCC 12+ warning suppressions for cpprestsdk")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_subdirectory(etcd_cpp_apiv3)
|
||||
add_subdirectory(xxHash)
|
||||
add_subdirectory(spdlog)
|
||||
|
||||
if(USE_NPU)
|
||||
add_subdirectory(torch_npu_ops)
|
||||
endif()
|
||||
add_subdirectory(Mooncake)
|
||||
|
||||
target_include_directories(mooncake_store PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Mooncake/mooncake-transfer-engine/include
|
||||
)
|
||||
|
||||
if(USE_ILU)
|
||||
if(TARGET cpprest)
|
||||
set_target_properties(cpprest PROPERTIES
|
||||
CXX_STANDARD 20
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
CXX_EXTENSIONS OFF
|
||||
)
|
||||
endif()
|
||||
if(TARGET transfer_engine)
|
||||
target_compile_options(transfer_engine PRIVATE -std=c++20)
|
||||
set_target_properties(transfer_engine PROPERTIES
|
||||
CXX_STANDARD 20
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
)
|
||||
message(STATUS "Set C++20 for transfer_engine target")
|
||||
endif()
|
||||
if(TARGET SMHasherSupport)
|
||||
set_target_properties(SMHasherSupport PROPERTIES
|
||||
CXX_STANDARD 11
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
CXX_EXTENSIONS OFF
|
||||
)
|
||||
message(STATUS "SMHasherSupport target found and configured")
|
||||
else()
|
||||
message(WARNING "SMHasherSupport target not found after adding smhasher")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
## The order of static libraries is important in the CMake build system because the linker processes them strictly from left to right.
|
||||
## -> The linker scans each library only once and extracts object files solely to resolve currently undefined symbols.
|
||||
## -> In modern CMake, the best practice is to explicitly declare a target's dependencies, allowing CMake to automatically determine the correct linking order.
|
||||
## -> The following code is added to prevent symbol resolution errors when xllm links against mooncake-related static libraries.
|
||||
target_link_libraries(mooncake_store PUBLIC transfer_engine cachelib_memory_allocator)
|
||||
target_link_libraries(cachelib_memory_allocator PRIVATE Folly::folly glog::glog)
|
||||
131
upstream_ref/xllm/third_party/dependencies.sh
vendored
Normal file
131
upstream_ref/xllm/third_party/dependencies.sh
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Color definitions
|
||||
GREEN="\033[0;32m"
|
||||
BLUE="\033[0;34m"
|
||||
YELLOW="\033[0;33m"
|
||||
RED="\033[0;31m"
|
||||
NC="\033[0m" # No Color
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
||||
INSTALL_PREFIX="/usr/local/yalantinglibs"
|
||||
|
||||
print_section() {
|
||||
echo -e "\n${BLUE}=== $1 ===${NC}"
|
||||
}
|
||||
|
||||
print_success() {
|
||||
echo -e "${GREEN}✓ $1${NC}"
|
||||
}
|
||||
|
||||
print_warning() {
|
||||
echo -e "${YELLOW}$1${NC}"
|
||||
}
|
||||
|
||||
print_error() {
|
||||
echo -e "${RED}✗ ERROR: $1${NC}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
run_or_die() {
|
||||
local error_message="$1"
|
||||
shift
|
||||
"$@"
|
||||
if [ $? -ne 0 ]; then
|
||||
print_error "$error_message"
|
||||
fi
|
||||
}
|
||||
|
||||
ensure_dir() {
|
||||
local dir_path="$1"
|
||||
local error_message="$2"
|
||||
if [ ! -d "${dir_path}" ]; then
|
||||
run_or_die "${error_message}" mkdir -p "${dir_path}"
|
||||
fi
|
||||
}
|
||||
|
||||
remove_dir_if_exists() {
|
||||
local dir_path="$1"
|
||||
local dir_name="$2"
|
||||
if [ -d "${dir_path}" ]; then
|
||||
print_warning "${dir_name} directory already exists. Removing for fresh install..."
|
||||
run_or_die "Failed to remove existing ${dir_name} directory" rm -rf "${dir_path}"
|
||||
fi
|
||||
}
|
||||
|
||||
patch_yalantinglibs_config() {
|
||||
local config_file="$1"
|
||||
if [ -f "${config_file}" ]; then
|
||||
run_or_die \
|
||||
"Failed to patch yalantinglibs config.cmake" \
|
||||
sed -i \
|
||||
'54s/target_link_libraries(${ylt_target_name} -libverbs)/target_link_libraries(${ylt_target_name} INTERFACE -libverbs)/' \
|
||||
"${config_file}"
|
||||
fi
|
||||
}
|
||||
|
||||
patch_yalantinglibs_easylog() {
|
||||
local easylog_header="$1"
|
||||
if [ -f "${easylog_header}" ]; then
|
||||
run_or_die \
|
||||
"Failed to patch yalantinglibs easylog severity default" \
|
||||
sed -i \
|
||||
'/std::atomic<Severity> min_severity_ =/,/#endif/c\ std::atomic<Severity> min_severity_ = Severity::WARN;' \
|
||||
"${easylog_header}"
|
||||
fi
|
||||
}
|
||||
|
||||
install_yalantinglibs() {
|
||||
print_section "Installing yalantinglibs"
|
||||
|
||||
local thirdparties_dir="${REPO_ROOT}/third_party/Mooncake/thirdparties"
|
||||
local yalanting_repo_url="https://gitcode.com/gh_mirrors/ya/yalantinglibs.git"
|
||||
local yalanting_source_dir="${thirdparties_dir}/yalantinglibs"
|
||||
local yalanting_build_dir="${yalanting_source_dir}/build"
|
||||
local yalanting_config_file="${INSTALL_PREFIX}/lib/cmake/yalantinglibs/config.cmake"
|
||||
local yalanting_easylog_header="${yalanting_source_dir}/include/ylt/easylog.hpp"
|
||||
|
||||
ensure_dir "${thirdparties_dir}" "Failed to create Mooncake/thirdparties directory"
|
||||
remove_dir_if_exists "${yalanting_source_dir}" "yalantinglibs"
|
||||
|
||||
echo "Cloning yalantinglibs from ${yalanting_repo_url}"
|
||||
run_or_die "Failed to clone yalantinglibs" git clone "${yalanting_repo_url}" "${yalanting_source_dir}"
|
||||
|
||||
echo "Checking out yalantinglibs version 0.5.5..."
|
||||
run_or_die "Failed to checkout yalantinglibs version 0.5.5" git -C "${yalanting_source_dir}" checkout 0.5.5
|
||||
|
||||
patch_yalantinglibs_easylog "${yalanting_easylog_header}"
|
||||
|
||||
ensure_dir "${yalanting_build_dir}" "Failed to create build directory"
|
||||
|
||||
echo "Configuring yalantinglibs..."
|
||||
run_or_die \
|
||||
"Failed to configure yalantinglibs" \
|
||||
cmake \
|
||||
-S "${yalanting_source_dir}" \
|
||||
-B "${yalanting_build_dir}" \
|
||||
-DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}" \
|
||||
-DBUILD_EXAMPLES=OFF \
|
||||
-DBUILD_BENCHMARK=OFF \
|
||||
-DBUILD_UNIT_TESTS=OFF \
|
||||
-DYLT_ENABLE_IBV=ON
|
||||
|
||||
echo "Building yalantinglibs (using $(nproc) cores)..."
|
||||
run_or_die "Failed to build yalantinglibs" cmake --build "${yalanting_build_dir}" -j"$(nproc)"
|
||||
|
||||
echo "Installing yalantinglibs..."
|
||||
run_or_die "Failed to install yalantinglibs" cmake --install "${yalanting_build_dir}"
|
||||
|
||||
patch_yalantinglibs_config "${yalanting_config_file}"
|
||||
print_success "yalantinglibs installed successfully to ${INSTALL_PREFIX}"
|
||||
}
|
||||
|
||||
main() {
|
||||
ensure_dir "${INSTALL_PREFIX}" "Failed to create install directory: ${INSTALL_PREFIX}"
|
||||
echo -e "${YELLOW}Installing to: ${INSTALL_PREFIX}${NC}"
|
||||
|
||||
install_yalantinglibs
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user