HCgemmBatched
Applicable Products
Hardware Model |
Supported or Not |
|---|---|
Not supported |
|
Not supported |
|
Not supported |
|
Supported |
|
Not supported |
Function Description
API function:
- asdBlasMakeHCgemmBatchedPlan: initializes the operator configuration corresponding to the handle.
- asdBlasHCgemmBatched: computes the product of complex matrices.
Formula:
- asdBlasHCgemmBatched formula:

- Example:
[ [ 1+i, 1+2i ], [ 1+3i, 1+4i ] ]inTensorB[i]:
[ [ 2+i, 2+2i ], [ 2+3i, 2+4i ] ]inTensorC[i]:
[ [ 3+i, 3+2i ], [ 3+3i, 3+4i ] ]The input transa is N, and the input transb is T.
The input m is 2, the input n is 2, the input k is 2, the input alpha is 1+i, and the input beta is 2+2i.
The input lda is 2, the input ldb is 2, and the input ldc is 2.
The input batchCount is 1.
After the asdBlasHCgemmBatched operator is called, the output C is as follows:
[ [ -15+19i, -27+19i ], [ -37+21i, -57+13i ] ]
Function Prototype
- AspbStatus asdBlasMakeHCgemmBatchedPlan(asdBlasHandle handle)
- AspbStatus asdBlasHCgemmBatched(asdBlasHandle handle, asdBlasOperation_t transa, asdBlasOperation_t transb, const int64_t m,const int64_t n, const int64_t k, const std::complex<op::fp16_t> &alpha, aclTensor *A,const int64_t lda, aclTensor *B, const int64_t ldb, const std::complex<op::fp16_t> &beta,aclTensor *C, const int64_t ldc, const int64_t batchCount)
Parameter Description
- asdBlasMakeHCgemmBatchedPlan
Parameter
Input/Output
Type
Description
handle
Input
asdBlasHandle
Handle of the HCgemmBatched operator.
- asdBlasHCgemmBatched
Parameter
Input/Output
Type
Description
handle
Input
asdBlasHandle
Handle of the HCgemmBatched operator.
transa
Input
asdBlasOperation_t
Whether matrix A should be transposed. The value must be ASDBLAS_OP_N.
transb
Input
asdBlasOperation_t
Whether matrix B should be transposed. The value must be ASDBLAS_OP_N.
m
Input
const int64_t
Number of rows of matrix C. The value range is {1-32}.
n
Input
const int64_t
Number of columns of matrix C. The value range is {1-32}.
k
Input
const int64_t
Common dimension of matrices A and B. The value range is {1-32}.
alpha
Input
const std::complex<op::fp16_t> &
alpha in the formula, which is a complex scalar used to multiply the result of matrix multiplication. The value must be 1+0j.
A
Input
aclTensor *
A in the formula, which is in column-major order and is a tensor on the device. The data type is COMPLEX32, the data format is ND, and the shape is [batchCount, m, k].
lda
Input
const int64_t
Memory address offset between adjacent elements in matrix A. The value is the same as that of k.
B
Input
aclTensor *
B in the formula, which is a tensor on the device. The data type can only be COMPLEX32, the data format can be ND, and the shape is [batchCount, k, n].
ldb
Input
const int64_t
Memory address offset between adjacent elements in matrix B. The value is the same as that of n.
beta
Input
const std::complex<op::fp16_t> &
beta in the formula is a complex scalar, and is used to multiply the matrix C. The value must be 0+0j.
C
Output
aclTensor *
C in the formula, which is a tensor on the device. The data type can only be COMPLEX32, the data format can be ND, and the shape is [batchCount, m, n].
ldc
Input
const int64_t
Memory address offset between the left and right adjacent elements of C. The value is the same as n.
batchCount
Input
const int64_t
Number of batches. The value range is {12 - 26208}.
Return Value Description
For details about the return values, see Return Value.
Constraints
- asdBlasMakeHCgemmBatchedPlan: none.
- asdBlasHCgemmBatched
- The supported CANN version is CANN 8.0 or later.
- The supported input data type is COMPLEX32.
- The supported output data type is COMPLEX32.
- During actual operator computation, only 3D ND computation is supported.
- The input data of the operator is in row-major order. The input shape is [batchCount, m, k], [batchCount, k, n], or [batchCount, m, n], and the output shape is [batchCount, m, n].
Calling Example
For details about the operator calling example, see HcgemmBatched.