HIP: Heterogenous-computing Interface for Portability
device_util.h
1 /*
2 Copyright (c) 2015-2017 Advanced Micro Devices, Inc. All rights reserved.
3 
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 THE SOFTWARE.
21 */
22 
23 #ifndef DEVICE_UTIL_H
24 #define DEVICE_UTIL_H
25 
27 
28 /*
29  Heap size computation for malloc and free device functions.
30 */
31 
32 #define HIP_SQRT_2 1.41421356237
33 #define HIP_SQRT_PI 1.77245385091
34 
35 #define __hip_erfinva3 -0.140543331
36 #define __hip_erfinva2 0.914624893
37 #define __hip_erfinva1 -1.645349621
38 #define __hip_erfinva0 0.886226899
39 
40 #define __hip_erfinvb4 0.012229801
41 #define __hip_erfinvb3 -0.329097515
42 #define __hip_erfinvb2 1.442710462
43 #define __hip_erfinvb1 -2.118377725
44 #define __hip_erfinvb0 1
45 
46 #define __hip_erfinvc3 1.641345311
47 #define __hip_erfinvc2 3.429567803
48 #define __hip_erfinvc1 -1.62490649
49 #define __hip_erfinvc0 -1.970840454
50 
51 #define __hip_erfinvd2 1.637067800
52 #define __hip_erfinvd1 3.543889200
53 #define __hip_erfinvd0 1
54 
55 #define HIP_PI 3.14159265358979323846
56 
57 __device__ float __hip_erfinvf(float x);
58 __device__ double __hip_erfinv(double x);
59 
60 __device__ float __hip_j0f(float x);
61 __device__ double __hip_j0(double x);
62 
63 __device__ float __hip_j1f(float x);
64 __device__ double __hip_j1(double x);
65 
66 __device__ float __hip_y0f(float x);
67 __device__ double __hip_y0(double x);
68 
69 __device__ float __hip_y1f(float x);
70 __device__ double __hip_y1(double x);
71 
72 __device__ float __hip_jnf(int n, float x);
73 __device__ double __hip_jn(int n, double x);
74 
75 __device__ float __hip_ynf(int n, float x);
76 __device__ double __hip_yn(int n, double x);
77 
78 __device__ float __hip_precise_cosf(float x);
79 __device__ float __hip_precise_exp10f(float x);
80 __device__ float __hip_precise_expf(float x);
81 __device__ float __hip_precise_frsqrt_rn(float x);
82 __device__ float __hip_precise_fsqrt_rd(float x);
83 __device__ float __hip_precise_fsqrt_rn(float x);
84 __device__ float __hip_precise_fsqrt_ru(float x);
85 __device__ float __hip_precise_fsqrt_rz(float x);
86 __device__ float __hip_precise_log10f(float x);
87 __device__ float __hip_precise_log2f(float x);
88 __device__ float __hip_precise_logf(float x);
89 __device__ float __hip_precise_powf(float base, float exponent);
90 __device__ void __hip_precise_sincosf(float x, float* s, float* c);
91 __device__ float __hip_precise_sinf(float x);
92 __device__ float __hip_precise_tanf(float x);
93 // Double Precision Math
94 __device__ double __hip_precise_dsqrt_rd(double x);
95 __device__ double __hip_precise_dsqrt_rn(double x);
96 __device__ double __hip_precise_dsqrt_ru(double x);
97 __device__ double __hip_precise_dsqrt_rz(double x);
98 
99 
100 // Float Fast Math
101 __device__ float __hip_fast_exp10f(float x);
102 __device__ float __hip_fast_expf(float x);
103 __device__ float __hip_fast_frsqrt_rn(float x);
104 __device__ float __hip_fast_fsqrt_rn(float x);
105 __device__ float __hip_fast_fsqrt_ru(float x);
106 __device__ float __hip_fast_fsqrt_rz(float x);
107 __device__ float __hip_fast_log10f(float x);
108 __device__ float __hip_fast_logf(float x);
109 __device__ float __hip_fast_powf(float base, float exponent);
110 __device__ void __hip_fast_sincosf(float x, float* s, float* c);
111 __device__ float __hip_fast_tanf(float x);
112 // Double Precision Math
113 __device__ double __hip_fast_dsqrt_rd(double x);
114 __device__ double __hip_fast_dsqrt_rn(double x);
115 __device__ double __hip_fast_dsqrt_ru(double x);
116 __device__ double __hip_fast_dsqrt_rz(double x);
117 
118 float __hip_host_j0f(float x);
119 double __hip_host_j0(double x);
120 
121 float __hip_host_j1f(float x);
122 double __hip_host_j1(double x);
123 
124 float __hip_host_y0f(float x);
125 double __hip_host_y1(double x);
126 
127 float __hip_host_y1f(float x);
128 double __hip_host_y1(double x);
129 
130 float __hip_host_jnf(int n, float x);
131 double __hip_host_jn(int n, double x);
132 
133 float __hip_host_ynf(int n, float x);
134 double __hip_host_yn(int n, double x);
135 
136 #endif
Contains definitions of APIs for HIP runtime.