Skip to content

[flang][cuda] Add bind name for __ull2double_rX interfaces #153465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions flang/module/cudadevice.f90
Original file line number Diff line number Diff line change
Expand Up @@ -667,29 +667,29 @@ attributes(device) real(8) function sinpi(x) bind(c,name='__nv_sinpi')
end function
end interface

interface __ull2double_rn
attributes(device) double precision function __ull2double_rn(i) bind(c)
interface __ull2double_rd
attributes(device) double precision function __ull2double_rd(i) bind(c, name='__nv_ull2double_rd')
!dir$ ignore_tkr (d) i
integer(8), value :: i
end function
end interface

interface __ull2double_rz
attributes(device) double precision function __ull2double_rz(i) bind(c)
interface __ull2double_rn
attributes(device) double precision function __ull2double_rn(i) bind(c, name='__nv_ull2double_rn')
!dir$ ignore_tkr (d) i
integer(8), value :: i
end function
end interface

interface __ull2double_ru
attributes(device) double precision function __ull2double_ru(i) bind(c)
attributes(device) double precision function __ull2double_ru(i) bind(c, name='__nv_ull2double_ru')
!dir$ ignore_tkr (d) i
integer(8), value :: i
end function
end interface

interface __ull2double_rd
attributes(device) double precision function __ull2double_rd(i) bind(c)
interface __ull2double_rz
attributes(device) double precision function __ull2double_rz(i) bind(c, name='__nv_ull2double_rz')
!dir$ ignore_tkr (d) i
integer(8), value :: i
end function
Expand Down
8 changes: 8 additions & 0 deletions flang/test/Lower/CUDA/cuda-device-proc.cuf
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ attributes(global) subroutine devsub()
af = __powf(af, af)
ad = __dsqrt_rd(ad)
ad = __dsqrt_ru(ad)
ad = __ull2double_rd(al)
ad = __ull2double_rn(al)
ad = __ull2double_ru(al)
ad = __ull2double_rz(al)
r2 = __float2half_rn(af)
af = __half2float(r2)
end
Expand Down Expand Up @@ -156,6 +160,10 @@ end
! CHECK: %{{.*}} = fir.call @__nv_powf(%{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32, f32) -> f32
! CHECK: %{{.*}} = fir.call @__nv_dsqrt_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> f64
! CHECK: %{{.*}} = fir.call @__nv_dsqrt_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> f64
! CHECK: %{{.*}} = fir.call @__nv_ull2double_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> f64
! CHECK: %{{.*}} = fir.call @__nv_ull2double_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> f64
! CHECK: %{{.*}} = fir.call @__nv_ull2double_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> f64
! CHECK: %{{.*}} = fir.call @__nv_ull2double_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> f64
! CHECK: %{{.*}} = fir.call @__nv_float2half_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f16
! CHECK: %{{.*}} = fir.call @__nv_half2float(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f16) -> f32

Expand Down