Skip to content

Commit ad1941a

Browse files
committed
[flang][cuda] Add bind name for __fss interface
1 parent f4cf610 commit ad1941a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

flang/module/cudadevice.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,11 +743,11 @@ attributes(device) real(8) function sinpi(x) bind(c,name='__nv_sinpi')
743743
end interface
744744

745745
interface __ffs
746-
attributes(device) integer function __ffs(i) bind(c)
746+
attributes(device) integer function __ffs(i) bind(c, name='__nv_ffs')
747747
!dir$ ignore_tkr (d) i
748748
integer, value :: i
749749
end function
750-
attributes(device) integer function __ffsll(i) bind(c)
750+
attributes(device) integer function __ffsll(i) bind(c, name='__nv_ffsll')
751751
!dir$ ignore_tkr (d) i
752752
integer(8), value :: i
753753
end function

flang/test/Lower/CUDA/cuda-device-proc.cuf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ attributes(global) subroutine devsub()
1111
integer(8) :: al
1212
integer(8) :: time
1313
integer :: smalltime
14+
integer(4) :: res
1415

1516
call syncthreads()
1617
call syncwarp(1)
@@ -49,6 +50,9 @@ attributes(global) subroutine devsub()
4950
smalltime = clock()
5051
time = clock64()
5152
time = globalTimer()
53+
54+
res = __ffs(ai)
55+
res = __ffs(al)
5256
end
5357

5458
! CHECK-LABEL: func.func @_QPdevsub() attributes {cuf.proc_attr = #cuf.cuda_proc<global>}
@@ -89,6 +93,9 @@ end
8993
! CHECK: %{{.*}} = nvvm.read.ptx.sreg.clock64 : i64
9094
! CHECK: %{{.*}} = nvvm.read.ptx.sreg.globaltimer : i64
9195

96+
! CHECK: %{{.*}} = fir.call @__nv_ffs(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> i32
97+
! CHECK: %{{.*}} = fir.call @__nv_ffsll(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> i32
98+
9299
subroutine host1()
93100
integer, device :: a(32)
94101
integer, device :: ret

0 commit comments

Comments
 (0)