/* * Copyright (c) Facebook, Inc. and its affiliates. * All rights reserved. * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ #pragma once #include #include #include "FbgemmBuild.h" #include "UtilsAvx2.h" namespace fbgemm { /** * @brief Helper struct to type specialize for uint8 and int8 together. */ template struct is_8bit { static constexpr bool value = std::is_same::value || std::is_same::value; }; /** * @brief Typed enum to specify matrix operations. */ enum class matrix_op_t { NoTranspose, Transpose }; /** * @brief Typed enum for supported instruction sets. */ enum class inst_set_t { anyarch, avx2, avx512 }; /** * @brief Typed enum for implementation type. * * ref is reference and opt is optimized. */ enum class impl_type_t { ref, opt }; /** * @brief A function to compare data in two buffers for closeness/equality. */ template FBGEMM_API int compare_buffers( const T* ref, const T* test, int m, int n, int ld, int max_mismatches_to_report, float atol = 1e-3); /** * @brief Debugging helper. */ template void printMatrix( matrix_op_t trans, const T* inp, size_t R, size_t C, size_t ld, std::string name); /** * @brief Transpose a matrix. * * @param M the number of rows of input matrix * @param N the number of columns of input matrix */ void transpose_simd( int M, int N, const float* src, int ld_src, float* dst, int ld_dst); /** * @brief Are we running on a AVX512 supported cpu? */ FBGEMM_API bool fbgemmHasAvx512Support(); /** * @brief Are we running on a AVX2 supported cpu? */ FBGEMM_API bool fbgemmHasAvx2Support(); } // namespace fbgemm