chromium/third_party/tflite/src/tensorflow/lite/kernels/cpu_backend_gemm_ruy.h

/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#ifndef TENSORFLOW_LITE_KERNELS_CPU_BACKEND_GEMM_RUY_H_
#define TENSORFLOW_LITE_KERNELS_CPU_BACKEND_GEMM_RUY_H_

#include "ruy/matrix.h"  // from @ruy
#include "ruy/mul_params.h"  // from @ruy
#include "ruy/ruy.h"  // from @ruy
#include "tensorflow/lite/kernels/cpu_backend_context.h"
#include "tensorflow/lite/kernels/cpu_backend_gemm_params.h"
#include "tensorflow/lite/kernels/internal/compatibility.h"

namespace tflite {
namespace cpu_backend_gemm {
namespace detail {

inline ruy::CachePolicy ToRuyCachePolicy(CachePolicy cache_policy) {}

template <typename Scalar, typename DataPointer>
void MakeRuyMatrix(const MatrixParams<Scalar>& params, DataPointer data_ptr,
                   ruy::Matrix<Scalar>* dst, bool use_caching = false) {}

// Floating-point case.
template <typename AccumScalar, typename DstScalar,
          QuantizationFlavor quantization_flavor>
struct MakeRuyMulParamsImpl final {};

// Integer-quantized case with destination type narrower than int32
MakeRuyMulParamsImpl<std::int32_t, DstScalar, quantization_flavor>;

// Raw-integer case with destination type int32.
MakeRuyMulParamsImpl<std::int32_t, std::int32_t, quantization_flavor>;

template <typename AccumScalar, typename DstScalar,
          QuantizationFlavor quantization_flavor>
void MakeRuyMulParams(
    const GemmParams<AccumScalar, DstScalar, quantization_flavor>& params,
    ruy::MulParams<AccumScalar, DstScalar>* ruy_mul_params) {}

template <typename LhsScalar, typename RhsScalar, typename AccumScalar,
          typename DstScalar, QuantizationFlavor quantization_flavor>
struct GemmImplUsingRuy {};

}  // namespace detail
}  // namespace cpu_backend_gemm
}  // namespace tflite

#endif  // TENSORFLOW_LITE_KERNELS_CPU_BACKEND_GEMM_RUY_H_