ReshapeAndCacheOperation

功能

将k、v的特征离散的放到kcache, vcache内,功能与KVCacheOperation类似。

定义

struct ReshapeAndCacheParam {};

输入

参数

维度

数据类型

格式

key

[num_tokens, k_num_head, head_size]

float16/int8/bf16

ND

value

[num_tokens,v_ num_head, head_size]

float16/int8/bf16

ND

keyCache

[num_blocks, block_size, k_num_head, head_size]

float16/int8/bf16

ND

valueCache

[num_blocks, block_size, v_ num_head, head_size]

float16/int8/bf16

ND

slotMapping

[num_tokens]

int32

ND

输出

参数

维度

数据类型

格式

keyCache

[num_blocks, block_size, k_head_num, head_size]

float16/int8/bf16

ND

valueCache

[num_blocks, block_size, k_head_num, head_size]

float16/int8/bf16

ND

输出keyCache,valueCache与同名输入指向同一地址,即进行原地修改。