Developer Reference for Intel® oneAPI Math Kernel Library for Fortran

ID 766686
Date 3/22/2024
Public

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

Document Table of Contents

mkl_jit_get_?gemm_ptr

Return the GEMM kernel associated with a jitter previously created with mkl_jit_create_?gemm.

Syntax

c_func = mkl_jit_get_sgemm_ptr(jitter)

c_func = mkl_jit_get_dgemm_ptr(jitter)

c_func = mkl_jit_get_cgemm_ptr(jitter)

c_func = mkl_jit_get_zgemm_ptr(jitter)

Include Files

  • mkl_blas.f90

Description

The mkl_jit_get_?gemm_ptr functions belong to a set of related routines that enable use of just-in-time code generation.

The mkl_jit_get_?gemm_ptr functions take as input a jitter previously created with mkl_jit_create_?gemm, and return the GEMM kernel associated with that jitter. The returned GEMM kernel computes a scalar-matrix-matrix product and adds the result to a scalar-matrix product, with general matrices. The operation is defined as follows:

C := alpha*op(A)*op(B) + beta*C

Where:

  • op(X) is one of op(X) = X or op(X) = XT or op(X) = XH
  • alpha and beta are scalars
  • A, B, and C 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
NOTE:

Generating a new kernel with mkl_jit_create_?gemm involves moderate runtime overhead. To benefit from JIT code generation, use this feature when you need to call the generated kernel many times (for example, several hundred calls).

NOTE:

The JIT API requires Fortran 90 and the ISO_C_BINDING module.

Input Parameter

jitter

TYPE(C_PTR), VALUE

Handle to the code generator.

Return Values

c_func

TYPE(C_FUNPTR)

If the jitter input is not a C NULL pointer, returns a C function pointer to a GEMM kernel. The returned C function pointer must be converted to a Fortran procedure pointer (of abstract interface ?gemm_jit_kernel_t) using C_F_PROCPOINTER. The GEMM kernel can then be called with four parameters: the jitter and the three matrices a, b, and c. Otherwise, returns a C NULL pointer.

If transa, transb, m, n, k, lda, ldb, and ldc are the parameters used during the creation of the input jitter, then:

a

transa = 'N' transa = 'T' or transa = 'C'

Array of size lda*k

Before calling the returned function pointer, the leading m-by-k part of the array a must contain the matrix A.

Array of size lda*m

Before calling the returned function pointer, the leading k-by-m part of the array a must contain the matrix A.

b

transb = 'N' transb = 'T' or transb = 'C'

Array of size ldb*n

Before calling the returned function pointer, the leading k-by-n part of the array b must contain the matrix B.

Array of size ldb*k

Before calling the returned function pointer, the leading n-by-k part of the array b must contain the matrix B.

c

Array of size ldc*n

Before calling the returned function pointer, the leading m-by-n part of the array c must contain the matrix C.