MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
dispatch_traits.hpp File Reference
#include <algorithm>
#include <cstddef>
#include <type_traits>
#include <complex>
#include <mtl/tag/orientation.hpp>
#include <mtl/mat/compressed2D.hpp>
#include <mtl/mtl_fwd.hpp>
#include <mtl/memory/memory_space.hpp>
#include <mtl/simd/batch.hpp>

Classes

struct  mtl::interface::blas_triangular_call
 The BLAS ?trsm / ?trmm description of the left-side problem A X = B (or B := A B) on dense buffers that may be row-major (#724). More...

Namespaces

namespace  mtl
namespace  mtl::interface
namespace  mtl::detail
 mat*vec multiply into pre-allocated y: y = A * x.

Concepts

concept  mtl::interface::BlasDenseMatrix
 Concept satisfied by dense matrix types eligible for BLAS/LAPACK dispatch.
concept  mtl::interface::BlasHermitianMatrix
 Concept satisfied by dense matrix types eligible for complex-Hermitian LAPACK dispatch (cheev/zheev).
concept  mtl::interface::ContiguousVector
 True when a vector type's storage is CONTIGUOUS – data()[i] IS element i.
concept  mtl::interface::BlasDenseVector
 Concept satisfied by dense vector types eligible for BLAS dispatch.
concept  mtl::interface::SimdDenseVector
 Concept satisfied by dense vector types eligible for MTL5's OWN SIMD kernels.
concept  mtl::interface::SimdNarrowVector
 Concept satisfied by dense vector types whose element type is not a lane but can be WIDENED into one by a dot-product accumulate – 16-bit integers, as of #451 phase 2.
concept  mtl::interface::SimdQuadVector
 Concept satisfied by dense vector types of an 8-bit element that the quad multiply-accumulate can widen into a 32-bit lane (#451 phase 3).
concept  mtl::interface::ContiguousMatrixData
 Storage shape only: contiguous data() plus dimensions, with NO constraint on the element type.
concept  mtl::interface::SimdDenseMatrix
 Concept satisfied by dense matrix types eligible for MTL5's own SIMD kernels – BlasDenseMatrix widened to every mtl::simd lane type, for the same reason as SimdDenseVector.
concept  mtl::interface::ThreadableDenseMatrix
 Concept satisfied by dense matrix types whose OUTPUT ROWS may be partitioned across threads: the storage shape only, with NO constraint on the element type.
concept  mtl::interface::ThreadableDenseVector
 Concept satisfied by dense vector types usable as an operand or an output of a row-partitioned kernel.

Typedefs

template<typename M>
using mtl::interface::memory_space_t = ::mtl::detail::memory_space_of_t<std::remove_cvref_t<M>>
 The memory space of a container type: M::memory_space where M names one, otherwise memory_space::host, as for expressions, views and user types, which all address host memory.
template<typename M>
using mtl::interface::runtime_of_t = ::mtl::detail::runtime_of_space_t<memory_space_t<M>>
 The device runtime M's elements belong to (#1017): R for a container in memory_space::device<R>, shared<R> or pinned<R>; runtime::none for host memory, expressions, views and user types.

Functions

template<typename T>
constexpr std::size_t mtl::interface::row_grain (std::size_t units_per_row)
 Grain (in output rows) for a kernel that partitions over rows, given the work each row costs in iteration units – num_cols() for a GEMV, N*K for a GEMM.
template<typename MA, typename MB>
blas_triangular_call mtl::interface::blas_triangular_describe (bool upper, std::size_t m, std::size_t n)
template<typename M>
constexpr char mtl::interface::blas_lower_uplo ()
 For a symmetric operand whose LOWER triangle holds the data: the uplo that names that triangle in the column-major view of its buffer.

Variables

template<typename T>
constexpr bool mtl::interface::is_blas_scalar_v
 True for scalar types supported by standard BLAS/LAPACK (float, double).
template<typename T>
constexpr bool mtl::interface::is_lapack_complex_v = false
 True for complex scalar types backed by LAPACK (complex<float>, complex<double>).
template<typename T>
constexpr bool mtl::interface::is_lapack_complex_v< std::complex< T > > = is_blas_scalar_v<T>
template<typename Accumulator>
constexpr bool mtl::interface::accumulator_allows_blas_v = std::is_void_v<Accumulator>
 Whether the requested accumulator policy permits a hardware-fixed BLAS / native-fast path.
template<typename M>
constexpr bool mtl::interface::host_resident_v = memory_space_t<M>::host_accessible
 Whether host code, and so every dispatch target in this header, may read M's elements.
template<typename M, typename Space>
constexpr bool mtl::interface::in_memory_space_v = std::is_same_v<memory_space_t<M>, Space>
 Whether M's elements live in memory space Space.
template<typename M, typename... Ms>
constexpr bool mtl::interface::same_runtime_v
 Whether every operand belongs to one device runtime (#1017).
template<typename R, typename T>
constexpr bool mtl::interface::runtime_supports_v
 Whether runtime R's devices can compute in T (#1017): false for double on a device without FP64.
template<typename T>
constexpr std::size_t mtl::interface::parallel_chunk_units
 Iteration units that make one parallel chunk worth dispatching, for element type T.
template<typename M>
constexpr bool mtl::interface::is_row_major_v
 Check if a matrix type uses row-major orientation.
template<typename M>
constexpr bool mtl::interface::is_compressed2D_v = false
 Check if a matrix type is a sparse compressed2D (for sparse solver dispatch).
template<typename Value, typename Params>
constexpr bool mtl::interface::is_compressed2D_v< mat::compressed2D< Value, Params > > = true
template<typename M>
constexpr bool mtl::interface::is_suitesparse_eligible_v
 True for sparse matrices with BLAS-compatible scalar types (float/double).
template<typename V>
constexpr bool mtl::interface::is_dense_vector_double_v = false
 True for vec::dense_vector<double, P>, the only vector type the SuiteSparse bindings (umfpack_solve, cholmod_solve, spqr_solve) take.
template<typename Params>
constexpr bool mtl::interface::is_dense_vector_double_v< vec::dense_vector< double, Params > > = true
template<typename M, typename VecX, typename VecB>
constexpr bool mtl::interface::suitesparse_solve_dispatches_v
 True when the sparse solve dispatch can call a SuiteSparse binding: compressed2D<double> with dense_vector<double> x and b.
template<typename M>
constexpr bool mtl::detail::row_major_contiguous_v
 Row-major storage with contiguous rows: data() and a row-major orientation.
constexpr std::size_t mtl::detail::triangular_block = 64
 Row block of the blocked trsm and trmm on the native-fast path (#724): the diagonal blocks run in the row loop, everything else in the blocked GEMM, so the row loop's share of the flops is about triangular_block / m.