| 1 | // Tencent is pleased to support the open source community by making ncnn available. |
| 2 | // |
| 3 | // Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved. |
| 4 | // |
| 5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except |
| 6 | // in compliance with the License. You may obtain a copy of the License at |
| 7 | // |
| 8 | // https://opensource.org/licenses/BSD-3-Clause |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software distributed |
| 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| 13 | // specific language governing permissions and limitations under the License. |
| 14 | |
| 15 | #include "cpu.h" |
| 16 | #include "mat.h" |
| 17 | #if __mips_loongson_mmi |
| 18 | #include "loongson_mmi.h" |
| 19 | #endif // __mips_loongson_mmi |
| 20 | |
| 21 | namespace ncnn { |
| 22 | |
| 23 | #include "convolution_sgemm_int8.h" |
| 24 | #include "convolution_winograd_transform_int8.h" |
| 25 | #include "convolution_winograd_dot_int8.h" |
| 26 | #include "convolution_3x3_int8.h" |
| 27 | |
| 28 | // pack1 |
| 29 | void im2col_sgemm_int8_loongson_mmi(const Mat& bottom_im2col, Mat& top_blob, const Mat& kernel, const Option& opt) |
| 30 | { |
| 31 | im2col_sgemm_int8_msa(bottom_im2col, top_blob, kernel, opt); |
| 32 | } |
| 33 | |
| 34 | void convolution_im2col_sgemm_transform_kernel_int8_loongson_mmi(const Mat& kernel, Mat& kernel_tm, int inch, int outch, int kernel_w, int kernel_h) |
| 35 | { |
| 36 | convolution_im2col_sgemm_transform_kernel_int8_msa(kernel, kernel_tm, inch, outch, kernel_w, kernel_h); |
| 37 | } |
| 38 | |
| 39 | void conv3x3s1_winograd43_transform_kernel_int8_loongson_mmi(const Mat& kernel, Mat& kernel_tm_packed, int inch, int outch, const Option& opt) |
| 40 | { |
| 41 | conv3x3s1_winograd43_transform_kernel_int8_msa(kernel, kernel_tm_packed, inch, outch, opt); |
| 42 | } |
| 43 | |
| 44 | void convolution_winograd_dot_int8_loongson_mmi(Mat& bottom_blob_tm, int outch, const Mat& kernel_tm, Mat& top_blob_tm, const Option& opt) |
| 45 | { |
| 46 | convolution_winograd_dot_int8_msa(bottom_blob_tm, outch, kernel_tm, top_blob_tm, opt); |
| 47 | } |
| 48 | |
| 49 | } // namespace ncnn |