Developer Reference for Intel® oneAPI Math Kernel Library for C

ID 766684
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

cblas_?gemm_pack_get_size, cblas_gemm_*_pack_get_size

Returns the number of bytes required to store the packed matrix.

Syntax

size_t cblas_hgemm_pack_get_size (const CBLAS_IDENTIFIER identifier, const MKL_INT m, const MKL_INT n, const MKL_INT k)

size_t cblas_sgemm_pack_get_size (const CBLAS_IDENTIFIER identifier, const MKL_INT m, const MKL_INT n, const MKL_INT k)

size_t cblas_dgemm_pack_get_size (const CBLAS_IDENTIFIER identifier, const MKL_INT m, const MKL_INT n, const MKL_INT k)

size_t cblas_gemm_s8u8s32_pack_get_size (const CBLAS_IDENTIFIER identifier, const MKL_INT m, const MKL_INT n, const MKL_INT k)

size_t cblas_gemm_s16s16s32_pack_get_size (const CBLAS_IDENTIFIER identifier, const MKL_INT m, const MKL_INT n, const MKL_INT k)

size_t cblas_gemm_bf16bf16f32_pack_get_size (const CBLAS_IDENTIFIER identifier, const MKL_INT m, const MKL_INT n, const MKL_INT k)

size_t cblas_gemm_f16f16f32_pack_get_size (const CBLAS_IDENTIFIER identifier, const MKL_INT m, const MKL_INT n, const MKL_INT k)

Include Files

  • mkl.h

Description

The cblas_?gemm_pack_get_size and cblas_gemm_*_pack_get_size routines belong to a set of related routines that enable the use of an internal packed storage. Call the cblas_?gemm_pack_get_size and cblas_gemm_*_pack_get_size routines first to query the size of storage required for a packed matrix structure to be used in subsequent calls. Ultimately, the packed matrix structure is used to compute

C := alpha*op(A)*op(B) + beta*C for bfloat16, half, single and double precision or

C := alpha*(op(A)+ A_offset)*(op(B)+ B_offset) + beta*C + C_offset for integer type.

where:

  • op(X) is one of the operations op(X) = X or op(X) = XT
  • alpha and beta are scalars,
  • A , A_offset,B, B_offset,C, and C_offset are matrices
  • op(A) is an m-by-k matrix,
  • op(B) is a k-by-n matrix,
  • C is an m-by-n matrix.
  • A_offset is an m-by-k matrix.
  • B_offset is an k-by-n matrix.
  • C_offset is an m-by-n matrix.

Input Parameters

Parameter Type Description
identifier CBLAS_IDENTIFIER

Specifies which matrix is to be packed:

If identifier = CblasAMatrix, the size returned is the size required to store matrix A in an internal format.

If identifier = CblasBMatrix, the size returned is the size required to store matrix B in an internal format.

m MKL_INT

Specifies the number of rows of matrix op(A) and of the matrix C. The value of m must be at least zero.

n MKL_INT

Specifies the number of columns of matrix op(B) and the number of columns of matrix C. The value of n must be at least zero.

k MKL_INT

Specifies the number of columns of matrix op(A) and the number of rows of matrix op(B). The value of k must be at least zero.

Return Values

Parameter Type Description
size size_t

Returns the size (in bytes) required to store the matrix when packed into the internal format of Intel® oneAPI Math Kernel Library (oneMKL).

Example

See the following examples in the MKL installation directory to understand the use of these routines:

cblas_hgemm_pack_get_size: examples\cblas\source\cblas_hgemm_computex.c

cblas_sgemm_pack_get_size: examples\cblas\source\cblas_sgemm_computex.c

cblas_dgemm_pack_get_size: examples\cblas\source\cblas_dgemm_computex.c

cblas_gemm_s8u8s32_pack_get_size: examples\cblas\source\cblas_gemm_s8u8s32_computex.c

cblas_gemm_s16u16s32_pack_get_size: examples\cblas\source\cblas_gemm_s16s16s32_computex.c

cblas_gemm_bf16bf16f32_pack_get_size: examples\cblas\source\cblas_gemm_bf16bf16f32_computex.c

cblas_gemm_f16f16f32_pack_get_size: examples\cblas\source\cblas_gemm_f16f16f32_computex.c

See Also