HIP: Heterogenous-computing Interface for Portability
math_fwd.h
1 /*
2 Copyright (c) 2015 - present 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 #pragma once
24 
25 #include "host_defines.h"
26 
27 #if defined(__cplusplus)
28  extern "C" {
29 #endif
30 
31 // BEGIN FLOAT
32 __device__
33 __attribute__((const))
34 float __ocml_acos_f32(float);
35 __device__
36 __attribute__((pure))
37 float __ocml_acosh_f32(float);
38 __device__
39 __attribute__((const))
40 float __ocml_asin_f32(float);
41 __device__
42 __attribute__((pure))
43 float __ocml_asinh_f32(float);
44 __device__
45 __attribute__((const))
46 float __ocml_atan2_f32(float, float);
47 __device__
48 __attribute__((const))
49 float __ocml_atan_f32(float);
50 __device__
51 __attribute__((pure))
52 float __ocml_atanh_f32(float);
53 __device__
54 __attribute__((pure))
55 float __ocml_cbrt_f32(float);
56 __device__
57 __attribute__((const))
58 float __ocml_ceil_f32(float);
59 __device__
60 __attribute__((const))
61 __device__
62 float __ocml_copysign_f32(float, float);
63 __device__
64 float __ocml_cos_f32(float);
65 __device__
66 __attribute__((pure))
67 __device__
68 float __ocml_cosh_f32(float);
69 __device__
70 float __ocml_cospi_f32(float);
71 __device__
72 float __ocml_i0_f32(float);
73 __device__
74 float __ocml_i1_f32(float);
75 __device__
76 __attribute__((pure))
77 float __ocml_erfc_f32(float);
78 __device__
79 __attribute__((pure))
80 float __ocml_erfcinv_f32(float);
81 __device__
82 __attribute__((pure))
83 float __ocml_erfcx_f32(float);
84 __device__
85 __attribute__((pure))
86 float __ocml_erf_f32(float);
87 __device__
88 __attribute__((pure))
89 float __ocml_erfinv_f32(float);
90 __device__
91 __attribute__((pure))
92 float __ocml_exp10_f32(float);
93 __device__
94 __attribute__((pure))
95 float __ocml_exp2_f32(float);
96 __device__
97 __attribute__((pure))
98 float __ocml_exp_f32(float);
99 __device__
100 __attribute__((pure))
101 float __ocml_expm1_f32(float);
102 __device__
103 __attribute__((const))
104 float __ocml_fabs_f32(float);
105 __device__
106 __attribute__((const))
107 float __ocml_fdim_f32(float, float);
108 __device__
109 __attribute__((const))
110 float __ocml_floor_f32(float);
111 __device__
112 __attribute__((const))
113 float __ocml_fma_f32(float, float, float);
114 __device__
115 __attribute__((const))
116 float __ocml_fmax_f32(float, float);
117 __device__
118 __attribute__((const))
119 float __ocml_fmin_f32(float, float);
120 __device__
121 __attribute__((const))
122 __device__
123 float __ocml_fmod_f32(float, float);
124 __device__
125 float __ocml_frexp_f32(float, __attribute__((address_space(5))) int*);
126 __device__
127 __attribute__((const))
128 float __ocml_hypot_f32(float, float);
129 __device__
130 __attribute__((const))
131 int __ocml_ilogb_f32(float);
132 __device__
133 __attribute__((const))
134 int __ocml_isfinite_f32(float);
135 __device__
136 __attribute__((const))
137 int __ocml_isinf_f32(float);
138 __device__
139 __attribute__((const))
140 int __ocml_isnan_f32(float);
141 __device__
142 float __ocml_j0_f32(float);
143 __device__
144 float __ocml_j1_f32(float);
145 __device__
146 __attribute__((const))
147 float __ocml_ldexp_f32(float, int);
148 __device__
149 float __ocml_lgamma_f32(float);
150 __device__
151 __attribute__((pure))
152 float __ocml_log10_f32(float);
153 __device__
154 __attribute__((pure))
155 float __ocml_log1p_f32(float);
156 __device__
157 __attribute__((pure))
158 float __ocml_log2_f32(float);
159 __device__
160 __attribute__((const))
161 float __ocml_logb_f32(float);
162 __device__
163 __attribute__((pure))
164 float __ocml_log_f32(float);
165 __device__
166 float __ocml_modf_f32(float, __attribute__((address_space(5))) float*);
167 __device__
168 __attribute__((const))
169 float __ocml_nearbyint_f32(float);
170 __device__
171 __attribute__((const))
172 float __ocml_nextafter_f32(float, float);
173 __device__
174 __attribute__((const))
175 float __ocml_len3_f32(float, float, float);
176 __device__
177 __attribute__((const))
178 float __ocml_len4_f32(float, float, float, float);
179 __device__
180 __attribute__((pure))
181 float __ocml_ncdf_f32(float);
182 __device__
183 __attribute__((pure))
184 float __ocml_ncdfinv_f32(float);
185 __device__
186 __attribute__((pure))
187 float __ocml_pow_f32(float, float);
188 __device__
189 __attribute__((pure))
190 float __ocml_rcbrt_f32(float);
191 __device__
192 __attribute__((const))
193 float __ocml_remainder_f32(float, float);
194 __device__
195 float __ocml_remquo_f32(float, float, __attribute__((address_space(5))) int*);
196 __device__
197 __attribute__((const))
198 float __ocml_rhypot_f32(float, float);
199 __device__
200 __attribute__((const))
201 float __ocml_rint_f32(float);
202 __device__
203 __attribute__((const))
204 float __ocml_rlen3_f32(float, float, float);
205 __device__
206 __attribute__((const))
207 float __ocml_rlen4_f32(float, float, float, float);
208 __device__
209 __attribute__((const))
210 float __ocml_round_f32(float);
211 __device__
212 __attribute__((pure))
213 float __ocml_rsqrt_f32(float);
214 __device__
215 __attribute__((const))
216 float __ocml_scalb_f32(float, float);
217 __device__
218 __attribute__((const))
219 float __ocml_scalbn_f32(float, int);
220 __device__
221 __attribute__((const))
222 int __ocml_signbit_f32(float);
223 __device__
224 float __ocml_sincos_f32(float, __attribute__((address_space(5))) float*);
225 __device__
226 float __ocml_sincospi_f32(float, __attribute__((address_space(5))) float*);
227 __device__
228 float __ocml_sin_f32(float);
229 __device__
230 __attribute__((pure))
231 float __ocml_sinh_f32(float);
232 __device__
233 float __ocml_sinpi_f32(float);
234 __device__
235 __attribute__((const))
236 float __ocml_sqrt_f32(float);
237 __device__
238 float __ocml_tan_f32(float);
239 __device__
240 __attribute__((pure))
241 float __ocml_tanh_f32(float);
242 __device__
243 float __ocml_tgamma_f32(float);
244 __device__
245 __attribute__((const))
246 float __ocml_trunc_f32(float);
247 __device__
248 float __ocml_y0_f32(float);
249 __device__
250 float __ocml_y1_f32(float);
251 
252 // BEGIN INTRINSICS
253 __device__
254 __attribute__((const))
255 float __ocml_add_rte_f32(float, float);
256 __device__
257 __attribute__((const))
258 float __ocml_add_rtn_f32(float, float);
259 __device__
260 __attribute__((const))
261 float __ocml_add_rtp_f32(float, float);
262 __device__
263 __attribute__((const))
264 float __ocml_add_rtz_f32(float, float);
265 __device__
266 __attribute__((const))
267 float __ocml_sub_rte_f32(float, float);
268 __device__
269 __attribute__((const))
270 float __ocml_sub_rtn_f32(float, float);
271 __device__
272 __attribute__((const))
273 float __ocml_sub_rtp_f32(float, float);
274 __device__
275 __attribute__((const))
276 float __ocml_sub_rtz_f32(float, float);
277 __device__
278 __attribute__((const))
279 float __ocml_mul_rte_f32(float, float);
280 __device__
281 __attribute__((const))
282 float __ocml_mul_rtn_f32(float, float);
283 __device__
284 __attribute__((const))
285 float __ocml_mul_rtp_f32(float, float);
286 __device__
287 __attribute__((const))
288 float __ocml_mul_rtz_f32(float, float);
289 __device__
290 __attribute__((const))
291 float __ocml_sqrt_rte_f32(float);
292 __device__
293 __attribute__((const))
294 float __ocml_sqrt_rtn_f32(float);
295 __device__
296 __attribute__((const))
297 float __ocml_sqrt_rtp_f32(float);
298 __device__
299 __attribute__((const))
300 float __ocml_sqrt_rtz_f32(float);
301 __device__
302 __attribute__((const))
303 float __ocml_fma_rte_f32(float, float, float);
304 __device__
305 __attribute__((const))
306 float __ocml_fma_rtn_f32(float, float, float);
307 __device__
308 __attribute__((const))
309 float __ocml_fma_rtp_f32(float, float, float);
310 __device__
311 __attribute__((const))
312 float __ocml_fma_rtz_f32(float, float, float);
313 
314 __device__
315 __attribute__((const))
316 float __llvm_amdgcn_cos_f32(float) __asm("llvm.amdgcn.cos.f32");
317 __device__
318 __attribute__((const))
319 float __llvm_amdgcn_rcp_f32(float) __asm("llvm.amdgcn.rcp.f32");
320 __device__
321 __attribute__((const))
322 float __llvm_amdgcn_rsq_f32(float) __asm("llvm.amdgcn.rsq.f32");
323 __device__
324 __attribute__((const))
325 float __llvm_amdgcn_sin_f32(float) __asm("llvm.amdgcn.sin.f32");
326 // END INTRINSICS
327 // END FLOAT
328 
329 // BEGIN DOUBLE
330 __device__
331 __attribute__((const))
332 double __ocml_acos_f64(double);
333 __device__
334 __attribute__((pure))
335 double __ocml_acosh_f64(double);
336 __device__
337 __attribute__((const))
338 double __ocml_asin_f64(double);
339 __device__
340 __attribute__((pure))
341 double __ocml_asinh_f64(double);
342 __device__
343 __attribute__((const))
344 double __ocml_atan2_f64(double, double);
345 __device__
346 __attribute__((const))
347 double __ocml_atan_f64(double);
348 __device__
349 __attribute__((pure))
350 double __ocml_atanh_f64(double);
351 __device__
352 __attribute__((pure))
353 double __ocml_cbrt_f64(double);
354 __device__
355 __attribute__((const))
356 double __ocml_ceil_f64(double);
357 __device__
358 __attribute__((const))
359 double __ocml_copysign_f64(double, double);
360 __device__
361 double __ocml_cos_f64(double);
362 __device__
363 __attribute__((pure))
364 double __ocml_cosh_f64(double);
365 __device__
366 double __ocml_cospi_f64(double);
367 __device__
368 double __ocml_i0_f64(double);
369 __device__
370 double __ocml_i1_f64(double);
371 __device__
372 __attribute__((pure))
373 double __ocml_erfc_f64(double);
374 __device__
375 __attribute__((pure))
376 double __ocml_erfcinv_f64(double);
377 __device__
378 __attribute__((pure))
379 double __ocml_erfcx_f64(double);
380 __device__
381 __attribute__((pure))
382 double __ocml_erf_f64(double);
383 __device__
384 __attribute__((pure))
385 double __ocml_erfinv_f64(double);
386 __device__
387 __attribute__((pure))
388 double __ocml_exp10_f64(double);
389 __device__
390 __attribute__((pure))
391 double __ocml_exp2_f64(double);
392 __device__
393 __attribute__((pure))
394 double __ocml_exp_f64(double);
395 __device__
396 __attribute__((pure))
397 double __ocml_expm1_f64(double);
398 __device__
399 __attribute__((const))
400 double __ocml_fabs_f64(double);
401 __device__
402 __attribute__((const))
403 double __ocml_fdim_f64(double, double);
404 __device__
405 __attribute__((const))
406 double __ocml_floor_f64(double);
407 __device__
408 __attribute__((const))
409 double __ocml_fma_f64(double, double, double);
410 __device__
411 __attribute__((const))
412 double __ocml_fmax_f64(double, double);
413 __device__
414 __attribute__((const))
415 double __ocml_fmin_f64(double, double);
416 __device__
417 __attribute__((const))
418 double __ocml_fmod_f64(double, double);
419 __device__
420 double __ocml_frexp_f64(double, __attribute__((address_space(5))) int*);
421 __device__
422 __attribute__((const))
423 double __ocml_hypot_f64(double, double);
424 __device__
425 __attribute__((const))
426 int __ocml_ilogb_f64(double);
427 __device__
428 __attribute__((const))
429 int __ocml_isfinite_f64(double);
430 __device__
431 __attribute__((const))
432 int __ocml_isinf_f64(double);
433 __device__
434 __attribute__((const))
435 int __ocml_isnan_f64(double);
436 __device__
437 double __ocml_j0_f64(double);
438 __device__
439 double __ocml_j1_f64(double);
440 __device__
441 __attribute__((const))
442 double __ocml_ldexp_f64(double, int);
443 __device__
444 double __ocml_lgamma_f64(double);
445 __device__
446 __attribute__((pure))
447 double __ocml_log10_f64(double);
448 __device__
449 __attribute__((pure))
450 double __ocml_log1p_f64(double);
451 __device__
452 __attribute__((pure))
453 double __ocml_log2_f64(double);
454 __device__
455 __attribute__((const))
456 double __ocml_logb_f64(double);
457 __device__
458 __attribute__((pure))
459 double __ocml_log_f64(double);
460 __device__
461 double __ocml_modf_f64(double, __attribute__((address_space(5))) double*);
462 __device__
463 __attribute__((const))
464 double __ocml_nearbyint_f64(double);
465 __device__
466 __attribute__((const))
467 double __ocml_nextafter_f64(double, double);
468 __device__
469 __attribute__((const))
470 double __ocml_len3_f64(double, double, double);
471 __device__
472 __attribute__((const))
473 double __ocml_len4_f64(double, double, double, double);
474 __device__
475 __attribute__((pure))
476 double __ocml_ncdf_f64(double);
477 __device__
478 __attribute__((pure))
479 double __ocml_ncdfinv_f64(double);
480 __device__
481 __attribute__((pure))
482 double __ocml_pow_f64(double, double);
483 __device__
484 __attribute__((pure))
485 double __ocml_rcbrt_f64(double);
486 __device__
487 __attribute__((const))
488 double __ocml_remainder_f64(double, double);
489 __device__
490 double __ocml_remquo_f64(
491  double, double, __attribute__((address_space(5))) int*);
492 __device__
493 __attribute__((const))
494 double __ocml_rhypot_f64(double, double);
495 __device__
496 __attribute__((const))
497 double __ocml_rint_f64(double);
498 __device__
499 __attribute__((const))
500 double __ocml_rlen3_f64(double, double, double);
501 __device__
502 __attribute__((const))
503 double __ocml_rlen4_f64(double, double, double, double);
504 __device__
505 __attribute__((const))
506 double __ocml_round_f64(double);
507 __device__
508 __attribute__((pure))
509 double __ocml_rsqrt_f64(double);
510 __device__
511 __attribute__((const))
512 double __ocml_scalb_f64(double, double);
513 __device__
514 __attribute__((const))
515 double __ocml_scalbn_f64(double, int);
516 __device__
517 __attribute__((const))
518 int __ocml_signbit_f64(double);
519 __device__
520 double __ocml_sincos_f64(double, __attribute__((address_space(5))) double*);
521 __device__
522 double __ocml_sincospi_f64(double, __attribute__((address_space(5))) double*);
523 __device__
524 double __ocml_sin_f64(double);
525 __device__
526 __attribute__((pure))
527 double __ocml_sinh_f64(double);
528 __device__
529 double __ocml_sinpi_f64(double);
530 __device__
531 __attribute__((const))
532 double __ocml_sqrt_f64(double);
533 __device__
534 double __ocml_tan_f64(double);
535 __device__
536 __attribute__((pure))
537 double __ocml_tanh_f64(double);
538 __device__
539 double __ocml_tgamma_f64(double);
540 __device__
541 __attribute__((const))
542 double __ocml_trunc_f64(double);
543 __device__
544 double __ocml_y0_f64(double);
545 __device__
546 double __ocml_y1_f64(double);
547 
548 // BEGIN INTRINSICS
549 __device__
550 __attribute__((const))
551 double __ocml_add_rte_f64(double, double);
552 __device__
553 __attribute__((const))
554 double __ocml_add_rtn_f64(double, double);
555 __device__
556 __attribute__((const))
557 double __ocml_add_rtp_f64(double, double);
558 __device__
559 __attribute__((const))
560 double __ocml_add_rtz_f64(double, double);
561 __device__
562 __attribute__((const))
563 double __ocml_sub_rte_f64(double, double);
564 __device__
565 __attribute__((const))
566 double __ocml_sub_rtn_f64(double, double);
567 __device__
568 __attribute__((const))
569 double __ocml_sub_rtp_f64(double, double);
570 __device__
571 __attribute__((const))
572 double __ocml_sub_rtz_f64(double, double);
573 __device__
574 __attribute__((const))
575 double __ocml_mul_rte_f64(double, double);
576 __device__
577 __attribute__((const))
578 double __ocml_mul_rtn_f64(double, double);
579 __device__
580 __attribute__((const))
581 double __ocml_mul_rtp_f64(double, double);
582 __device__
583 __attribute__((const))
584 double __ocml_mul_rtz_f64(double, double);
585 __device__
586 __attribute__((const))
587 double __ocml_sqrt_rte_f64(double);
588 __device__
589 __attribute__((const))
590 double __ocml_sqrt_rtn_f64(double);
591 __device__
592 __attribute__((const))
593 double __ocml_sqrt_rtp_f64(double);
594 __device__
595 __attribute__((const))
596 double __ocml_sqrt_rtz_f64(double);
597 __device__
598 __attribute__((const))
599 double __ocml_fma_rte_f64(double, double, double);
600 __device__
601 __attribute__((const))
602 double __ocml_fma_rtn_f64(double, double, double);
603 __device__
604 __attribute__((const))
605 double __ocml_fma_rtp_f64(double, double, double);
606 __device__
607 __attribute__((const))
608 double __ocml_fma_rtz_f64(double, double, double);
609 
610 __device__
611 __attribute__((const))
612 double __llvm_amdgcn_rcp_f64(double) __asm("llvm.amdgcn.rcp.f64");
613 __device__
614 __attribute__((const))
615 double __llvm_amdgcn_rsq_f64(double) __asm("llvm.amdgcn.rsq.f64");
616 // END INTRINSICS
617 // END DOUBLE
618 
619 #if defined(__cplusplus)
620  } // extern "C"
621 #endif
TODO-doc.