Skip to content

Commit eb84c11

Browse files
authored
[flang][cuda] Add more math intrinsic interfaces in cudadevice (#128931)
1 parent 418a987 commit eb84c11

File tree

1 file changed

+345
-0
lines changed

1 file changed

+345
-0
lines changed

flang/module/cudadevice.f90

+345
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,351 @@ attributes(device) real(8) function sinpi(x) bind(c,name='__nv_sinpi')
431431
end function
432432
end interface
433433

434+
interface __float2half_rn
435+
attributes(device) real(2) function __float2half_rn(r) bind(c)
436+
!dir$ ignore_tkr (d) r
437+
real, value :: r
438+
end function
439+
end interface
440+
441+
interface __half2float
442+
attributes(device) real function __half2float(i) bind(c)
443+
!dir$ ignore_tkr (d) i
444+
real(2), value :: i
445+
end function
446+
end interface
447+
448+
interface __double2int_rn
449+
attributes(device) integer function __double2int_rn(r) bind(c)
450+
!dir$ ignore_tkr (d) r
451+
double precision, value :: r
452+
end function
453+
end interface
454+
455+
interface __double2int_rz
456+
attributes(device) integer function __double2int_rz(r) bind(c)
457+
!dir$ ignore_tkr (d) r
458+
double precision, value :: r
459+
end function
460+
end interface
461+
462+
interface __double2int_ru
463+
attributes(device) integer function __double2int_ru(r) bind(c)
464+
!dir$ ignore_tkr (d) r
465+
double precision, value :: r
466+
end function
467+
end interface
468+
469+
interface __double2int_rd
470+
attributes(device) integer function __double2int_rd(r) bind(c)
471+
!dir$ ignore_tkr (d) r
472+
double precision, value :: r
473+
end function
474+
end interface
475+
476+
interface __double2uint_rn
477+
attributes(device) integer function __double2uint_rn(r) bind(c)
478+
!dir$ ignore_tkr (d) r
479+
double precision, value :: r
480+
end function
481+
end interface
482+
483+
interface __double2uint_rz
484+
attributes(device) integer function __double2uint_rz(r) bind(c)
485+
!dir$ ignore_tkr (d) r
486+
double precision, value :: r
487+
end function
488+
end interface
489+
490+
interface __double2uint_ru
491+
attributes(device) integer function __double2uint_ru(r) bind(c)
492+
!dir$ ignore_tkr (d) r
493+
double precision, value :: r
494+
end function
495+
end interface
496+
497+
interface __double2uint_rd
498+
attributes(device) integer function __double2uint_rd(r) bind(c)
499+
!dir$ ignore_tkr (d) r
500+
double precision, value :: r
501+
end function
502+
end interface
503+
504+
interface __double2float_rn
505+
attributes(device) real function __double2float_rn(r) bind(c)
506+
!dir$ ignore_tkr (d) r
507+
double precision, value :: r
508+
end function
509+
end interface
510+
511+
interface __double2float_rz
512+
attributes(device) real function __double2float_rz(r) bind(c)
513+
!dir$ ignore_tkr (d) r
514+
double precision, value :: r
515+
end function
516+
end interface
517+
518+
interface __double2float_ru
519+
attributes(device) real function __double2float_ru(r) bind(c)
520+
!dir$ ignore_tkr (d) r
521+
double precision, value :: r
522+
end function
523+
end interface
524+
525+
interface __double2float_rd
526+
attributes(device) real function __double2float_rd(r) bind(c)
527+
!dir$ ignore_tkr (d) r
528+
double precision, value :: r
529+
end function
530+
end interface
531+
532+
interface __double2loint
533+
attributes(device) integer function __double2loint(r) bind(c)
534+
!dir$ ignore_tkr (d) r
535+
double precision, value :: r
536+
end function
537+
end interface
538+
539+
interface __double2hiint
540+
attributes(device) integer function __double2hiint(r) bind(c)
541+
!dir$ ignore_tkr (d) r
542+
double precision, value :: r
543+
end function
544+
end interface
545+
546+
interface __hiloint2double
547+
attributes(device) double precision function __hiloint2double(i, j) bind(c)
548+
!dir$ ignore_tkr (d) i, (d) j
549+
integer, value :: i, j
550+
end function
551+
end interface
552+
553+
interface __int2double_rn
554+
attributes(device) double precision function __int2double_rn(i) bind(c)
555+
!dir$ ignore_tkr (d) i
556+
integer, value :: i
557+
end function
558+
end interface
559+
560+
interface __uint2double_rn
561+
attributes(device) double precision function __uint2double_rn(i) bind(c)
562+
!dir$ ignore_tkr (d) i
563+
integer, value :: i
564+
end function
565+
end interface
566+
567+
interface __double2ll_rn
568+
attributes(device) integer(8) function __double2ll_rn(r) bind(c)
569+
!dir$ ignore_tkr (d) r
570+
double precision, value :: r
571+
end function
572+
end interface
573+
574+
interface __double2ll_rz
575+
attributes(device) integer(8) function __double2ll_rz(r) bind(c)
576+
!dir$ ignore_tkr (d) r
577+
double precision, value :: r
578+
end function
579+
end interface
580+
581+
interface __double2ll_ru
582+
attributes(device) integer(8) function __double2ll_ru(r) bind(c)
583+
!dir$ ignore_tkr (d) r
584+
double precision, value :: r
585+
end function
586+
end interface
587+
588+
interface __double2ll_rd
589+
attributes(device) integer(8) function __double2ll_rd(r) bind(c)
590+
!dir$ ignore_tkr (d) r
591+
double precision, value :: r
592+
end function
593+
end interface
594+
595+
interface __double2ull_rn
596+
attributes(device) integer(8) function __double2ull_rn(r) bind(c)
597+
!dir$ ignore_tkr (d) r
598+
double precision, value :: r
599+
end function
600+
end interface
601+
602+
interface __double2ull_rz
603+
attributes(device) integer(8) function __double2ull_rz(r) bind(c)
604+
!dir$ ignore_tkr (d) r
605+
double precision, value :: r
606+
end function
607+
end interface
608+
609+
interface __double2ull_ru
610+
attributes(device) integer(8) function __double2ull_ru(r) bind(c)
611+
!dir$ ignore_tkr (d) r
612+
double precision, value :: r
613+
end function
614+
end interface
615+
616+
interface __double2ull_rd
617+
attributes(device) integer(8) function __double2ull_rd(r) bind(c)
618+
!dir$ ignore_tkr (d) r
619+
double precision, value :: r
620+
end function
621+
end interface
622+
623+
interface __ll2double_rn
624+
attributes(device) double precision function __ll2double_rn(i) bind(c)
625+
!dir$ ignore_tkr (d) i
626+
integer(8), value :: i
627+
end function
628+
end interface
629+
630+
interface __ll2double_rz
631+
attributes(device) double precision function __ll2double_rz(i) bind(c)
632+
!dir$ ignore_tkr (d) i
633+
integer(8), value :: i
634+
end function
635+
end interface
636+
637+
interface __ll2double_ru
638+
attributes(device) double precision function __ll2double_ru(i) bind(c)
639+
!dir$ ignore_tkr (d) i
640+
integer(8), value :: i
641+
end function
642+
end interface
643+
644+
interface __ll2double_rd
645+
attributes(device) double precision function __ll2double_rd(i) bind(c)
646+
!dir$ ignore_tkr (d) i
647+
integer(8), value :: i
648+
end function
649+
end interface
650+
651+
interface __ull2double_rn
652+
attributes(device) double precision function __ull2double_rn(i) bind(c)
653+
!dir$ ignore_tkr (d) i
654+
integer(8), value :: i
655+
end function
656+
end interface
657+
658+
interface __ull2double_rz
659+
attributes(device) double precision function __ull2double_rz(i) bind(c)
660+
!dir$ ignore_tkr (d) i
661+
integer(8), value :: i
662+
end function
663+
end interface
664+
665+
interface __ull2double_ru
666+
attributes(device) double precision function __ull2double_ru(i) bind(c)
667+
!dir$ ignore_tkr (d) i
668+
integer(8), value :: i
669+
end function
670+
end interface
671+
672+
interface __ull2double_rd
673+
attributes(device) double precision function __ull2double_rd(i) bind(c)
674+
!dir$ ignore_tkr (d) i
675+
integer(8), value :: i
676+
end function
677+
end interface
678+
679+
interface __mul24
680+
attributes(device) integer function __mul24(i,j) bind(c)
681+
!dir$ ignore_tkr (d) i, (d) j
682+
integer, value :: i,j
683+
end function
684+
end interface
685+
686+
interface __umul24
687+
attributes(device) integer function __umul24(i,j) bind(c)
688+
!dir$ ignore_tkr (d) i, (d) j
689+
integer, value :: i,j
690+
end function
691+
end interface
692+
693+
interface __dsqrt_ru
694+
attributes(device) double precision function __dsqrt_ru(x) bind(c)
695+
!dir$ ignore_tkr (d) x
696+
double precision, value :: x
697+
end function
698+
end interface
699+
700+
interface __dsqrt_rd
701+
attributes(device) double precision function __dsqrt_rd(x) bind(c)
702+
!dir$ ignore_tkr (d) x
703+
double precision, value :: x
704+
end function
705+
end interface
706+
707+
interface __ddiv_rn
708+
attributes(device) double precision function __ddiv_rn(x,y) bind(c)
709+
!dir$ ignore_tkr (d) x, (d) y
710+
double precision, value :: x, y
711+
end function
712+
end interface
713+
714+
interface __ddiv_rz
715+
attributes(device) double precision function __ddiv_rz(x,y) bind(c)
716+
!dir$ ignore_tkr (d) x, (d) y
717+
double precision, value :: x, y
718+
end function
719+
end interface
720+
721+
interface __ddiv_ru
722+
attributes(device) double precision function __ddiv_ru(x,y) bind(c)
723+
!dir$ ignore_tkr (d) x, (d) y
724+
double precision, value :: x, y
725+
end function
726+
end interface
727+
728+
interface __ddiv_rd
729+
attributes(device) double precision function __ddiv_rd(x,y) bind(c)
730+
!dir$ ignore_tkr (d) x, (d) y
731+
double precision, value :: x, y
732+
end function
733+
end interface
734+
735+
interface __clz
736+
attributes(device) integer function __clz(i) bind(c)
737+
!dir$ ignore_tkr (d) i
738+
integer, value :: i
739+
end function
740+
attributes(device) integer function __clzll(i) bind(c)
741+
!dir$ ignore_tkr (d) i
742+
integer(8), value :: i
743+
end function
744+
end interface
745+
746+
interface __ffs
747+
attributes(device) integer function __ffs(i) bind(c)
748+
!dir$ ignore_tkr (d) i
749+
integer, value :: i
750+
end function
751+
attributes(device) integer function __ffsll(i) bind(c)
752+
!dir$ ignore_tkr (d) i
753+
integer(8), value :: i
754+
end function
755+
end interface
756+
757+
interface __popc
758+
attributes(device) integer function __popc(i) bind(c)
759+
!dir$ ignore_tkr (d) i
760+
integer, value :: i
761+
end function
762+
attributes(device) integer function __popcll(i) bind(c)
763+
!dir$ ignore_tkr (d) i
764+
integer(8), value :: i
765+
end function
766+
end interface
767+
768+
interface __brev
769+
attributes(device) integer function __brev(i) bind(c)
770+
!dir$ ignore_tkr (d) i
771+
integer, value :: i
772+
end function
773+
attributes(device) integer(8) function __brevll(i) bind(c)
774+
!dir$ ignore_tkr (d) i
775+
integer(8), value :: i
776+
end function
777+
end interface
778+
434779
! Atomic Operations
435780

436781
interface atomicadd

0 commit comments

Comments
 (0)