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
55 lines
1.5 KiB
C++
55 lines
1.5 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 <brpc/server.h>
|
|
#include <google/protobuf/service.h>
|
|
|
|
#include "core/common/metrics.h"
|
|
|
|
namespace xllm {
|
|
|
|
static void request_in_metric(void* context) {
|
|
COUNTER_INC(server_request_in_total);
|
|
}
|
|
|
|
static void request_out_metric(void* context) {
|
|
auto ctrl = reinterpret_cast<brpc::Controller*>(context);
|
|
if (ctrl == nullptr) {
|
|
LOG(ERROR) << "ctrl is nullptr";
|
|
return;
|
|
}
|
|
|
|
if (!ctrl->Failed()) {
|
|
COUNTER_INC(server_request_total_ok);
|
|
} else {
|
|
COUNTER_INC(server_request_total_fail);
|
|
if (ctrl->ErrorCode() == brpc::ELIMIT) {
|
|
COUNTER_INC(server_request_total_limit);
|
|
}
|
|
}
|
|
}
|
|
|
|
static void device_info_metric() {
|
|
// TODO: get cpu device info
|
|
GAUGE_SET(xllm_cpu_num, 0);
|
|
GAUGE_SET(xllm_cpu_utilization, 0);
|
|
|
|
// TODO: get gpu device info
|
|
GAUGE_SET(xllm_gpu_num, 0);
|
|
GAUGE_SET(xllm_gpu_utilization, 0);
|
|
}
|
|
|
|
} // namespace xllm
|