From 1c5d6c56922cd3e22117f533112db90d507925b2 Mon Sep 17 00:00:00 2001 From: tensor-tang Date: Wed, 11 Jul 2018 20:48:18 +0800 Subject: [PATCH] disable xsmm with float16 --- paddle/fluid/operators/math/blas_impl.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/operators/math/blas_impl.h b/paddle/fluid/operators/math/blas_impl.h index 701965759e..238bd3f8de 100644 --- a/paddle/fluid/operators/math/blas_impl.h +++ b/paddle/fluid/operators/math/blas_impl.h @@ -162,10 +162,10 @@ struct CBlas { } #endif }; + template -inline static bool UseXSMM(const int &m, const int &n, const int &k, - bool transa, bool transb, const T &alpha, - const T &beta) { +inline bool UseXSMM(const int &m, const int &n, const int &k, bool transa, + bool transb, const T &alpha, const T &beta) { #ifdef PADDLE_WITH_LIBXSMM // Refer to https://github.com/hfp/libxsmm/blob/master/README.md // But the threshold is custom @@ -182,6 +182,14 @@ inline static bool UseXSMM(const int &m, const int &n, const int &k, return false; } +template <> +inline bool UseXSMM(const int &m, const int &n, const int &k, + bool transa, bool transb, + const platform::float16 &alpha, + const platform::float16 &beta) { + return false; +} + template <> template void Blas::GEMM(CBLAS_TRANSPOSE transA, @@ -194,7 +202,6 @@ void Blas::GEMM(CBLAS_TRANSPOSE transA, #ifdef PADDLE_WITH_LIBXSMM if (UseXSMM(M, N, K, transA != CblasNoTrans, transB != CblasNoTrans, alpha, beta)) { - // refer to https://github.com/hfp/libxsmm/blob/master/README.md // Note: SMM use ColMajor const char transa = 'N'; const char transb = 'N'; -- GitLab