Cgemm
Applicable Products
Hardware Model |
Supported or Not |
|---|---|
Not supported |
|
Not supported |
|
Not supported |
|
Supported |
|
Supported |
Function Description
API function:
- asdBlasMakeCgemmPlan: initializes the Cgemm operator configuration corresponding to the handle.
- asdBlasCgemm: a type of matrix multiplication operation, which is used to compute the product of two complex matrices.
Formula:
- asdBlasCgemm formula:

where,

- Example:
[ [ 1+i, 1+2i ], [ 1+3i, 1+4i ] ]The inTensorB is as follows:
[ [ 2+i, 2+2i ], [ 2+3i, 2+4i ] ]The input inTensorC is as follows:
[ [ 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.
After the Cgemm operator is called, the outTensor is as follows:
[ [ -15+19i, -27+19i ], [ -37+21i, -57+13i ] ]
Function Prototype
- AspbStatus asdBlasMakeCgemmPlan(asdBlasHandle handle, asdBlasOperation_t transa, asdBlasOperation_t transb, int64_t m,int64_t n, int64_t k, int64_t lda, int64_t ldb, int64_t ldc)
- AspbStatus asdBlasCgemm(asdBlasHandle handle, asdBlasOperation_t transa, asdBlasOperation_t transb, const int64_t m,const int64_t n, const int64_t k, const std::complex<float> *alpha, aclTensor *A,const int64_t lda, aclTensor *B, const int64_t ldb, const std::complex<float> *beta,aclTensor *C, const int64_t ldc)
Parameter Description
- asdBlasMakeCgemmPlan
Parameter
Input/Output
Type
Description
handle
Input
asdBlasHandle
Handle of the Cgemm operator.
transa
Input
asdBlasOperation_t
Whether matrix A should be transposed.
ASDBLAS_OP_N //Not transposed ASDBLAS_OP_T // Transposed ASDBLAS_OP_C //Conjugately transposed
transb
Input
asdBlasOperation_t
Whether matrix B needs to be transposed.
ASDBLAS_OP_N //Not transposed ASDBLAS_OP_T // Transposed ASDBLAS_OP_C //Conjugately transposed
m
Input
const int64_t
Number of rows in matrix A and matrix C.
n
Input
const int64_t
Number of columns in matrix B and matrix C.
k
Input
const int64_t
Common dimension of matrix A and matrix B.
lda
Input
const int64_t
Memory address offset between adjacent elements in matrix A (currently constrained to m).
ldb
Input
const int64_t
Memory address offset between adjacent elements in matrix B (currently constrained to k).
ldc
Input
const int64_t
Memory address offset between adjacent elements in matrix C (currently constrained to m).
- asdBlasCgemm
Parameter
Input/Output
Type
Description
handle
Input
asdBlasHandle
cgemm operator handle.
transa
Input
asdBlasOperation_t
Whether matrix A should be transposed.
ASDBLAS_OP_N // Not transposed ASDBLAS_OP_T // Transposed ASDBLAS_OP_C // Conjugately transposed
transb
Input
asdBlasOperation_t
Whether matrix B needs to be transposed.
ASDBLAS_OP_N // Not transposed ASDBLAS_OP_T // Transposed ASDBLAS_OP_C // Conjugately transposed
m
Input
const int64_t
Number of rows in matrix C.
n
Input
const int64_t
Number of columns in matrix C.
k
Input
const int64_t
Common dimension of matrix A and matrix B.
alpha
Input
const std::complex<float> *
alpha in the formula, which is a complex scalar used to multiply the result of matrix multiplication.
A
Input
aclTensor *
A in the formula, which is in column-major order and is a tensor on the device. The data type is COMPLEX64, the data format is ND, and the shape is [m, k].
lda
Input
const int64_t
Memory address offset between adjacent elements in matrix A (currently constrained to m).
B
Input
aclTensor *
B in the formula, which is a tensor on the device. The data type can only be COMPLEX64, the data format can be ND, and the shape is [k, n].
ldb
Input
const int64_t
Memory address offset between adjacent elements in matrix B (currently constrained to k).
beta
Input
const std::complex<float> *
beta in the formula is a complex scalar, and is used to multiply the matrix C.
C
Input/Output
aclTensor *
C in the formula, which is a tensor on the device. The data type can only be COMPLEX64, the data format can be ND, and the shape is [m, n].
ldc
Input
const int64_t
Memory address offset between adjacent elements in matrix C (currently constrained to m).
Return Value Description
For details about the return values, see Return Value.
Constraints
- asdBlasMakeCgemmPlan: none.
- asdBlasCgemm
- The input element count (m, n, k) currently supports the range [1, 8192].
- The operator input data is in column-major order. The input shape is [m, k], [k, n], or [m, n], and the output shape is [m, n].
- The operator does not support the calculation for three or more dimensions.
Calling Example
For details about the operator calling example, see Cgemm.