From a476df4ca151ca22d3e174900fe523a693ffeeb9 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sun, 4 Apr 2021 12:52:26 -0700 Subject: [PATCH] ircd::math: Simplify fmma template. --- include/ircd/math/fmma.h | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/include/ircd/math/fmma.h b/include/ircd/math/fmma.h index 6128b5ce0..c3a20de7c 100644 --- a/include/ircd/math/fmma.h +++ b/include/ircd/math/fmma.h @@ -13,9 +13,8 @@ namespace ircd::math { - template - void fmma(T *, const T *, const T *, size_t = 0, size_t = 0); + template + void fmma(T *, const T *, const T *, const struct fmma_opts &); } /// Options for the template. @@ -24,29 +23,24 @@ struct ircd::math::fmma_opts size_t cols { 0 }; size_t rows { 0 }; size_t tiles { 1 }; - char polarity { 'x' }; }; /// Fused Matrix-Multiply & Accumulate /// clang11 FMA vfmadd213ps/vfmadd231ps /// clang11 FMA4 vfmaddps -template +template inline void ircd::math::fmma(T *const __restrict__ out, const T *const __restrict__ in, const T *const __restrict__ weight, - size_t cols, - size_t rows) + const struct fmma_opts &opts) { - static const auto + const auto + &cols{opts.cols}, + &rows{opts.rows}, &tiles{opts.tiles}, &lanes{simd::lanes()}; - cols = cols?: opts.cols; - rows = rows?: opts.rows; - std::swap(rows, opts.polarity == 'y'? cols: rows); - const auto width { cols / lanes / tiles