Rate This Document
Findability
Accuracy
Completeness
Readability

kutacc_core_bgemm_pack

Perform the pack operation on a matrix and store it in the allocated buffer.

Interface Definition

void kutacc_core_bgemm_pack(char matrixIdentifier, char transA, char transB, const BLASINT m, const BLASINT n, const BLASINT k, const BLASINT lda, const BLASINT ldb, const __bf16 *src, __bf16 *dst);

Parameters

Parameter

Type

Description

Input/Output

matrixIdentifier

Character

Matrix to be packed. The default value is matrix B.

  • identifier = 'A': Matrix A is packed.
  • identifier = 'B': Matrix B is packed.

Input

transA

Character

Transposition of matrix A.

  • transA = 'N': Matrix A is not transposed.
  • transA = 'T': Matrix A is transposed.

Input

transB

Character

Transposition of matrix B.

  • transB = 'N': Matrix B is not transposed.
  • transB = 'T': Matrix B is transposed.

Input

m

Integer

Number of rows in matrix A

Input

n

Integer

Number of columns of matrix B

Input

k

Integer

Number of columns of matrix A and number of rows of matrix B

Input

lda

Integer

Leading dimension of matrix A

Input

ldb

Integer

Leading dimension of matrix B

Input

src

Half-precision floating-point pointer

Input matrix

Input

dst

Half-precision floating-point pointer

Packed matrix

Input/Output

Dependencies

#include "kutacc_core.h"

Examples

C interface:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
    char transA = 'N', transB = 'N';
    BLASINT m = 4, k = 3, n = 4;
    BLASINT lda = m;
    BLASINT ldb = n;

    __bf16 a[12] = {
        0.1, 0.2, 0.3, 0.4,
        0.5, 0.6, 0.7, 0.8,
        0.9, 1.0, 1.1, 1.2
    };
    size_t size_a = kutacc_core_bgemm_pack_get_size('A', m, n, k);
    __bf16 *sa = (__bf16 *)malloc(size_a * sizeof(__bf16));
    kutacc_core_bgemm_pack('A', transA, transB, m, n, k, lda, ldb, a, sa);
    free(sa);
    /* 
     * Output dst: 
     *     0.100098       0.601562        0.400391        1.000000 
     *     0.500000       0.300781        0.800781        1.101562
     *     0.200195       0.699219        0.898438        1.203125
     */