[flang][cuda] Set cudadevice interfaces as public by default (#127229)

Remove the PRIVATE statement from cudadevice as it hides any interfaces
from the used __cuda_device module.
This commit is contained in:
Valentin Clement (バレンタイン クレメン)
2025-02-14 10:16:16 -08:00
committed by GitHub
parent ec17161c6e
commit 004afcbfb4
2 changed files with 1 additions and 76 deletions

View File

@@ -11,7 +11,4 @@
module __cuda_device module __cuda_device
implicit none implicit none
! Set PRIVATE by default to explicitly only export what is meant
! to be exported by this MODULE.
end module end module

View File

@@ -15,45 +15,36 @@ module cudadevice
use, intrinsic :: __fortran_builtins, only: c_devloc => __builtin_c_devloc use, intrinsic :: __fortran_builtins, only: c_devloc => __builtin_c_devloc
implicit none implicit none
! Set PRIVATE by default to explicitly only export what is meant
! to be exported by this MODULE.
private
! Synchronization Functions ! Synchronization Functions
interface interface
attributes(device) subroutine syncthreads() attributes(device) subroutine syncthreads()
end subroutine end subroutine
end interface end interface
public :: syncthreads
interface interface
attributes(device) integer function syncthreads_and(value) attributes(device) integer function syncthreads_and(value)
integer, value :: value integer, value :: value
end function end function
end interface end interface
public :: syncthreads_and
interface interface
attributes(device) integer function syncthreads_count(value) attributes(device) integer function syncthreads_count(value)
integer, value :: value integer, value :: value
end function end function
end interface end interface
public :: syncthreads_count
interface interface
attributes(device) integer function syncthreads_or(value) attributes(device) integer function syncthreads_or(value)
integer, value :: value integer, value :: value
end function end function
end interface end interface
public :: syncthreads_or
interface interface
attributes(device) subroutine syncwarp(mask) attributes(device) subroutine syncwarp(mask)
integer, value :: mask integer, value :: mask
end subroutine end subroutine
end interface end interface
public :: syncwarp
! Memory Fences ! Memory Fences
@@ -61,19 +52,16 @@ implicit none
attributes(device) subroutine threadfence() attributes(device) subroutine threadfence()
end subroutine end subroutine
end interface end interface
public :: threadfence
interface interface
attributes(device) subroutine threadfence_block() attributes(device) subroutine threadfence_block()
end subroutine end subroutine
end interface end interface
public :: threadfence_block
interface interface
attributes(device) subroutine threadfence_system() attributes(device) subroutine threadfence_system()
end subroutine end subroutine
end interface end interface
public :: threadfence_system
! Math API ! Math API
@@ -83,7 +71,6 @@ implicit none
real, value :: a, b real, value :: a, b
end function end function
end interface end interface
public :: __fadd_rn
interface __fadd_rz interface __fadd_rz
attributes(device) real function __fadd_rz(a,b) bind(c, name='__nv_fadd_rz') attributes(device) real function __fadd_rz(a,b) bind(c, name='__nv_fadd_rz')
@@ -91,7 +78,6 @@ implicit none
real, value :: a, b real, value :: a, b
end function end function
end interface end interface
public :: __fadd_rz
interface interface
attributes(device) function __fadd_rd(x, y) bind(c, name='__nv_fadd_rd') attributes(device) function __fadd_rd(x, y) bind(c, name='__nv_fadd_rd')
@@ -99,7 +85,6 @@ implicit none
real :: __fadd_rd real :: __fadd_rd
end function end function
end interface end interface
public :: __fadd_rd
interface interface
attributes(device) function __fadd_ru(x, y) bind(c, name='__nv_fadd_ru') attributes(device) function __fadd_ru(x, y) bind(c, name='__nv_fadd_ru')
@@ -107,7 +92,6 @@ implicit none
real :: __fadd_ru real :: __fadd_ru
end function end function
end interface end interface
public :: __fadd_ru
interface __fmul_rn interface __fmul_rn
attributes(device) real function __fmul_rn(a,b) bind(c, name='__nv_fmul_rn') attributes(device) real function __fmul_rn(a,b) bind(c, name='__nv_fmul_rn')
@@ -115,7 +99,6 @@ implicit none
real, value :: a, b real, value :: a, b
end function end function
end interface end interface
public :: __fmul_rn
interface __fmul_rz interface __fmul_rz
attributes(device) real function __fmul_rz(a,b) bind(c, name='__nv_fmul_rz') attributes(device) real function __fmul_rz(a,b) bind(c, name='__nv_fmul_rz')
@@ -123,7 +106,6 @@ implicit none
real, value :: a, b real, value :: a, b
end function end function
end interface end interface
public :: __fmul_rz
interface __fmul_ru interface __fmul_ru
attributes(device) real function __fmul_ru(a,b) bind(c, name='__nv_fmul_ru') attributes(device) real function __fmul_ru(a,b) bind(c, name='__nv_fmul_ru')
@@ -131,7 +113,6 @@ implicit none
real, value :: a, b real, value :: a, b
end function end function
end interface end interface
public :: __fmul_ru
interface __fmul_rd interface __fmul_rd
attributes(device) real function __fmul_rd(a,b) bind(c, name='__nv_fmul_rd') attributes(device) real function __fmul_rd(a,b) bind(c, name='__nv_fmul_rd')
@@ -139,7 +120,6 @@ implicit none
real, value :: a, b real, value :: a, b
end function end function
end interface end interface
public :: __fmul_rd
interface __fmaf_rn interface __fmaf_rn
attributes(device) real function __fmaf_rn(a,b,c) bind(c, name='__nv_fmaf_rn') attributes(device) real function __fmaf_rn(a,b,c) bind(c, name='__nv_fmaf_rn')
@@ -147,7 +127,6 @@ implicit none
real, value :: a, b, c real, value :: a, b, c
end function end function
end interface end interface
public :: __fmaf_rn
interface __fmaf_rz interface __fmaf_rz
attributes(device) real function __fmaf_rz(a,b,c) bind(c, name='__nv_fmaf_rz') attributes(device) real function __fmaf_rz(a,b,c) bind(c, name='__nv_fmaf_rz')
@@ -155,7 +134,6 @@ implicit none
real, value :: a, b, c real, value :: a, b, c
end function end function
end interface end interface
public :: __fmaf_rz
interface __fmaf_ru interface __fmaf_ru
attributes(device) real function __fmaf_ru(a,b,c) bind(c, name='__nv_fmaf_ru') attributes(device) real function __fmaf_ru(a,b,c) bind(c, name='__nv_fmaf_ru')
@@ -163,7 +141,6 @@ implicit none
real, value :: a, b, c real, value :: a, b, c
end function end function
end interface end interface
public :: __fmaf_ru
interface __fmaf_rd interface __fmaf_rd
attributes(device) real function __fmaf_rd(a,b,c) bind(c, name='__nv_fmaf_rd') attributes(device) real function __fmaf_rd(a,b,c) bind(c, name='__nv_fmaf_rd')
@@ -171,7 +148,6 @@ implicit none
real, value :: a, b, c real, value :: a, b, c
end function end function
end interface end interface
public :: __fmaf_rd
interface __frcp_rn interface __frcp_rn
attributes(device) real function __frcp_rn(a) bind(c, name='__nv_frcp_rn') attributes(device) real function __frcp_rn(a) bind(c, name='__nv_frcp_rn')
@@ -179,7 +155,6 @@ implicit none
real, value :: a real, value :: a
end function end function
end interface end interface
public :: __frcp_rn
interface __frcp_rz interface __frcp_rz
attributes(device) real function __frcp_rz(a) bind(c, name='__nv_frcp_rz') attributes(device) real function __frcp_rz(a) bind(c, name='__nv_frcp_rz')
@@ -187,7 +162,6 @@ implicit none
real, value :: a real, value :: a
end function end function
end interface end interface
public :: __frcp_rz
interface __frcp_ru interface __frcp_ru
attributes(device) real function __frcp_ru(a) bind(c, name='__nv_frcp_ru') attributes(device) real function __frcp_ru(a) bind(c, name='__nv_frcp_ru')
@@ -195,7 +169,6 @@ implicit none
real, value :: a real, value :: a
end function end function
end interface end interface
public :: __frcp_ru
interface __frcp_rd interface __frcp_rd
attributes(device) real function __frcp_rd(a) bind(c, name='__nv_frcp_rd') attributes(device) real function __frcp_rd(a) bind(c, name='__nv_frcp_rd')
@@ -203,7 +176,6 @@ implicit none
real, value :: a real, value :: a
end function end function
end interface end interface
public :: __frcp_rd
interface __fsqrt_rn interface __fsqrt_rn
attributes(device) real function __fsqrt_rn(a) bind(c, name='__nv_fsqrt_rn') attributes(device) real function __fsqrt_rn(a) bind(c, name='__nv_fsqrt_rn')
@@ -211,7 +183,6 @@ implicit none
real, value :: a real, value :: a
end function end function
end interface end interface
public :: __fsqrt_rn
interface __fsqrt_rz interface __fsqrt_rz
attributes(device) real function __fsqrt_rz(a) bind(c, name='__nv_fsqrt_rz') attributes(device) real function __fsqrt_rz(a) bind(c, name='__nv_fsqrt_rz')
@@ -219,7 +190,6 @@ implicit none
real, value :: a real, value :: a
end function end function
end interface end interface
public :: __fsqrt_rz
interface __fsqrt_ru interface __fsqrt_ru
attributes(device) real function __fsqrt_ru(a) bind(c, name='__nv_fsqrt_ru') attributes(device) real function __fsqrt_ru(a) bind(c, name='__nv_fsqrt_ru')
@@ -227,7 +197,6 @@ implicit none
real, value :: a real, value :: a
end function end function
end interface end interface
public :: __fsqrt_ru
interface __fsqrt_rd interface __fsqrt_rd
attributes(device) real function __fsqrt_rd(a) bind(c, name='__nv_fsqrt_rd') attributes(device) real function __fsqrt_rd(a) bind(c, name='__nv_fsqrt_rd')
@@ -235,7 +204,6 @@ implicit none
real, value :: a real, value :: a
end function end function
end interface end interface
public :: __fsqrt_rd
interface __fdiv_rn interface __fdiv_rn
attributes(device) real function __fdiv_rn(a,b) bind(c, name='__nv_fdiv_rn') attributes(device) real function __fdiv_rn(a,b) bind(c, name='__nv_fdiv_rn')
@@ -243,7 +211,6 @@ implicit none
real, value :: a, b real, value :: a, b
end function end function
end interface end interface
public :: __fdiv_rn
interface __fdiv_rz interface __fdiv_rz
attributes(device) real function __fdiv_rz(a,b) bind(c, name='__nv_fdiv_rz') attributes(device) real function __fdiv_rz(a,b) bind(c, name='__nv_fdiv_rz')
@@ -251,7 +218,6 @@ implicit none
real, value :: a, b real, value :: a, b
end function end function
end interface end interface
public :: __fdiv_rz
interface __fdiv_ru interface __fdiv_ru
attributes(device) real function __fdiv_ru(a,b) bind(c, name='__nv_fdiv_ru') attributes(device) real function __fdiv_ru(a,b) bind(c, name='__nv_fdiv_ru')
@@ -259,7 +225,6 @@ implicit none
real, value :: a, b real, value :: a, b
end function end function
end interface end interface
public :: __fdiv_ru
interface __fdiv_rd interface __fdiv_rd
attributes(device) real function __fdiv_rd(a,b) bind(c, name='__nv_fdiv_rd') attributes(device) real function __fdiv_rd(a,b) bind(c, name='__nv_fdiv_rd')
@@ -267,7 +232,6 @@ implicit none
real, value :: a, b real, value :: a, b
end function end function
end interface end interface
public :: __fdiv_rd
interface __dadd_rn interface __dadd_rn
attributes(device) real(8) function __dadd_rn(a,b) bind(c, name='__nv_dadd_rn') attributes(device) real(8) function __dadd_rn(a,b) bind(c, name='__nv_dadd_rn')
@@ -275,7 +239,6 @@ implicit none
real(8), value :: a, b real(8), value :: a, b
end function end function
end interface end interface
public :: __dadd_rn
interface __dadd_rz interface __dadd_rz
attributes(device) real(8) function __dadd_rz(a,b) bind(c, name='__nv_dadd_rz') attributes(device) real(8) function __dadd_rz(a,b) bind(c, name='__nv_dadd_rz')
@@ -283,7 +246,6 @@ implicit none
real(8), value :: a, b real(8), value :: a, b
end function end function
end interface end interface
public :: __dadd_rz
interface __dadd_ru interface __dadd_ru
attributes(device) real(8) function __dadd_ru(a,b) bind(c, name='__nv_dadd_ru') attributes(device) real(8) function __dadd_ru(a,b) bind(c, name='__nv_dadd_ru')
@@ -291,7 +253,6 @@ implicit none
real(8), value :: a, b real(8), value :: a, b
end function end function
end interface end interface
public :: __dadd_ru
interface __dadd_rd interface __dadd_rd
attributes(device) real(8) function __dadd_rd(a,b) bind(c, name='__nv_dadd_rd') attributes(device) real(8) function __dadd_rd(a,b) bind(c, name='__nv_dadd_rd')
@@ -299,7 +260,6 @@ implicit none
real(8), value :: a, b real(8), value :: a, b
end function end function
end interface end interface
public :: __dadd_rd
interface __dmul_rn interface __dmul_rn
attributes(device) real(8) function __dmul_rn(a,b) bind(c, name='__nv_dmul_rn') attributes(device) real(8) function __dmul_rn(a,b) bind(c, name='__nv_dmul_rn')
@@ -307,7 +267,6 @@ implicit none
real(8), value :: a, b real(8), value :: a, b
end function end function
end interface end interface
public :: __dmul_rn
interface __dmul_rz interface __dmul_rz
attributes(device) real(8) function __dmul_rz(a,b) bind(c, name='__nv_dmul_rz') attributes(device) real(8) function __dmul_rz(a,b) bind(c, name='__nv_dmul_rz')
@@ -315,7 +274,6 @@ implicit none
real(8), value :: a, b real(8), value :: a, b
end function end function
end interface end interface
public :: __dmul_rz
interface __dmul_ru interface __dmul_ru
attributes(device) real(8) function __dmul_ru(a,b) bind(c, name='__nv_dmul_ru') attributes(device) real(8) function __dmul_ru(a,b) bind(c, name='__nv_dmul_ru')
@@ -323,7 +281,6 @@ implicit none
real(8), value :: a, b real(8), value :: a, b
end function end function
end interface end interface
public :: __dmul_ru
interface __dmul_rd interface __dmul_rd
attributes(device) real(8) function __dmul_rd(a,b) bind(c, name='__nv_dmul_rd') attributes(device) real(8) function __dmul_rd(a,b) bind(c, name='__nv_dmul_rd')
@@ -331,7 +288,6 @@ implicit none
real(8), value :: a, b real(8), value :: a, b
end function end function
end interface end interface
public :: __dmul_rd
interface __fma_rn interface __fma_rn
attributes(device) real(8) function __fma_rn(a,b,c) bind(c, name='__nv_fma_rn') attributes(device) real(8) function __fma_rn(a,b,c) bind(c, name='__nv_fma_rn')
@@ -339,7 +295,6 @@ implicit none
real(8), value :: a, b, c real(8), value :: a, b, c
end function end function
end interface end interface
public :: __fma_rn
interface __fma_rz interface __fma_rz
attributes(device) real(8) function __fma_rz(a,b,c) bind(c, name='__nv_fma_rz') attributes(device) real(8) function __fma_rz(a,b,c) bind(c, name='__nv_fma_rz')
@@ -347,7 +302,6 @@ implicit none
real(8), value :: a, b, c real(8), value :: a, b, c
end function end function
end interface end interface
public :: __fma_rz
interface __fma_ru interface __fma_ru
attributes(device) real(8) function __fma_ru(a,b,c) bind(c, name='__nv_fma_ru') attributes(device) real(8) function __fma_ru(a,b,c) bind(c, name='__nv_fma_ru')
@@ -355,7 +309,6 @@ implicit none
real(8), value :: a, b, c real(8), value :: a, b, c
end function end function
end interface end interface
public :: __fma_ru
interface __fma_rd interface __fma_rd
attributes(device) real(8) function __fma_rd(a,b,c) bind(c, name='__nv_fma_rd') attributes(device) real(8) function __fma_rd(a,b,c) bind(c, name='__nv_fma_rd')
@@ -363,7 +316,6 @@ implicit none
real(8), value :: a, b, c real(8), value :: a, b, c
end function end function
end interface end interface
public :: __fma_rd
interface rsqrt interface rsqrt
attributes(device) real(4) function rsqrtf(x) bind(c,name='__nv_rsqrtf') attributes(device) real(4) function rsqrtf(x) bind(c,name='__nv_rsqrtf')
@@ -373,7 +325,6 @@ implicit none
real(8), value :: x real(8), value :: x
end function end function
end interface end interface
public :: rsqrt
interface signbit interface signbit
attributes(device) integer(4) function signbitf(x) bind(c,name='__nv_signbitf') attributes(device) integer(4) function signbitf(x) bind(c,name='__nv_signbitf')
@@ -383,7 +334,6 @@ implicit none
real(8), value :: x real(8), value :: x
end function end function
end interface end interface
public :: signbit
interface interface
attributes(device) subroutine sincosf(x, y, z) bind(c,name='__nv_sincosf') attributes(device) subroutine sincosf(x, y, z) bind(c,name='__nv_sincosf')
@@ -392,7 +342,6 @@ implicit none
real(4), device :: z real(4), device :: z
end subroutine end subroutine
end interface end interface
public :: sincosf
interface interface
attributes(device) subroutine sincos(x, y, z) bind(c,name='__nv_sincos') attributes(device) subroutine sincos(x, y, z) bind(c,name='__nv_sincos')
real(8), value :: x real(8), value :: x
@@ -404,7 +353,6 @@ implicit none
procedure :: sincosf procedure :: sincosf
procedure :: sincos procedure :: sincos
end interface end interface
public :: sincos
interface interface
attributes(device) subroutine sincospif(x, y, z) bind(c,name='__nv_sincospif') attributes(device) subroutine sincospif(x, y, z) bind(c,name='__nv_sincospif')
@@ -413,7 +361,6 @@ implicit none
real(4), device :: z real(4), device :: z
end subroutine end subroutine
end interface end interface
public :: sincospif
interface interface
attributes(device) subroutine sincospi(x, y, z) bind(c,name='__nv_sincospi') attributes(device) subroutine sincospi(x, y, z) bind(c,name='__nv_sincospi')
real(8), value :: x real(8), value :: x
@@ -425,14 +372,12 @@ implicit none
procedure :: sincospif procedure :: sincospif
procedure :: sincospi procedure :: sincospi
end interface end interface
public :: sincospi
interface interface
attributes(device) real(4) function cospif(x) bind(c,name='__nv_cospif') attributes(device) real(4) function cospif(x) bind(c,name='__nv_cospif')
real(4), value :: x real(4), value :: x
end function end function
end interface end interface
public :: cospif
interface interface
attributes(device) real(8) function cospi(x) bind(c,name='__nv_cospi') attributes(device) real(8) function cospi(x) bind(c,name='__nv_cospi')
real(8), value :: x real(8), value :: x
@@ -442,14 +387,12 @@ implicit none
procedure :: cospif procedure :: cospif
procedure :: cospi procedure :: cospi
end interface end interface
public :: cospi
interface interface
attributes(device) real(4) function sinpif(x) bind(c,name='__nv_sinpif') attributes(device) real(4) function sinpif(x) bind(c,name='__nv_sinpif')
real(4), value :: x real(4), value :: x
end function end function
end interface end interface
public :: sinpif
interface interface
attributes(device) real(8) function sinpi(x) bind(c,name='__nv_sinpi') attributes(device) real(8) function sinpi(x) bind(c,name='__nv_sinpi')
real(8), value :: x real(8), value :: x
@@ -459,7 +402,6 @@ implicit none
procedure :: sinpif procedure :: sinpif
procedure :: sinpi procedure :: sinpi
end interface end interface
public :: sinpi
interface mulhi interface mulhi
attributes(device) integer function __mulhi(i,j) bind(c,name='__nv_mulhi') attributes(device) integer function __mulhi(i,j) bind(c,name='__nv_mulhi')
@@ -467,7 +409,6 @@ implicit none
integer, value :: i,j integer, value :: i,j
end function end function
end interface end interface
public :: mulhi
interface umulhi interface umulhi
attributes(device) integer function __umulhi(i,j) bind(c,name='__nv_umulhi') attributes(device) integer function __umulhi(i,j) bind(c,name='__nv_umulhi')
@@ -475,7 +416,6 @@ implicit none
integer, value :: i,j integer, value :: i,j
end function end function
end interface end interface
public :: umulhi
interface mul64hi interface mul64hi
attributes(device) integer(8) function __mul64hi(i,j) bind(c,name='__nv_mul64hi') attributes(device) integer(8) function __mul64hi(i,j) bind(c,name='__nv_mul64hi')
@@ -483,7 +423,6 @@ implicit none
integer(8), value :: i,j integer(8), value :: i,j
end function end function
end interface end interface
public :: mul64hi
interface umul64hi interface umul64hi
attributes(device) integer(8) function __umul64hi(i,j) bind(c,name='__nv_umul64hi') attributes(device) integer(8) function __umul64hi(i,j) bind(c,name='__nv_umul64hi')
@@ -491,8 +430,6 @@ implicit none
integer(8), value :: i,j integer(8), value :: i,j
end function end function
end interface end interface
public :: umul64hi
! Atomic Operations ! Atomic Operations
@@ -517,8 +454,7 @@ implicit none
integer(8), intent(inout) :: address integer(8), intent(inout) :: address
integer(8), value :: val integer(8), value :: val
end function end function
end interface end interface
public :: atomicadd
interface atomicsub interface atomicsub
attributes(device) pure integer function atomicsubi(address, val) attributes(device) pure integer function atomicsubi(address, val)
@@ -542,7 +478,6 @@ implicit none
integer(8), value :: val integer(8), value :: val
end function end function
end interface end interface
public :: atomicsub
interface atomicmax interface atomicmax
attributes(device) pure integer function atomicmaxi(address, val) attributes(device) pure integer function atomicmaxi(address, val)
@@ -566,7 +501,6 @@ implicit none
integer(8), value :: val integer(8), value :: val
end function end function
end interface end interface
public :: atomicmax
interface atomicmin interface atomicmin
attributes(device) pure integer function atomicmini(address, val) attributes(device) pure integer function atomicmini(address, val)
@@ -590,7 +524,6 @@ implicit none
integer(8), value :: val integer(8), value :: val
end function end function
end interface end interface
public :: atomicmin
interface atomicand interface atomicand
attributes(device) pure integer function atomicandi(address, val) attributes(device) pure integer function atomicandi(address, val)
@@ -599,7 +532,6 @@ implicit none
integer, value :: val integer, value :: val
end function end function
end interface end interface
public :: atomicand
interface atomicor interface atomicor
attributes(device) pure integer function atomicori(address, val) attributes(device) pure integer function atomicori(address, val)
@@ -608,7 +540,6 @@ implicit none
integer, value :: val integer, value :: val
end function end function
end interface end interface
public :: atomicor
interface atomicinc interface atomicinc
attributes(device) pure integer function atomicinci(address, val) attributes(device) pure integer function atomicinci(address, val)
@@ -617,7 +548,6 @@ implicit none
integer, value :: val integer, value :: val
end function end function
end interface end interface
public :: atomicinc
interface atomicdec interface atomicdec
attributes(device) pure integer function atomicdeci(address, val) attributes(device) pure integer function atomicdeci(address, val)
@@ -626,12 +556,10 @@ implicit none
integer, value :: val integer, value :: val
end function end function
end interface end interface
public :: atomicdec
interface interface
attributes(device) integer(8) function clock64() attributes(device) integer(8) function clock64()
end function end function
end interface end interface
public :: clock64
end module end module