Skip to content

Commit 397d808

Browse files
committed
[flang][cuda] Add bind name for __brev interface
1 parent f4cf610 commit 397d808

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

flang/module/cudadevice.f90

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

767767
interface __brev
768-
attributes(device) integer function __brev(i) bind(c)
768+
attributes(device) integer function __brev(i) bind(c, name='__nv_brev')
769769
!dir$ ignore_tkr (d) i
770770
integer, value :: i
771771
end function
772-
attributes(device) integer(8) function __brevll(i) bind(c)
772+
attributes(device) integer(8) function __brevll(i) bind(c, name ='__nv_brevll')
773773
!dir$ ignore_tkr (d) i
774774
integer(8), value :: i
775775
end function

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

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

1517
call syncthreads()
1618
call syncwarp(1)
@@ -49,6 +51,9 @@ attributes(global) subroutine devsub()
4951
smalltime = clock()
5052
time = clock64()
5153
time = globalTimer()
54+
55+
res = __brev(ai)
56+
resl = __brev(al)
5257
end
5358

5459
! CHECK-LABEL: func.func @_QPdevsub() attributes {cuf.proc_attr = #cuf.cuda_proc<global>}
@@ -89,6 +94,9 @@ end
8994
! CHECK: %{{.*}} = nvvm.read.ptx.sreg.clock64 : i64
9095
! CHECK: %{{.*}} = nvvm.read.ptx.sreg.globaltimer : i64
9196

97+
! CHECK: %{{.*}} = fir.call @__nv_brev(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> i32
98+
! CHECK: %{{.*}} = fir.call @__nv_brevll(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> i64
99+
92100
subroutine host1()
93101
integer, device :: a(32)
94102
integer, device :: ret

0 commit comments

Comments
 (0)