Strmm

Applicable Products

Hardware Model

Supported or Not

Atlas 200I/500 A2 inference products

Not supported

Atlas inference products

Not supported

Atlas training products

Not supported

Atlas A2 training products/Atlas A2 inference products

Supported

Atlas A3 inference products/Atlas A3 training products

Supported

Function Description

API function

  • asdBlasMakeStrmmPlan: initializes the Strmm operator configuration corresponding to the handle.
  • asdBlasStrmm: single precision. It is used to multiply a triangular matrix A by a matrix B to obtain a new matrix C.

Formula:

  • asdBlasStrmm calculation formula:

  • Example:

    Input A:

    [   [ 1, 0 ],
        [ 3, 4 ]  ]

    Input B:

    [   [ 1, 2 ],
        [ 3, 4 ]  ]

    The input side is L, the input uplo is L, the input trans is N, and the input diag is N.

    The input n is 2, the input lda is 2, the input ldb is 2, and the input ldc is 2.

    The input alpha is 2.345.

    After the Strmm operator is called, the output C is as follows:

    [  [ 2.3450,  4.6900],
       [35.1750, 51.5900]  ]

Function Prototype

  • AspbStatus asdBlasMakeStrmmPlan(asdBlasHandle handle)
  • AspbStatus asdBlasStrmm(asdBlasHandle handle, asdBlasSideMode_t side, asdBlasFillMode_t uplo, asdBlasOperation_t trans,asdBlasDiagType_t diag, const int64_t m, const int64_t n, const float *alpha, aclTensor *A,const int64_t lda, aclTensor *B, const int64_t ldb, aclTensor *C, const int64_t ldc)

Parameter Description

  • asdBlasMakeStrmmPlan

    Parameter

    Input/Output

    Type

    Description

    handle

    Input

    asdBlasHandle

    Handle of the Strmm operator.

  • asdBlasStrmm

    Parameter

    Input/Output

    Type

    Description

    handle

    Input

    asdBlasHandle

    Handle of the Strmm operator.

    side

    Input

    asdBlasSideMode_t

    Specifies whether matrix A is on the left or right side of the multiplication.

    ASDBLAS_SIDE_LEFT // Left
    ASDBLAS_SIDE_RIGHT // Right

    uplo

    Input

    asdBlasFillMode_t

    Storage mode of matrix A.

    ASDBLAS_FILL_MODE_LOWER // Lower triangle
    ASDBLAS_FILL_MODE_UPPER // Upper triangle

    trans

    Input

    asdBlasOperation_t

    Whether to transpose matrix A.

    ASDBLAS_OP_N // Not transposed
    ASDBLAS_OP_T // Transposed

    diag

    Input

    asdBlasDiagType_t

    Specifies whether the diagonal elements of matrix A are assumed to be 1.

    ASDBLAS_DIAG_NON_UNIT // Not assumed to be 1
    ASDBLAS_DIAG_UNIT // Assumed to be 1

    m

    Input

    const int64_t

    Number of rows in matrix B and matrix C.

    n

    Input

    const int64_t

    Number of columns in matrix B and matrix C.

    alpha

    Input

    const float *

    alpha in the formula, which the coefficient used to compute the matrix multiplication.

    A

    Input

    aclTensor *

    A in the formula, which is a tensor on the device. The data type can only be FLOAT32, the data format can be ND, and the shape is [n, n]. When A is the left-side multiplication matrix, the shape is [m, m]; when A is the right-side multiplication matrix, the shape is [n, n].

    lda

    Input

    const int64_t

    Stride of elements in tensor A (currently constrained to m/n: m when side=ASDBLAS_SIDE_LEFT, and n when side=ASDBLAS_SIDE_RIGHT).

    B

    Input

    aclTensor *

    B in the formula, which is a tensor on the device. The data type can only be FLOAT32, the data format can be ND, and the shape is [m, n].

    ldb

    Input

    const int64_t

    Stride of elements in tensor B (currently constrained to m).

    C

    Output

    aclTensor *

    C in the formula, which is a tensor on the device. The data type can only be FLOAT32, the data format can be ND, and the shape is [m, n].

    ldc

    Input

    const int64_t

    Stride of elements in tensor C (currently constrained to m).

Return Value Description

For details about the return values, see Return Value.

Constraints

  • asdBlasMakeStrmmPlan: none.
  • asdBlasStrmm
    • The input element count (m, n) currently supports the range [1, 8193].
    • When side is set to ASDBLAS_SIDE_LEFT, the input shape of the operator is [m, m] and [m, n], and the output shape is [m, n].
    • When side is set to ASDBLAS_SIDE_RIGHT, the input shape of the operator is [n, n] and [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 Strmm.