MLA Input and Output
Parameter |
Dimension |
Data Type |
Format |
cpu/npu |
Description |
|---|---|---|---|---|---|
qNope |
[tokenNum, headNum, 512] |
float16/bf16/int8 |
ND |
NPU |
Input. Query without positional encoding. If cacheMode is set to 2, the value is of the int8 data type. |
qRope |
[tokenNum, headNum, 64] |
float16/bf16 |
ND |
NPU |
Input. Query with rotational positional encoding. |
ctKV |
[blockNum, blockSize, kvHeadNum, 512]
|
float16/bf16/int8 |
ND/NZ |
NPU |
Input. ctkv without positional encoding.
|
kRope |
[blockNum, blockSize, kvHeadNum, 64] If cacheMode is set to 2 or 3: [blockNum, kvHeadNum*64 / 16 ,blockSize, 16] |
float16/bf16 |
ND/NZ |
NPU |
Input. k with rotational positional encoding. If cacheMode is set to 2 or 3, NZ is used. |
block_tables |
[batch, maxBlockNumPerQuery] |
int32 |
ND |
NPU |
Input. kvcache block mapping table of each query. |
kvSeqlen |
[batch] |
int32 |
ND |
CPU |
Input. Context length (kvseqlen) corresponding to each query. |
mask |
float16/bf16 |
ND |
NPU |
Input. Attention mask. This parameter is passed when maskType is not 0. |
|
qseqlen |
[batch] |
int32 |
ND |
CPU |
Input. seqLen corresponding to each batch. This parameter is passed when calcType is 1. The value range is [1, 4]. |
qkDescale |
[headNum] |
float |
ND |
NPU |
Input. This parameter is passed when cacheMode is 2. |
pvDescale |
[headNum] |
float |
ND |
NPU |
Input. This parameter is passed when cacheMode is 2. |
maskUseStatus |
[batch] |
int32 |
ND |
CPU |
This parameter can be used in the MTP1 scenario where the Spec is used together with the Ring. That is, this parameter is passed when calcType is 3. This parameter indicates whether each mask is used. How to enable this function: maskUseStatus = MASK_USE_STATUS_TYPE_BATCH_MASK Internal padding value: 1: The mask is used. 0: No mask is used. MTP1: qseqlen[i] is 2. |
attenOut |
[tokenNum, headNum, 512] |
float16/bf16 |
ND |
NPU |
Attention output. |
Ise |
[tokenNum, headNum, 1] |
float16/bf16/float |
ND |
NPU |
Ise output.
|