[flang][cuda] Add interfaces for __dsqrt_rn and __dsqrt_rz (#153624)

This commit is contained in:
Valentin Clement (バレンタイン クレメン) 2025-08-14 15:08:33 -07:00 committed by GitHub
parent cb2f0d0a5f
commit df15c0d716
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 29 additions and 5 deletions

View File

@ -814,6 +814,13 @@ implicit none
end function
end interface
interface __dsqrt_rn
attributes(device) double precision function __dsqrt_rn(x) bind(c, name='__nv_dsqrt_rn')
!dir$ ignore_tkr (d) x
double precision, value :: x
end function
end interface
interface __dsqrt_ru
attributes(device) double precision function __dsqrt_ru(x) bind(c, name='__nv_dsqrt_ru')
!dir$ ignore_tkr (d) x
@ -821,6 +828,13 @@ implicit none
end function
end interface
interface __dsqrt_rz
attributes(device) double precision function __dsqrt_rz(x) bind(c, name='__nv_dsqrt_rz')
!dir$ ignore_tkr (d) x
double precision, value :: x
end function
end interface
interface __ddiv_rn
attributes(device) double precision function __ddiv_rn(x,y) bind(c, name='__nv_ddiv_rn')
!dir$ ignore_tkr (d) x, (d) y

View File

@ -82,8 +82,6 @@ attributes(global) subroutine devsub()
ai = __mul24(ai, ai)
ai = __umul24(ai, ai)
af = __powf(af, af)
ad = __dsqrt_rd(ad)
ad = __dsqrt_ru(ad)
ad = __ull2double_rd(al)
ad = __ull2double_rn(al)
ad = __ull2double_ru(al)
@ -162,8 +160,6 @@ end
! CHECK: %{{.*}} = fir.call @__nv_mul24(%{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32, i32) -> i32
! CHECK: %{{.*}} = fir.call @__nv_umul24(%{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32, i32) -> i32
! 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

View File

@ -20,6 +20,21 @@ end subroutine
! CHECK-LABEL: _QPtest_usad
! CHECK: %{{.*}} = fir.call @__nv_usad(%{{.*}}, %{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32, i32, i32) -> i32
attributes(global) subroutine test_dsqrt_rX()
double precision :: res
double precision :: p
res = __dsqrt_rd(p)
res = __dsqrt_rn(p)
res = __dsqrt_ru(p)
res = __dsqrt_rz(p)
end subroutine
! CHECK-LABEL: _QPtest_dsqrt_rx
! CHECK: %{{.*}} = fir.call @__nv_dsqrt_rd(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> f64
! CHECK: %{{.*}} = fir.call @__nv_dsqrt_rn(%{{.*}}) 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_dsqrt_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> f64
attributes(global) subroutine test_uint2float_rX()
real :: res
integer :: i
@ -146,4 +161,3 @@ end subroutine
! CHECK: %{{.*}} = fir.call @__nv_double2ull_rn(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
! CHECK: %{{.*}} = fir.call @__nv_double2ull_ru(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64
! CHECK: %{{.*}} = fir.call @__nv_double2ull_rz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f64) -> i64