PullKvBlocks
函数功能
通过block列表的方式,从远端节点拉取Cache到本地Cache,仅当角色为DECODER时可调用。
函数原型
Status PullKvBlocks(const CacheIndex &src_cache_index, const Cache &dst_cache, const std::vector<uint64_t> &src_blocks, const std::vector<uint64_t> &dst_blocks, const KvCacheExtParam &ext_param = {});
参数说明
参数名称 |
输入/输出 |
取值说明 |
---|---|---|
src_cache_index |
输入 |
远端源Cache的索引。 |
dst_cache |
输入 |
本地目的Cache。 |
src_blocks |
输入 |
源Cache的block index列表 。 |
dst_blocks |
输入 |
目的Cache的block index列表 。 |
ext_param |
输入 |
预留扩展参数,暂不支持。 |
调用示例
CacheIndex cache_key{0, 1, 0}; std::vector<uint64_t> prompt_blocks = {1,3,5,7}; std::vector<uint64_t> decoder_blocks = {0,2,4,6}; auto ret = llm_datadist.PullKvBlocks(cache_key, kv_cache, prompt_blocks, decoder_blocks);
返回值
- LLM_SUCCESS:成功
- LLM_PARAM_INVALID:参数错误
- LLM_NOT_YET_LINK:与远端cluster没有建链
- LLM_TIMEOUT:拉取超时
- LLM_KV_CACHE_NOT_EXIST:远端KvCache不存在
- 其他:失败
约束说明
需要在Initialize接口初始化完成后调用。dst_cache必须为AllocateCache接口已申请的Cache。
父主题: LlmDataDist