Input and Output
Parameter |
Dimension |
Data Type |
Format |
cpu/npu |
Description |
Use Cases |
|---|---|---|---|---|---|---|
query |
[ntokens, qHiddenSize] |
float16/bf16 |
ND |
npu |
Query matrix. |
Basic |
key |
[ntokens, kHiddenSize] |
float16/bf16 |
ND |
npu |
Key matrix. This parameter is not passed when kvcacheCfg is set to K_BYPASS_V_BYPASS. |
Basic |
value |
[ntokens, vHiddenSize] |
float16/bf16 |
ND |
npu |
Value matrix. This parameter is not passed when kvcacheCfg is set to K_BYPASS_V_BYPASS. |
Basic |
cacheK |
[layerNum, batch, maxSeqLen, kHiddenSize] |
float16/bf16 |
cpu/npu |
|
Basic |
|
cacheV |
[layerNum, batch, maxSeqLen, vhiddenSize] |
float16/bf16 |
npu/cpu |
|
Basic |
|
attentionMask |
See mask |
- |
- |
- |
- |
Mask |
tokenOffset |
[batch] |
int32/uint32 |
ND |
cpu |
Token offset after calculation. |
Basic |
seqLen |
[batch] |
int32/uint32 |
ND |
cpu |
1: incremental or full mode. > 1: full mode. |
Basic |
layerId |
[1] |
int32/uint32 |
ND |
npu |
KV of the cache for calculation. |
Basic |
batchStatus |
[batch] |
int32/uint32 |
ND |
cpu |
Batch to be calculated when calculable batch control is enabled. |
Calculable batch control |
logN |
|
float |
ND |
npu |
In the full phase, the value is the logN sequence of the length maxSeqLen. Each request in a batch obtains a value from this vector based on seqlen. In the incremental phase, the value is the logN corresponding to the new request in each batch. This tensor is required when the scale type is logN. |
LogN |
output |
[nTokens, headNum * vHeadSize] |
float16/bf16 |
ND |
npu |
Output. |
Basic |