XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame^] | 1 | // Copyright (c) Facebook, Inc. and its affiliates. |
| 2 | // All rights reserved. |
| 3 | // |
| 4 | // Copyright 2019 Google LLC |
| 5 | // |
| 6 | // This source code is licensed under the BSD-style license found in the |
| 7 | // LICENSE file in the root directory of this source tree. |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include <stdint.h> |
| 12 | #include <stddef.h> |
| 13 | |
| 14 | #include <xnnpack/params.h> |
| 15 | |
| 16 | #ifdef __cplusplus |
| 17 | extern "C" { |
| 18 | #endif |
| 19 | |
| 20 | typedef void (*requantization_function)( |
| 21 | size_t n, |
| 22 | const int32_t* input, |
| 23 | float scale, |
| 24 | uint8_t zero_point, |
| 25 | uint8_t qmin, |
| 26 | uint8_t qmax, |
| 27 | uint8_t* output); |
| 28 | |
| 29 | #define DECLARE_REQUANTIZATION_FUNCTION(fn_name) \ |
| 30 | void fn_name( \ |
| 31 | size_t n, \ |
| 32 | const int32_t* input, \ |
| 33 | float scale, \ |
| 34 | uint8_t zero_point, \ |
| 35 | uint8_t qmin, \ |
| 36 | uint8_t qmax, \ |
| 37 | uint8_t* output); |
| 38 | |
| 39 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_precise__scalar_unsigned32) |
| 40 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_precise__scalar_unsigned64) |
| 41 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_precise__scalar_signed64) |
| 42 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_precise__sse2) |
| 43 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_precise__ssse3) |
| 44 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_precise__sse4) |
| 45 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_precise__neon) |
| 46 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_precise__psimd) |
| 47 | |
| 48 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_fp32__scalar_lrintf) |
| 49 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_fp32__scalar_magic) |
| 50 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_fp32__sse2) |
| 51 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_fp32__neon) |
| 52 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_fp32__psimd) |
| 53 | |
| 54 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_q31__scalar) |
| 55 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_q31__sse2) |
| 56 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_q31__ssse3) |
| 57 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_q31__sse4) |
| 58 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_q31__neon) |
| 59 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_q31__psimd) |
| 60 | |
| 61 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_gemmlowp__scalar) |
| 62 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_gemmlowp__sse2) |
| 63 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_gemmlowp__ssse3) |
| 64 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_gemmlowp__sse4) |
| 65 | DECLARE_REQUANTIZATION_FUNCTION(xnn_requantize_gemmlowp__neon) |
| 66 | |
| 67 | #ifdef __cplusplus |
| 68 | } /* extern "C" */ |
| 69 | #endif |