简介
数据类型LLVMReq定义在:"${INSTALL_DIR}/runtime/include/ge/llm_engine_types.h"。${INSTALL_DIR}请替换为CANN软件安装后文件存储路径。若安装的Ascend-cann-toolkit软件包,以root安装举例,则安装后文件存储路径为:/usr/local/Ascend/ascend-toolkit/latest。
具体信息如下。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | class LLMReq { public: LLMReq() = default; ~LLMReq() = default; //设置请求的ID,不同请求的ID不能重复 void SetReqId(const uint64_t req_id) { req_id_ = req_id; } //获取请求ID uint64_t GetReqId() const { return req_id_; } //设置全量kv的长度,当前暂没用到 void SetPromptLength(const uint64_t prompt_length) { prompt_length_ = prompt_length; } //获取kv长度 uint64_t GetPromptLength() const { return prompt_length_; } //设置请求所在的全量集群ID void SetPromptClusterId(const uint64_t prompt_cluster_id) { prompt_cluster_id_ = prompt_cluster_id; } //获取请求所在的全量集群ID uint64_t GetPromptClusterId() const { return prompt_cluster_id_; } //设置请求所在的增量集群ID void SetDecoderClusterId(const uint64_t decoder_cluster_id) { decoder_cluster_id_ = decoder_cluster_id; } //获取请求所在的增量集群ID uint64_t GetDecoderClusterId() const { return decoder_cluster_id_; } //预加载公共前缀 void SetPrefixId(const uint64_t prefix_id) { prefix_id_ = prefix_id; } //释放公共前缀 uint64_t GetPrefixId() const { return prefix_id_; } void SetSequenceLen(const uint64_t sequence_length) { sequence_length_ = sequence_length; } uint64_t GetSequenceLen() const { return sequence_length_; } private: uint64_t req_id_{kInvalidReqId}; // 请求Prompt的句子长度,做完padding的值, 用于申请Prompt的KV Cache uint64_t prompt_length_{0UL}; uint64_t prompt_cluster_id_{0UL}; uint64_t decoder_cluster_id_{0UL}; uint64_t prefix_id_{kInvalidPrefixId}; uint64_t sequence_length_{0UL}; int8_t reserved_[120]; } |
父主题: LLMReq