|
MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
|
#include <array>#include <cassert>#include <cstddef>#include <cstdint>#include <limits>#include <memory>#include <span>#include <stdexcept>#include <string>#include <type_traits>#include <vector>#include <mtl/concepts/block_scheme.hpp>#include <mtl/concepts/matrix.hpp>#include <mtl/concepts/vector.hpp>#include <mtl/detail/same_object.hpp>#include <mtl/detail/thread_pool.hpp>#include <mtl/detail/wrapping_arithmetic.hpp>#include <mtl/interface/dispatch_traits.hpp>#include <mtl/mat/dense2D.hpp>#include <mtl/math/accumulator_traits.hpp>#include <mtl/math/identity.hpp>#include <mtl/simd/algorithm.hpp>#include <mtl/tag/sparsity.hpp>#include <mtl/traits/ashape.hpp>#include <mtl/traits/category.hpp>#include <mtl/vec/dense_vector.hpp>Classes | |
| class | mtl::mat::block_matrix_view< S > |
| Read-only, row-major view of a rows x cols matrix stored as blocks of the scheme S, cols / S::block_size blocks per row. More... | |
| struct | mtl::block_kernels< S > |
| Customization point for a scheme's fused mat-vec kernel. More... | |
| struct | mtl::traits::category< mat::block_matrix_view< S > > |
| struct | mtl::ashape::ashape<::mtl::mat::block_matrix_view< S > > |
| class | mtl::block_matrix_view< S > |
| Read-only, row-major view of a rows x cols matrix stored as blocks of the scheme S, cols / S::block_size blocks per row. More... | |
Namespaces | |
| namespace | mtl |
| namespace | mtl::mat |
| namespace | mtl::detail |
| mat*vec multiply into pre-allocated y: y = A * x. | |
| namespace | mtl::traits |
| namespace | mtl::ashape |
Concepts | |
| concept | mtl::BlockGemvScheme |
| Does the scheme supply a fused gemv? | |
| concept | mtl::detail::declares_scratch_bytes |
| concept | mtl::detail::declares_scratch_alignment |
Functions | |
| template<typename S> | |
| constexpr std::size_t | mtl::detail::block_scratch_alignment () noexcept |
| template<BlockScheme S> | |
| std::size_t | mtl::block_gemv_scratch_bytes (std::size_t cols) |
| Scratch bytes mult() needs for a block matrix of scheme S with cols columns: the fused kernel's scratch_bytes(cols), or 0 when the scheme has no fused kernel or its kernel declares none. | |
| template<typename Accumulator, typename S, typename VIn, typename VOut> | |
| void | mtl::detail::block_mult_rows (const mat::block_matrix_view< S > &A, const VIn &x, VOut &y, std::size_t rb, std::size_t re, std::vector< float > &buf) |
| y[rb, re) = A x for a block matrix: decode one row into buf, then dot it with x. | |
| template<typename Accumulator, typename S, typename VIn, typename VOut> | |
| void | mtl::detail::block_mult_decode (const mat::block_matrix_view< S > &A, const VIn &x, VOut &y) |
| y = A x by decode-then-dot, rows partitioned across the thread pool. | |
| template<typename Accumulator = void, BlockScheme S, Vector VIn, Vector VOut> | |
| void | mtl::mult (const mat::block_matrix_view< S > &A, const VIn &x, VOut &y, std::span< std::byte > scratch) |
| y = A x for a block matrix, into a pre-allocated y, with the fused kernel's scratch supplied by the caller. | |
| template<typename Accumulator = void, BlockScheme S, Vector VIn, Vector VOut> | |
| void | mtl::mult (const mat::block_matrix_view< S > &A, const VIn &x, VOut &y) |
| y = A x for a block matrix, into a pre-allocated y. | |
| template<BlockScheme S, Matrix MDst> | |
| void | mtl::convert (const mat::block_matrix_view< S > &src, MDst &dst) |
| Decode a block matrix into a pre-allocated destination, a row at a time. | |
| template<typename DstValue, BlockScheme S> | |
| mat::dense2D< DstValue > | mtl::convert (const mat::block_matrix_view< S > &src) |
| Decode a block matrix into a new dense2D<DstValue>. | |
| template<BlockScheme S, Vector V> requires (!Matrix<V>) | |
| auto | mtl::mat::operator* (const block_matrix_view< S > &A, const V &x) |
| A * x into a new dense_vector, through mult(). | |
Variables | |
| template<BlockScheme S> | |
| constexpr std::size_t | mtl::block_gemv_scratch_alignment = detail::block_scratch_alignment<S>() |
| The alignment that scratch must have: the fused kernel's scratch_alignment, which must be a power of two, or alignof(std::max_align_t). | |
| template<typename Accumulator, typename S, typename VIn, typename VOut> | |
| constexpr bool | mtl::detail::block_fused_gemv_v |
| Does mult(A, x, y) on these types run the scheme's fused kernel? | |