Skip to content

Commit c1a51cc

Browse files
authored
Merge branch 'main' into bugfix/main
2 parents e542c22 + ba5be35 commit c1a51cc

File tree

102 files changed

+2242
-1474
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+2242
-1474
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
44
option(USE_NPU "Enable NPU support" OFF)
55
option(USE_MLU "Enable MLU support" OFF)
66
option(USE_CUDA "Enable CUDA support" OFF)
7+
add_compile_definitions(YLT_ENABLE_IBV)
8+
add_definitions(-DYLT_ENABLE_IBV)
9+
set(YLT_ENABLE_IBV ON)
710

811
if(DEVICE_ARCH STREQUAL "ARM")
912
set(CMAKE_SYSTEM_PROCESSOR aarch64)

setup.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ def check_and_install_pre_commit():
471471
print("Run 'pre-commit install' failed. Please install pre-commit: pip install pre-commit")
472472
exit(0)
473473

474-
def run_git_command(command, cwd=None, check=True):
474+
def run_shell_command(command, cwd=None, check=True):
475475
try:
476476
subprocess.run(command, cwd=cwd, check=check, shell=True, capture_output=True, text=True)
477477
return True
@@ -518,15 +518,15 @@ def apply_patch_safely(patch_file_path, repo_path):
518518

519519
if has_uncommitted_changes(repo_path):
520520
print(f"⚠️ Uncommitted changes detected. Running `git reset --hard` for {repo_path}")
521-
if not run_git_command("git reset --hard", cwd=repo_path):
521+
if not run_shell_command("git reset --hard", cwd=repo_path):
522522
print("❌ Failed to reset changes!")
523523
return False
524524

525525
print(f"🛠️ Apply patch: {patch_file_path}")
526-
apply_success = run_git_command(f"git apply --check {patch_file_path}", cwd=repo_path, check=False)
526+
apply_success = run_shell_command(f"git apply --check {patch_file_path}", cwd=repo_path, check=False)
527527

528528
if apply_success:
529-
if not run_git_command(f"git apply {patch_file_path}", cwd=repo_path):
529+
if not run_shell_command(f"git apply {patch_file_path}", cwd=repo_path):
530530
print("❌ apply patch fail!")
531531
apply_success = False
532532

@@ -538,7 +538,7 @@ def apply_patch_safely(patch_file_path, repo_path):
538538
print(f" cd {repo_path} && git apply {patch_file_path}")
539539
return False
540540

541-
def apply_patch():
541+
def pre_build():
542542
if os.path.exists("third_party/custom_patch"):
543543
script_path = os.path.dirname(os.path.abspath(__file__))
544544
mooncake_repo_path = os.path.join(script_path, "third_party/Mooncake")
@@ -547,6 +547,9 @@ def apply_patch():
547547
cpprestsdk_repo_path = os.path.join(script_path, "third_party/cpprestsdk")
548548
if not apply_patch_safely("../custom_patch/cpprestsdk.patch", cpprestsdk_repo_path):
549549
exit(0)
550+
if not run_shell_command("sh third_party/dependencies.sh", cwd=script_path):
551+
print("❌ Failed to reset changes!")
552+
exit(0)
550553

551554
if __name__ == "__main__":
552555
device = 'a2' # default
@@ -563,9 +566,10 @@ def apply_patch():
563566
del sys.argv[idx]
564567
del sys.argv[idx]
565568
if '--dry_run' not in sys.argv:
566-
apply_patch()
569+
pre_build()
567570
else:
568571
sys.argv.remove("--dry_run")
572+
569573
if '--install-xllm-kernels' in sys.argv:
570574
idx = sys.argv.index('--install-xllm-kernels')
571575
if idx + 1 < len(sys.argv):

third_party/Mooncake

Submodule Mooncake updated from fb26af7 to be89497

third_party/custom_patch/Mooncake.patch

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ index 8483085..9d263dd 100644
2626
add_subdirectory(benchmarks)
2727
\ No newline at end of file
2828
diff --git a/mooncake-store/include/offset_allocator/offset_allocator.hpp b/mooncake-store/include/offset_allocator/offset_allocator.hpp
29-
index fde978b..ac54f8c 100644
29+
index b6d55c8..2d80158 100644
3030
--- a/mooncake-store/include/offset_allocator/offset_allocator.hpp
3131
+++ b/mooncake-store/include/offset_allocator/offset_allocator.hpp
3232
@@ -6,7 +6,7 @@
@@ -38,40 +38,24 @@ index fde978b..ac54f8c 100644
3838

3939
namespace mooncake::offset_allocator {
4040
typedef unsigned char uint8;
41-
diff --git a/mooncake-store/include/storage_backend.h b/mooncake-store/include/storage_backend.h
42-
index a30f0c6..3bfeffb 100644
43-
--- a/mooncake-store/include/storage_backend.h
44-
+++ b/mooncake-store/include/storage_backend.h
45-
@@ -4,8 +4,8 @@
46-
#include <vector>
47-
#include <mutex>
48-
#include <fstream>
49-
-#include <types.h>
50-
-#include <file_interface.h>
51-
+#include "types.h"
52-
+#include "file_interface.h"
53-
#include <filesystem>
54-
#include <thread>
55-
#include <chrono>
5641
diff --git a/mooncake-store/include/types.h b/mooncake-store/include/types.h
57-
index d2830a3..39c3b27 100644
42+
index 077926b..b36862b 100644
5843
--- a/mooncake-store/include/types.h
5944
+++ b/mooncake-store/include/types.h
60-
@@ -10,8 +10,11 @@
61-
#include <variant>
45+
@@ -8,7 +8,10 @@
46+
#include <unordered_map>
6247
#include <vector>
6348

6449
-#include "Slab.h"
6550
+#include "cachelib_memory_allocator/Slab.h"
66-
#include "allocator.h"
6751
+namespace iguana {
6852
+using std::contiguous_iterator;
6953
+}
7054
#include "ylt/struct_json/json_reader.h"
7155
#include "ylt/struct_json/json_writer.h"
7256

7357
diff --git a/mooncake-store/src/ha_helper.cpp b/mooncake-store/src/ha_helper.cpp
74-
index c1f4ded..e4b982b 100644
58+
index 796838a..8e72b80 100644
7559
--- a/mooncake-store/src/ha_helper.cpp
7660
+++ b/mooncake-store/src/ha_helper.cpp
7761
@@ -1,3 +1,6 @@
@@ -81,7 +65,7 @@ index c1f4ded..e4b982b 100644
8165
#include "ha_helper.h"
8266
#include "etcd_helper.h"
8367
#include "rpc_service.h"
84-
@@ -169,4 +172,6 @@ MasterServiceSupervisor::~MasterServiceSupervisor() {
68+
@@ -174,4 +177,6 @@ MasterServiceSupervisor::~MasterServiceSupervisor() {
8569
}
8670
}
8771

@@ -113,7 +97,7 @@ index f515671..7a019b6 100644
11397
+#pragma GCC pop_options
11498
\ No newline at end of file
11599
diff --git a/mooncake-store/src/utils.cpp b/mooncake-store/src/utils.cpp
116-
index b775851..736d61d 100644
100+
index 9678f57..f41eb10 100644
117101
--- a/mooncake-store/src/utils.cpp
118102
+++ b/mooncake-store/src/utils.cpp
119103
@@ -1,6 +1,6 @@

third_party/dependencies.sh

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#!/bin/bash
2+
3+
# Color definitions
4+
GREEN="\033[0;32m"
5+
BLUE="\033[0;34m"
6+
YELLOW="\033[0;33m"
7+
RED="\033[0;31m"
8+
NC="\033[0m" # No Color
9+
10+
# Configuration
11+
REPO_ROOT=`pwd`
12+
13+
# Function to print section headers
14+
print_section() {
15+
echo -e "\n${BLUE}=== $1 ===${NC}"
16+
}
17+
18+
# Function to print success messages
19+
print_success() {
20+
echo -e "${GREEN}$1${NC}"
21+
}
22+
23+
# Function to print error messages and exit
24+
print_error() {
25+
echo -e "${RED}✗ ERROR: $1${NC}"
26+
exit 1
27+
}
28+
29+
# Function to check command success
30+
check_success() {
31+
if [ $? -ne 0 ]; then
32+
print_error "$1"
33+
fi
34+
}
35+
36+
if [ $(id -u) -ne 0 ]; then
37+
print_error "Require root permission, try sudo ./dependencies.sh"
38+
fi
39+
40+
41+
# Install yalantinglibs
42+
print_section "Installing yalantinglibs"
43+
44+
# Check if thirdparties directory exists
45+
if [ ! -d "${REPO_ROOT}/third_party/Mooncake/thirdparties" ]; then
46+
mkdir -p "${REPO_ROOT}/third_party/Mooncake/thirdparties"
47+
check_success "Failed to create Mooncake/thirdparties directory"
48+
fi
49+
50+
# Change to thirdparties directory
51+
cd "${REPO_ROOT}/third_party/Mooncake/thirdparties"
52+
check_success "Failed to change to Mooncake/thirdparties directory"
53+
54+
# Check if yalantinglibs is already installed
55+
if [ -d "yalantinglibs" ]; then
56+
echo -e "${YELLOW}yalantinglibs directory already exists. Removing for fresh install...${NC}"
57+
rm -rf yalantinglibs
58+
check_success "Failed to remove existing yalantinglibs directory"
59+
fi
60+
61+
# Clone yalantinglibs
62+
echo "Cloning yalantinglibs from https://gitcode.com/gh_mirrors/ya/yalantinglibs.git"
63+
git clone https://gitcode.com/gh_mirrors/ya/yalantinglibs.git
64+
check_success "Failed to clone yalantinglibs"
65+
66+
# Build and install yalantinglibs
67+
cd yalantinglibs
68+
check_success "Failed to change to yalantinglibs directory"
69+
70+
# Checkout version 0.5.5
71+
echo "Checking out yalantinglibs version 0.5.5..."
72+
git checkout 0.5.5
73+
check_success "Failed to checkout yalantinglibs version 0.5.5"
74+
75+
mkdir -p build
76+
check_success "Failed to create build directory"
77+
78+
cd build
79+
check_success "Failed to change to build directory"
80+
81+
echo "Configuring yalantinglibs..."
82+
cmake .. -DBUILD_EXAMPLES=OFF -DBUILD_BENCHMARK=OFF -DBUILD_UNIT_TESTS=OFF -DYLT_ENABLE_IBV=ON
83+
check_success "Failed to configure yalantinglibs"
84+
85+
echo "Building yalantinglibs (using $(nproc) cores)..."
86+
cmake --build . -j$(nproc)
87+
check_success "Failed to build yalantinglibs"
88+
89+
echo "Installing yalantinglibs..."
90+
cmake --install .
91+
check_success "Failed to install yalantinglibs"
92+
93+
sed -i '54s/target_link_libraries(${ylt_target_name} -libverbs)/target_link_libraries(${ylt_target_name} INTERFACE -libverbs)/' /usr/local/lib/cmake/yalantinglibs/config.cmake
94+
95+
print_success "yalantinglibs installed successfully"
96+

xllm/core/common/global_flags.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,14 +336,18 @@ DEFINE_string(store_protocol,
336336
"tcp",
337337
"KV cache store protocol(e.g. tcp, rdma).");
338338

339-
DEFINE_string(store_master_server_entry,
339+
DEFINE_string(store_master_server_address,
340340
"",
341341
"The address information of the store master service.");
342342

343-
DEFINE_string(store_metadata_connstring,
343+
DEFINE_string(store_metadata_server,
344344
"",
345345
"The address of the kv cache store metadata service.");
346346

347+
DEFINE_string(store_local_hostname,
348+
"",
349+
"The local host name of the kv cache store client.");
350+
347351
// --- computation communication parallel config ---
348352

349353
DEFINE_bool(

xllm/core/common/global_flags.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,11 @@ DECLARE_bool(enable_kvcache_store);
161161

162162
DECLARE_string(store_protocol);
163163

164-
DECLARE_string(store_master_server_entry);
164+
DECLARE_string(store_master_server_address);
165165

166-
DECLARE_string(store_metadata_connstring);
166+
DECLARE_string(store_metadata_server);
167+
168+
DECLARE_string(store_local_hostname);
167169

168170
DECLARE_bool(enable_multi_stream_parallel);
169171

xllm/core/common/options.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ std::string Options::to_string() const {
5454
<< ", enable_cache_upload: " << enable_cache_upload()
5555
<< ", enable_kvcache_store: " << enable_kvcache_store()
5656
<< ", store_protocol: " << store_protocol()
57-
<< ", store_master_server_entry: " << store_master_server_entry()
58-
<< ", store_metadata_connstring: " << store_metadata_connstring()
57+
<< ", store_master_server_address: " << store_master_server_address()
58+
<< ", store_metadata_server: " << store_metadata_server()
59+
<< ", store_local_hostname: " << store_local_hostname()
5960
<< ", enable_multi_stream_parallel: " << enable_multi_stream_parallel()
6061
<< ", enable_continuous_kvcache: " << enable_continuous_kvcache()
6162
<< ", disable_ttft_profiling: " << disable_ttft_profiling()

xllm/core/common/options.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,11 @@ class Options {
146146

147147
PROPERTY(std::string, store_protocol) = "tcp";
148148

149-
PROPERTY(std::string, store_master_server_entry) = "";
149+
PROPERTY(std::string, store_master_server_address) = "";
150150

151-
PROPERTY(std::string, store_metadata_connstring) = "";
151+
PROPERTY(std::string, store_metadata_server) = "";
152+
153+
PROPERTY(std::string, store_local_hostname) = "";
152154

153155
PROPERTY(bool, enable_multi_stream_parallel) = false;
154156

0 commit comments

Comments
 (0)