Enabling the Multi-Head Compression Function in the ALiBi Scenario
compressType=COMPRESS_TYPE_KVHEAD, kvCacheCfg=K_CACHE_V_CACHE
Input
Parameter |
Dimension |
Data Type |
Format |
Description |
|---|---|---|---|---|
key |
[num_tokens, num_head, head_size] |
float16/bf16/int8 |
ND |
Key of multiple tokens in the current step. The last dimension must be a multiple of 32. |
value |
[num_tokens, num_head, head_size] |
float16/bf16/int8 |
ND |
Value of multiple tokens in the current step. The last dimension must be a multiple of 32. |
keyCache |
[num_blocks, block_size, 1, head_size] |
float16/bf16/int8 |
ND |
All key caches. |
valueCache |
[num_blocks, block_size, 1, head_size] |
float16/bf16/int8 |
ND |
All value caches. |
slotMapping |
[batch*num_head] |
int32 |
ND |
|
wins |
[batch*num_head] |
int32 |
ND |
Compression. wins[i] < seqLens[floor(i/num_head)]. The value in wins must be greater than or equal to 0. If the value is 0, compression is not performed. |
seqLens |
[batch] |
int32 |
ND |
Actual seqLen of each batch. The internal value is greater than 0. |
Output
Parameter |
Dimension |
Data Type |
Format |
Description |
|---|---|---|---|---|
keyCacheOut |
[num_blocks, block_size, 1, head_size] |
float16/bf16/int8 |
ND |
All key caches. The address is the same as that of the input keyCache. |
valueCacheOut |
[num_blocks, block_size, 1, head_size] |
float16/bf16/int8 |
ND |
All value caches. The address is the same as that of valueCache. |