LIBXS Module

Public API: constants. Public API: types and procedures. Public API: GEMM dispatch. Public API: prediction. Re-exported from ISO_C_BINDING for convenience.



Variables

Type Visibility Attributes Name Initial
integer(kind=C_INT), public, parameter :: LIBXS_TIMER_TICK_KIND = C_LONG_LONG

Integer kind used by timer interface.

integer(kind=C_INT), public, parameter :: LIBXS_DATATYPE_F64 = IOR(0, ISHFT(8, 4))

Enumerates element/data types. The raw value encodes type-size in bits [7:4].

integer(kind=C_INT), public, parameter :: LIBXS_DATATYPE_F32 = IOR(1, ISHFT(4, 4))

Enumerates element/data types. The raw value encodes type-size in bits [7:4].

integer(kind=C_INT), public, parameter :: LIBXS_DATATYPE_C64 = IOR(2, ISHFT(16, 4))

Enumerates element/data types. The raw value encodes type-size in bits [7:4].

integer(kind=C_INT), public, parameter :: LIBXS_DATATYPE_C32 = IOR(3, ISHFT(8, 4))

Enumerates element/data types. The raw value encodes type-size in bits [7:4].

integer(kind=C_INT), public, parameter :: LIBXS_DATATYPE_I64 = IOR(4, ISHFT(8, 4))

Enumerates element/data types. The raw value encodes type-size in bits [7:4].

integer(kind=C_INT), public, parameter :: LIBXS_DATATYPE_U64 = IOR(5, ISHFT(8, 4))

Enumerates element/data types. The raw value encodes type-size in bits [7:4].

integer(kind=C_INT), public, parameter :: LIBXS_DATATYPE_I32 = IOR(6, ISHFT(4, 4))

Enumerates element/data types. The raw value encodes type-size in bits [7:4].

integer(kind=C_INT), public, parameter :: LIBXS_DATATYPE_U32 = IOR(7, ISHFT(4, 4))

Enumerates element/data types. The raw value encodes type-size in bits [7:4].

integer(kind=C_INT), public, parameter :: LIBXS_DATATYPE_I16 = IOR(8, ISHFT(2, 4))

Enumerates element/data types. The raw value encodes type-size in bits [7:4].

integer(kind=C_INT), public, parameter :: LIBXS_DATATYPE_U16 = IOR(9, ISHFT(2, 4))

Enumerates element/data types. The raw value encodes type-size in bits [7:4].

integer(kind=C_INT), public, parameter :: LIBXS_DATATYPE_I8 = IOR(10, ISHFT(1, 4))

Enumerates element/data types. The raw value encodes type-size in bits [7:4].

integer(kind=C_INT), public, parameter :: LIBXS_DATATYPE_U8 = IOR(11, ISHFT(1, 4))

Enumerates element/data types. The raw value encodes type-size in bits [7:4].

integer(kind=C_INT), public, parameter :: LIBXS_DATATYPE_UNKNOWN = 12

Enumerates element/data types. The raw value encodes type-size in bits [7:4].

integer(kind=C_INT), public, parameter :: LIBXS_GEMM_FLAGS_DEFAULT = 0

Enumerates GEMM batch synchronization flags (bitfield).

integer(kind=C_INT), public, parameter :: LIBXS_GEMM_FLAG_NOLOCK = 1

Enumerates GEMM batch synchronization flags (bitfield).

integer(kind=C_INT), public, parameter :: LIBXS_TARGET_ARCH_UNKNOWN = 0

Enumerates the available target architectures and ISA extensions as returned by libxs_cpuid.

integer(kind=C_INT), public, parameter :: LIBXS_TARGET_ARCH_GENERIC = 1

Enumerates the available target architectures and ISA extensions as returned by libxs_cpuid.

integer(kind=C_INT), public, parameter :: LIBXS_X86_GENERIC = 1002

Enumerates the available target architectures and ISA extensions as returned by libxs_cpuid.

integer(kind=C_INT), public, parameter :: LIBXS_X86_SSE3 = 1003

Enumerates the available target architectures and ISA extensions as returned by libxs_cpuid.

integer(kind=C_INT), public, parameter :: LIBXS_X86_SSE42 = 1004

Enumerates the available target architectures and ISA extensions as returned by libxs_cpuid.

integer(kind=C_INT), public, parameter :: LIBXS_X86_AVX = 1005

Enumerates the available target architectures and ISA extensions as returned by libxs_cpuid.

integer(kind=C_INT), public, parameter :: LIBXS_X86_AVX2 = 1006

Enumerates the available target architectures and ISA extensions as returned by libxs_cpuid.

integer(kind=C_INT), public, parameter :: LIBXS_X86_AVX10_256 = 1030

Enumerates the available target architectures and ISA extensions as returned by libxs_cpuid.

integer(kind=C_INT), public, parameter :: LIBXS_X86_AVX512 = 1100

Enumerates the available target architectures and ISA extensions as returned by libxs_cpuid.

integer(kind=C_INT), public, parameter :: LIBXS_X86_AVX512_AMX = 1105

Enumerates the available target architectures and ISA extensions as returned by libxs_cpuid.

integer(kind=C_INT), public, parameter :: LIBXS_X86_AVX512_INT8 = 1110

Enumerates the available target architectures and ISA extensions as returned by libxs_cpuid.

integer(kind=C_INT), public, parameter :: LIBXS_X86_AVX10_512 = 1200

Enumerates the available target architectures and ISA extensions as returned by libxs_cpuid.

integer(kind=C_INT), public, parameter :: LIBXS_X86_ALLFEAT = 1999

Enumerates the available target architectures and ISA extensions as returned by libxs_cpuid.

integer(kind=C_INT), public, parameter :: LIBXS_AARCH64 = 2001

Enumerates the available target architectures and ISA extensions as returned by libxs_cpuid.

integer(kind=C_INT), public, parameter :: LIBXS_AARCH64_SVE128 = 2201

Enumerates the available target architectures and ISA extensions as returned by libxs_cpuid.

integer(kind=C_INT), public, parameter :: LIBXS_AARCH64_SVE256 = 2301

Enumerates the available target architectures and ISA extensions as returned by libxs_cpuid.

integer(kind=C_INT), public, parameter :: LIBXS_AARCH64_SVE512 = 2401

Enumerates the available target architectures and ISA extensions as returned by libxs_cpuid.

integer(kind=C_INT), public, parameter :: LIBXS_AARCH64_ALLFEAT = 2999

Enumerates the available target architectures and ISA extensions as returned by libxs_cpuid.

integer(kind=C_INT), public, parameter :: LIBXS_PREDICT_AUTO = 0

Prediction mode flags (ORable).

integer(kind=C_INT), public, parameter :: LIBXS_PREDICT_INTERPOLATE = 1

Prediction mode flags (ORable).

integer(kind=C_INT), public, parameter :: LIBXS_PREDICT_CLASSIFY = 2

Prediction mode flags (ORable).

integer(kind=C_INT), public, parameter :: LIBXS_PREDICT_TEMPORAL = 4

Prediction mode flags (ORable).

integer(kind=C_INT), public, parameter :: LIBXS_PREDICT_IDENTITY = 0

Prediction output transform.

integer(kind=C_INT), public, parameter :: LIBXS_PREDICT_LOG = 1

Prediction output transform.

integer(kind=C_INT), public, parameter :: LIBXS_PREDICT_SQRT = 2

Prediction output transform.

integer(kind=C_INT), public, parameter :: LIBXS_PREDICT_RAW = 0

Prediction input decomposition mode.

integer(kind=C_INT), public, parameter :: LIBXS_PREDICT_SPREAD = 1

Prediction input decomposition mode.

integer(kind=C_INT), public, parameter :: LIBXS_PREDICT_PCA = 2

Prediction input decomposition mode.

integer(kind=C_INT), public, parameter :: LIBXS_PREDICT_SETDIFF = 3

Prediction input decomposition mode.

integer(kind=C_INT), public, parameter :: LIBXS_PREDICT_FISHER = 4

Prediction input decomposition mode.

integer(kind=C_INT), public, parameter :: LIBXS_PREDICT_RF = 5

Prediction input decomposition mode.

integer(kind=C_INT), public, parameter :: LIBXS_FPRINT_MAXORDER = 8

Maximum derivative order for fingerprints.


Interfaces

public interface libxs_syr2k

  • private subroutine libxs_syr2k_config(config, uplo, alpha, beta, a, b, c)

    SYR2K with pre-dispatched config.

    Arguments

    Type IntentOptional Attributes Name
    type(libxs_gemm_config_t), intent(in), TARGET :: config
    character(len=C_CHAR), intent(in), VALUE :: uplo
    real(kind=C_DOUBLE), intent(in), VALUE :: alpha
    real(kind=C_DOUBLE), intent(in), VALUE :: beta
    type(C_PTR), intent(in), VALUE :: a
    type(C_PTR), intent(in), VALUE :: b
    type(C_PTR), VALUE :: c
  • private subroutine libxs_syr2k_direct(datatype, n, k, lda, ldb, ldc, uplo, alpha, beta, a, b, c, registry)

    SYR2K direct: dispatch + call in one shot.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=C_INT), intent(in) :: datatype
    integer(kind=C_INT), intent(in) :: n
    integer(kind=C_INT), intent(in) :: k
    integer(kind=C_INT), intent(in) :: lda
    integer(kind=C_INT), intent(in) :: ldb
    integer(kind=C_INT), intent(in) :: ldc
    character(len=C_CHAR), intent(in) :: uplo
    real(kind=C_DOUBLE), intent(in) :: alpha
    real(kind=C_DOUBLE), intent(in) :: beta
    type(C_PTR), intent(in) :: a
    type(C_PTR), intent(in) :: b
    type(C_PTR) :: c
    type(C_PTR), intent(in), optional :: registry

public interface libxs_syrk

  • private subroutine libxs_syrk_config(config, uplo, alpha, beta, a, c)

    SYRK with pre-dispatched config.

    Arguments

    Type IntentOptional Attributes Name
    type(libxs_gemm_config_t), intent(in), TARGET :: config
    character(len=C_CHAR), intent(in), VALUE :: uplo
    real(kind=C_DOUBLE), intent(in), VALUE :: alpha
    real(kind=C_DOUBLE), intent(in), VALUE :: beta
    type(C_PTR), intent(in), VALUE :: a
    type(C_PTR), VALUE :: c
  • private subroutine libxs_syrk_direct(datatype, n, k, lda, ldc, uplo, alpha, beta, a, c, registry)

    SYRK direct: dispatch + call in one shot.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=C_INT), intent(in) :: datatype
    integer(kind=C_INT), intent(in) :: n
    integer(kind=C_INT), intent(in) :: k
    integer(kind=C_INT), intent(in) :: lda
    integer(kind=C_INT), intent(in) :: ldc
    character(len=C_CHAR), intent(in) :: uplo
    real(kind=C_DOUBLE), intent(in) :: alpha
    real(kind=C_DOUBLE), intent(in) :: beta
    type(C_PTR), intent(in) :: a
    type(C_PTR) :: c
    type(C_PTR), intent(in), optional :: registry

interface

  • public pure function libxs_cpuid(info) bind(C)

    Returns the detected ISA level for the current platform. Pass C_NULL_PTR instead of info to skip filling the CPU properties structure.

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: info

    Return Value integer(kind=C_INT)

interface

  • public pure function libxs_cpuid_name(id) bind(C)

    Returns a human-readable name for the given ISA level id. The returned pointer is to static storage.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=C_INT), intent(in), VALUE :: id

    Return Value type(C_PTR)

interface

  • public pure function libxs_cpuid_id(name) bind(C)

    Translates a CPU architecture name (e.g., "avx2") to the corresponding LIBXS id constant.

    Arguments

    Type IntentOptional Attributes Name
    character(len=C_CHAR), intent(in) :: name(*)

    Return Value integer(kind=C_INT)

interface

  • public pure function libxs_cpuid_vlen(id) bind(C)

    Returns the SIMD vector length (VLEN) in bytes for the given ISA level; zero if scalar.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=C_INT), intent(in), VALUE :: id

    Return Value integer(kind=C_INT)

interface

  • public function libxs_cpuid_amx_enable() bind(C)

    Request AMX tile state from the OS. Returns 0 on success, -1 on failure.

    Arguments

    None

    Return Value integer(kind=C_INT)

interface

  • public function libxs_timer_tick() bind(C)

    Returns the current tick of a monotonic timer source. Uses a platform-specific resolution; convert to seconds with libxs_timer_duration.

    Arguments

    None

    Return Value integer(kind=libxs_timer_tick_kind)

interface

  • public pure function libxs_timer_duration(tick0, tick1) bind(C)

    Returns the duration (in seconds) between two ticks received by libxs_timer_tick.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=LIBXS_TIMER_TICK_KIND), intent(in), VALUE :: tick0
    integer(kind=LIBXS_TIMER_TICK_KIND), intent(in), VALUE :: tick1

    Return Value real(kind=C_DOUBLE)

interface

  • public function libxs_malloc_pool(malloc_fn, free_fn) bind(C)

    Create a memory pool (returns opaque handle).

    Arguments

    Type IntentOptional Attributes Name
    type(C_FUNPTR), intent(in), VALUE :: malloc_fn
    type(C_FUNPTR), intent(in), VALUE :: free_fn

    Return Value type(C_PTR)

interface

  • public function libxs_malloc_xpool(malloc_fn, free_fn, max_nthreads) bind(C)

    Create a pool with extended allocators (per-thread extra).

    Arguments

    Type IntentOptional Attributes Name
    type(C_FUNPTR), intent(in), VALUE :: malloc_fn
    type(C_FUNPTR), intent(in), VALUE :: free_fn
    integer(kind=C_INT), intent(in), VALUE :: max_nthreads

    Return Value type(C_PTR)

interface

  • public pure function libxs_hash_string(string) bind(C)

    Calculate a 64-bit hash for a character string.

    Arguments

    Type IntentOptional Attributes Name
    character(len=C_CHAR), intent(in) :: string(*)

    Return Value integer(kind=C_LONG_LONG)

interface

  • public pure function libxs_hash_iso3309(data, size, seed) bind(C)

    CRC-32 (ISO 3309 polynomial) for the given data.

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: data
    integer(kind=C_INT), intent(in), VALUE :: size
    integer(kind=C_INT), intent(in), VALUE :: seed

    Return Value integer(kind=C_INT)

interface

  • public pure function libxs_adler32(data, size, seed) bind(C)

    Adler-32 checksum for the given data.

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: data
    integer(kind=C_INT), intent(in), VALUE :: size
    integer(kind=C_INT), intent(in), VALUE :: seed

    Return Value integer(kind=C_INT)

interface

  • public pure function libxs_memcmp(a, b, nbytes) result(diff) bind(C))

    Compare two memory regions (binds to libxs_memcmp).

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: a
    type(C_PTR), intent(in), VALUE :: b
    integer(kind=C_SIZE_T), intent(in), VALUE :: nbytes

    Return Value integer(kind=C_INT)

interface

  • public pure function libxs_matdiff_epsilon(input) bind(C)

    Combine absolute and relative norms into a single value which can be used to check against a margin.

    Arguments

    Type IntentOptional Attributes Name
    type(libxs_matdiff_t), intent(in) :: input

    Return Value real(kind=C_DOUBLE)

interface

  • public function libxs_registry_create() bind(C)

    Create a registry (key-value store). Returns C_NULL_PTR in case of an error.

    Arguments

    None

    Return Value type(C_PTR)

interface

  • public function libxs_registry_lock(registry) bind(C)

    Return internal lock of registry.

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: registry

    Return Value type(C_PTR)

interface

  • public function libxs_registry_info(registry, info) bind(C)

    Get registry information. Returns 0 on success.

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: registry
    type(libxs_registry_info_t), intent(out) :: info

    Return Value integer(kind=C_INT)

interface

  • public function libxs_matdiff_combine(output, input) bind(C)

    Combine two single-matrix diffs into a meta-diff.

    Arguments

    Type IntentOptional Attributes Name
    type(libxs_matdiff_t), intent(inout) :: output
    type(libxs_matdiff_t), intent(in) :: input

    Return Value integer(kind=C_INT)

interface

  • public function libxs_get_verbosity() bind(C)

    Query the verbosity level.

    Arguments

    None

    Return Value integer(kind=C_INT)

interface

  • public function libxs_timer_info(info) bind(C)

    Query timer properties.

    Arguments

    Type IntentOptional Attributes Name
    type(libxs_timer_info_t), intent(out) :: info

    Return Value integer(kind=C_INT)

interface

  • public function libxs_predict_create(ninputs, noutputs) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=C_INT), intent(in), VALUE :: ninputs
    integer(kind=C_INT), intent(in), VALUE :: noutputs

    Return Value type(C_PTR)

interface

  • public function libxs_predict_lock(model) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: model

    Return Value type(C_PTR)

interface

  • public function libxs_predict_push(lock, model, inputs, outputs) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: lock
    type(C_PTR), intent(in), VALUE :: model
    real(kind=C_DOUBLE), intent(in) :: inputs(*)
    real(kind=C_DOUBLE), intent(in) :: outputs(*)

    Return Value integer(kind=C_INT)

interface

  • public function libxs_predict_build(model, nclusters, order) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: model
    integer(kind=C_INT), intent(in), VALUE :: nclusters
    integer(kind=C_INT), intent(in), VALUE :: order

    Return Value integer(kind=C_INT)

interface

  • public function libxs_predict_build_task(lock, model, nclusters, order, tid, ntasks) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: lock
    type(C_PTR), intent(in), VALUE :: model
    integer(kind=C_INT), intent(in), VALUE :: nclusters
    integer(kind=C_INT), intent(in), VALUE :: order
    integer(kind=C_INT), intent(in), VALUE :: tid
    integer(kind=C_INT), intent(in), VALUE :: ntasks

    Return Value integer(kind=C_INT)

interface

  • public function libxs_predict_save(model, buffer, size) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: model
    type(C_PTR), intent(in), VALUE :: buffer
    integer(kind=C_SIZE_T), intent(inout) :: size

    Return Value integer(kind=C_INT)

interface

  • public function libxs_predict_load(buffer, size) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: buffer
    integer(kind=C_SIZE_T), intent(in), VALUE :: size

    Return Value type(C_PTR)

interface

  • public function libxs_predict_load_csv(model, filename, delims, inputs, outputs, header, header_size, delim_out) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: model
    character(len=C_CHAR), intent(in) :: filename(*)
    type(C_PTR), intent(in), VALUE :: delims
    type(C_PTR), intent(in), VALUE :: inputs
    type(C_PTR), intent(in), VALUE :: outputs
    type(C_PTR), intent(in), VALUE :: header
    integer(kind=C_INT), intent(in), VALUE :: header_size
    type(C_PTR), intent(in), VALUE :: delim_out

    Return Value integer(kind=C_INT)

interface

  • public function libxs_strtoken(str, delims, index, length) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    character(len=C_CHAR), intent(in) :: str(*)
    character(len=C_CHAR), intent(in) :: delims(*)
    integer(kind=C_INT), intent(in), VALUE :: index
    integer(kind=C_INT), intent(out) :: length

    Return Value type(C_PTR)

interface

  • public subroutine libxs_init() bind(C)

    Initialize the library.

    Arguments

    None

interface

  • public subroutine libxs_finalize() bind(C)

    De-initialize the library and free internal memory.

    Arguments

    None

interface

  • public subroutine libxs_free(ptr) bind(C)

    Free memory allocated by libxs_malloc.

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: ptr

interface

  • public subroutine libxs_free_pool(pool) bind(C)

    Destroy pool and free all associated memory.

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: pool

interface

  • public subroutine libxs_malloc_arg(pool, extra) bind(C)

    Set the per-thread extra argument for an extended pool.

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: pool
    type(C_PTR), intent(in), VALUE :: extra

interface

  • public pure subroutine libxs_matdiff_reduce(output, input) bind(C)

    Reduces matdiff info (max function). Initialize output with libxs_matdiff_clear first.

    Arguments

    Type IntentOptional Attributes Name
    type(libxs_matdiff_t), intent(inout) :: output
    type(libxs_matdiff_t), intent(in) :: input

interface

  • public pure subroutine libxs_matdiff_clear(info) bind(C)

    Clears the given info-structure, e.g., for the initial reduction-value (libxs_matdiff_reduce).

    Arguments

    Type IntentOptional Attributes Name
    type(libxs_matdiff_t), intent(out) :: info

interface

  • public subroutine libxs_registry_destroy(registry) bind(C)

    Destroy registry and release all entries.

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: registry

interface

  • public subroutine libxs_gemm_batch(a_array, b_array, c_array, batchsize, config) bind(C)

    Pointer-array GEMM batch. Shape, alpha/beta, datatype from config%shape.

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in) :: a_array(*)
    type(C_PTR), intent(in) :: b_array(*)
    type(C_PTR) :: c_array(*)
    integer(kind=C_INT), intent(in), VALUE :: batchsize
    type(libxs_gemm_config_t), intent(in) :: config

interface

  • public subroutine libxs_gemm_batch_task(a_array, b_array, c_array, batchsize, config, tid, ntasks) bind(C)

    Pointer-array GEMM batch: per-thread variant.

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in) :: a_array(*)
    type(C_PTR), intent(in) :: b_array(*)
    type(C_PTR) :: c_array(*)
    integer(kind=C_INT), intent(in), VALUE :: batchsize
    type(libxs_gemm_config_t), intent(in) :: config
    integer(kind=C_INT), intent(in), VALUE :: tid
    integer(kind=C_INT), intent(in), VALUE :: ntasks

interface

  • public subroutine libxs_gemm_index(a, stride_a, b, stride_b, c, stride_c, index_stride, index_base, batchsize, config) bind(C)

    Index-array GEMM batch: element-offsets into contiguous A, B, C buffers. index_stride is the Byte-stride used to walk stride_a, stride_b, stride_c (e.g. 4 for packed INTEGER(C_INT) arrays). index_stride=0: constant-stride mode. index_base selects the indexing convention: 0 for zero-based (C), 1 for one-based (Fortran). Shape, alpha/beta, datatype from config%shape.

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: a
    type(C_PTR), intent(in), VALUE :: stride_a
    type(C_PTR), intent(in), VALUE :: b
    type(C_PTR), intent(in), VALUE :: stride_b
    type(C_PTR), VALUE :: c
    type(C_PTR), intent(in), VALUE :: stride_c
    integer(kind=C_INT), intent(in), VALUE :: index_stride
    integer(kind=C_INT), intent(in), VALUE :: index_base
    integer(kind=C_INT), intent(in), VALUE :: batchsize
    type(libxs_gemm_config_t), intent(in) :: config

interface

  • public subroutine libxs_gemm_index_task(a, stride_a, b, stride_b, c, stride_c, index_stride, index_base, batchsize, config, tid, ntasks) bind(C)

    Index-array GEMM batch: per-thread variant.

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: a
    type(C_PTR), intent(in), VALUE :: stride_a
    type(C_PTR), intent(in), VALUE :: b
    type(C_PTR), intent(in), VALUE :: stride_b
    type(C_PTR), VALUE :: c
    type(C_PTR), intent(in), VALUE :: stride_c
    integer(kind=C_INT), intent(in), VALUE :: index_stride
    integer(kind=C_INT), intent(in), VALUE :: index_base
    integer(kind=C_INT), intent(in), VALUE :: batchsize
    type(libxs_gemm_config_t), intent(in) :: config
    integer(kind=C_INT), intent(in), VALUE :: tid
    integer(kind=C_INT), intent(in), VALUE :: ntasks

interface

  • public subroutine libxs_set_verbosity(level) bind(C)

    Set the verbosity level.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=C_INT), intent(in), VALUE :: level

interface

  • public subroutine libxs_predict_destroy(model) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: model

interface

  • public subroutine libxs_predict_set_mode(model, mode) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: model
    integer(kind=C_INT), intent(in), VALUE :: mode

interface

  • public subroutine libxs_predict_set_weights(model, weights) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: model
    real(kind=C_DOUBLE), intent(in) :: weights(*)

interface

  • public subroutine libxs_predict_set_transform(model, output, transform) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: model
    integer(kind=C_INT), intent(in), VALUE :: output
    integer(kind=C_INT), intent(in), VALUE :: transform

interface

  • public subroutine libxs_predict_set_refine(model, iterations) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: model
    integer(kind=C_INT), intent(in), VALUE :: iterations

interface

  • public subroutine libxs_predict_set_series(model, nseries, window) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: model
    integer(kind=C_INT), intent(in), VALUE :: nseries
    integer(kind=C_INT), intent(in), VALUE :: window

interface

  • public subroutine libxs_predict_set_target(model, target) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: model
    integer(kind=C_INT), intent(in), VALUE :: target

interface

  • public subroutine libxs_predict_set_decompose(model, decompose) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: model
    integer(kind=C_INT), intent(in), VALUE :: decompose

interface

  • public subroutine libxs_predict_set_diff(model, order) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: model
    integer(kind=C_INT), intent(in), VALUE :: order

interface

  • public subroutine libxs_predict_eval(lock, model, inputs, outputs, info, nblend) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: lock
    type(C_PTR), intent(in), VALUE :: model
    real(kind=C_DOUBLE), intent(in) :: inputs(*)
    real(kind=C_DOUBLE), intent(out) :: outputs(*)
    type(libxs_predict_info_t), intent(out) :: info
    integer(kind=C_INT), intent(in), VALUE :: nblend

interface

  • public subroutine libxs_predict_inverse(lock, model, target_outputs, inputs, info) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: lock
    type(C_PTR), intent(in), VALUE :: model
    real(kind=C_DOUBLE), intent(in) :: target_outputs(*)
    real(kind=C_DOUBLE), intent(out) :: inputs(*)
    type(libxs_predict_info_t), intent(out) :: info

interface

  • public subroutine libxs_predict_query(model, info) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: model
    type(libxs_predict_query_t), intent(out) :: info

interface

  • public subroutine libxs_predict_get(model, index, inputs, outputs) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: model
    integer(kind=C_INT), intent(in), VALUE :: index
    real(kind=C_DOUBLE), intent(out) :: inputs(*)
    real(kind=C_DOUBLE), intent(out) :: outputs(*)

interface

  • public subroutine libxs_predict_eval_batch(model, inputs_batch, outputs_batch, count, nblend) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: model
    real(kind=C_DOUBLE), intent(in) :: inputs_batch(*)
    real(kind=C_DOUBLE), intent(out) :: outputs_batch(*)
    integer(kind=C_INT), intent(in), VALUE :: count
    integer(kind=C_INT), intent(in), VALUE :: nblend

interface

  • public subroutine libxs_predict_eval_batch_task(model, inputs_batch, outputs_batch, count, nblend, tid, ntasks) bind(C)

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in), VALUE :: model
    real(kind=C_DOUBLE), intent(in) :: inputs_batch(*)
    real(kind=C_DOUBLE), intent(out) :: outputs_batch(*)
    integer(kind=C_INT), intent(in), VALUE :: count
    integer(kind=C_INT), intent(in), VALUE :: nblend
    integer(kind=C_INT), intent(in), VALUE :: tid
    integer(kind=C_INT), intent(in), VALUE :: ntasks

public interface libxs_malloc

Allocate memory (flags=0: automatic).

  • private function libxs_malloc_bytes(pool, nbytes, alignment)

    Allocate from a pool reaching steady-state. alignment=0 (LIBXS_MALLOC_AUTO, default): automatic. alignment=1 (LIBXS_MALLOC_NATIVE): preserve allocator's point !er.

    Arguments

    Type IntentOptional Attributes Name
    type(C_PTR), intent(in) :: pool
    integer(kind=C_SIZE_T), intent(in) :: nbytes
    integer(kind=C_INT), intent(in), optional :: alignment

    Return Value type(C_PTR)

public interface libxs_hash

Calculate a hash value for a given array and seed.

  • private pure function libxs_hash_xchar(key, seed)

    Calculates a hash value for the given array and seed.

    Arguments

    Type IntentOptional Attributes Name
    character(len=C_CHAR), intent(in), CONTIGUOUS, TARGET :: key(:)
    integer(kind=C_INT), intent(in) :: seed

    Return Value integer(kind=C_INT)

  • private pure function libxs_hash_xi8(key, seed)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=C_INT8_T), intent(in), CONTIGUOUS, TARGET :: key(:)
    integer(kind=C_INT), intent(in) :: seed

    Return Value integer(kind=C_INT)

  • private pure function libxs_hash_xi32(key, seed)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=C_INT), intent(in), CONTIGUOUS, TARGET :: key(:)
    integer(kind=C_INT), intent(in) :: seed

    Return Value integer(kind=C_INT)

  • private pure function libxs_hash_xi64(key, seed)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=C_LONG_LONG), intent(in), CONTIGUOUS, TARGET :: key(:)
    integer(kind=C_INT), intent(in) :: seed

    Return Value integer(kind=C_INT)

  • private pure function libxs_hash_char(key)

    Arguments

    Type IntentOptional Attributes Name
    character(len=C_CHAR), intent(in), CONTIGUOUS, TARGET :: key(:)

    Return Value integer(kind=C_INT)

  • private pure function libxs_hash_i8(key)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=C_INT8_T), intent(in), CONTIGUOUS, TARGET :: key(:)

    Return Value integer(kind=C_INT)

  • private pure function libxs_hash_i32(key)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=C_INT), intent(in), CONTIGUOUS, TARGET :: key(:)

    Return Value integer(kind=C_INT)

  • private pure function libxs_hash_i64(key)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=C_LONG_LONG), intent(in), CONTIGUOUS, TARGET :: key(:)

    Return Value integer(kind=C_INT)

public interface libxs_diff

Check if two arrays differ (.TRUE. if different).

  • private pure function libxs_diff_char(a, b)

    Calculates if there is a difference between two arrays.

    Arguments

    Type IntentOptional Attributes Name
    character(len=C_CHAR), intent(in), CONTIGUOUS, TARGET :: a(:)
    character(len=C_CHAR), intent(in), CONTIGUOUS, TARGET :: b(:)

    Return Value logical

  • private pure function libxs_diff_i8(a, b)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=C_INT8_T), intent(in), CONTIGUOUS, TARGET :: a(:)
    integer(kind=C_INT8_T), intent(in), CONTIGUOUS, TARGET :: b(:)

    Return Value logical

  • private pure function libxs_diff_i32(a, b)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=C_INT), intent(in), CONTIGUOUS, TARGET :: a(:)
    integer(kind=C_INT), intent(in), CONTIGUOUS, TARGET :: b(:)

    Return Value logical

  • private pure function libxs_diff_i64(a, b)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=C_LONG_LONG), intent(in), CONTIGUOUS, TARGET :: a(:)
    integer(kind=C_LONG_LONG), intent(in), CONTIGUOUS, TARGET :: b(:)

    Return Value logical

public interface libxs_fprint

Foeppl polynomial fingerprint (generic).

  • private function libxs_fprint_ptr(info, datatype, data, ndims, shape, stride, order, axis) result(rc)

    General fingerprint: C_PTR data, explicit shape/stride. stride and order and axis are optional.

    Arguments

    Type IntentOptional Attributes Name
    type(libxs_fprint_t), intent(out) :: info
    integer(kind=C_INT), intent(in) :: datatype
    type(C_PTR), intent(in) :: data
    integer(kind=C_INT), intent(in) :: ndims
    integer(kind=C_SIZE_T), intent(in), TARGET :: shape(ndims)
    integer(kind=C_SIZE_T), intent(in), optional, TARGET :: stride(ndims)
    integer(kind=C_INT), intent(in), optional :: order
    integer(kind=C_INT), intent(in), optional :: axis

    Return Value integer(kind=C_INT)

  • private function libxs_fprint_f64(info, data, order, axis) result(rc)

    1-D fingerprint for REAL(C_DOUBLE) array.

    Arguments

    Type IntentOptional Attributes Name
    type(libxs_fprint_t), intent(out) :: info
    real(kind=C_DOUBLE), intent(in), TARGET :: data(:)
    integer(kind=C_INT), intent(in), optional :: order
    integer(kind=C_INT), intent(in), optional :: axis

    Return Value integer(kind=C_INT)

  • private function libxs_fprint_f32(info, data, order, axis) result(rc)

    1-D fingerprint for REAL(C_FLOAT) array.

    Arguments

    Type IntentOptional Attributes Name
    type(libxs_fprint_t), intent(out) :: info
    real(kind=C_FLOAT), intent(in), TARGET :: data(:)
    integer(kind=C_INT), intent(in), optional :: order
    integer(kind=C_INT), intent(in), optional :: axis

    Return Value integer(kind=C_INT)

  • private function libxs_fprint_i32(info, data, order, axis) result(rc)

    1-D fingerprint for INTEGER(C_INT) array.

    Arguments

    Type IntentOptional Attributes Name
    type(libxs_fprint_t), intent(out) :: info
    integer(kind=C_INT), intent(in), TARGET :: data(:)
    integer(kind=C_INT), intent(in), optional :: order
    integer(kind=C_INT), intent(in), optional :: axis

    Return Value integer(kind=C_INT)

  • private function libxs_fprint_i8(info, data, order, axis) result(rc)

    1-D fingerprint for INTEGER(C_INT8_T) array.

    Arguments

    Type IntentOptional Attributes Name
    type(libxs_fprint_t), intent(out) :: info
    integer(kind=C_INT8_T), intent(in), TARGET :: data(:)
    integer(kind=C_INT), intent(in), optional :: order
    integer(kind=C_INT), intent(in), optional :: axis

    Return Value integer(kind=C_INT)


Derived Types

type, public, BIND(C) ::  libxs_matdiff_t

Structure of differences with matrix norms according to http://www.netlib.org/lapack/lug/node75.html).

Components

Type Visibility Attributes Name Initial
real(kind=C_DOUBLE), public :: norm1_abs

One-norm

real(kind=C_DOUBLE), public :: norm1_rel

One-norm

real(kind=C_DOUBLE), public :: normi_abs

Infinity-norm

real(kind=C_DOUBLE), public :: normi_rel

Infinity-norm

real(kind=C_DOUBLE), public :: normf_rel

Froebenius-norm

real(kind=C_DOUBLE), public :: linf_abs

Maximum difference, L2-norm (absolute and relative), and R-squared.

real(kind=C_DOUBLE), public :: linf_rel

Maximum difference, L2-norm (absolute and relative), and R-squared.

real(kind=C_DOUBLE), public :: l2_abs

Maximum difference, L2-norm (absolute and relative), and R-squared.

real(kind=C_DOUBLE), public :: l2_rel

Maximum difference, L2-norm (absolute and relative), and R-squared.

real(kind=C_DOUBLE), public :: rsq

Maximum difference, L2-norm (absolute and relative), and R-squared.

real(kind=C_DOUBLE), public :: l1_ref

Statistics: sum/l1, min, max, avg, variance.

real(kind=C_DOUBLE), public :: min_ref

Statistics: sum/l1, min, max, avg, variance.

real(kind=C_DOUBLE), public :: max_ref

Statistics: sum/l1, min, max, avg, variance.

real(kind=C_DOUBLE), public :: avg_ref

Statistics: sum/l1, min, max, avg, variance.

real(kind=C_DOUBLE), public :: var_ref

Statistics: sum/l1, min, max, avg, variance.

real(kind=C_DOUBLE), public :: l1_tst
real(kind=C_DOUBLE), public :: min_tst
real(kind=C_DOUBLE), public :: max_tst
real(kind=C_DOUBLE), public :: avg_tst
real(kind=C_DOUBLE), public :: var_tst
real(kind=C_DOUBLE), public :: diag_min_ref

Diagonal statistics: min and max of diagonal elements.

real(kind=C_DOUBLE), public :: diag_max_ref

Diagonal statistics: min and max of diagonal elements.

real(kind=C_DOUBLE), public :: diag_min_tst
real(kind=C_DOUBLE), public :: diag_max_tst
real(kind=C_DOUBLE), public :: v_ref

Values(v_ref, v_tst) at location of largest linf_abs.

real(kind=C_DOUBLE), public :: v_tst

Values(v_ref, v_tst) at location of largest linf_abs.

real(kind=C_DOUBLE), public :: w

Cumulative weight for online mean.

integer(kind=C_INT), public :: m

Location (m, n) and reduction index (i, r).

integer(kind=C_INT), public :: n

Location (m, n) and reduction index (i, r).

integer(kind=C_INT), public :: i

Location (m, n) and reduction index (i, r).

integer(kind=C_INT), public :: r

Location (m, n) and reduction index (i, r).

type, public, BIND(C) ::  libxs_registry_info_t

Registry status information.

Components

Type Visibility Attributes Name Initial
integer(kind=C_SIZE_T), public :: capacity
integer(kind=C_SIZE_T), public :: size
integer(kind=C_SIZE_T), public :: nbytes

type, public, BIND(C) ::  libxs_cpuid_t

CPU identification result.

Components

Type Visibility Attributes Name Initial
character(len=C_CHAR), public :: model(256)
integer(kind=C_INT), public :: constant_tsc

type, public, BIND(C) ::  libxs_fprint_t

Foeppl polynomial fingerprint.

Components

Type Visibility Attributes Name Initial
real(kind=C_DOUBLE), public :: l2(LIBXS_FPRINT_MAXORDER+1)
real(kind=C_DOUBLE), public :: l1(LIBXS_FPRINT_MAXORDER+1)
real(kind=C_DOUBLE), public :: linf(LIBXS_FPRINT_MAXORDER+1)
real(kind=C_DOUBLE), public :: mean(LIBXS_FPRINT_MAXORDER+1)
integer(kind=C_INT), public :: order
integer(kind=C_INT), public :: n
integer(kind=C_INT), public :: datatype

type, public, BIND(C) ::  libxs_timer_info_t

Timer properties.

Components

Type Visibility Attributes Name Initial
integer(kind=C_INT), public :: tsc

type, public, BIND(C) ::  libxs_gemm_backend_t

GEMM shape: problem geometry, transpose flags, and scalar coefficients. Alpha/beta stored as double (float promoted without loss). Also serves as registry key when caching configurations.

Components

Type Visibility Attributes Name Initial
type(C_FUNPTR), public :: jit_create_dgemm = C_NULL_FUNPTR
type(C_FUNPTR), public :: jit_get_dgemm = C_NULL_FUNPTR
type(C_FUNPTR), public :: jit_create_sgemm = C_NULL_FUNPTR
type(C_FUNPTR), public :: jit_get_sgemm = C_NULL_FUNPTR
type(C_FUNPTR), public :: xgemm_dispatch = C_NULL_FUNPTR
type(C_FUNPTR), public :: dgemm_blas = C_NULL_FUNPTR
type(C_FUNPTR), public :: sgemm_blas = C_NULL_FUNPTR

type, public, BIND(C) ::  libxs_gemm_shape_t

Components

Type Visibility Attributes Name Initial
integer(kind=C_INT), public :: datatype = 0
character(len=C_CHAR), public :: transa = C_NULL_CHAR
character(len=C_CHAR), public :: transb = C_NULL_CHAR
integer(kind=C_INT), public :: m = 0
integer(kind=C_INT), public :: n = 0
integer(kind=C_INT), public :: k = 0
integer(kind=C_INT), public :: lda = 0
integer(kind=C_INT), public :: ldb = 0
integer(kind=C_INT), public :: ldc = 0
real(kind=C_DOUBLE), public :: alpha = 0
real(kind=C_DOUBLE), public :: beta = 0

type, public, BIND(C) ::  libxs_gemm_config_t

GEMM kernel configuration. All function-pointer fields are C_FUNPTR (default C_NULL_FUNPTR). Populate from Fortran with C_FUNLOC or pass to C code that calls libxs_gemm_dispatch. The shape member is populated by libxs_gemm_dispatch.

Components

Type Visibility Attributes Name Initial
type(C_FUNPTR), public :: dgemm_blas = C_NULL_FUNPTR
type(C_FUNPTR), public :: sgemm_blas = C_NULL_FUNPTR
type(C_FUNPTR), public :: dgemm_jit = C_NULL_FUNPTR
type(C_FUNPTR), public :: sgemm_jit = C_NULL_FUNPTR
type(C_FUNPTR), public :: xgemm = C_NULL_FUNPTR
type(C_PTR), public :: jitter = C_NULL_PTR
integer(kind=C_INT), public :: flags = LIBXS_GEMM_FLAGS_DEFAULT
type(libxs_gemm_shape_t), public :: shape

type, public, BIND(C) ::  libxs_predict_info_t

Per-output confidence information from prediction.

Components

Type Visibility Attributes Name Initial
type(C_PTR), public :: values = C_NULL_PTR
type(C_PTR), public :: error = C_NULL_PTR
type(C_PTR), public :: confidence = C_NULL_PTR
type(C_PTR), public :: variance = C_NULL_PTR
type(C_PTR), public :: interpolated = C_NULL_PTR
integer(kind=C_INT), public :: noutputs = 0
integer(kind=C_INT), public :: cluster = -1
real(kind=C_DOUBLE), public :: distance = 0

type, public, BIND(C) ::  libxs_predict_query_t

Model statistics after build.

Components

Type Visibility Attributes Name Initial
real(kind=C_DOUBLE), public :: compression = 0
integer(kind=C_INT), public :: order = 0
integer(kind=C_INT), public :: nclusters = 0
integer(kind=C_INT), public :: nentries = 0
integer(kind=C_INT), public :: iterations = 0

Functions

public elemental function libxs_typesize(datatype)

Extract type-size (in Bytes) from datatype enum.

Arguments

Type IntentOptional Attributes Name
integer(kind=C_INT), intent(in) :: datatype

Return Value integer(kind=C_INT)

public function libxs_fprint_diff(a, b, weights)

Weighted Sobolev distance between two fingerprints. If weights is absent, default weights are used.

Arguments

Type IntentOptional Attributes Name
type(libxs_fprint_t), intent(in) :: a
type(libxs_fprint_t), intent(in) :: b
real(kind=C_DOUBLE), intent(in), optional, TARGET :: weights(*)

Return Value real(kind=C_DOUBLE)

public function libxs_registry_set(registry, key, key_size, value_init, value_size)

Register a key-value pair. Returns a pointer to the stored value, or C_NULL_PTR on failure.

Arguments

Type IntentOptional Attributes Name
type(C_PTR), intent(in) :: registry
type(C_PTR), intent(in) :: key
integer(kind=C_SIZE_T), intent(in) :: key_size
type(C_PTR), intent(in) :: value_init
integer(kind=C_SIZE_T), intent(in) :: value_size

Return Value type(C_PTR)

public function libxs_registry_get(registry, key, key_size)

Query a value by key. Returns C_NULL_PTR if the key is not found.

Arguments

Type IntentOptional Attributes Name
type(C_PTR), intent(in) :: registry
type(C_PTR), intent(in) :: key
integer(kind=C_SIZE_T), intent(in) :: key_size

Return Value type(C_PTR)

public function libxs_registry_get_copy(registry, key, key_size, value_out, value_size)

Thread-safe query: copies up to value_size bytes into value_out under the lock. Returns non-zero if the key was found.

Arguments

Type IntentOptional Attributes Name
type(C_PTR), intent(in) :: registry
type(C_PTR), intent(in) :: key
integer(kind=C_SIZE_T), intent(in) :: key_size
type(C_PTR), intent(in) :: value_out
integer(kind=C_SIZE_T), intent(in) :: value_size

Return Value integer(kind=C_INT)

public function libxs_registry_has(registry, key, key_size)

Check if a key exists (non-zero if found).

Arguments

Type IntentOptional Attributes Name
type(C_PTR), intent(in) :: registry
type(C_PTR), intent(in) :: key
integer(kind=C_SIZE_T), intent(in) :: key_size

Return Value integer(kind=C_INT)

public function libxs_registry_extract(registry, key, key_size, value_out, value_size)

Atomically retrieve and remove a key-value pair. Copies up to value_size bytes into value_out, then removes the entry. Returns non-zero if found.

Arguments

Type IntentOptional Attributes Name
type(C_PTR), intent(in) :: registry
type(C_PTR), intent(in) :: key
integer(kind=C_SIZE_T), intent(in) :: key_size
type(C_PTR), intent(in) :: value_out
integer(kind=C_SIZE_T), intent(in) :: value_size

Return Value integer(kind=C_INT)

public function libxs_gemm_dispatch(config, datatype, transa, transb, m, n, k, lda, ldb, ldc, alpha, beta, jit_create_dgemm, jit_get_dgemm, jit_create_sgemm, jit_get_sgemm, xgemm_dispatch, dgemm_blas, sgemm_blas, registry)

Dispatch a GEMM kernel and populate config. Accepts OPTIONAL backend function pointers for MKL JIT, LIBXSMM xgemm, and BLAS fallback. Returns nonzero if a usable kernel was obtained.

Arguments

Type IntentOptional Attributes Name
type(libxs_gemm_config_t), intent(inout) :: config
integer(kind=C_INT), intent(in) :: datatype
character(len=C_CHAR), intent(in) :: transa
character(len=C_CHAR), intent(in) :: transb
integer(kind=C_INT), intent(in) :: m
integer(kind=C_INT), intent(in) :: n
integer(kind=C_INT), intent(in) :: k
integer(kind=C_INT), intent(in) :: lda
integer(kind=C_INT), intent(in) :: ldb
integer(kind=C_INT), intent(in) :: ldc
real(kind=C_DOUBLE), intent(in) :: alpha
real(kind=C_DOUBLE), intent(in) :: beta
type(C_FUNPTR), intent(in), optional :: jit_create_dgemm
type(C_FUNPTR), intent(in), optional :: jit_get_dgemm
type(C_FUNPTR), intent(in), optional :: jit_create_sgemm
type(C_FUNPTR), intent(in), optional :: jit_get_sgemm
type(C_FUNPTR), intent(in), optional :: xgemm_dispatch
type(C_FUNPTR), intent(in), optional :: dgemm_blas
type(C_FUNPTR), intent(in), optional :: sgemm_blas
type(C_PTR), intent(in), optional :: registry

Return Value integer(kind=C_INT)

public function libxs_syr2k_dispatch(datatype, n, k, lda, ldb, ldc, jit_create_dgemm, jit_get_dgemm, jit_create_sgemm, jit_get_sgemm, xgemm_dispatch, dgemm_blas, sgemm_blas, registry)

Dispatch a GEMM config for SYR2K. Accepts OPTIONAL backend function pointers. Returns C_PTR to registry-owned config (NULL on failure).

Arguments

Type IntentOptional Attributes Name
integer(kind=C_INT), intent(in) :: datatype
integer(kind=C_INT), intent(in) :: n
integer(kind=C_INT), intent(in) :: k
integer(kind=C_INT), intent(in) :: lda
integer(kind=C_INT), intent(in) :: ldb
integer(kind=C_INT), intent(in) :: ldc
type(C_FUNPTR), intent(in), optional :: jit_create_dgemm
type(C_FUNPTR), intent(in), optional :: jit_get_dgemm
type(C_FUNPTR), intent(in), optional :: jit_create_sgemm
type(C_FUNPTR), intent(in), optional :: jit_get_sgemm
type(C_FUNPTR), intent(in), optional :: xgemm_dispatch
type(C_FUNPTR), intent(in), optional :: dgemm_blas
type(C_FUNPTR), intent(in), optional :: sgemm_blas
type(C_PTR), intent(in), optional :: registry

Return Value type(C_PTR)

public function libxs_syrk_dispatch(datatype, n, k, lda, ldc, jit_create_dgemm, jit_get_dgemm, jit_create_sgemm, jit_get_sgemm, xgemm_dispatch, dgemm_blas, sgemm_blas, registry)

Dispatch a GEMM config for SYRK. Accepts OPTIONAL backend function pointers. Returns C_PTR to registry-owned config (NULL on failure).

Arguments

Type IntentOptional Attributes Name
integer(kind=C_INT), intent(in) :: datatype
integer(kind=C_INT), intent(in) :: n
integer(kind=C_INT), intent(in) :: k
integer(kind=C_INT), intent(in) :: lda
integer(kind=C_INT), intent(in) :: ldc
type(C_FUNPTR), intent(in), optional :: jit_create_dgemm
type(C_FUNPTR), intent(in), optional :: jit_get_dgemm
type(C_FUNPTR), intent(in), optional :: jit_create_sgemm
type(C_FUNPTR), intent(in), optional :: jit_get_sgemm
type(C_FUNPTR), intent(in), optional :: xgemm_dispatch
type(C_FUNPTR), intent(in), optional :: dgemm_blas
type(C_FUNPTR), intent(in), optional :: sgemm_blas
type(C_PTR), intent(in), optional :: registry

Return Value type(C_PTR)


Subroutines

public pure subroutine libxs_matcopy(outm, inm, typesize, m, n, ldi, ldo)

Copy a matrix (or zero if source is NULL). ldo defaults to m (tightly packed output).

Arguments

Type IntentOptional Attributes Name
type(C_PTR), intent(in), VALUE :: outm
type(C_PTR), intent(in), VALUE :: inm
integer(kind=C_INT), intent(in), VALUE :: typesize
integer(kind=C_INT), intent(in), VALUE :: m
integer(kind=C_INT), intent(in), VALUE :: n
integer(kind=C_INT), intent(in), VALUE :: ldi
integer(kind=C_INT), intent(in), optional, VALUE :: ldo

public pure subroutine libxs_matcopy_task(outm, inm, typesize, m, n, ldi, ldo, tid, ntasks)

Copy a matrix: task variant for external threading. ldo defaults to m (tightly packed output).

Arguments

Type IntentOptional Attributes Name
type(C_PTR), intent(in), VALUE :: outm
type(C_PTR), intent(in), VALUE :: inm
integer(kind=C_INT), intent(in), VALUE :: typesize
integer(kind=C_INT), intent(in), VALUE :: m
integer(kind=C_INT), intent(in), VALUE :: n
integer(kind=C_INT), intent(in), VALUE :: ldi
integer(kind=C_INT), intent(in), optional, VALUE :: ldo
integer(kind=C_INT), intent(in), VALUE :: tid
integer(kind=C_INT), intent(in), VALUE :: ntasks

public pure subroutine libxs_otrans(outm, inm, typesize, m, n, ldi, ldo)

Out-of-place matrix transpose. ldo defaults to n (tightly packed transposed output).

Arguments

Type IntentOptional Attributes Name
type(C_PTR), intent(in), VALUE :: outm
type(C_PTR), intent(in), VALUE :: inm
integer(kind=C_INT), intent(in), VALUE :: typesize
integer(kind=C_INT), intent(in), VALUE :: m
integer(kind=C_INT), intent(in), VALUE :: n
integer(kind=C_INT), intent(in), VALUE :: ldi
integer(kind=C_INT), intent(in), optional, VALUE :: ldo

public pure subroutine libxs_otrans_task(outm, inm, typesize, m, n, ldi, ldo, tid, ntasks)

Out-of-place transpose: task variant. ldo defaults to n (tightly packed transposed output).

Arguments

Type IntentOptional Attributes Name
type(C_PTR), intent(in), VALUE :: outm
type(C_PTR), intent(in), VALUE :: inm
integer(kind=C_INT), intent(in), VALUE :: typesize
integer(kind=C_INT), intent(in), VALUE :: m
integer(kind=C_INT), intent(in), VALUE :: n
integer(kind=C_INT), intent(in), VALUE :: ldi
integer(kind=C_INT), intent(in), optional, VALUE :: ldo
integer(kind=C_INT), intent(in), VALUE :: tid
integer(kind=C_INT), intent(in), VALUE :: ntasks

public subroutine libxs_matdiff(info, datatype, m, n, ref, tst, ldref, ldtst)

Matdiff wrapper with OPTIONAL arguments.

Arguments

Type IntentOptional Attributes Name
type(libxs_matdiff_t), intent(out) :: info
integer(kind=C_INT), intent(in) :: datatype
integer(kind=C_INT), intent(in) :: m
integer(kind=C_INT), intent(in), optional :: n
type(C_PTR), intent(in), optional :: ref
type(C_PTR), intent(in), optional :: tst
integer(kind=C_INT), intent(in), optional :: ldref
integer(kind=C_INT), intent(in), optional :: ldtst

public subroutine libxs_itrans(inout, typesize, m, n, ldi, ldo, scratch)

In-place matrix transpose. ldo defaults to n. scratch defaults to NULL (auto-allocate internally).

Arguments

Type IntentOptional Attributes Name
type(C_PTR), intent(in) :: inout
integer(kind=C_INT), intent(in) :: typesize
integer(kind=C_INT), intent(in) :: m
integer(kind=C_INT), intent(in) :: n
integer(kind=C_INT), intent(in) :: ldi
integer(kind=C_INT), intent(in), optional :: ldo
type(C_PTR), intent(in), optional :: scratch

public subroutine libxs_itrans_task(inout, typesize, m, n, ldi, ldo, scratch, tid, ntasks)

In-place transpose: task variant. ldo defaults to n. scratch defaults to NULL.

Arguments

Type IntentOptional Attributes Name
type(C_PTR), intent(in) :: inout
integer(kind=C_INT), intent(in) :: typesize
integer(kind=C_INT), intent(in) :: m
integer(kind=C_INT), intent(in) :: n
integer(kind=C_INT), intent(in) :: ldi
integer(kind=C_INT), intent(in), optional :: ldo
type(C_PTR), intent(in), optional :: scratch
integer(kind=C_INT), intent(in) :: tid
integer(kind=C_INT), intent(in) :: ntasks

public subroutine libxs_registry_remove(registry, key, key_size)

Remove a key-value pair from the registry.

Arguments

Type IntentOptional Attributes Name
type(C_PTR), intent(in) :: registry
type(C_PTR), intent(in) :: key
integer(kind=C_SIZE_T), intent(in) :: key_size

public subroutine libxs_gemm_call(config, a, b, c)

Call the GEMM kernel dispatched into config.

Arguments

Type IntentOptional Attributes Name
type(libxs_gemm_config_t), intent(in) :: config
type(C_PTR), intent(in), VALUE :: a
type(C_PTR), intent(in), VALUE :: b
type(C_PTR), VALUE :: c

public subroutine libxs_gemm_release(config)

Release a GEMM config: clear all kernel pointers. If the config holds a JIT jitter handle, the caller must destroy it first (e.g., call mkl_jit_destroy before calling this routine).

Arguments

Type IntentOptional Attributes Name
type(libxs_gemm_config_t), intent(inout) :: config