/* Copyright (c) 2019 Anakin Authors, Inc. 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 ANAKIN_SABER_FUNCS_IMPL_X86_MKL_PACKED_INT8_GEMM_H
#define ANAKIN_SABER_FUNCS_IMPL_X86_MKL_PACKED_INT8_GEMM_H

#include "saber/funcs/impl/x86/mkl_gemm.h"
#include "saber/core/tensor.h"
namespace anakin {
namespace saber {
class PackedMKLInt8Gemm {
public:
    SaberStatus init(const bool trans_a, const bool trans_b,
                     const int m, const int n, const int k, Tensor<X86>& b, float scale_a = 1.f);
    SaberStatus dispatch(const float alpha, const float beta, int m,
                         const Tensor<X86>& a, Tensor<X86>& c, Tensor<X86>* bias = nullptr);

private:
    MklDnnGemm<int8_t, int8_t, int> _wx_gemm;
    Tensor<X86> _int8_weights_wx;
    Tensor<X86> _scale_in;
    Tensor<X86> _scale_out;
    std::vector<float> _scale;
    int _m;
    int _n;
    int _k;
};
}
}
#endif //ANAKIN_SABER_FUNCS_IMPL_X86_MKL_PACKED_INT8_GEMM_H
