Replaces cherry-picked upstream_ref with complete source trees. xllm/ — Iluvatar official C++ inference engine (15MB, 1470 files) Complete: kernels → layers → models → runtime → scheduler → api Excluded: .git, binary images, third_party submodule checkouts ds_vllm/ — Iluvatar official vllm fork (8MB, 703 files) Included: csrc/ (ALL CUDA kernels), fused_moe/, qwen3_5 model, _custom_ops Excluded: tests, benchmarks, docs, examples (not needed for reference) Critical call chains now fully traceable: MoE: moe_topk_softmax_kernels.cuh → ixformer.h → fused_moe.cpp → layer GDN: qwen3_gated_delta_net_base.cpp → qwen3_5_gated_delta_net.cpp Attention: ixformer.h → xllm_paged_attention → attention.cpp
73 lines
2.1 KiB
C++
73 lines
2.1 KiB
C++
/* Copyright 2025 The xLLM Authors. All Rights Reserved.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
https://github.com/jd-opensource/xllm/blob/main/LICENSE
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
==============================================================================*/
|
|
|
|
#include "xllm_server_registry.h"
|
|
|
|
namespace xllm {
|
|
|
|
XllmServer* ServerRegistry::register_server(const std::string& name) {
|
|
{
|
|
LOG(INFO) << "Register server " << name << ".";
|
|
|
|
std::lock_guard<std::mutex> lock(mutex_);
|
|
if (servers_.find(name) != servers_.end()) {
|
|
LOG(ERROR) << "Register server failed, " << name
|
|
<< " has been registered already.";
|
|
return servers_[name].get();
|
|
}
|
|
|
|
servers_[name] = XllmServerFactory::create_xllm_server();
|
|
return servers_[name].get();
|
|
}
|
|
}
|
|
|
|
void ServerRegistry::unregister_server(const std::string& name) {
|
|
{
|
|
LOG(INFO) << "Unregister server " << name << ".";
|
|
|
|
std::lock_guard<std::mutex> lock(mutex_);
|
|
auto iter = servers_.find(name);
|
|
if (iter == servers_.end()) {
|
|
LOG(ERROR) << "Unregister server failed, " << name
|
|
<< " isn't registered.";
|
|
} else {
|
|
servers_.erase(iter);
|
|
}
|
|
}
|
|
}
|
|
|
|
XllmServer* ServerRegistry::get_server(const std::string& name) {
|
|
{
|
|
std::lock_guard<std::mutex> lock(mutex_);
|
|
if (servers_.find(name) == servers_.end()) {
|
|
LOG(ERROR) << "Server " << name << " doesn't exist.";
|
|
return nullptr;
|
|
}
|
|
|
|
return servers_[name].get();
|
|
}
|
|
}
|
|
|
|
XllmServer* ServerRegistry::try_get_server(const std::string& name) {
|
|
std::lock_guard<std::mutex> lock(mutex_);
|
|
auto it = servers_.find(name);
|
|
if (it == servers_.end()) {
|
|
return nullptr;
|
|
}
|
|
return it->second.get();
|
|
}
|
|
|
|
} // namespace xllm
|