feat: 支持 Mooncake UbDiag 两层编译与单 RPM 分发 - #13
Merged
zchuango merged 18 commits intoJul 30, 2026
Conversation
31 tasks
qinyufei63
force-pushed
the
supercache_dev_ubdiag
branch
from
July 23, 2026 07:56
b10db08 to
5c74cb5
Compare
1 task
新增 mooncake-common/FindUbDiag.cmake: 始终 FetchContent 拉源码,默认 UBDIAG_DISABLE constexpr 空函数,可选编译真实库+CLI。锁定 ubdiag v0.5.1。 三个子模块 CMakeLists: find_package(UbDiag) 改为 include(FindUbDiag.cmake)。 p2p-store/build.sh: 新增 UBDIAG_LAYER 参数,vendored 模式链接真实库,mock 模式跳过。 p2p-store/CMakeLists.txt: 传 MOONCAKE_UBDIAG_ACTIVE_LAYER 给 build.sh。
qinyufei63
force-pushed
the
supercache_dev_ubdiag
branch
from
July 30, 2026 05:03
1f9a0f2 to
9997920
Compare
zchuango
approved these changes
Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
本 PR 将 Mooncake 的 UbDiag 接入收敛为两个互斥编译层,并保持单一 Mooncake RPM 的交付方式。
MOONCAKE_ENABLE_UBDIAG=OFF):通过 FetchContent 拉取固定提交8df2c2844d402e2e4dcd5ceab2424e8d36c5f99f,仅使用 UbDiag 公共头文件并传播UBDIAG_DISABLE。Mooncake 不编译、不链接libubdiag.so,RPM 也不包含 UbDiag 运行时产物。MOONCAKE_ENABLE_UBDIAG=ON):使用find_package(UbDiag CONFIG)消费系统 RPM 已安装的共享库、开发配置和 CLI。Mooncake 链接系统libubdiag.so,并保留 PerfPoint、P99/P999/P9999、PerfLog 与 CSV 能力;出包时将所选 CLI、共享库符号链接链和可选配置一并装入 Mooncake RPM。Layer 1 不下载或编译真实 UbDiag,也不再校验 tag、Git SHA 或文件 SHA。系统 UbDiag 包的功能与 ABI 正确性由 UbDiag 发布方负责;Mooncake 只检查完成编译和单 RPM 交付所需的最小契约。
Layer contract
Layer 0
MOONCAKE_UBDIAG_SOURCE_DIR指定离线源码目录。UbDiag::ubdiag_lib接口目标,但该目标仅传播头文件和UBDIAG_DISABLE。mooncake_ubdiag.env标记为mock,运行时路径字段为空。Layer 1
启用
-DMOONCAKE_ENABLE_UBDIAG=ON时,配置阶段要求:UbDiag::ubdiag_lib;SHARED_LIBRARY,并可解析到真实libubdiag.so;UBDIAG_ENABLE_PERCENTILE与UBDIAG_ENABLE_PERFLOG;ubdiagCLI;VERSION-RELEASE.ARCH完全一致。未满足任一条件时,CMake 直接给出安装或重装 UbDiag RPM 的明确错误,不回退到源码构建。
Implementation
mooncake-common/FindUbDiag.cmake:实现两层选择、统一目标、Layer 1 最小包契约和四字段构建清单。UbDiag::ubdiag_lib。scripts/build_rpm.sh:Layer 0 仅打包 Mooncake;Layer 1 额外复制/usr/bin/ubdiag、与选中真实库对应的libubdiag.so*符号链接链及可选/etc/ubdiag/ubdiag.conf,并通过%post/%postun执行ldconfig。docs/ubdiag_integration_guide.md:保留面向用户的构建、打包、安装和故障处理说明。Scope
最终差异为 8 个文件、465 行新增和 31 行删除,共 496 行:
cmake/RemoveRpath.cmake、构建树 RPATH 扫描、ELF 全量扫描、源码身份复核或隔离回装等保护性业务外逻辑;How Has This Been Tested?
Current head (
64f45d2848bfaf5cb14a28192132df8d6594d5ec)UBDIAG_DISABLE,产物不依赖libubdiag.so。git diff --check、目标文件 codespell、cmake-format --check通过。bash -n,避免 Windows 工作树 CRLF 干扰结论。完整 Mooncake 本机构建受当前环境缺少目标分支完整第三方依赖限制,未伪造通过结论。
AArch64 双节点 UB 与 RPM 验证
2026-07-30 已在当前最终提交上重新完成 AArch64 双节点真实 UB、UbDiag 数据导出、Mooncake RPM 出包和隔离回装全流程验证。
NEEDED输出均无libubdiag.so;运行前后 UbDiag SHM 无变化。/usr/lib64/libubdiag.so.0.6.1,CLI 报告 UbDiag 0.6.1。/usr/bin/ubdiag、/usr/lib64/libubdiag.so*和/etc/ubdiag/ubdiag.conf。Repository-wide checks
pre-commit run --all-files已在当前精确提交上执行。全仓检查会命中目标分支既有的 trailing-whitespace、EOF、Ruff、codespell、clang-format 和 cmake-format 问题,并修改大量无关文件;因此本 PR 只保留目标 8 个文件的检查结果,不将基线格式化噪声带入本次变更。Documentation
Checklist
./scripts/code_format.shpre-commit run --all-filesand all hooks passAI Assistance Disclosure
The human submitter has reviewed the changes and is responsible for understanding and defending them.