1 | /* fp16private.h |
2 | * |
3 | * Copyright 2021 Red Hat, Inc. |
4 | * |
5 | * This library is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU Lesser General Public |
7 | * License as published by the Free Software Foundation; either |
8 | * version 2.1 of the License, or (at your option) any later version. |
9 | * |
10 | * This library is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | * Lesser General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU Lesser General Public |
16 | * License along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | * |
18 | * SPDX-License-Identifier: LGPL-2.1-or-later |
19 | */ |
20 | |
21 | #ifndef __FP16_PRIVATE_H__ |
22 | #define __FP16_PRIVATE_H__ |
23 | |
24 | #include <glib.h> |
25 | |
26 | G_BEGIN_DECLS |
27 | |
28 | #define FP16_ZERO ((guint16)0) |
29 | #define FP16_ONE ((guint16)15360) |
30 | #define FP16_MINUS_ONE ((guint16)48128) |
31 | |
32 | void float_to_half4 (const float f[4], |
33 | guint16 h[4]); |
34 | |
35 | void half_to_float4 (const guint16 h[4], |
36 | float f[4]); |
37 | |
38 | void float_to_half (const float *f, |
39 | guint16 *h, |
40 | int n); |
41 | |
42 | void half_to_float (const guint16 *h, |
43 | float *f, |
44 | int n); |
45 | |
46 | void float_to_half4_f16c (const float f[4], |
47 | guint16 h[4]); |
48 | |
49 | void half_to_float4_f16c (const guint16 h[4], |
50 | float f[4]); |
51 | |
52 | void float_to_half_f16c (const float *f, |
53 | guint16 *h, |
54 | int n); |
55 | |
56 | void half_to_float_f16c (const guint16 *h, |
57 | float *f, |
58 | int n); |
59 | |
60 | void float_to_half4_c (const float f[4], |
61 | guint16 h[4]); |
62 | |
63 | void half_to_float4_c (const guint16 h[4], |
64 | float f[4]); |
65 | |
66 | void float_to_half_c (const float *f, |
67 | guint16 *h, |
68 | int n); |
69 | |
70 | void half_to_float_c (const guint16 *h, |
71 | float *f, |
72 | int n); |
73 | |
74 | G_END_DECLS |
75 | |
76 | #endif |
77 | |