Always-available CPU reference tensor kernels.
More...
|
| template<typename T , std::size_t MR, std::size_t NR, std::size_t KR> |
| void | uni20::kernel::contract_strided (static_vector< extent_strides< 2 >, MR > const &Mgrp, static_vector< extent_strides< 2 >, NR > const &Ngrp, static_vector< extent_strides< 2 >, KR > const &Kgrp, T alpha, T const *A, T const *B, T beta, T *C) |
| | Execute the CPU tensor contraction using precomputed stride groupings.
|
| |
| | uni20::kernel::cpu::GemmLoop< T, MR, NR, KR >::GemmLoop (static_vector< extent_strides< 2 >, MR > const &Mgrp, static_vector< extent_strides< 2 >, NR > const &Ngrp, static_vector< extent_strides< 2 >, KR > const &Kgrp, T alpha, T beta) noexcept |
| | Build the loop engine for a fused contraction.
|
| |
| void | uni20::kernel::cpu::GemmLoop< T, MR, NR, KR >::run (T const *A0, T const *B0, T *C0) noexcept |
| | Perform C = β·C + α·(A ⋅ B) over all fused M, N, and K dimensions.
|
| |
Always-available CPU reference tensor kernels.
◆ contract_strided()
template<typename T , std::size_t MR, std::size_t NR, std::size_t KR>
| void uni20::kernel::contract_strided |
( |
static_vector< extent_strides< 2 >, MR > const & |
Mgrp, |
|
|
static_vector< extent_strides< 2 >, NR > const & |
Ngrp, |
|
|
static_vector< extent_strides< 2 >, KR > const & |
Kgrp, |
|
|
T |
alpha, |
|
|
T const * |
A, |
|
|
T const * |
B, |
|
|
T |
beta, |
|
|
T * |
C |
|
) |
| |
Execute the CPU tensor contraction using precomputed stride groupings.
- Template Parameters
-
| T | Scalar type stored in the tensors. |
| MR | Number of fused M dimensions. |
| NR | Number of fused N dimensions. |
| KR | Number of fused K dimensions. |
- Parameters
-
| Mgrp | Metadata describing extents and strides for the fused M dimensions. |
| Ngrp | Metadata describing extents and strides for the fused N dimensions. |
| Kgrp | Metadata describing extents and strides for the fused K dimensions. |
| alpha | Scaling factor applied to the contraction output. |
| A | Pointer to the base of the left-hand operand. |
| B | Pointer to the base of the right-hand operand. |
| beta | Scaling factor applied to the pre-existing contents of the destination tensor. |
| C | Pointer to the base of the destination tensor. |
◆ GemmLoop()
template<typename T , std::size_t MR, std::size_t NR, std::size_t KR>
| uni20::kernel::cpu::GemmLoop< T, MR, NR, KR >::GemmLoop |
( |
static_vector< extent_strides< 2 >, MR > const & |
Mgrp, |
|
|
static_vector< extent_strides< 2 >, NR > const & |
Ngrp, |
|
|
static_vector< extent_strides< 2 >, KR > const & |
Kgrp, |
|
|
T |
alpha, |
|
|
T |
beta |
|
) |
| |
|
inlinenoexcept |
Build the loop engine for a fused contraction.
- Parameters
-
| Mgrp | Metadata describing extents and strides for the fused M dimensions. |
| Ngrp | Metadata describing extents and strides for the fused N dimensions. |
| Kgrp | Metadata describing extents and strides for the fused K dimensions. |
| alpha | Scaling factor applied to the contraction output. |
| beta | Scaling factor applied to the pre-existing contents of the destination tensor. |
◆ run()
template<typename T , std::size_t MR, std::size_t NR, std::size_t KR>
Perform C = β·C + α·(A ⋅ B) over all fused M, N, and K dimensions.
- Parameters
-
| A0 | Pointer to the base of the left-hand operand. |
| B0 | Pointer to the base of the right-hand operand. |
| C0 | Pointer to the base of the destination tensor. |