kutacc_core_bgemm_ex
Compute the product of a general matrix and a matrix.
That is,
.
Interface Definition
void kutacc_core_bgemm_ex(char transA, char transB, const BLASINT m, const BLASINT n, const BLASINT k, const __bf16 alpha, const __bf16 *a, const BLASINT lda, const __bf16 *b, const BLASINT ldb, const __bf16 beta, __bf16 *c, const BLASINT ldc, const BlasExtendParam *blas_extend_param);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
transA |
Character |
Transposition of matrix A.
|
Input |
transB |
Character |
Transposition of matrix B.
|
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 |
alpha |
Half-precision floating-point type |
Multiplication coefficient of matrices A and B. |
Input |
a |
Half-precision floating-point pointer |
Matrix A |
Input |
lda |
Integer |
Leading dimension of matrix A |
Input |
b |
Half-precision floating-point pointer |
Matrix B |
Input |
ldb |
Integer |
Leading dimension of matrix B |
Input |
beta |
Half-precision floating-point type |
Multiplication coefficient of matrix C |
Input |
c |
Half-precision floating-point pointer |
Matrix C |
Input |
ldc |
Half-precision floating-point type |
Leading dimension of matrix C |
Input/Output |
blas_extend_param |
Structure pointer type |
Sets an extended operation. In the structure, type indicates the operation type, extra indicates the operation data, and next indicates the pointer to the next extended operation structure.
|
Input |
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 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | char transA = 'N', transB = 'N'; BLASINT m = 4, k = 3, n = 4; BLASINT lda = m; BLASINT ldb = k; BLASINT ldc = m; __bf16 alpha = vcvth_bf16_f32(1.0); __bf16 beta = vcvth_bf16_f32(3.0); __bf16 a[12] = { 3.4019, -1.0562, 2.8310, 2.9844, 4.1165, -3.0245, -1.6478, 2.6829, -2.2223, 0.5397, -0.2260, 1.2887 }; __bf16 b[12] = { -1.3522, 0.1340, 4.5223, 4.1612, 1.3571, 2.1730, -3.5840, 1.0697, -4.8370, -2.5711, -3.6277, 3.0418 }; __bf16 c[12] = {0}; BlasExtendParam *extend_param = (BlasExtendParam *)malloc(sizeof(BlasExtendParam)); if (extend_param == NULL) { return; } extend_param->type = BLAS_EXTEND_TYPE_ACTIVATION; extend_param->extra = BLAS_EXTEND_ACTIVATION_RELU; extend_param->next = NULL; kutacc_core_bgemm_ex(transA, transB, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc, extend_param); free(extend_param); /* * Output c: * 0.000000 43.250000 2.968750 0.000000 * 10.437500 0.000000 0.000000 15.750000 * 0.000000 32.500000 0.000000 11.625000 * 6.531250 43.750000 0.000000 0.000000 */ |