18#ifndef __NNFW_RUY_RUY_SUPPORT_H__
19#define __NNFW_RUY_RUY_SUPPORT_H__
22#include <ruy/matrix.h>
39 return ::ruy::CachePolicy::kNeverCache;
41 return ::ruy::CachePolicy::kCacheIfLargeSpeedup;
43 return ::ruy::CachePolicy::kAlwaysCache;
46 return ::ruy::CachePolicy::kNeverCache;
50template <
typename Scalar,
typename DataPo
inter>
52 ::ruy::Matrix<Scalar> *dst,
bool use_caching =
false)
56 ::ruy::MakeSimpleLayout(params.
rows, params.
cols, ruy_order, dst->mutable_layout());
59 dst->set_data(data_ptr);
68template <
typename AccumScalar,
typename DstScalar, QuantizationFlavor quantization_flavor>
70 ::ruy::MulParams<AccumScalar, DstScalar> *ruy_mul_params)
73 ruy_mul_params->set_bias(params.
bias);
74 ruy_mul_params->set_clamp_min(params.
clamp_min);
75 ruy_mul_params->set_clamp_max(params.
clamp_max);
79template <
typename DstScalar, QuantizationFlavor quantization_flavor>
81 ::ruy::MulParams<std::int32_t, DstScalar> *ruy_mul_params)
83 static_assert(
sizeof(DstScalar) <
sizeof(std::int32_t),
"");
94 ruy_mul_params->set_bias(params.
bias);
95 ruy_mul_params->set_clamp_min(params.
clamp_min);
96 ruy_mul_params->set_clamp_max(params.
clamp_max);
100template <QuantizationFlavor quantization_flavor>
102 ::ruy::MulParams<std::int32_t, std::int32_t> *ruy_mul_params)
104 ruy_mul_params->set_bias(params.
bias);
void MakeRuyMulParams(const GemmParams< AccumScalar, DstScalar, quantization_flavor > ¶ms, ::ruy::MulParams< AccumScalar, DstScalar > *ruy_mul_params)
void MakeRuyMatrix(const MatrixParams< Scalar > ¶ms, DataPointer data_ptr, ::ruy::Matrix< Scalar > *dst, bool use_caching=false)
inline ::ruy::CachePolicy ToRuyCachePolicy(CachePolicy cache_policy)
@ kIntegerWithPerRowMultiplier
@ kIntegerWithUniformMultiplier
AccumScalar multiplier_fixedpoint
const int * multiplier_exponent_perchannel
const AccumScalar * multiplier_fixedpoint_perchannel