[Feat] Integrate ASU Store into UCM (#1352)
Purpose
Introduce ASU Store into UCM, including the ASU Store backend, UCM/vLLM integration, KV-cache registration, build and packaging integration, configuration, and focused unit tests. This PR also aligns the KV logger with the UCM logger implementation while preserving the kv::logger namespace and KV_* prefixes.
Modifications
ASU Store and transport Add AsuStore as a UCM Store backend, connecting the UCM Store interface with the standalone KvClient implementation in kv_semantics. The store supports:
- Asynchronous query, load, dump, check, and wait operations
- Prefix and reverse KV-cache lookup
- Client and transport configuration modes
- MLA, GQA, and HMA tensor layouts
- Layerwise and non-layerwise KV-cache layouts
- Multiple ASU nodes and KV namespaces
- Configurable query and task timeouts
- Connection recovery after consecutive failures
- Shared transport providers
- AIV and FakeBackend providers
- Event-aware asynchronous dump submission Corresponding PR
- https://github.com/ModelEngine-Group/unified-cache-management/pull/979
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1018
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1031
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1048
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1056
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1089
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1093
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1147
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1159
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1167
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1171
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1182
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1191
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1194
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1222
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1235
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1240
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1294
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1306
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1311
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1312
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1317
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1339
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1341 KV-cache registration and connector integration Register worker KV-cache device memory during Store setup. The direct and HMA connectors provide:
- MLA, GQA, and HMA tensor-layout metadata
- Device IDs, tensor sizes, cache addresses, and sizes
- FA and WA Store namespace isolation
- Event handles for asynchronous dump submission Scheduler instances skip device-memory registration. Corresponding PR
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1101
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1106
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1127
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1291
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1336 Build, packaging, and tests Add the BUILD_UCM_ASU build option, ASU Store CMake integration, package installation, Ascend build support, simulation CI coverage, example configuration, CODEOWNERS, and ASU Store unit tests. Corresponding PR
- https://github.com/ModelEngine-Group/unified-cache-management/pull/962
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1173
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1174
- https://github.com/ModelEngine-Group/unified-cache-management/pull/1316 KV logger alignment Align the KV logger with the UCM logger implementation while retaining KV-facing naming:
- Keep kv::logger and KV_* macros
- Add asynchronous logging and periodic flushing
- Keep source-location strings valid for asynchronous formatting
- Support KV_LOG_LEVEL, compatible KV_LOGGER_LEVEL, and KV_LOG_TO_FILE
- Avoid creating empty log files before the first file log is emitted
Test
- ASU unit tests are built successfully.
- Added configuration parsing and propagation unit-test coverage.
- A UCM offline inference is passed. (TP2+AIV backend/Fake Backend)
Co-authored-by: Fengli5355 fengli5355@gmail.com Co-authored-by: Qiong Wu wq674452797@gmail.com Co-authored-by: Wencheng Cai 67788930+Crz-Willis@users.noreply.github.com
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
| 文档 | 网站 | 发展路线图 | EN |
概述
统一缓存管理器(Unified Cache Management, UCM)的核心原理是持久化 LLM 的 KVCache,并通过多种检索机制替代冗余计算。UCM 不仅支持前缀缓存(prefix cache, PC),还提供了多种无需训练的稀疏注意力检索方法,在处理极长序列推理任务时达到更高性能。此外,UCM 基于存算分离架构提供了 PD 分离方案,使得异构计算资源的管理更加简单灵活。与 vLLM 集成后,UCM 在多轮对话和长上下文推理等多种场景下可将推理延迟降低 3–10 倍。
动机
随着模型尺寸的不断增长,KV 缓存也变得越来越大,且越来越稀疏,对于长序列请求来说尤为明显。为了减小 GPU 显存的使用,主流的方向是将全量的 KV 数据卸载到外部存储中,而在 GPU 显存中只保留部分或者被压缩的 KV 数据。这同时可以减小 GPU 的运算量,在解码时增加最大生成序列长度和批大小。
有许多种不同的稀疏 KV 缓存的实现。最新的论文指出,能够最好地适配所有场景和所有模型的方法是不存在的。因此,更好的做法是搭建一套公共的框架,并在此之上接入不同的稀疏化算法,就像 KV 连接器和 PC 一样。
图中所有灰色框代表vLLM 0.9.2版本中的现有类,绿色框则代表UCM新增组件。浅绿色框展示了基于此框架未来规划扩展的子类。
UcmSparseBase是不同稀疏算法的基类。类似于KV连接器的设计,它将在scheduler和layer.py中的关键位置植入hook点,用于执行稀疏KVCache block的加载、转储和计算操作。
SparseKVManager允许用户针对不同算法自定义KVCache block的分配策略。为了将所有实现统一在SparseKVBase框架下,系统会调用SparseKVBase基类,而具体实现则由稀疏算法的子类完成。
KVStoreBase有助于实现稀疏算法与外部存储的解耦。它定义了与外部存储的通信方法,使得任何稀疏算法都能与任意外部存储系统无缝协作。其核心机制是通过ID和偏移量来标识数据块。这种方法不仅适用于稀疏场景,还能天然支持前缀缓存。KVStoreConnector将其与vLLM的KVConnectorBase_V1连接以提供前缀缓存功能。例如,NFSStore作为参考实现,提供了在单机本地文件系统或多服务器环境下通过NFS挂载点存储KVCache的能力。
支持特性
快速开始
请参考 快速开始_vLLM 和 快速开始_vLLM-Ascend.
分支
联系我们
许可协议
UCM 采用 MIT 许可证(附加额外条件),详情请参阅 LICENSE 文件。