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