HCgemvBatched

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

Not supported

Function Description

API function:

  • asdBlasMakeHCgemvBatchedPlan: initializes the operator configuration corresponding to the handle.
  • asdBlasHCgemvBatched: computes the product of a batch of complex matrices and vectors.

Formula:

  • asdBlasHCgemvBatched formula:

    op indicates that matrix A is conjugately transposed or not transposed.

  • Example:

    Input inTensorA[i]:

    [   [ 1+i, 1+2i ],
        [ 1+3i, 1+4i ]  ]

    Input x[i]:

    [ 1+i, 1+i ]

    The input trans is N, indicating that matrix A is not transposed.

    The input m is 2, the input n is 2, the input alpha is 1+0i, and the input beta is 0+0i.

    The input lda is 2.

    The input batchCount is 1.

    After the asdBlasHCgemvBatched operator is called, the output y[i] is as follows:

    [0+4i, 0+8i]

Function Prototype

  • AspbStatus asdBlasMakeHCgemvBatchedPlan(asdBlasHandle handle, asdBlasOperation_t trans, const int64_t m)
  • AspbStatus asdBlasHCgemvBatched(asdBlasHandle handle, asdBlasOperation_t trans, const int64_t m, const int64_t n,const std::complex<op::fp16_t> &alpha, aclTensor *A, const int64_t lda,aclTensor *x, const int64_t incx, const std::complex<op::fp16_t> &beta,aclTensor *y, const int64_t incy, const int64_t batchCount)

Parameter Description

  • asdBlasMakeHCgemvBatchedPlan

    Parameter

    Input/Output

    Type

    Description

    handle

    Input

    asdBlasHandle

    Operator handle.

    trans

    Input

    asdBlasOperation_t

    Whether matrix A should be transposed.

    ASDBLAS_OP_N //Not transposed
    ASDBLAS_OP_C //Conjugately transposed

    m

    Input

    const int64_t

    Number of rows in matrix A in a single batch.

  • asdBlasHCgemvBatched

    Parameter

    Input/Output

    Type

    Description

    handle

    Input

    asdBlasHandle

    Operator handle.

    trans

    Input

    asdBlasOperation_t

    Whether matrix A should be transposed.

    ASDBLAS_OP_N //Not transposed
    ASDBLAS_OP_C //Conjugately transposed

    m

    Input

    const int64_t

    Number of rows in matrix A in a single batch.

    n

    Input

    const int64_t

    Number of columns in matrix A in a single batch.

    alpha

    Input

    const std::complex<op::fp16_t> &

    alpha in the formula is a complex scalar, and is used to multiply the result of the matrix and vector multiplication. In the current version, the value of alpha can only be 1+0i.

    A

    Input

    aclTensor *

    Matrix A in the formula, which is in row-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, n].

    lda

    Input

    const int64_t

    Memory address increment between consecutive elements of A (currently restricted to m).

    x

    Input

    aclTensor *

    Vector x in the formula, which is a tensor on the device. The data type must be COMPLEX32 and the data format must be ND.

    • When the value of trans is not transposed, shape is [batchCount, n].
    • When the value of trans is conjugately transposed, shape is [batchCount, m].

    incx

    Input

    const int64_t

    Stride of vector x (currently restricted to 1).

    beta

    Input

    const std::complex<op::fp16_t> &

    beta in the formula is a complex scalar, and is used to multiply vector y. In the current version, the value of beta can only be 0+0i.

    y

    Input/Output

    aclTensor *

    Vector y in the formula, which is a tensor on the device. The data type must be COMPLEX64 and the data format must be ND.

    • When the value of trans is not transposed, shape is [batchCount, m].
    • When the value of trans is conjugately transposed, shape is [batchCount, n].

    incy

    Input

    const int64_t

    Stride of vector y (currently restricted to 1).

    batchCount

    Input

    const int64_t

    Number of batches. The value range is {12 - 314496}.

Return Value Description

For details about the return values, see Return Value.

Constraints

  • asdBlasMakeCgemvBatchedPlan: none.
  • asdBlasCgemvBatched
    • The supported CANN version is CANN 8.0 or later.
    • The supported input data type is COMPLEX32.
    • The supported output data type is COMPLEX32.

Calling Example

For details about the operator calling example, see HcgemvBatched.