Function: gemm_ex

Applicability

Product

Supported (√/x)

Atlas A3 training products / Atlas A3 inference products

Atlas A2 training products / Atlas A2 inference products

Atlas training products

Atlas inference products

Atlas 200I/500 A2 inference products

Function Usage

Computes matrix-matrix multiplication: C = αAB + βC. The data types of the input and output data are set using arguments. This API is asynchronous.

Prototype

  • C Prototype
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    aclError aclblasGemmEx(aclTransType transA,
    aclTransType transB,
    aclTransType transC,
    int m,
    int n,
    int k,
    const void *alpha,
    const void *matrixA,
    int lda,
    aclDataType dataTypeA,
    const void *matrixB,
    int ldb,
    aclDataType dataTypeB,
    const void *beta,
    void *matrixC,
    int ldc,
    aclDataType dataTypeC,
    aclComputeType type,
    aclrtStream stream)
    
  • Python Function
    1
    2
    3
    4
    5
    6
    ret = acl.blas.gemm_ex(trans_a, trans_b, trans_c,
    m, n, k,
    alpha, matrix_a, lda, data_type_a,
    matrix_b, ldb, data_type_b,
    beta, matrix_c, ldc, data_type_c,
    type, stream)
    

Parameter Description

Parameter

Description

trans_a

Int, whether matrix A is transposed.

trans_b

Int, whether matrix B is transposed.

trans_c

Int, whether matrix C is transposed. Currently, only aclTrans_N is supported.

m

Int, number of rows in matrix A and matrix C.

n

Int, number of columns in matrix B and matrix C.

k

Int, number of columns in matrix A and number of rows in matrix B.

alpha

Int, data pointer address of scalar alpha used for executing the multiplication operation.

matrix_a

Int, data pointer address of matrix A.

lda

Int, leading dimension of matrix A. For row-major transpose, lda is the number of columns of matrix A. This parameter is reserved and can only be set to –1.

data_type_a

Int, data type of matrix A.

matrix_b

Int, data pointer address of matrix B.

ldb

Int, leading dimension of matrix B. For row-major transpose, ldb is the number of columns of matrix B. This parameter is reserved and can only be set to –1.

data_type_b

Int, data type of matrix B.

beta

Int, data pointer address of scalar beta used for executing the multiplication operation.

matrix_c

Int, data pointer address of matrix C.

ldc

Int, leading dimension of matrix C. This parameter is reserved and can only be set to –1.

data_type_c

Int, data type of matrix C.

type

Int, computation precision.

stream

Int, stream where the operator is executed.

Return Value Description

Return Value

Description

ret

Int, error code: 0 on success; else, failure.

Restrictions

A, B, and C support a limited combination of data types. α and β have the same data types as C.

Data Type of A

Data Type of x

Data Type of y

aclFloat16

aclFloat16

aclFloat16

aclFloat16

aclFloat16

float(float32)

int8_t

int8_t

float(float32)

int8_t

int8_t

int32_t

Reference

For details about the API call sequence and example, see API Call Sequence.